Update library
This commit is contained in:
parent
59d7351c8d
commit
6630170a3b
10 changed files with 42 additions and 273 deletions
|
@ -95,16 +95,6 @@ func ToggleFullscreen() {
|
||||||
C.ToggleFullscreen()
|
C.ToggleFullscreen()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnhideWindow - Show the window
|
|
||||||
func UnhideWindow() {
|
|
||||||
C.UnhideWindow()
|
|
||||||
}
|
|
||||||
|
|
||||||
// HideWindow - Hide the window
|
|
||||||
func HideWindow() {
|
|
||||||
C.HideWindow()
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetWindowIcon - Set icon for window (only PLATFORM_DESKTOP)
|
// SetWindowIcon - Set icon for window (only PLATFORM_DESKTOP)
|
||||||
func SetWindowIcon(image Image) {
|
func SetWindowIcon(image Image) {
|
||||||
cimage := image.cptr()
|
cimage := image.cptr()
|
||||||
|
|
|
@ -156,22 +156,6 @@ func DrawGrid(slices int32, spacing float32) {
|
||||||
C.DrawGrid(cslices, cspacing)
|
C.DrawGrid(cslices, cspacing)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DrawGizmo - Draw simple gizmo
|
|
||||||
func DrawGizmo(position Vector3) {
|
|
||||||
cposition := position.cptr()
|
|
||||||
C.DrawGizmo(*cposition)
|
|
||||||
}
|
|
||||||
|
|
||||||
// LoadMeshes - Load mesh from file
|
|
||||||
func LoadMeshes(fileName string) Mesh {
|
|
||||||
cfileName := C.CString(fileName)
|
|
||||||
defer C.free(unsafe.Pointer(cfileName))
|
|
||||||
ccount := C.int(0)
|
|
||||||
ret := C.LoadMeshes(cfileName, &ccount)
|
|
||||||
v := newMeshFromPointer(unsafe.Pointer(&ret))
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
// LoadModel - Load model from file
|
// LoadModel - Load model from file
|
||||||
func LoadModel(fileName string) Model {
|
func LoadModel(fileName string) Model {
|
||||||
cfileName := C.CString(fileName)
|
cfileName := C.CString(fileName)
|
||||||
|
@ -390,20 +374,20 @@ func DrawBillboard(camera Camera, texture Texture2D, center Vector3, size float3
|
||||||
}
|
}
|
||||||
|
|
||||||
// DrawBillboardRec - Draw a billboard texture defined by sourceRec
|
// DrawBillboardRec - Draw a billboard texture defined by sourceRec
|
||||||
func DrawBillboardRec(camera Camera, texture Texture2D, sourceRec Rectangle, center Vector3, size float32, tint Color) {
|
func DrawBillboardRec(camera Camera, texture Texture2D, sourceRec Rectangle, center Vector3, size Vector2, tint Color) {
|
||||||
ccamera := camera.cptr()
|
ccamera := camera.cptr()
|
||||||
ctexture := texture.cptr()
|
ctexture := texture.cptr()
|
||||||
csourceRec := sourceRec.cptr()
|
csourceRec := sourceRec.cptr()
|
||||||
ccenter := center.cptr()
|
ccenter := center.cptr()
|
||||||
csize := (C.float)(size)
|
csize := size.cptr()
|
||||||
ctint := tint.cptr()
|
ctint := tint.cptr()
|
||||||
C.DrawBillboardRec(*ccamera, *ctexture, *csourceRec, *ccenter, csize, *ctint)
|
C.DrawBillboardRec(*ccamera, *ctexture, *csourceRec, *ccenter, *csize, *ctint)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MeshBoundingBox - Compute mesh bounding box limits
|
// GetMeshBoundingBox - Compute mesh bounding box limits
|
||||||
func MeshBoundingBox(mesh Mesh) BoundingBox {
|
func GetMeshBoundingBox(mesh Mesh) BoundingBox {
|
||||||
cmesh := mesh.cptr()
|
cmesh := mesh.cptr()
|
||||||
ret := C.MeshBoundingBox(*cmesh)
|
ret := C.GetMeshBoundingBox(*cmesh)
|
||||||
v := newBoundingBoxFromPointer(unsafe.Pointer(&ret))
|
v := newBoundingBoxFromPointer(unsafe.Pointer(&ret))
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,11 +105,6 @@ func IsWindowFocused() bool {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
// UndecorateWindow - Undecorate the window (only PLATFORM_DESKTOP)
|
|
||||||
func UndecorateWindow() {
|
|
||||||
C.UndecorateWindow()
|
|
||||||
}
|
|
||||||
|
|
||||||
// MaximizeWindow - Maximize the window, if resizable (only PLATFORM_DESKTOP)
|
// MaximizeWindow - Maximize the window, if resizable (only PLATFORM_DESKTOP)
|
||||||
func MaximizeWindow() {
|
func MaximizeWindow() {
|
||||||
C.MaximizeWindow()
|
C.MaximizeWindow()
|
||||||
|
@ -120,11 +115,6 @@ func RestoreWindow() {
|
||||||
C.RestoreWindow()
|
C.RestoreWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecorateWindow - Decorate the window (only PLATFORM_DESKTOP)
|
|
||||||
func DecorateWindow() {
|
|
||||||
C.DecorateWindow()
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetMonitorRefreshRate - Get primary monitor refresh rate
|
// GetMonitorRefreshRate - Get primary monitor refresh rate
|
||||||
func GetMonitorRefreshRate(monitor int) int {
|
func GetMonitorRefreshRate(monitor int) int {
|
||||||
cmonitor := (C.int)(monitor)
|
cmonitor := (C.int)(monitor)
|
||||||
|
|
|
@ -174,11 +174,11 @@ func WaveCrop(wave Wave, initSample int32, finalSample int32) {
|
||||||
C.WaveCrop(cwave, cinitSample, cfinalSample)
|
C.WaveCrop(cwave, cinitSample, cfinalSample)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetWaveData - Get samples data from wave as a floats array
|
// LoadWaveSamples - Get samples data from wave as a floats array
|
||||||
func GetWaveData(wave Wave) []float32 {
|
func LoadWaveSamples(wave Wave) []float32 {
|
||||||
var data []float32
|
var data []float32
|
||||||
cwave := wave.cptr()
|
cwave := wave.cptr()
|
||||||
ret := C.GetWaveData(*cwave)
|
ret := C.LoadWaveSamples(*cwave)
|
||||||
|
|
||||||
sliceHeader := (*reflect.SliceHeader)((unsafe.Pointer(&data)))
|
sliceHeader := (*reflect.SliceHeader)((unsafe.Pointer(&data)))
|
||||||
sliceHeader.Cap = int(wave.SampleCount)
|
sliceHeader.Cap = int(wave.SampleCount)
|
||||||
|
@ -233,10 +233,10 @@ func ResumeMusicStream(music Music) {
|
||||||
C.ResumeMusicStream(cmusic)
|
C.ResumeMusicStream(cmusic)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsMusicPlaying - Check if music is playing
|
// IsMusicStreamPlaying - Check if music is playing
|
||||||
func IsMusicPlaying(music Music) bool {
|
func IsMusicStreamPlaying(music Music) bool {
|
||||||
cmusic := *(*C.Music)(unsafe.Pointer(&music))
|
cmusic := *(*C.Music)(unsafe.Pointer(&music))
|
||||||
ret := C.IsMusicPlaying(cmusic)
|
ret := C.IsMusicStreamPlaying(cmusic)
|
||||||
v := bool(ret)
|
v := bool(ret)
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
|
@ -1147,13 +1147,11 @@ type RenderTexture2D struct {
|
||||||
ID uint32
|
ID uint32
|
||||||
// Color buffer attachment texture
|
// Color buffer attachment texture
|
||||||
Texture Texture2D
|
Texture Texture2D
|
||||||
// Depth buffer attachment texture
|
|
||||||
Depth Texture2D
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRenderTexture2D - Returns new RenderTexture2D
|
// NewRenderTexture2D - Returns new RenderTexture2D
|
||||||
func NewRenderTexture2D(id uint32, texture, depth Texture2D) RenderTexture2D {
|
func NewRenderTexture2D(id uint32, texture Texture2D) RenderTexture2D {
|
||||||
return RenderTexture2D{id, texture, depth}
|
return RenderTexture2D{id, texture}
|
||||||
}
|
}
|
||||||
|
|
||||||
// newRenderTexture2DFromPointer - Returns new RenderTexture2D from pointer
|
// newRenderTexture2DFromPointer - Returns new RenderTexture2D from pointer
|
||||||
|
|
|
@ -2,6 +2,7 @@ package rl
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
#include "rlgl.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
@ -38,15 +39,15 @@ func LoadShader(vsFileName string, fsFileName string) Shader {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadShaderCode - Load shader from code strings and bind default locations
|
// LoadShaderFromMemory - Load shader from code strings and bind default locations
|
||||||
func LoadShaderCode(vsCode string, fsCode string) Shader {
|
func LoadShaderFromMemory(vsCode string, fsCode string) Shader {
|
||||||
cvsCode := C.CString(vsCode)
|
cvsCode := C.CString(vsCode)
|
||||||
defer C.free(unsafe.Pointer(cvsCode))
|
defer C.free(unsafe.Pointer(cvsCode))
|
||||||
|
|
||||||
cfsCode := C.CString(fsCode)
|
cfsCode := C.CString(fsCode)
|
||||||
defer C.free(unsafe.Pointer(cfsCode))
|
defer C.free(unsafe.Pointer(cfsCode))
|
||||||
|
|
||||||
ret := C.LoadShaderCode(cvsCode, cfsCode)
|
ret := C.LoadShaderFromMemory(cvsCode, cfsCode)
|
||||||
v := newShaderFromPointer(unsafe.Pointer(&ret))
|
v := newShaderFromPointer(unsafe.Pointer(&ret))
|
||||||
|
|
||||||
return v
|
return v
|
||||||
|
@ -60,14 +61,14 @@ func UnloadShader(shader Shader) {
|
||||||
|
|
||||||
// GetShaderDefault - Get default shader
|
// GetShaderDefault - Get default shader
|
||||||
func GetShaderDefault() Shader {
|
func GetShaderDefault() Shader {
|
||||||
ret := C.GetShaderDefault()
|
ret := C.rlGetShaderDefault()
|
||||||
v := newShaderFromPointer(unsafe.Pointer(&ret))
|
v := newShaderFromPointer(unsafe.Pointer(&ret))
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTextureDefault - Get default texture
|
// GetTextureDefault - Get default texture
|
||||||
func GetTextureDefault() *Texture2D {
|
func GetTextureDefault() *Texture2D {
|
||||||
ret := C.GetTextureDefault()
|
ret := C.rlGetTextureDefault()
|
||||||
v := newTexture2DFromPointer(unsafe.Pointer(&ret))
|
v := newTexture2DFromPointer(unsafe.Pointer(&ret))
|
||||||
return &v
|
return &v
|
||||||
}
|
}
|
||||||
|
@ -103,56 +104,13 @@ func SetShaderValueMatrix(shader Shader, uniformLoc int32, mat Matrix) {
|
||||||
// SetMatrixProjection - Set a custom projection matrix (replaces internal projection matrix)
|
// SetMatrixProjection - Set a custom projection matrix (replaces internal projection matrix)
|
||||||
func SetMatrixProjection(proj Matrix) {
|
func SetMatrixProjection(proj Matrix) {
|
||||||
cproj := proj.cptr()
|
cproj := proj.cptr()
|
||||||
C.SetMatrixProjection(*cproj)
|
C.rlSetMatrixProjection(*cproj)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMatrixModelview - Set a custom modelview matrix (replaces internal modelview matrix)
|
// SetMatrixModelview - Set a custom modelview matrix (replaces internal modelview matrix)
|
||||||
func SetMatrixModelview(view Matrix) {
|
func SetMatrixModelview(view Matrix) {
|
||||||
cview := view.cptr()
|
cview := view.cptr()
|
||||||
C.SetMatrixModelview(*cview)
|
C.rlSetMatrixModelview(*cview)
|
||||||
}
|
|
||||||
|
|
||||||
// GenTextureCubemap - Generate cubemap texture from HDR texture
|
|
||||||
func GenTextureCubemap(shader Shader, skyHDR Texture2D, size int) Texture2D {
|
|
||||||
cshader := shader.cptr()
|
|
||||||
cskyHDR := skyHDR.cptr()
|
|
||||||
csize := (C.int)(size)
|
|
||||||
|
|
||||||
ret := C.GenTextureCubemap(*cshader, *cskyHDR, csize)
|
|
||||||
v := newTexture2DFromPointer(unsafe.Pointer(&ret))
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
// GenTextureIrradiance - Generate irradiance texture using cubemap data
|
|
||||||
func GenTextureIrradiance(shader Shader, cubemap Texture2D, size int) Texture2D {
|
|
||||||
cshader := shader.cptr()
|
|
||||||
ccubemap := cubemap.cptr()
|
|
||||||
csize := (C.int)(size)
|
|
||||||
|
|
||||||
ret := C.GenTextureIrradiance(*cshader, *ccubemap, csize)
|
|
||||||
v := newTexture2DFromPointer(unsafe.Pointer(&ret))
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
// GenTexturePrefilter - Generate prefilter texture using cubemap data
|
|
||||||
func GenTexturePrefilter(shader Shader, cubemap Texture2D, size int) Texture2D {
|
|
||||||
cshader := shader.cptr()
|
|
||||||
ccubemap := cubemap.cptr()
|
|
||||||
csize := (C.int)(size)
|
|
||||||
|
|
||||||
ret := C.GenTexturePrefilter(*cshader, *ccubemap, csize)
|
|
||||||
v := newTexture2DFromPointer(unsafe.Pointer(&ret))
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
// GenTextureBRDF - Generate BRDF texture using cubemap data
|
|
||||||
func GenTextureBRDF(shader Shader, size int) Texture2D {
|
|
||||||
cshader := shader.cptr()
|
|
||||||
csize := (C.int)(size)
|
|
||||||
|
|
||||||
ret := C.GenTextureBRDF(*cshader, csize)
|
|
||||||
v := newTexture2DFromPointer(unsafe.Pointer(&ret))
|
|
||||||
return v
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// BeginShaderMode - Begin custom shader drawing
|
// BeginShaderMode - Begin custom shader drawing
|
||||||
|
@ -176,41 +134,3 @@ func BeginBlendMode(mode BlendMode) {
|
||||||
func EndBlendMode() {
|
func EndBlendMode() {
|
||||||
C.EndBlendMode()
|
C.EndBlendMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitVrSimulator - Init VR simulator for selected device
|
|
||||||
func InitVrSimulator() {
|
|
||||||
C.InitVrSimulator()
|
|
||||||
}
|
|
||||||
|
|
||||||
// CloseVrSimulator - Close VR simulator for current device
|
|
||||||
func CloseVrSimulator() {
|
|
||||||
C.CloseVrSimulator()
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsVrSimulatorReady - Detect if VR simulator is ready
|
|
||||||
func IsVrSimulatorReady() bool {
|
|
||||||
ret := C.IsVrSimulatorReady()
|
|
||||||
v := bool(ret)
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateVrTracking - Update VR tracking (position and orientation) and camera
|
|
||||||
func UpdateVrTracking(camera *Camera) {
|
|
||||||
ccamera := camera.cptr()
|
|
||||||
C.UpdateVrTracking(ccamera)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ToggleVrMode - Enable/Disable VR experience (device or simulator)
|
|
||||||
func ToggleVrMode() {
|
|
||||||
C.ToggleVrMode()
|
|
||||||
}
|
|
||||||
|
|
||||||
// BeginVrDrawing - Begin VR simulator stereo rendering
|
|
||||||
func BeginVrDrawing() {
|
|
||||||
C.BeginVrDrawing()
|
|
||||||
}
|
|
||||||
|
|
||||||
// EndVrDrawing - End VR simulator stereo rendering
|
|
||||||
func EndVrDrawing() {
|
|
||||||
C.EndVrDrawing()
|
|
||||||
}
|
|
|
@ -1,106 +0,0 @@
|
||||||
|
|
||||||
// Vertex shader definition to embed, no external file required
|
|
||||||
static const char distortionVShaderStr[] =
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_21)
|
|
||||||
"#version 120 \n"
|
|
||||||
#elif defined(GRAPHICS_API_OPENGL_ES2)
|
|
||||||
"#version 100 \n"
|
|
||||||
#endif
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_21)
|
|
||||||
"attribute vec3 vertexPosition; \n"
|
|
||||||
"attribute vec2 vertexTexCoord; \n"
|
|
||||||
"attribute vec4 vertexColor; \n"
|
|
||||||
"varying vec2 fragTexCoord; \n"
|
|
||||||
"varying vec4 fragColor; \n"
|
|
||||||
#elif defined(GRAPHICS_API_OPENGL_33)
|
|
||||||
"#version 330 \n"
|
|
||||||
"in vec3 vertexPosition; \n"
|
|
||||||
"in vec2 vertexTexCoord; \n"
|
|
||||||
"in vec4 vertexColor; \n"
|
|
||||||
"out vec2 fragTexCoord; \n"
|
|
||||||
"out vec4 fragColor; \n"
|
|
||||||
#endif
|
|
||||||
"uniform mat4 mvp; \n"
|
|
||||||
"void main() \n"
|
|
||||||
"{ \n"
|
|
||||||
" fragTexCoord = vertexTexCoord; \n"
|
|
||||||
" fragColor = vertexColor; \n"
|
|
||||||
" gl_Position = mvp*vec4(vertexPosition, 1.0); \n"
|
|
||||||
"} \n";
|
|
||||||
|
|
||||||
// Fragment shader definition to embed, no external file required
|
|
||||||
static const char distortionFShaderStr[] =
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_21)
|
|
||||||
"#version 120 \n"
|
|
||||||
#elif defined(GRAPHICS_API_OPENGL_ES2)
|
|
||||||
"#version 100 \n"
|
|
||||||
"precision mediump float; \n" // precision required for OpenGL ES2 (WebGL)
|
|
||||||
#endif
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_21)
|
|
||||||
"varying vec2 fragTexCoord; \n"
|
|
||||||
"varying vec4 fragColor; \n"
|
|
||||||
#elif defined(GRAPHICS_API_OPENGL_33)
|
|
||||||
"#version 330 \n"
|
|
||||||
"in vec2 fragTexCoord; \n"
|
|
||||||
"in vec4 fragColor; \n"
|
|
||||||
"out vec4 finalColor; \n"
|
|
||||||
#endif
|
|
||||||
"uniform sampler2D texture0; \n"
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_21)
|
|
||||||
"uniform vec2 leftLensCenter; \n"
|
|
||||||
"uniform vec2 rightLensCenter; \n"
|
|
||||||
"uniform vec2 leftScreenCenter; \n"
|
|
||||||
"uniform vec2 rightScreenCenter; \n"
|
|
||||||
"uniform vec2 scale; \n"
|
|
||||||
"uniform vec2 scaleIn; \n"
|
|
||||||
"uniform vec4 hmdWarpParam; \n"
|
|
||||||
"uniform vec4 chromaAbParam; \n"
|
|
||||||
#elif defined(GRAPHICS_API_OPENGL_33)
|
|
||||||
"uniform vec2 leftLensCenter = vec2(0.288, 0.5); \n"
|
|
||||||
"uniform vec2 rightLensCenter = vec2(0.712, 0.5); \n"
|
|
||||||
"uniform vec2 leftScreenCenter = vec2(0.25, 0.5); \n"
|
|
||||||
"uniform vec2 rightScreenCenter = vec2(0.75, 0.5); \n"
|
|
||||||
"uniform vec2 scale = vec2(0.25, 0.45); \n"
|
|
||||||
"uniform vec2 scaleIn = vec2(4, 2.2222); \n"
|
|
||||||
"uniform vec4 hmdWarpParam = vec4(1, 0.22, 0.24, 0); \n"
|
|
||||||
"uniform vec4 chromaAbParam = vec4(0.996, -0.004, 1.014, 0.0); \n"
|
|
||||||
#endif
|
|
||||||
"void main() \n"
|
|
||||||
"{ \n"
|
|
||||||
" vec2 lensCenter = fragTexCoord.x < 0.5 ? leftLensCenter : rightLensCenter; \n"
|
|
||||||
" vec2 screenCenter = fragTexCoord.x < 0.5 ? leftScreenCenter : rightScreenCenter; \n"
|
|
||||||
" vec2 theta = (fragTexCoord - lensCenter)*scaleIn; \n"
|
|
||||||
" float rSq = theta.x*theta.x + theta.y*theta.y; \n"
|
|
||||||
" vec2 theta1 = theta*(hmdWarpParam.x + hmdWarpParam.y*rSq + hmdWarpParam.z*rSq*rSq + hmdWarpParam.w*rSq*rSq*rSq); \n"
|
|
||||||
" vec2 thetaBlue = theta1*(chromaAbParam.z + chromaAbParam.w*rSq); \n"
|
|
||||||
" vec2 tcBlue = lensCenter + scale*thetaBlue; \n"
|
|
||||||
" if (any(bvec2(clamp(tcBlue, screenCenter - vec2(0.25, 0.5), screenCenter + vec2(0.25, 0.5)) - tcBlue))) \n"
|
|
||||||
" { \n"
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_21)
|
|
||||||
" gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); \n"
|
|
||||||
#elif defined(GRAPHICS_API_OPENGL_33)
|
|
||||||
" finalColor = vec4(0.0, 0.0, 0.0, 1.0); \n"
|
|
||||||
#endif
|
|
||||||
" } \n"
|
|
||||||
" else \n"
|
|
||||||
" { \n"
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_21)
|
|
||||||
" float blue = texture2D(texture0, tcBlue).b; \n"
|
|
||||||
" vec2 tcGreen = lensCenter + scale*theta1; \n"
|
|
||||||
" float green = texture2D(texture0, tcGreen).g; \n"
|
|
||||||
#elif defined(GRAPHICS_API_OPENGL_33)
|
|
||||||
" float blue = texture(texture0, tcBlue).b; \n"
|
|
||||||
" vec2 tcGreen = lensCenter + scale*theta1; \n"
|
|
||||||
" float green = texture(texture0, tcGreen).g; \n"
|
|
||||||
#endif
|
|
||||||
" vec2 thetaRed = theta1*(chromaAbParam.x + chromaAbParam.y*rSq); \n"
|
|
||||||
" vec2 tcRed = lensCenter + scale*thetaRed; \n"
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_21)
|
|
||||||
" float red = texture2D(texture0, tcRed).r; \n"
|
|
||||||
" gl_FragColor = vec4(red, green, blue, 1.0); \n"
|
|
||||||
#elif defined(GRAPHICS_API_OPENGL_33)
|
|
||||||
" float red = texture(texture0, tcRed).r; \n"
|
|
||||||
" finalColor = vec4(red, green, blue, 1.0); \n"
|
|
||||||
#endif
|
|
||||||
" } \n"
|
|
||||||
"} \n";
|
|
|
@ -68,22 +68,22 @@ func DrawCircle(centerX, centerY int32, radius float32, color Color) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DrawCircleSector - Draw a piece of a circle
|
// DrawCircleSector - Draw a piece of a circle
|
||||||
func DrawCircleSector(center Vector2, radius float32, startAngle, endAngle, segments int32, color Color) {
|
func DrawCircleSector(center Vector2, radius, startAngle, endAngle float32, segments int32, color Color) {
|
||||||
ccenter := center.cptr()
|
ccenter := center.cptr()
|
||||||
cradius := (C.float)(radius)
|
cradius := (C.float)(radius)
|
||||||
cstartAngle := (C.int)(startAngle)
|
cstartAngle := (C.float)(startAngle)
|
||||||
cendAngle := (C.int)(endAngle)
|
cendAngle := (C.float)(endAngle)
|
||||||
csegments := (C.int)(segments)
|
csegments := (C.int)(segments)
|
||||||
ccolor := color.cptr()
|
ccolor := color.cptr()
|
||||||
C.DrawCircleSector(*ccenter, cradius, cstartAngle, cendAngle, csegments, *ccolor)
|
C.DrawCircleSector(*ccenter, cradius, cstartAngle, cendAngle, csegments, *ccolor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DrawCircleSectorLines -
|
// DrawCircleSectorLines -
|
||||||
func DrawCircleSectorLines(center Vector2, radius float32, startAngle, endAngle, segments int32, color Color) {
|
func DrawCircleSectorLines(center Vector2, radius, startAngle, endAngle float32, segments int32, color Color) {
|
||||||
ccenter := center.cptr()
|
ccenter := center.cptr()
|
||||||
cradius := (C.float)(radius)
|
cradius := (C.float)(radius)
|
||||||
cstartAngle := (C.int)(startAngle)
|
cstartAngle := (C.float)(startAngle)
|
||||||
cendAngle := (C.int)(endAngle)
|
cendAngle := (C.float)(endAngle)
|
||||||
csegments := (C.int)(segments)
|
csegments := (C.int)(segments)
|
||||||
ccolor := color.cptr()
|
ccolor := color.cptr()
|
||||||
C.DrawCircleSectorLines(*ccenter, cradius, cstartAngle, cendAngle, csegments, *ccolor)
|
C.DrawCircleSectorLines(*ccenter, cradius, cstartAngle, cendAngle, csegments, *ccolor)
|
||||||
|
@ -137,24 +137,24 @@ func DrawEllipseLines(centerX, centerY int32, radiusH, radiusV float32, color Co
|
||||||
}
|
}
|
||||||
|
|
||||||
// DrawRing -
|
// DrawRing -
|
||||||
func DrawRing(center Vector2, innerRadius, outerRadius float32, startAngle, endAngle, segments int32, color Color) {
|
func DrawRing(center Vector2, innerRadius, outerRadius, startAngle, endAngle float32, segments int32, color Color) {
|
||||||
ccenter := center.cptr()
|
ccenter := center.cptr()
|
||||||
cinnerRadius := (C.float)(innerRadius)
|
cinnerRadius := (C.float)(innerRadius)
|
||||||
couterRadius := (C.float)(outerRadius)
|
couterRadius := (C.float)(outerRadius)
|
||||||
cstartAngle := (C.int)(startAngle)
|
cstartAngle := (C.float)(startAngle)
|
||||||
cendAngle := (C.int)(endAngle)
|
cendAngle := (C.float)(endAngle)
|
||||||
csegments := (C.int)(segments)
|
csegments := (C.int)(segments)
|
||||||
ccolor := color.cptr()
|
ccolor := color.cptr()
|
||||||
C.DrawRing(*ccenter, cinnerRadius, couterRadius, cstartAngle, cendAngle, csegments, *ccolor)
|
C.DrawRing(*ccenter, cinnerRadius, couterRadius, cstartAngle, cendAngle, csegments, *ccolor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DrawRingLines -
|
// DrawRingLines -
|
||||||
func DrawRingLines(center Vector2, innerRadius, outerRadius float32, startAngle, endAngle, segments int32, color Color) {
|
func DrawRingLines(center Vector2, innerRadius, outerRadius, startAngle, endAngle float32, segments int32, color Color) {
|
||||||
ccenter := center.cptr()
|
ccenter := center.cptr()
|
||||||
cinnerRadius := (C.float)(innerRadius)
|
cinnerRadius := (C.float)(innerRadius)
|
||||||
couterRadius := (C.float)(outerRadius)
|
couterRadius := (C.float)(outerRadius)
|
||||||
cstartAngle := (C.int)(startAngle)
|
cstartAngle := (C.float)(startAngle)
|
||||||
cendAngle := (C.int)(endAngle)
|
cendAngle := (C.float)(endAngle)
|
||||||
csegments := (C.int)(segments)
|
csegments := (C.int)(segments)
|
||||||
ccolor := color.cptr()
|
ccolor := color.cptr()
|
||||||
C.DrawRingLines(*ccenter, cinnerRadius, couterRadius, cstartAngle, cendAngle, csegments, *ccolor)
|
C.DrawRingLines(*ccenter, cinnerRadius, couterRadius, cstartAngle, cendAngle, csegments, *ccolor)
|
||||||
|
@ -237,9 +237,9 @@ func DrawRectangleLines(posX, posY, width, height int32, color Color) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DrawRectangleLinesEx - Draw rectangle outline with extended parameters
|
// DrawRectangleLinesEx - Draw rectangle outline with extended parameters
|
||||||
func DrawRectangleLinesEx(rec Rectangle, lineThick int32, color Color) {
|
func DrawRectangleLinesEx(rec Rectangle, lineThick float32, color Color) {
|
||||||
crec := rec.cptr()
|
crec := rec.cptr()
|
||||||
clineThick := (C.int)(lineThick)
|
clineThick := (C.float)(lineThick)
|
||||||
ccolor := color.cptr()
|
ccolor := color.cptr()
|
||||||
C.DrawRectangleLinesEx(*crec, clineThick, *ccolor)
|
C.DrawRectangleLinesEx(*crec, clineThick, *ccolor)
|
||||||
}
|
}
|
||||||
|
@ -254,11 +254,11 @@ func DrawRectangleRounded(rec Rectangle, roundness float32, segments int32, colo
|
||||||
}
|
}
|
||||||
|
|
||||||
// DrawRectangleRoundedLines - Draw rectangle with rounded edges outline
|
// DrawRectangleRoundedLines - Draw rectangle with rounded edges outline
|
||||||
func DrawRectangleRoundedLines(rec Rectangle, roundness float32, segments, lineThick int32, color Color) {
|
func DrawRectangleRoundedLines(rec Rectangle, roundness float32, segments, lineThick float32, color Color) {
|
||||||
crec := rec.cptr()
|
crec := rec.cptr()
|
||||||
croundness := (C.float)(roundness)
|
croundness := (C.float)(roundness)
|
||||||
csegments := (C.int)(segments)
|
csegments := (C.int)(segments)
|
||||||
clineThick := (C.int)(lineThick)
|
clineThick := (C.float)(lineThick)
|
||||||
ccolor := color.cptr()
|
ccolor := color.cptr()
|
||||||
C.DrawRectangleRoundedLines(*crec, croundness, csegments, clineThick, *ccolor)
|
C.DrawRectangleRoundedLines(*crec, croundness, csegments, clineThick, *ccolor)
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,14 +56,14 @@ func LoadFontFromImage(image Image, key Color, firstChar int32) Font {
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadFontData - Load font data for further use
|
// LoadFontData - Load font data for further use
|
||||||
func LoadFontData(fileName string, fontSize int32, fontChars *int32, charsCount, typ int32) *CharInfo {
|
func LoadFontData(fileData []byte, dataSize int32, fontSize int32, fontChars *int32, charsCount, typ int32) *CharInfo {
|
||||||
cfileName := C.CString(fileName)
|
cfileData := (*C.uchar)(unsafe.Pointer(&fileData[0]))
|
||||||
defer C.free(unsafe.Pointer(cfileName))
|
cdataSize := (C.int)(dataSize)
|
||||||
cfontSize := (C.int)(fontSize)
|
cfontSize := (C.int)(fontSize)
|
||||||
cfontChars := (*C.int)(unsafe.Pointer(fontChars))
|
cfontChars := (*C.int)(unsafe.Pointer(fontChars))
|
||||||
ccharsCount := (C.int)(charsCount)
|
ccharsCount := (C.int)(charsCount)
|
||||||
ctype := (C.int)(typ)
|
ctype := (C.int)(typ)
|
||||||
ret := C.LoadFontData(cfileName, cfontSize, cfontChars, ccharsCount, ctype)
|
ret := C.LoadFontData(cfileData, cdataSize, cfontSize, cfontChars, ccharsCount, ctype)
|
||||||
v := newCharInfoFromPointer(unsafe.Pointer(&ret))
|
v := newCharInfoFromPointer(unsafe.Pointer(&ret))
|
||||||
return &v
|
return &v
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,13 +113,6 @@ func GetImageData(img *Image) []Color {
|
||||||
return (*[1 << 24]Color)(unsafe.Pointer(ret))[0 : img.Width*img.Height]
|
return (*[1 << 24]Color)(unsafe.Pointer(ret))[0 : img.Width*img.Height]
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetImageDataNormalized - Get pixel data from image as Vector4 slice (float normalized)
|
|
||||||
func GetImageDataNormalized(img *Image) []Vector4 {
|
|
||||||
cimg := img.cptr()
|
|
||||||
ret := C.GetImageDataNormalized(*cimg)
|
|
||||||
return (*[1 << 24]Vector4)(unsafe.Pointer(ret))[0 : img.Width*img.Height]
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPixelDataSize - Get pixel data size in bytes (image or texture)
|
// GetPixelDataSize - Get pixel data size in bytes (image or texture)
|
||||||
func GetPixelDataSize(width, height, format int32) int32 {
|
func GetPixelDataSize(width, height, format int32) int32 {
|
||||||
cwidth := (C.int)(width)
|
cwidth := (C.int)(width)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue