Purego rlgl implemented
This commit is contained in:
parent
7637a03441
commit
251b88bcb4
4 changed files with 1664 additions and 874 deletions
|
@ -512,6 +512,8 @@ var detachAudioMixedProcessor func(processor uintptr)
|
|||
func init() {
|
||||
raylibDll = loadLibrary()
|
||||
|
||||
initRlglPurego()
|
||||
|
||||
purego.RegisterLibFunc(&initWindow, raylibDll, "InitWindow")
|
||||
purego.RegisterLibFunc(&closeWindow, raylibDll, "CloseWindow")
|
||||
purego.RegisterLibFunc(&windowShouldClose, raylibDll, "WindowShouldClose")
|
||||
|
|
874
raylib/rlgl.go
874
raylib/rlgl.go
|
@ -1,49 +1,5 @@
|
|||
package rl
|
||||
|
||||
/*
|
||||
#include "raylib.h"
|
||||
#include "rlgl.h"
|
||||
#include <stdlib.h>
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// SetMatrixProjection - Set a custom projection matrix (replaces internal projection matrix)
|
||||
func SetMatrixProjection(proj Matrix) {
|
||||
cproj := proj.cptr()
|
||||
C.rlSetMatrixProjection(*cproj)
|
||||
}
|
||||
|
||||
// SetMatrixModelview - Set a custom modelview matrix (replaces internal modelview matrix)
|
||||
func SetMatrixModelview(view Matrix) {
|
||||
cview := view.cptr()
|
||||
C.rlSetMatrixModelview(*cview)
|
||||
}
|
||||
|
||||
// BeginShaderMode - Begin custom shader drawing
|
||||
func BeginShaderMode(shader Shader) {
|
||||
cshader := shader.cptr()
|
||||
C.BeginShaderMode(*cshader)
|
||||
}
|
||||
|
||||
// EndShaderMode - End custom shader drawing (use default shader)
|
||||
func EndShaderMode() {
|
||||
C.EndShaderMode()
|
||||
}
|
||||
|
||||
// BeginBlendMode - Begin blending mode (alpha, additive, multiplied)
|
||||
func BeginBlendMode(mode BlendMode) {
|
||||
cmode := (C.int)(mode)
|
||||
C.BeginBlendMode(cmode)
|
||||
}
|
||||
|
||||
// EndBlendMode - End blending mode (reset to default: alpha blending)
|
||||
func EndBlendMode() {
|
||||
C.EndBlendMode()
|
||||
}
|
||||
|
||||
const (
|
||||
// Texture parameters (equivalent to OpenGL defines)
|
||||
TextureWrapS = 0x2802 // GL_TEXTURE_WRAP_S
|
||||
|
@ -179,833 +135,3 @@ const (
|
|||
)
|
||||
|
||||
type rlFramebufferAttachTextureType = int32
|
||||
|
||||
// MatrixMode - Choose the current matrix to be transformed
|
||||
func MatrixMode(mode int32) {
|
||||
cmode := C.int(mode)
|
||||
C.rlMatrixMode(cmode)
|
||||
}
|
||||
|
||||
// PushMatrix - Push the current matrix to stack
|
||||
func PushMatrix() {
|
||||
C.rlPushMatrix()
|
||||
}
|
||||
|
||||
// PopMatrix - Pop lattest inserted matrix from stack
|
||||
func PopMatrix() {
|
||||
C.rlPopMatrix()
|
||||
}
|
||||
|
||||
// LoadIdentity - Reset current matrix to identity matrix
|
||||
func LoadIdentity() {
|
||||
C.rlLoadIdentity()
|
||||
}
|
||||
|
||||
// Translatef - Multiply the current matrix by a translation matrix
|
||||
func Translatef(x float32, y float32, z float32) {
|
||||
cx := C.float(x)
|
||||
cy := C.float(y)
|
||||
cz := C.float(z)
|
||||
C.rlTranslatef(cx, cy, cz)
|
||||
}
|
||||
|
||||
// Rotatef - Multiply the current matrix by a rotation matrix
|
||||
func Rotatef(angle float32, x float32, y float32, z float32) {
|
||||
cangle := C.float(angle)
|
||||
cx := C.float(x)
|
||||
cy := C.float(y)
|
||||
cz := C.float(z)
|
||||
C.rlRotatef(cangle, cx, cy, cz)
|
||||
}
|
||||
|
||||
// Scalef - Multiply the current matrix by a scaling matrix
|
||||
func Scalef(x float32, y float32, z float32) {
|
||||
cx := C.float(x)
|
||||
cy := C.float(y)
|
||||
cz := C.float(z)
|
||||
C.rlScalef(cx, cy, cz)
|
||||
}
|
||||
|
||||
// Frustum .
|
||||
func Frustum(left float64, right float64, bottom float64, top float64, znear float64, zfar float64) {
|
||||
cleft := C.double(left)
|
||||
cright := C.double(right)
|
||||
cbottom := C.double(bottom)
|
||||
ctop := C.double(top)
|
||||
cznear := C.double(znear)
|
||||
czfar := C.double(zfar)
|
||||
C.rlFrustum(cleft, cright, cbottom, ctop, cznear, czfar)
|
||||
}
|
||||
|
||||
// Ortho .
|
||||
func Ortho(left float64, right float64, bottom float64, top float64, znear float64, zfar float64) {
|
||||
cleft := C.double(left)
|
||||
cright := C.double(right)
|
||||
cbottom := C.double(bottom)
|
||||
ctop := C.double(top)
|
||||
cznear := C.double(znear)
|
||||
czfar := C.double(zfar)
|
||||
C.rlOrtho(cleft, cright, cbottom, ctop, cznear, czfar)
|
||||
}
|
||||
|
||||
// Viewport - Set the viewport area
|
||||
func Viewport(x int32, y int32, width int32, height int32) {
|
||||
cx := C.int(x)
|
||||
cy := C.int(y)
|
||||
cwidth := C.int(width)
|
||||
cheight := C.int(height)
|
||||
C.rlViewport(cx, cy, cwidth, cheight)
|
||||
}
|
||||
|
||||
// Begin - Initialize drawing mode (how to organize vertex)
|
||||
func Begin(mode int32) {
|
||||
cmode := C.int(mode)
|
||||
C.rlBegin(cmode)
|
||||
}
|
||||
|
||||
// End - Finish vertex providing
|
||||
func End() {
|
||||
C.rlEnd()
|
||||
}
|
||||
|
||||
// Vertex2i - Define one vertex (position) - 2 int
|
||||
func Vertex2i(x int32, y int32) {
|
||||
cx := C.int(x)
|
||||
cy := C.int(y)
|
||||
C.rlVertex2i(cx, cy)
|
||||
}
|
||||
|
||||
// Vertex2f - Define one vertex (position) - 2 float
|
||||
func Vertex2f(x float32, y float32) {
|
||||
cx := C.float(x)
|
||||
cy := C.float(y)
|
||||
C.rlVertex2f(cx, cy)
|
||||
}
|
||||
|
||||
// Vertex3f - Define one vertex (position) - 3 float
|
||||
func Vertex3f(x float32, y float32, z float32) {
|
||||
cx := C.float(x)
|
||||
cy := C.float(y)
|
||||
cz := C.float(z)
|
||||
C.rlVertex3f(cx, cy, cz)
|
||||
}
|
||||
|
||||
// TexCoord2f - Define one vertex (texture coordinate) - 2 float
|
||||
func TexCoord2f(x float32, y float32) {
|
||||
cx := C.float(x)
|
||||
cy := C.float(y)
|
||||
C.rlTexCoord2f(cx, cy)
|
||||
}
|
||||
|
||||
// Normal3f - Define one vertex (normal) - 3 float
|
||||
func Normal3f(x float32, y float32, z float32) {
|
||||
cx := C.float(x)
|
||||
cy := C.float(y)
|
||||
cz := C.float(z)
|
||||
C.rlNormal3f(cx, cy, cz)
|
||||
}
|
||||
|
||||
// Color4ub - Define one vertex (color) - 4 byte
|
||||
func Color4ub(r uint8, g uint8, b uint8, a uint8) {
|
||||
cr := C.uchar(r)
|
||||
cg := C.uchar(g)
|
||||
cb := C.uchar(b)
|
||||
ca := C.uchar(a)
|
||||
C.rlColor4ub(cr, cg, cb, ca)
|
||||
}
|
||||
|
||||
// Color3f - Define one vertex (color) - 3 float
|
||||
func Color3f(x float32, y float32, z float32) {
|
||||
cx := C.float(x)
|
||||
cy := C.float(y)
|
||||
cz := C.float(z)
|
||||
C.rlColor3f(cx, cy, cz)
|
||||
}
|
||||
|
||||
// Color4f - Define one vertex (color) - 4 float
|
||||
func Color4f(x float32, y float32, z float32, w float32) {
|
||||
cx := C.float(x)
|
||||
cy := C.float(y)
|
||||
cz := C.float(z)
|
||||
cw := C.float(w)
|
||||
C.rlColor4f(cx, cy, cz, cw)
|
||||
}
|
||||
|
||||
// EnableVertexArray - Enable vertex array (VAO, if supported)
|
||||
func EnableVertexArray(vaoId uint32) bool {
|
||||
cvaoId := C.uint(vaoId)
|
||||
return bool(C.rlEnableVertexArray(cvaoId))
|
||||
}
|
||||
|
||||
// DisableVertexArray - Disable vertex array (VAO, if supported)
|
||||
func DisableVertexArray() {
|
||||
C.rlDisableVertexArray()
|
||||
}
|
||||
|
||||
// EnableVertexBuffer - Enable vertex buffer (VBO)
|
||||
func EnableVertexBuffer(id uint32) {
|
||||
cid := C.uint(id)
|
||||
C.rlEnableVertexBuffer(cid)
|
||||
}
|
||||
|
||||
// DisableVertexBuffer - Disable vertex buffer (VBO)
|
||||
func DisableVertexBuffer() {
|
||||
C.rlDisableVertexBuffer()
|
||||
}
|
||||
|
||||
// EnableVertexBufferElement - Enable vertex buffer element (VBO element)
|
||||
func EnableVertexBufferElement(id uint32) {
|
||||
cid := C.uint(id)
|
||||
C.rlEnableVertexBufferElement(cid)
|
||||
}
|
||||
|
||||
// DisableVertexBufferElement - Disable vertex buffer element (VBO element)
|
||||
func DisableVertexBufferElement() {
|
||||
C.rlDisableVertexBufferElement()
|
||||
}
|
||||
|
||||
// EnableVertexAttribute - Enable vertex attribute index
|
||||
func EnableVertexAttribute(index uint32) {
|
||||
cindex := C.uint(index)
|
||||
C.rlEnableVertexAttribute(cindex)
|
||||
}
|
||||
|
||||
// DisableVertexAttribute - Disable vertex attribute index
|
||||
func DisableVertexAttribute(index uint32) {
|
||||
cindex := C.uint(index)
|
||||
C.rlDisableVertexAttribute(cindex)
|
||||
}
|
||||
|
||||
// ActiveTextureSlot - Select and active a texture slot
|
||||
func ActiveTextureSlot(slot int32) {
|
||||
cslot := C.int(slot)
|
||||
C.rlActiveTextureSlot(cslot)
|
||||
}
|
||||
|
||||
// EnableTexture - Enable texture
|
||||
func EnableTexture(id uint32) {
|
||||
cid := C.uint(id)
|
||||
C.rlEnableTexture(cid)
|
||||
}
|
||||
|
||||
// DisableTexture - Disable texture
|
||||
func DisableTexture() {
|
||||
C.rlDisableTexture()
|
||||
}
|
||||
|
||||
// EnableTextureCubemap - Enable texture cubemap
|
||||
func EnableTextureCubemap(id uint32) {
|
||||
cid := C.uint(id)
|
||||
C.rlEnableTextureCubemap(cid)
|
||||
}
|
||||
|
||||
// DisableTextureCubemap - Disable texture cubemap
|
||||
func DisableTextureCubemap() {
|
||||
C.rlDisableTextureCubemap()
|
||||
}
|
||||
|
||||
// TextureParameters - Set texture parameters (filter, wrap)
|
||||
func TextureParameters(id uint32, param int32, value int32) {
|
||||
cid := C.uint(id)
|
||||
cparam := C.int(param)
|
||||
cvalue := C.int(value)
|
||||
C.rlTextureParameters(cid, cparam, cvalue)
|
||||
}
|
||||
|
||||
// CubemapParameters - Set cubemap parameters (filter, wrap)
|
||||
func CubemapParameters(id uint32, param int32, value int32) {
|
||||
cid := C.uint(id)
|
||||
cparam := C.int(param)
|
||||
cvalue := C.int(value)
|
||||
C.rlCubemapParameters(cid, cparam, cvalue)
|
||||
}
|
||||
|
||||
// EnableShader - Enable shader program
|
||||
func EnableShader(id uint32) {
|
||||
cid := C.uint(id)
|
||||
C.rlEnableShader(cid)
|
||||
}
|
||||
|
||||
// DisableShader - Disable shader program
|
||||
func DisableShader() {
|
||||
C.rlDisableShader()
|
||||
}
|
||||
|
||||
// EnableFramebuffer - Enable render texture (fbo)
|
||||
func EnableFramebuffer(id uint32) {
|
||||
cid := C.uint(id)
|
||||
C.rlEnableFramebuffer(cid)
|
||||
}
|
||||
|
||||
// DisableFramebuffer - Disable render texture (fbo), return to default framebuffer
|
||||
func DisableFramebuffer() {
|
||||
C.rlDisableFramebuffer()
|
||||
}
|
||||
|
||||
// ActiveDrawBuffers - Activate multiple draw color buffers
|
||||
func ActiveDrawBuffers(count int32) {
|
||||
ccount := C.int(count)
|
||||
C.rlActiveDrawBuffers(ccount)
|
||||
}
|
||||
|
||||
// EnableColorBlend - Enable color blending
|
||||
func EnableColorBlend() {
|
||||
C.rlEnableColorBlend()
|
||||
}
|
||||
|
||||
// DisableColorBlend - Disable color blending
|
||||
func DisableColorBlend() {
|
||||
C.rlDisableColorBlend()
|
||||
}
|
||||
|
||||
// EnableDepthTest - Enable depth test
|
||||
func EnableDepthTest() {
|
||||
C.rlEnableDepthTest()
|
||||
}
|
||||
|
||||
// DisableDepthTest - Disable depth test
|
||||
func DisableDepthTest() {
|
||||
C.rlDisableDepthTest()
|
||||
}
|
||||
|
||||
// EnableDepthMask - Enable depth write
|
||||
func EnableDepthMask() {
|
||||
C.rlEnableDepthMask()
|
||||
}
|
||||
|
||||
// DisableDepthMask - Disable depth write
|
||||
func DisableDepthMask() {
|
||||
C.rlDisableDepthMask()
|
||||
}
|
||||
|
||||
// EnableBackfaceCulling - Enable backface culling
|
||||
func EnableBackfaceCulling() {
|
||||
C.rlEnableBackfaceCulling()
|
||||
}
|
||||
|
||||
// DisableBackfaceCulling - Disable backface culling
|
||||
func DisableBackfaceCulling() {
|
||||
C.rlDisableBackfaceCulling()
|
||||
}
|
||||
|
||||
// SetCullFace - Set face culling mode
|
||||
func SetCullFace(mode int32) {
|
||||
cmode := C.int(mode)
|
||||
C.rlSetCullFace(cmode)
|
||||
}
|
||||
|
||||
// EnableScissorTest - Enable scissor test
|
||||
func EnableScissorTest() {
|
||||
C.rlEnableScissorTest()
|
||||
}
|
||||
|
||||
// DisableScissorTest - Disable scissor test
|
||||
func DisableScissorTest() {
|
||||
C.rlDisableScissorTest()
|
||||
}
|
||||
|
||||
// Scissor - Scissor test
|
||||
func Scissor(x int32, y int32, width int32, height int32) {
|
||||
cx := C.int(x)
|
||||
cy := C.int(y)
|
||||
cwidth := C.int(width)
|
||||
cheight := C.int(height)
|
||||
C.rlScissor(cx, cy, cwidth, cheight)
|
||||
}
|
||||
|
||||
// EnableWireMode - Enable wire mode
|
||||
func EnableWireMode() {
|
||||
C.rlEnableWireMode()
|
||||
}
|
||||
|
||||
// EnablePointMode - Enable point mode
|
||||
func EnablePointMode() {
|
||||
C.rlEnablePointMode()
|
||||
}
|
||||
|
||||
// DisableWireMode - Disable wire mode
|
||||
func DisableWireMode() {
|
||||
C.rlDisableWireMode()
|
||||
}
|
||||
|
||||
// SetLineWidth - Set the line drawing width
|
||||
func SetLineWidth(width float32) {
|
||||
cwidth := C.float(width)
|
||||
C.rlSetLineWidth(cwidth)
|
||||
}
|
||||
|
||||
// GetLineWidth - Get the line drawing width
|
||||
func GetLineWidth() float32 {
|
||||
return float32(C.rlGetLineWidth())
|
||||
}
|
||||
|
||||
// EnableSmoothLines - Enable line aliasing
|
||||
func EnableSmoothLines() {
|
||||
C.rlEnableSmoothLines()
|
||||
}
|
||||
|
||||
// DisableSmoothLines - Disable line aliasing
|
||||
func DisableSmoothLines() {
|
||||
C.rlDisableSmoothLines()
|
||||
}
|
||||
|
||||
// EnableStereoRender - Enable stereo rendering
|
||||
func EnableStereoRender() {
|
||||
C.rlEnableStereoRender()
|
||||
}
|
||||
|
||||
// DisableStereoRender - Disable stereo rendering
|
||||
func DisableStereoRender() {
|
||||
C.rlDisableStereoRender()
|
||||
}
|
||||
|
||||
// IsStereoRenderEnabled - Check if stereo render is enabled
|
||||
func IsStereoRenderEnabled() bool {
|
||||
return bool(C.rlIsStereoRenderEnabled())
|
||||
}
|
||||
|
||||
// ClearColor - Clear color buffer with color
|
||||
func ClearColor(r uint8, g uint8, b uint8, a uint8) {
|
||||
cr := C.uchar(r)
|
||||
cg := C.uchar(g)
|
||||
cb := C.uchar(b)
|
||||
ca := C.uchar(a)
|
||||
C.rlClearColor(cr, cg, cb, ca)
|
||||
}
|
||||
|
||||
// ClearScreenBuffers - Clear used screen buffers (color and depth)
|
||||
func ClearScreenBuffers() {
|
||||
C.rlClearScreenBuffers()
|
||||
}
|
||||
|
||||
// CheckErrors - Check and log OpenGL error codes
|
||||
func CheckErrors() {
|
||||
C.rlCheckErrors()
|
||||
}
|
||||
|
||||
// SetBlendMode - Set blending mode
|
||||
func SetBlendMode(mode int32) {
|
||||
cmode := C.int(mode)
|
||||
C.rlSetBlendMode(cmode)
|
||||
}
|
||||
|
||||
// SetBlendFactors - Set blending mode factor and equation (using OpenGL factors)
|
||||
func SetBlendFactors(glSrcFactor int32, glDstFactor int32, glEquation int32) {
|
||||
cglSrcFactor := C.int(glSrcFactor)
|
||||
cglDstFactor := C.int(glDstFactor)
|
||||
cglEquation := C.int(glEquation)
|
||||
C.rlSetBlendFactors(cglSrcFactor, cglDstFactor, cglEquation)
|
||||
}
|
||||
|
||||
// SetBlendFactorsSeparate - Set blending mode factors and equations separately (using OpenGL factors)
|
||||
func SetBlendFactorsSeparate(glSrcRGB int32, glDstRGB int32, glSrcAlpha int32, glDstAlpha int32, glEqRGB int32, glEqAlpha int32) {
|
||||
cglSrcRGB := C.int(glSrcRGB)
|
||||
cglDstRGB := C.int(glDstRGB)
|
||||
cglSrcAlpha := C.int(glSrcAlpha)
|
||||
cglDstAlpha := C.int(glDstAlpha)
|
||||
cglEqRGB := C.int(glEqRGB)
|
||||
cglEqAlpha := C.int(glEqAlpha)
|
||||
C.rlSetBlendFactorsSeparate(cglSrcRGB, cglDstRGB, cglSrcAlpha, cglDstAlpha, cglEqRGB, cglEqAlpha)
|
||||
}
|
||||
|
||||
// glInit - Initialize rlgl (buffers, shaders, textures, states)
|
||||
func glInit(width int32, height int32) {
|
||||
cwidth := C.int(width)
|
||||
cheight := C.int(height)
|
||||
C.rlglInit(cwidth, cheight)
|
||||
}
|
||||
|
||||
// glClose - De-inititialize rlgl (buffers, shaders, textures)
|
||||
func glClose() {
|
||||
C.rlglClose()
|
||||
}
|
||||
|
||||
// GetVersion - Get current OpenGL version
|
||||
func GetVersion() int32 {
|
||||
return int32(C.rlGetVersion())
|
||||
}
|
||||
|
||||
// SetFramebufferWidth - Set current framebuffer width
|
||||
func SetFramebufferWidth(width int32) {
|
||||
cwidth := C.int(width)
|
||||
C.rlSetFramebufferWidth(cwidth)
|
||||
}
|
||||
|
||||
// GetFramebufferWidth - Get default framebuffer width
|
||||
func GetFramebufferWidth() int32 {
|
||||
return int32(C.rlGetFramebufferWidth())
|
||||
}
|
||||
|
||||
// SetFramebufferHeight - Set current framebuffer height
|
||||
func SetFramebufferHeight(height int32) {
|
||||
cheight := C.int(height)
|
||||
C.rlSetFramebufferHeight(cheight)
|
||||
}
|
||||
|
||||
// GetFramebufferHeight - Get default framebuffer height
|
||||
func GetFramebufferHeight() int32 {
|
||||
return int32(C.rlGetFramebufferHeight())
|
||||
}
|
||||
|
||||
// GetTextureIdDefault - Get default texture id
|
||||
func GetTextureIdDefault() uint32 {
|
||||
return uint32(C.rlGetTextureIdDefault())
|
||||
}
|
||||
|
||||
// GetShaderIdDefault - Get default shader id
|
||||
func GetShaderIdDefault() uint32 {
|
||||
return uint32(C.rlGetShaderIdDefault())
|
||||
}
|
||||
|
||||
// DrawRenderBatchActive - Update and draw internal render batch
|
||||
func DrawRenderBatchActive() {
|
||||
C.rlDrawRenderBatchActive()
|
||||
}
|
||||
|
||||
// CheckRenderBatchLimit - Check internal buffer overflow for a given number of vertex
|
||||
func CheckRenderBatchLimit(vCount int32) bool {
|
||||
cvCount := C.int(vCount)
|
||||
return bool(C.rlCheckRenderBatchLimit(cvCount))
|
||||
}
|
||||
|
||||
// SetTexture - Set current texture for render batch and check buffers limits
|
||||
func SetTexture(id uint32) {
|
||||
cid := C.uint(id)
|
||||
C.rlSetTexture(cid)
|
||||
}
|
||||
|
||||
// LoadVertexArray - Load vertex array (vao) if supported
|
||||
func LoadVertexArray() uint32 {
|
||||
return uint32(C.rlLoadVertexArray())
|
||||
}
|
||||
|
||||
// UnloadVertexBuffer .
|
||||
func UnloadVertexBuffer(vboId uint32) {
|
||||
cvboId := C.uint(vboId)
|
||||
C.rlUnloadVertexBuffer(cvboId)
|
||||
}
|
||||
|
||||
// SetVertexAttributeDivisor .
|
||||
func SetVertexAttributeDivisor(index uint32, divisor int32) {
|
||||
cindex := C.uint(index)
|
||||
cdivisor := C.int(divisor)
|
||||
C.rlSetVertexAttributeDivisor(cindex, cdivisor)
|
||||
}
|
||||
|
||||
// LoadTextureDepth - Load depth texture/renderbuffer (to be attached to fbo)
|
||||
func LoadTextureDepth(width, height int32, useRenderBuffer bool) {
|
||||
cwidth := C.int(width)
|
||||
cheight := C.int(height)
|
||||
cuseRenderBuffer := C.bool(useRenderBuffer)
|
||||
C.rlLoadTextureDepth(cwidth, cheight, cuseRenderBuffer)
|
||||
}
|
||||
|
||||
// LoadFramebuffer - Load an empty framebuffer
|
||||
func LoadFramebuffer(width int32, height int32) uint32 {
|
||||
cwidth := C.int(width)
|
||||
cheight := C.int(height)
|
||||
return uint32(C.rlLoadFramebuffer(cwidth, cheight))
|
||||
}
|
||||
|
||||
// FramebufferAttach - Attach texture/renderbuffer to a framebuffer
|
||||
func FramebufferAttach(fboId uint32, texId uint32, attachType int32, texType int32, mipLevel int32) {
|
||||
cfboId := C.uint(fboId)
|
||||
ctexId := C.uint(texId)
|
||||
cattachType := C.int(attachType)
|
||||
ctexType := C.int(texType)
|
||||
cmipLevel := C.int(mipLevel)
|
||||
C.rlFramebufferAttach(cfboId, ctexId, cattachType, ctexType, cmipLevel)
|
||||
}
|
||||
|
||||
// FramebufferComplete - Verify framebuffer is complete
|
||||
func FramebufferComplete(id uint32) bool {
|
||||
cid := C.uint(id)
|
||||
return bool(C.rlFramebufferComplete(cid))
|
||||
}
|
||||
|
||||
// UnloadFramebuffer - Delete framebuffer from GPU
|
||||
func UnloadFramebuffer(id uint32) {
|
||||
cid := C.uint(id)
|
||||
C.rlUnloadFramebuffer(cid)
|
||||
}
|
||||
|
||||
// LoadShaderCode - Load shader from code strings
|
||||
func LoadShaderCode(vsCode string, fsCode string) uint32 {
|
||||
cvsCode := C.CString(vsCode)
|
||||
defer C.free(unsafe.Pointer(cvsCode))
|
||||
cfsCode := C.CString(fsCode)
|
||||
defer C.free(unsafe.Pointer(cfsCode))
|
||||
return uint32(C.rlLoadShaderCode(cvsCode, cfsCode))
|
||||
}
|
||||
|
||||
// CompileShader - Compile custom shader and return shader id (type: VERTEX_SHADER, FRAGMENT_SHADER, COMPUTE_SHADER)
|
||||
func CompileShader(shaderCode string, type_ int32) uint32 {
|
||||
cshaderCode := C.CString(shaderCode)
|
||||
defer C.free(unsafe.Pointer(cshaderCode))
|
||||
ctype_ := C.int(type_)
|
||||
return uint32(C.rlCompileShader(cshaderCode, ctype_))
|
||||
}
|
||||
|
||||
// LoadShaderProgram - Load custom shader program
|
||||
func LoadShaderProgram(vShaderId uint32, fShaderId uint32) uint32 {
|
||||
cvShaderId := C.uint(vShaderId)
|
||||
cfShaderId := C.uint(fShaderId)
|
||||
return uint32(C.rlLoadShaderProgram(cvShaderId, cfShaderId))
|
||||
}
|
||||
|
||||
// UnloadShaderProgram - Unload shader program
|
||||
func UnloadShaderProgram(id uint32) {
|
||||
cid := C.uint(id)
|
||||
C.rlUnloadShaderProgram(cid)
|
||||
}
|
||||
|
||||
// GetLocationUniform - Get shader location uniform
|
||||
func GetLocationUniform(shaderId uint32, uniformName string) int32 {
|
||||
cshaderId := C.uint(shaderId)
|
||||
cuniformName := C.CString(uniformName)
|
||||
defer C.free(unsafe.Pointer(cuniformName))
|
||||
return int32(C.rlGetLocationUniform(cshaderId, cuniformName))
|
||||
}
|
||||
|
||||
// GetLocationAttrib - Get shader location attribute
|
||||
func GetLocationAttrib(shaderId uint32, attribName string) int32 {
|
||||
cshaderId := C.uint(shaderId)
|
||||
cattribName := C.CString(attribName)
|
||||
defer C.free(unsafe.Pointer(cattribName))
|
||||
return int32(C.rlGetLocationAttrib(cshaderId, cattribName))
|
||||
}
|
||||
|
||||
// SetUniformSampler - Set shader value sampler
|
||||
func SetUniformSampler(locIndex int32, textureId uint32) {
|
||||
clocIndex := C.int(locIndex)
|
||||
ctextureId := C.uint(textureId)
|
||||
C.rlSetUniformSampler(clocIndex, ctextureId)
|
||||
}
|
||||
|
||||
// ComputeShaderDispatch - Dispatch compute shader (equivalent to *draw* for graphics pilepine)
|
||||
func ComputeShaderDispatch(groupX uint32, groupY uint32, groupZ uint32) {
|
||||
cgroupX := C.uint(groupX)
|
||||
cgroupY := C.uint(groupY)
|
||||
cgroupZ := C.uint(groupZ)
|
||||
C.rlComputeShaderDispatch(cgroupX, cgroupY, cgroupZ)
|
||||
}
|
||||
|
||||
// GetShaderBufferSize - Get SSBO buffer size
|
||||
func GetShaderBufferSize(id uint32) uint32 {
|
||||
cid := C.uint(id)
|
||||
return uint32(C.rlGetShaderBufferSize(cid))
|
||||
}
|
||||
|
||||
// BindImageTexture - Bind image texture
|
||||
func BindImageTexture(id uint32, index uint32, format int32, readonly bool) {
|
||||
cid := C.uint(id)
|
||||
cindex := C.uint(index)
|
||||
cformat := C.int(format)
|
||||
creadonly := C.bool(readonly)
|
||||
C.rlBindImageTexture(cid, cindex, cformat, creadonly)
|
||||
}
|
||||
|
||||
// GetMatrixModelview - Get internal modelview matrix
|
||||
func GetMatrixModelview() Matrix {
|
||||
cResult := C.rlGetMatrixModelview()
|
||||
var goRes Matrix
|
||||
goRes.M4 = float32(cResult.m4)
|
||||
goRes.M2 = float32(cResult.m2)
|
||||
goRes.M14 = float32(cResult.m14)
|
||||
goRes.M3 = float32(cResult.m3)
|
||||
goRes.M7 = float32(cResult.m7)
|
||||
goRes.M12 = float32(cResult.m12)
|
||||
goRes.M6 = float32(cResult.m6)
|
||||
goRes.M15 = float32(cResult.m15)
|
||||
goRes.M5 = float32(cResult.m5)
|
||||
goRes.M9 = float32(cResult.m9)
|
||||
goRes.M13 = float32(cResult.m13)
|
||||
goRes.M10 = float32(cResult.m10)
|
||||
goRes.M11 = float32(cResult.m11)
|
||||
goRes.M0 = float32(cResult.m0)
|
||||
goRes.M8 = float32(cResult.m8)
|
||||
goRes.M1 = float32(cResult.m1)
|
||||
return goRes
|
||||
}
|
||||
|
||||
// GetMatrixProjection - Get internal projection matrix
|
||||
func GetMatrixProjection() Matrix {
|
||||
cResult := C.rlGetMatrixProjection()
|
||||
var goRes Matrix
|
||||
goRes.M13 = float32(cResult.m13)
|
||||
goRes.M10 = float32(cResult.m10)
|
||||
goRes.M11 = float32(cResult.m11)
|
||||
goRes.M15 = float32(cResult.m15)
|
||||
goRes.M5 = float32(cResult.m5)
|
||||
goRes.M9 = float32(cResult.m9)
|
||||
goRes.M1 = float32(cResult.m1)
|
||||
goRes.M0 = float32(cResult.m0)
|
||||
goRes.M8 = float32(cResult.m8)
|
||||
goRes.M14 = float32(cResult.m14)
|
||||
goRes.M3 = float32(cResult.m3)
|
||||
goRes.M7 = float32(cResult.m7)
|
||||
goRes.M4 = float32(cResult.m4)
|
||||
goRes.M2 = float32(cResult.m2)
|
||||
goRes.M12 = float32(cResult.m12)
|
||||
goRes.M6 = float32(cResult.m6)
|
||||
return goRes
|
||||
}
|
||||
|
||||
// GetMatrixTransform - Get internal accumulated transform matrix
|
||||
func GetMatrixTransform() Matrix {
|
||||
cResult := C.rlGetMatrixTransform()
|
||||
var goRes Matrix
|
||||
goRes.M0 = float32(cResult.m0)
|
||||
goRes.M8 = float32(cResult.m8)
|
||||
goRes.M1 = float32(cResult.m1)
|
||||
goRes.M7 = float32(cResult.m7)
|
||||
goRes.M4 = float32(cResult.m4)
|
||||
goRes.M2 = float32(cResult.m2)
|
||||
goRes.M14 = float32(cResult.m14)
|
||||
goRes.M3 = float32(cResult.m3)
|
||||
goRes.M12 = float32(cResult.m12)
|
||||
goRes.M6 = float32(cResult.m6)
|
||||
goRes.M11 = float32(cResult.m11)
|
||||
goRes.M15 = float32(cResult.m15)
|
||||
goRes.M5 = float32(cResult.m5)
|
||||
goRes.M9 = float32(cResult.m9)
|
||||
goRes.M13 = float32(cResult.m13)
|
||||
goRes.M10 = float32(cResult.m10)
|
||||
return goRes
|
||||
}
|
||||
|
||||
// GetMatrixProjectionStereo - Get internal projection matrix for stereo render (selected eye)
|
||||
func GetMatrixProjectionStereo(eye int32) Matrix {
|
||||
ceye := C.int(eye)
|
||||
cResult := C.rlGetMatrixProjectionStereo(ceye)
|
||||
var goRes Matrix
|
||||
goRes.M12 = float32(cResult.m12)
|
||||
goRes.M6 = float32(cResult.m6)
|
||||
goRes.M15 = float32(cResult.m15)
|
||||
goRes.M5 = float32(cResult.m5)
|
||||
goRes.M9 = float32(cResult.m9)
|
||||
goRes.M13 = float32(cResult.m13)
|
||||
goRes.M10 = float32(cResult.m10)
|
||||
goRes.M11 = float32(cResult.m11)
|
||||
goRes.M0 = float32(cResult.m0)
|
||||
goRes.M8 = float32(cResult.m8)
|
||||
goRes.M1 = float32(cResult.m1)
|
||||
goRes.M4 = float32(cResult.m4)
|
||||
goRes.M2 = float32(cResult.m2)
|
||||
goRes.M14 = float32(cResult.m14)
|
||||
goRes.M3 = float32(cResult.m3)
|
||||
goRes.M7 = float32(cResult.m7)
|
||||
return goRes
|
||||
}
|
||||
|
||||
// GetMatrixViewOffsetStereo - Get internal view offset matrix for stereo render (selected eye)
|
||||
func GetMatrixViewOffsetStereo(eye int32) Matrix {
|
||||
ceye := C.int(eye)
|
||||
cResult := C.rlGetMatrixViewOffsetStereo(ceye)
|
||||
var goRes Matrix
|
||||
goRes.M0 = float32(cResult.m0)
|
||||
goRes.M8 = float32(cResult.m8)
|
||||
goRes.M1 = float32(cResult.m1)
|
||||
goRes.M4 = float32(cResult.m4)
|
||||
goRes.M2 = float32(cResult.m2)
|
||||
goRes.M14 = float32(cResult.m14)
|
||||
goRes.M3 = float32(cResult.m3)
|
||||
goRes.M7 = float32(cResult.m7)
|
||||
goRes.M12 = float32(cResult.m12)
|
||||
goRes.M6 = float32(cResult.m6)
|
||||
goRes.M5 = float32(cResult.m5)
|
||||
goRes.M9 = float32(cResult.m9)
|
||||
goRes.M13 = float32(cResult.m13)
|
||||
goRes.M10 = float32(cResult.m10)
|
||||
goRes.M11 = float32(cResult.m11)
|
||||
goRes.M15 = float32(cResult.m15)
|
||||
return goRes
|
||||
}
|
||||
|
||||
// SetMatrixProjectionStereo - Set eyes projection matrices for stereo rendering
|
||||
func SetMatrixProjectionStereo(right Matrix, left Matrix) {
|
||||
var cright C.struct_Matrix
|
||||
cright.m12 = C.float(right.M12)
|
||||
cright.m6 = C.float(right.M6)
|
||||
cright.m5 = C.float(right.M5)
|
||||
cright.m9 = C.float(right.M9)
|
||||
cright.m13 = C.float(right.M13)
|
||||
cright.m10 = C.float(right.M10)
|
||||
cright.m11 = C.float(right.M11)
|
||||
cright.m15 = C.float(right.M15)
|
||||
cright.m0 = C.float(right.M0)
|
||||
cright.m8 = C.float(right.M8)
|
||||
cright.m1 = C.float(right.M1)
|
||||
cright.m4 = C.float(right.M4)
|
||||
cright.m2 = C.float(right.M2)
|
||||
cright.m14 = C.float(right.M14)
|
||||
cright.m3 = C.float(right.M3)
|
||||
cright.m7 = C.float(right.M7)
|
||||
var cleft C.struct_Matrix
|
||||
cleft.m10 = C.float(left.M10)
|
||||
cleft.m11 = C.float(left.M11)
|
||||
cleft.m15 = C.float(left.M15)
|
||||
cleft.m5 = C.float(left.M5)
|
||||
cleft.m9 = C.float(left.M9)
|
||||
cleft.m13 = C.float(left.M13)
|
||||
cleft.m0 = C.float(left.M0)
|
||||
cleft.m8 = C.float(left.M8)
|
||||
cleft.m1 = C.float(left.M1)
|
||||
cleft.m3 = C.float(left.M3)
|
||||
cleft.m7 = C.float(left.M7)
|
||||
cleft.m4 = C.float(left.M4)
|
||||
cleft.m2 = C.float(left.M2)
|
||||
cleft.m14 = C.float(left.M14)
|
||||
cleft.m12 = C.float(left.M12)
|
||||
cleft.m6 = C.float(left.M6)
|
||||
C.rlSetMatrixProjectionStereo(cright, cleft)
|
||||
}
|
||||
|
||||
// SetMatrixViewOffsetStereo - Set eyes view offsets matrices for stereo rendering
|
||||
func SetMatrixViewOffsetStereo(right Matrix, left Matrix) {
|
||||
var cright C.struct_Matrix
|
||||
cright.m12 = C.float(right.M12)
|
||||
cright.m6 = C.float(right.M6)
|
||||
cright.m5 = C.float(right.M5)
|
||||
cright.m9 = C.float(right.M9)
|
||||
cright.m13 = C.float(right.M13)
|
||||
cright.m10 = C.float(right.M10)
|
||||
cright.m11 = C.float(right.M11)
|
||||
cright.m15 = C.float(right.M15)
|
||||
cright.m0 = C.float(right.M0)
|
||||
cright.m8 = C.float(right.M8)
|
||||
cright.m1 = C.float(right.M1)
|
||||
cright.m4 = C.float(right.M4)
|
||||
cright.m2 = C.float(right.M2)
|
||||
cright.m14 = C.float(right.M14)
|
||||
cright.m3 = C.float(right.M3)
|
||||
cright.m7 = C.float(right.M7)
|
||||
var cleft C.struct_Matrix
|
||||
cleft.m12 = C.float(left.M12)
|
||||
cleft.m6 = C.float(left.M6)
|
||||
cleft.m5 = C.float(left.M5)
|
||||
cleft.m9 = C.float(left.M9)
|
||||
cleft.m13 = C.float(left.M13)
|
||||
cleft.m10 = C.float(left.M10)
|
||||
cleft.m11 = C.float(left.M11)
|
||||
cleft.m15 = C.float(left.M15)
|
||||
cleft.m0 = C.float(left.M0)
|
||||
cleft.m8 = C.float(left.M8)
|
||||
cleft.m1 = C.float(left.M1)
|
||||
cleft.m4 = C.float(left.M4)
|
||||
cleft.m2 = C.float(left.M2)
|
||||
cleft.m14 = C.float(left.M14)
|
||||
cleft.m3 = C.float(left.M3)
|
||||
cleft.m7 = C.float(left.M7)
|
||||
C.rlSetMatrixViewOffsetStereo(cright, cleft)
|
||||
}
|
||||
|
||||
// LoadDrawCube - Load and draw a cube
|
||||
func LoadDrawCube() {
|
||||
C.rlLoadDrawCube()
|
||||
}
|
||||
|
||||
// LoadDrawQuad - Load and draw a quad
|
||||
func LoadDrawQuad() {
|
||||
C.rlLoadDrawQuad()
|
||||
}
|
||||
|
|
875
raylib/rlgl_cgo.go
Normal file
875
raylib/rlgl_cgo.go
Normal file
|
@ -0,0 +1,875 @@
|
|||
package rl
|
||||
|
||||
/*
|
||||
#include "raylib.h"
|
||||
#include "rlgl.h"
|
||||
#include <stdlib.h>
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// SetMatrixProjection - Set a custom projection matrix (replaces internal projection matrix)
|
||||
func SetMatrixProjection(proj Matrix) {
|
||||
cproj := proj.cptr()
|
||||
C.rlSetMatrixProjection(*cproj)
|
||||
}
|
||||
|
||||
// SetMatrixModelview - Set a custom modelview matrix (replaces internal modelview matrix)
|
||||
func SetMatrixModelview(view Matrix) {
|
||||
cview := view.cptr()
|
||||
C.rlSetMatrixModelview(*cview)
|
||||
}
|
||||
|
||||
// BeginShaderMode - Begin custom shader drawing
|
||||
func BeginShaderMode(shader Shader) {
|
||||
cshader := shader.cptr()
|
||||
C.BeginShaderMode(*cshader)
|
||||
}
|
||||
|
||||
// EndShaderMode - End custom shader drawing (use default shader)
|
||||
func EndShaderMode() {
|
||||
C.EndShaderMode()
|
||||
}
|
||||
|
||||
// BeginBlendMode - Begin blending mode (alpha, additive, multiplied)
|
||||
func BeginBlendMode(mode BlendMode) {
|
||||
cmode := (C.int)(mode)
|
||||
C.BeginBlendMode(cmode)
|
||||
}
|
||||
|
||||
// EndBlendMode - End blending mode (reset to default: alpha blending)
|
||||
func EndBlendMode() {
|
||||
C.EndBlendMode()
|
||||
}
|
||||
|
||||
// MatrixMode - Choose the current matrix to be transformed
|
||||
func MatrixMode(mode int32) {
|
||||
cmode := C.int(mode)
|
||||
C.rlMatrixMode(cmode)
|
||||
}
|
||||
|
||||
// PushMatrix - Push the current matrix to stack
|
||||
func PushMatrix() {
|
||||
C.rlPushMatrix()
|
||||
}
|
||||
|
||||
// PopMatrix - Pop lattest inserted matrix from stack
|
||||
func PopMatrix() {
|
||||
C.rlPopMatrix()
|
||||
}
|
||||
|
||||
// LoadIdentity - Reset current matrix to identity matrix
|
||||
func LoadIdentity() {
|
||||
C.rlLoadIdentity()
|
||||
}
|
||||
|
||||
// Translatef - Multiply the current matrix by a translation matrix
|
||||
func Translatef(x float32, y float32, z float32) {
|
||||
cx := C.float(x)
|
||||
cy := C.float(y)
|
||||
cz := C.float(z)
|
||||
C.rlTranslatef(cx, cy, cz)
|
||||
}
|
||||
|
||||
// Rotatef - Multiply the current matrix by a rotation matrix
|
||||
func Rotatef(angle float32, x float32, y float32, z float32) {
|
||||
cangle := C.float(angle)
|
||||
cx := C.float(x)
|
||||
cy := C.float(y)
|
||||
cz := C.float(z)
|
||||
C.rlRotatef(cangle, cx, cy, cz)
|
||||
}
|
||||
|
||||
// Scalef - Multiply the current matrix by a scaling matrix
|
||||
func Scalef(x float32, y float32, z float32) {
|
||||
cx := C.float(x)
|
||||
cy := C.float(y)
|
||||
cz := C.float(z)
|
||||
C.rlScalef(cx, cy, cz)
|
||||
}
|
||||
|
||||
// Frustum .
|
||||
func Frustum(left float64, right float64, bottom float64, top float64, znear float64, zfar float64) {
|
||||
cleft := C.double(left)
|
||||
cright := C.double(right)
|
||||
cbottom := C.double(bottom)
|
||||
ctop := C.double(top)
|
||||
cznear := C.double(znear)
|
||||
czfar := C.double(zfar)
|
||||
C.rlFrustum(cleft, cright, cbottom, ctop, cznear, czfar)
|
||||
}
|
||||
|
||||
// Ortho .
|
||||
func Ortho(left float64, right float64, bottom float64, top float64, znear float64, zfar float64) {
|
||||
cleft := C.double(left)
|
||||
cright := C.double(right)
|
||||
cbottom := C.double(bottom)
|
||||
ctop := C.double(top)
|
||||
cznear := C.double(znear)
|
||||
czfar := C.double(zfar)
|
||||
C.rlOrtho(cleft, cright, cbottom, ctop, cznear, czfar)
|
||||
}
|
||||
|
||||
// Viewport - Set the viewport area
|
||||
func Viewport(x int32, y int32, width int32, height int32) {
|
||||
cx := C.int(x)
|
||||
cy := C.int(y)
|
||||
cwidth := C.int(width)
|
||||
cheight := C.int(height)
|
||||
C.rlViewport(cx, cy, cwidth, cheight)
|
||||
}
|
||||
|
||||
// Begin - Initialize drawing mode (how to organize vertex)
|
||||
func Begin(mode int32) {
|
||||
cmode := C.int(mode)
|
||||
C.rlBegin(cmode)
|
||||
}
|
||||
|
||||
// End - Finish vertex providing
|
||||
func End() {
|
||||
C.rlEnd()
|
||||
}
|
||||
|
||||
// Vertex2i - Define one vertex (position) - 2 int
|
||||
func Vertex2i(x int32, y int32) {
|
||||
cx := C.int(x)
|
||||
cy := C.int(y)
|
||||
C.rlVertex2i(cx, cy)
|
||||
}
|
||||
|
||||
// Vertex2f - Define one vertex (position) - 2 float
|
||||
func Vertex2f(x float32, y float32) {
|
||||
cx := C.float(x)
|
||||
cy := C.float(y)
|
||||
C.rlVertex2f(cx, cy)
|
||||
}
|
||||
|
||||
// Vertex3f - Define one vertex (position) - 3 float
|
||||
func Vertex3f(x float32, y float32, z float32) {
|
||||
cx := C.float(x)
|
||||
cy := C.float(y)
|
||||
cz := C.float(z)
|
||||
C.rlVertex3f(cx, cy, cz)
|
||||
}
|
||||
|
||||
// TexCoord2f - Define one vertex (texture coordinate) - 2 float
|
||||
func TexCoord2f(x float32, y float32) {
|
||||
cx := C.float(x)
|
||||
cy := C.float(y)
|
||||
C.rlTexCoord2f(cx, cy)
|
||||
}
|
||||
|
||||
// Normal3f - Define one vertex (normal) - 3 float
|
||||
func Normal3f(x float32, y float32, z float32) {
|
||||
cx := C.float(x)
|
||||
cy := C.float(y)
|
||||
cz := C.float(z)
|
||||
C.rlNormal3f(cx, cy, cz)
|
||||
}
|
||||
|
||||
// Color4ub - Define one vertex (color) - 4 byte
|
||||
func Color4ub(r uint8, g uint8, b uint8, a uint8) {
|
||||
cr := C.uchar(r)
|
||||
cg := C.uchar(g)
|
||||
cb := C.uchar(b)
|
||||
ca := C.uchar(a)
|
||||
C.rlColor4ub(cr, cg, cb, ca)
|
||||
}
|
||||
|
||||
// Color3f - Define one vertex (color) - 3 float
|
||||
func Color3f(x float32, y float32, z float32) {
|
||||
cx := C.float(x)
|
||||
cy := C.float(y)
|
||||
cz := C.float(z)
|
||||
C.rlColor3f(cx, cy, cz)
|
||||
}
|
||||
|
||||
// Color4f - Define one vertex (color) - 4 float
|
||||
func Color4f(x float32, y float32, z float32, w float32) {
|
||||
cx := C.float(x)
|
||||
cy := C.float(y)
|
||||
cz := C.float(z)
|
||||
cw := C.float(w)
|
||||
C.rlColor4f(cx, cy, cz, cw)
|
||||
}
|
||||
|
||||
// EnableVertexArray - Enable vertex array (VAO, if supported)
|
||||
func EnableVertexArray(vaoId uint32) bool {
|
||||
cvaoId := C.uint(vaoId)
|
||||
return bool(C.rlEnableVertexArray(cvaoId))
|
||||
}
|
||||
|
||||
// DisableVertexArray - Disable vertex array (VAO, if supported)
|
||||
func DisableVertexArray() {
|
||||
C.rlDisableVertexArray()
|
||||
}
|
||||
|
||||
// EnableVertexBuffer - Enable vertex buffer (VBO)
|
||||
func EnableVertexBuffer(id uint32) {
|
||||
cid := C.uint(id)
|
||||
C.rlEnableVertexBuffer(cid)
|
||||
}
|
||||
|
||||
// DisableVertexBuffer - Disable vertex buffer (VBO)
|
||||
func DisableVertexBuffer() {
|
||||
C.rlDisableVertexBuffer()
|
||||
}
|
||||
|
||||
// EnableVertexBufferElement - Enable vertex buffer element (VBO element)
|
||||
func EnableVertexBufferElement(id uint32) {
|
||||
cid := C.uint(id)
|
||||
C.rlEnableVertexBufferElement(cid)
|
||||
}
|
||||
|
||||
// DisableVertexBufferElement - Disable vertex buffer element (VBO element)
|
||||
func DisableVertexBufferElement() {
|
||||
C.rlDisableVertexBufferElement()
|
||||
}
|
||||
|
||||
// EnableVertexAttribute - Enable vertex attribute index
|
||||
func EnableVertexAttribute(index uint32) {
|
||||
cindex := C.uint(index)
|
||||
C.rlEnableVertexAttribute(cindex)
|
||||
}
|
||||
|
||||
// DisableVertexAttribute - Disable vertex attribute index
|
||||
func DisableVertexAttribute(index uint32) {
|
||||
cindex := C.uint(index)
|
||||
C.rlDisableVertexAttribute(cindex)
|
||||
}
|
||||
|
||||
// ActiveTextureSlot - Select and active a texture slot
|
||||
func ActiveTextureSlot(slot int32) {
|
||||
cslot := C.int(slot)
|
||||
C.rlActiveTextureSlot(cslot)
|
||||
}
|
||||
|
||||
// EnableTexture - Enable texture
|
||||
func EnableTexture(id uint32) {
|
||||
cid := C.uint(id)
|
||||
C.rlEnableTexture(cid)
|
||||
}
|
||||
|
||||
// DisableTexture - Disable texture
|
||||
func DisableTexture() {
|
||||
C.rlDisableTexture()
|
||||
}
|
||||
|
||||
// EnableTextureCubemap - Enable texture cubemap
|
||||
func EnableTextureCubemap(id uint32) {
|
||||
cid := C.uint(id)
|
||||
C.rlEnableTextureCubemap(cid)
|
||||
}
|
||||
|
||||
// DisableTextureCubemap - Disable texture cubemap
|
||||
func DisableTextureCubemap() {
|
||||
C.rlDisableTextureCubemap()
|
||||
}
|
||||
|
||||
// TextureParameters - Set texture parameters (filter, wrap)
|
||||
func TextureParameters(id uint32, param int32, value int32) {
|
||||
cid := C.uint(id)
|
||||
cparam := C.int(param)
|
||||
cvalue := C.int(value)
|
||||
C.rlTextureParameters(cid, cparam, cvalue)
|
||||
}
|
||||
|
||||
// CubemapParameters - Set cubemap parameters (filter, wrap)
|
||||
func CubemapParameters(id uint32, param int32, value int32) {
|
||||
cid := C.uint(id)
|
||||
cparam := C.int(param)
|
||||
cvalue := C.int(value)
|
||||
C.rlCubemapParameters(cid, cparam, cvalue)
|
||||
}
|
||||
|
||||
// EnableShader - Enable shader program
|
||||
func EnableShader(id uint32) {
|
||||
cid := C.uint(id)
|
||||
C.rlEnableShader(cid)
|
||||
}
|
||||
|
||||
// DisableShader - Disable shader program
|
||||
func DisableShader() {
|
||||
C.rlDisableShader()
|
||||
}
|
||||
|
||||
// EnableFramebuffer - Enable render texture (fbo)
|
||||
func EnableFramebuffer(id uint32) {
|
||||
cid := C.uint(id)
|
||||
C.rlEnableFramebuffer(cid)
|
||||
}
|
||||
|
||||
// DisableFramebuffer - Disable render texture (fbo), return to default framebuffer
|
||||
func DisableFramebuffer() {
|
||||
C.rlDisableFramebuffer()
|
||||
}
|
||||
|
||||
// ActiveDrawBuffers - Activate multiple draw color buffers
|
||||
func ActiveDrawBuffers(count int32) {
|
||||
ccount := C.int(count)
|
||||
C.rlActiveDrawBuffers(ccount)
|
||||
}
|
||||
|
||||
// EnableColorBlend - Enable color blending
|
||||
func EnableColorBlend() {
|
||||
C.rlEnableColorBlend()
|
||||
}
|
||||
|
||||
// DisableColorBlend - Disable color blending
|
||||
func DisableColorBlend() {
|
||||
C.rlDisableColorBlend()
|
||||
}
|
||||
|
||||
// EnableDepthTest - Enable depth test
|
||||
func EnableDepthTest() {
|
||||
C.rlEnableDepthTest()
|
||||
}
|
||||
|
||||
// DisableDepthTest - Disable depth test
|
||||
func DisableDepthTest() {
|
||||
C.rlDisableDepthTest()
|
||||
}
|
||||
|
||||
// EnableDepthMask - Enable depth write
|
||||
func EnableDepthMask() {
|
||||
C.rlEnableDepthMask()
|
||||
}
|
||||
|
||||
// DisableDepthMask - Disable depth write
|
||||
func DisableDepthMask() {
|
||||
C.rlDisableDepthMask()
|
||||
}
|
||||
|
||||
// EnableBackfaceCulling - Enable backface culling
|
||||
func EnableBackfaceCulling() {
|
||||
C.rlEnableBackfaceCulling()
|
||||
}
|
||||
|
||||
// DisableBackfaceCulling - Disable backface culling
|
||||
func DisableBackfaceCulling() {
|
||||
C.rlDisableBackfaceCulling()
|
||||
}
|
||||
|
||||
// SetCullFace - Set face culling mode
|
||||
func SetCullFace(mode int32) {
|
||||
cmode := C.int(mode)
|
||||
C.rlSetCullFace(cmode)
|
||||
}
|
||||
|
||||
// EnableScissorTest - Enable scissor test
|
||||
func EnableScissorTest() {
|
||||
C.rlEnableScissorTest()
|
||||
}
|
||||
|
||||
// DisableScissorTest - Disable scissor test
|
||||
func DisableScissorTest() {
|
||||
C.rlDisableScissorTest()
|
||||
}
|
||||
|
||||
// Scissor - Scissor test
|
||||
func Scissor(x int32, y int32, width int32, height int32) {
|
||||
cx := C.int(x)
|
||||
cy := C.int(y)
|
||||
cwidth := C.int(width)
|
||||
cheight := C.int(height)
|
||||
C.rlScissor(cx, cy, cwidth, cheight)
|
||||
}
|
||||
|
||||
// EnableWireMode - Enable wire mode
|
||||
func EnableWireMode() {
|
||||
C.rlEnableWireMode()
|
||||
}
|
||||
|
||||
// EnablePointMode - Enable point mode
|
||||
func EnablePointMode() {
|
||||
C.rlEnablePointMode()
|
||||
}
|
||||
|
||||
// DisableWireMode - Disable wire mode
|
||||
func DisableWireMode() {
|
||||
C.rlDisableWireMode()
|
||||
}
|
||||
|
||||
// SetLineWidth - Set the line drawing width
|
||||
func SetLineWidth(width float32) {
|
||||
cwidth := C.float(width)
|
||||
C.rlSetLineWidth(cwidth)
|
||||
}
|
||||
|
||||
// GetLineWidth - Get the line drawing width
|
||||
func GetLineWidth() float32 {
|
||||
return float32(C.rlGetLineWidth())
|
||||
}
|
||||
|
||||
// EnableSmoothLines - Enable line aliasing
|
||||
func EnableSmoothLines() {
|
||||
C.rlEnableSmoothLines()
|
||||
}
|
||||
|
||||
// DisableSmoothLines - Disable line aliasing
|
||||
func DisableSmoothLines() {
|
||||
C.rlDisableSmoothLines()
|
||||
}
|
||||
|
||||
// EnableStereoRender - Enable stereo rendering
|
||||
func EnableStereoRender() {
|
||||
C.rlEnableStereoRender()
|
||||
}
|
||||
|
||||
// DisableStereoRender - Disable stereo rendering
|
||||
func DisableStereoRender() {
|
||||
C.rlDisableStereoRender()
|
||||
}
|
||||
|
||||
// IsStereoRenderEnabled - Check if stereo render is enabled
|
||||
func IsStereoRenderEnabled() bool {
|
||||
return bool(C.rlIsStereoRenderEnabled())
|
||||
}
|
||||
|
||||
// ClearColor - Clear color buffer with color
|
||||
func ClearColor(r uint8, g uint8, b uint8, a uint8) {
|
||||
cr := C.uchar(r)
|
||||
cg := C.uchar(g)
|
||||
cb := C.uchar(b)
|
||||
ca := C.uchar(a)
|
||||
C.rlClearColor(cr, cg, cb, ca)
|
||||
}
|
||||
|
||||
// ClearScreenBuffers - Clear used screen buffers (color and depth)
|
||||
func ClearScreenBuffers() {
|
||||
C.rlClearScreenBuffers()
|
||||
}
|
||||
|
||||
// CheckErrors - Check and log OpenGL error codes
|
||||
func CheckErrors() {
|
||||
C.rlCheckErrors()
|
||||
}
|
||||
|
||||
// SetBlendMode - Set blending mode
|
||||
func SetBlendMode(mode int32) {
|
||||
cmode := C.int(mode)
|
||||
C.rlSetBlendMode(cmode)
|
||||
}
|
||||
|
||||
// SetBlendFactors - Set blending mode factor and equation (using OpenGL factors)
|
||||
func SetBlendFactors(glSrcFactor int32, glDstFactor int32, glEquation int32) {
|
||||
cglSrcFactor := C.int(glSrcFactor)
|
||||
cglDstFactor := C.int(glDstFactor)
|
||||
cglEquation := C.int(glEquation)
|
||||
C.rlSetBlendFactors(cglSrcFactor, cglDstFactor, cglEquation)
|
||||
}
|
||||
|
||||
// SetBlendFactorsSeparate - Set blending mode factors and equations separately (using OpenGL factors)
|
||||
func SetBlendFactorsSeparate(glSrcRGB int32, glDstRGB int32, glSrcAlpha int32, glDstAlpha int32, glEqRGB int32, glEqAlpha int32) {
|
||||
cglSrcRGB := C.int(glSrcRGB)
|
||||
cglDstRGB := C.int(glDstRGB)
|
||||
cglSrcAlpha := C.int(glSrcAlpha)
|
||||
cglDstAlpha := C.int(glDstAlpha)
|
||||
cglEqRGB := C.int(glEqRGB)
|
||||
cglEqAlpha := C.int(glEqAlpha)
|
||||
C.rlSetBlendFactorsSeparate(cglSrcRGB, cglDstRGB, cglSrcAlpha, cglDstAlpha, cglEqRGB, cglEqAlpha)
|
||||
}
|
||||
|
||||
// glInit - Initialize rlgl (buffers, shaders, textures, states)
|
||||
func glInit(width int32, height int32) {
|
||||
cwidth := C.int(width)
|
||||
cheight := C.int(height)
|
||||
C.rlglInit(cwidth, cheight)
|
||||
}
|
||||
|
||||
// glClose - De-inititialize rlgl (buffers, shaders, textures)
|
||||
func glClose() {
|
||||
C.rlglClose()
|
||||
}
|
||||
|
||||
// GetVersion - Get current OpenGL version
|
||||
func GetVersion() int32 {
|
||||
return int32(C.rlGetVersion())
|
||||
}
|
||||
|
||||
// SetFramebufferWidth - Set current framebuffer width
|
||||
func SetFramebufferWidth(width int32) {
|
||||
cwidth := C.int(width)
|
||||
C.rlSetFramebufferWidth(cwidth)
|
||||
}
|
||||
|
||||
// GetFramebufferWidth - Get default framebuffer width
|
||||
func GetFramebufferWidth() int32 {
|
||||
return int32(C.rlGetFramebufferWidth())
|
||||
}
|
||||
|
||||
// SetFramebufferHeight - Set current framebuffer height
|
||||
func SetFramebufferHeight(height int32) {
|
||||
cheight := C.int(height)
|
||||
C.rlSetFramebufferHeight(cheight)
|
||||
}
|
||||
|
||||
// GetFramebufferHeight - Get default framebuffer height
|
||||
func GetFramebufferHeight() int32 {
|
||||
return int32(C.rlGetFramebufferHeight())
|
||||
}
|
||||
|
||||
// GetTextureIdDefault - Get default texture id
|
||||
func GetTextureIdDefault() uint32 {
|
||||
return uint32(C.rlGetTextureIdDefault())
|
||||
}
|
||||
|
||||
// GetShaderIdDefault - Get default shader id
|
||||
func GetShaderIdDefault() uint32 {
|
||||
return uint32(C.rlGetShaderIdDefault())
|
||||
}
|
||||
|
||||
// DrawRenderBatchActive - Update and draw internal render batch
|
||||
func DrawRenderBatchActive() {
|
||||
C.rlDrawRenderBatchActive()
|
||||
}
|
||||
|
||||
// CheckRenderBatchLimit - Check internal buffer overflow for a given number of vertex
|
||||
func CheckRenderBatchLimit(vCount int32) bool {
|
||||
cvCount := C.int(vCount)
|
||||
return bool(C.rlCheckRenderBatchLimit(cvCount))
|
||||
}
|
||||
|
||||
// SetTexture - Set current texture for render batch and check buffers limits
|
||||
func SetTexture(id uint32) {
|
||||
cid := C.uint(id)
|
||||
C.rlSetTexture(cid)
|
||||
}
|
||||
|
||||
// LoadVertexArray - Load vertex array (vao) if supported
|
||||
func LoadVertexArray() uint32 {
|
||||
return uint32(C.rlLoadVertexArray())
|
||||
}
|
||||
|
||||
// UnloadVertexBuffer .
|
||||
func UnloadVertexBuffer(vboId uint32) {
|
||||
cvboId := C.uint(vboId)
|
||||
C.rlUnloadVertexBuffer(cvboId)
|
||||
}
|
||||
|
||||
// SetVertexAttributeDivisor .
|
||||
func SetVertexAttributeDivisor(index uint32, divisor int32) {
|
||||
cindex := C.uint(index)
|
||||
cdivisor := C.int(divisor)
|
||||
C.rlSetVertexAttributeDivisor(cindex, cdivisor)
|
||||
}
|
||||
|
||||
// LoadTextureDepth - Load depth texture/renderbuffer (to be attached to fbo)
|
||||
func LoadTextureDepth(width, height int32, useRenderBuffer bool) {
|
||||
cwidth := C.int(width)
|
||||
cheight := C.int(height)
|
||||
cuseRenderBuffer := C.bool(useRenderBuffer)
|
||||
C.rlLoadTextureDepth(cwidth, cheight, cuseRenderBuffer)
|
||||
}
|
||||
|
||||
// LoadFramebuffer - Load an empty framebuffer
|
||||
func LoadFramebuffer(width int32, height int32) uint32 {
|
||||
cwidth := C.int(width)
|
||||
cheight := C.int(height)
|
||||
return uint32(C.rlLoadFramebuffer(cwidth, cheight))
|
||||
}
|
||||
|
||||
// FramebufferAttach - Attach texture/renderbuffer to a framebuffer
|
||||
func FramebufferAttach(fboId uint32, texId uint32, attachType int32, texType int32, mipLevel int32) {
|
||||
cfboId := C.uint(fboId)
|
||||
ctexId := C.uint(texId)
|
||||
cattachType := C.int(attachType)
|
||||
ctexType := C.int(texType)
|
||||
cmipLevel := C.int(mipLevel)
|
||||
C.rlFramebufferAttach(cfboId, ctexId, cattachType, ctexType, cmipLevel)
|
||||
}
|
||||
|
||||
// FramebufferComplete - Verify framebuffer is complete
|
||||
func FramebufferComplete(id uint32) bool {
|
||||
cid := C.uint(id)
|
||||
return bool(C.rlFramebufferComplete(cid))
|
||||
}
|
||||
|
||||
// UnloadFramebuffer - Delete framebuffer from GPU
|
||||
func UnloadFramebuffer(id uint32) {
|
||||
cid := C.uint(id)
|
||||
C.rlUnloadFramebuffer(cid)
|
||||
}
|
||||
|
||||
// LoadShaderCode - Load shader from code strings
|
||||
func LoadShaderCode(vsCode string, fsCode string) uint32 {
|
||||
cvsCode := C.CString(vsCode)
|
||||
defer C.free(unsafe.Pointer(cvsCode))
|
||||
cfsCode := C.CString(fsCode)
|
||||
defer C.free(unsafe.Pointer(cfsCode))
|
||||
return uint32(C.rlLoadShaderCode(cvsCode, cfsCode))
|
||||
}
|
||||
|
||||
// CompileShader - Compile custom shader and return shader id (type: VERTEX_SHADER, FRAGMENT_SHADER, COMPUTE_SHADER)
|
||||
func CompileShader(shaderCode string, type_ int32) uint32 {
|
||||
cshaderCode := C.CString(shaderCode)
|
||||
defer C.free(unsafe.Pointer(cshaderCode))
|
||||
ctype_ := C.int(type_)
|
||||
return uint32(C.rlCompileShader(cshaderCode, ctype_))
|
||||
}
|
||||
|
||||
// LoadShaderProgram - Load custom shader program
|
||||
func LoadShaderProgram(vShaderId uint32, fShaderId uint32) uint32 {
|
||||
cvShaderId := C.uint(vShaderId)
|
||||
cfShaderId := C.uint(fShaderId)
|
||||
return uint32(C.rlLoadShaderProgram(cvShaderId, cfShaderId))
|
||||
}
|
||||
|
||||
// UnloadShaderProgram - Unload shader program
|
||||
func UnloadShaderProgram(id uint32) {
|
||||
cid := C.uint(id)
|
||||
C.rlUnloadShaderProgram(cid)
|
||||
}
|
||||
|
||||
// GetLocationUniform - Get shader location uniform
|
||||
func GetLocationUniform(shaderId uint32, uniformName string) int32 {
|
||||
cshaderId := C.uint(shaderId)
|
||||
cuniformName := C.CString(uniformName)
|
||||
defer C.free(unsafe.Pointer(cuniformName))
|
||||
return int32(C.rlGetLocationUniform(cshaderId, cuniformName))
|
||||
}
|
||||
|
||||
// GetLocationAttrib - Get shader location attribute
|
||||
func GetLocationAttrib(shaderId uint32, attribName string) int32 {
|
||||
cshaderId := C.uint(shaderId)
|
||||
cattribName := C.CString(attribName)
|
||||
defer C.free(unsafe.Pointer(cattribName))
|
||||
return int32(C.rlGetLocationAttrib(cshaderId, cattribName))
|
||||
}
|
||||
|
||||
// SetUniformSampler - Set shader value sampler
|
||||
func SetUniformSampler(locIndex int32, textureId uint32) {
|
||||
clocIndex := C.int(locIndex)
|
||||
ctextureId := C.uint(textureId)
|
||||
C.rlSetUniformSampler(clocIndex, ctextureId)
|
||||
}
|
||||
|
||||
// ComputeShaderDispatch - Dispatch compute shader (equivalent to *draw* for graphics pilepine)
|
||||
func ComputeShaderDispatch(groupX uint32, groupY uint32, groupZ uint32) {
|
||||
cgroupX := C.uint(groupX)
|
||||
cgroupY := C.uint(groupY)
|
||||
cgroupZ := C.uint(groupZ)
|
||||
C.rlComputeShaderDispatch(cgroupX, cgroupY, cgroupZ)
|
||||
}
|
||||
|
||||
// GetShaderBufferSize - Get SSBO buffer size
|
||||
func GetShaderBufferSize(id uint32) uint32 {
|
||||
cid := C.uint(id)
|
||||
return uint32(C.rlGetShaderBufferSize(cid))
|
||||
}
|
||||
|
||||
// BindImageTexture - Bind image texture
|
||||
func BindImageTexture(id uint32, index uint32, format int32, readonly bool) {
|
||||
cid := C.uint(id)
|
||||
cindex := C.uint(index)
|
||||
cformat := C.int(format)
|
||||
creadonly := C.bool(readonly)
|
||||
C.rlBindImageTexture(cid, cindex, cformat, creadonly)
|
||||
}
|
||||
|
||||
// GetMatrixModelview - Get internal modelview matrix
|
||||
func GetMatrixModelview() Matrix {
|
||||
cResult := C.rlGetMatrixModelview()
|
||||
var goRes Matrix
|
||||
goRes.M4 = float32(cResult.m4)
|
||||
goRes.M2 = float32(cResult.m2)
|
||||
goRes.M14 = float32(cResult.m14)
|
||||
goRes.M3 = float32(cResult.m3)
|
||||
goRes.M7 = float32(cResult.m7)
|
||||
goRes.M12 = float32(cResult.m12)
|
||||
goRes.M6 = float32(cResult.m6)
|
||||
goRes.M15 = float32(cResult.m15)
|
||||
goRes.M5 = float32(cResult.m5)
|
||||
goRes.M9 = float32(cResult.m9)
|
||||
goRes.M13 = float32(cResult.m13)
|
||||
goRes.M10 = float32(cResult.m10)
|
||||
goRes.M11 = float32(cResult.m11)
|
||||
goRes.M0 = float32(cResult.m0)
|
||||
goRes.M8 = float32(cResult.m8)
|
||||
goRes.M1 = float32(cResult.m1)
|
||||
return goRes
|
||||
}
|
||||
|
||||
// GetMatrixProjection - Get internal projection matrix
|
||||
func GetMatrixProjection() Matrix {
|
||||
cResult := C.rlGetMatrixProjection()
|
||||
var goRes Matrix
|
||||
goRes.M13 = float32(cResult.m13)
|
||||
goRes.M10 = float32(cResult.m10)
|
||||
goRes.M11 = float32(cResult.m11)
|
||||
goRes.M15 = float32(cResult.m15)
|
||||
goRes.M5 = float32(cResult.m5)
|
||||
goRes.M9 = float32(cResult.m9)
|
||||
goRes.M1 = float32(cResult.m1)
|
||||
goRes.M0 = float32(cResult.m0)
|
||||
goRes.M8 = float32(cResult.m8)
|
||||
goRes.M14 = float32(cResult.m14)
|
||||
goRes.M3 = float32(cResult.m3)
|
||||
goRes.M7 = float32(cResult.m7)
|
||||
goRes.M4 = float32(cResult.m4)
|
||||
goRes.M2 = float32(cResult.m2)
|
||||
goRes.M12 = float32(cResult.m12)
|
||||
goRes.M6 = float32(cResult.m6)
|
||||
return goRes
|
||||
}
|
||||
|
||||
// GetMatrixTransform - Get internal accumulated transform matrix
|
||||
func GetMatrixTransform() Matrix {
|
||||
cResult := C.rlGetMatrixTransform()
|
||||
var goRes Matrix
|
||||
goRes.M0 = float32(cResult.m0)
|
||||
goRes.M8 = float32(cResult.m8)
|
||||
goRes.M1 = float32(cResult.m1)
|
||||
goRes.M7 = float32(cResult.m7)
|
||||
goRes.M4 = float32(cResult.m4)
|
||||
goRes.M2 = float32(cResult.m2)
|
||||
goRes.M14 = float32(cResult.m14)
|
||||
goRes.M3 = float32(cResult.m3)
|
||||
goRes.M12 = float32(cResult.m12)
|
||||
goRes.M6 = float32(cResult.m6)
|
||||
goRes.M11 = float32(cResult.m11)
|
||||
goRes.M15 = float32(cResult.m15)
|
||||
goRes.M5 = float32(cResult.m5)
|
||||
goRes.M9 = float32(cResult.m9)
|
||||
goRes.M13 = float32(cResult.m13)
|
||||
goRes.M10 = float32(cResult.m10)
|
||||
return goRes
|
||||
}
|
||||
|
||||
// GetMatrixProjectionStereo - Get internal projection matrix for stereo render (selected eye)
|
||||
func GetMatrixProjectionStereo(eye int32) Matrix {
|
||||
ceye := C.int(eye)
|
||||
cResult := C.rlGetMatrixProjectionStereo(ceye)
|
||||
var goRes Matrix
|
||||
goRes.M12 = float32(cResult.m12)
|
||||
goRes.M6 = float32(cResult.m6)
|
||||
goRes.M15 = float32(cResult.m15)
|
||||
goRes.M5 = float32(cResult.m5)
|
||||
goRes.M9 = float32(cResult.m9)
|
||||
goRes.M13 = float32(cResult.m13)
|
||||
goRes.M10 = float32(cResult.m10)
|
||||
goRes.M11 = float32(cResult.m11)
|
||||
goRes.M0 = float32(cResult.m0)
|
||||
goRes.M8 = float32(cResult.m8)
|
||||
goRes.M1 = float32(cResult.m1)
|
||||
goRes.M4 = float32(cResult.m4)
|
||||
goRes.M2 = float32(cResult.m2)
|
||||
goRes.M14 = float32(cResult.m14)
|
||||
goRes.M3 = float32(cResult.m3)
|
||||
goRes.M7 = float32(cResult.m7)
|
||||
return goRes
|
||||
}
|
||||
|
||||
// GetMatrixViewOffsetStereo - Get internal view offset matrix for stereo render (selected eye)
|
||||
func GetMatrixViewOffsetStereo(eye int32) Matrix {
|
||||
ceye := C.int(eye)
|
||||
cResult := C.rlGetMatrixViewOffsetStereo(ceye)
|
||||
var goRes Matrix
|
||||
goRes.M0 = float32(cResult.m0)
|
||||
goRes.M8 = float32(cResult.m8)
|
||||
goRes.M1 = float32(cResult.m1)
|
||||
goRes.M4 = float32(cResult.m4)
|
||||
goRes.M2 = float32(cResult.m2)
|
||||
goRes.M14 = float32(cResult.m14)
|
||||
goRes.M3 = float32(cResult.m3)
|
||||
goRes.M7 = float32(cResult.m7)
|
||||
goRes.M12 = float32(cResult.m12)
|
||||
goRes.M6 = float32(cResult.m6)
|
||||
goRes.M5 = float32(cResult.m5)
|
||||
goRes.M9 = float32(cResult.m9)
|
||||
goRes.M13 = float32(cResult.m13)
|
||||
goRes.M10 = float32(cResult.m10)
|
||||
goRes.M11 = float32(cResult.m11)
|
||||
goRes.M15 = float32(cResult.m15)
|
||||
return goRes
|
||||
}
|
||||
|
||||
// SetMatrixProjectionStereo - Set eyes projection matrices for stereo rendering
|
||||
func SetMatrixProjectionStereo(right Matrix, left Matrix) {
|
||||
var cright C.struct_Matrix
|
||||
cright.m12 = C.float(right.M12)
|
||||
cright.m6 = C.float(right.M6)
|
||||
cright.m5 = C.float(right.M5)
|
||||
cright.m9 = C.float(right.M9)
|
||||
cright.m13 = C.float(right.M13)
|
||||
cright.m10 = C.float(right.M10)
|
||||
cright.m11 = C.float(right.M11)
|
||||
cright.m15 = C.float(right.M15)
|
||||
cright.m0 = C.float(right.M0)
|
||||
cright.m8 = C.float(right.M8)
|
||||
cright.m1 = C.float(right.M1)
|
||||
cright.m4 = C.float(right.M4)
|
||||
cright.m2 = C.float(right.M2)
|
||||
cright.m14 = C.float(right.M14)
|
||||
cright.m3 = C.float(right.M3)
|
||||
cright.m7 = C.float(right.M7)
|
||||
var cleft C.struct_Matrix
|
||||
cleft.m10 = C.float(left.M10)
|
||||
cleft.m11 = C.float(left.M11)
|
||||
cleft.m15 = C.float(left.M15)
|
||||
cleft.m5 = C.float(left.M5)
|
||||
cleft.m9 = C.float(left.M9)
|
||||
cleft.m13 = C.float(left.M13)
|
||||
cleft.m0 = C.float(left.M0)
|
||||
cleft.m8 = C.float(left.M8)
|
||||
cleft.m1 = C.float(left.M1)
|
||||
cleft.m3 = C.float(left.M3)
|
||||
cleft.m7 = C.float(left.M7)
|
||||
cleft.m4 = C.float(left.M4)
|
||||
cleft.m2 = C.float(left.M2)
|
||||
cleft.m14 = C.float(left.M14)
|
||||
cleft.m12 = C.float(left.M12)
|
||||
cleft.m6 = C.float(left.M6)
|
||||
C.rlSetMatrixProjectionStereo(cright, cleft)
|
||||
}
|
||||
|
||||
// SetMatrixViewOffsetStereo - Set eyes view offsets matrices for stereo rendering
|
||||
func SetMatrixViewOffsetStereo(right Matrix, left Matrix) {
|
||||
var cright C.struct_Matrix
|
||||
cright.m12 = C.float(right.M12)
|
||||
cright.m6 = C.float(right.M6)
|
||||
cright.m5 = C.float(right.M5)
|
||||
cright.m9 = C.float(right.M9)
|
||||
cright.m13 = C.float(right.M13)
|
||||
cright.m10 = C.float(right.M10)
|
||||
cright.m11 = C.float(right.M11)
|
||||
cright.m15 = C.float(right.M15)
|
||||
cright.m0 = C.float(right.M0)
|
||||
cright.m8 = C.float(right.M8)
|
||||
cright.m1 = C.float(right.M1)
|
||||
cright.m4 = C.float(right.M4)
|
||||
cright.m2 = C.float(right.M2)
|
||||
cright.m14 = C.float(right.M14)
|
||||
cright.m3 = C.float(right.M3)
|
||||
cright.m7 = C.float(right.M7)
|
||||
var cleft C.struct_Matrix
|
||||
cleft.m12 = C.float(left.M12)
|
||||
cleft.m6 = C.float(left.M6)
|
||||
cleft.m5 = C.float(left.M5)
|
||||
cleft.m9 = C.float(left.M9)
|
||||
cleft.m13 = C.float(left.M13)
|
||||
cleft.m10 = C.float(left.M10)
|
||||
cleft.m11 = C.float(left.M11)
|
||||
cleft.m15 = C.float(left.M15)
|
||||
cleft.m0 = C.float(left.M0)
|
||||
cleft.m8 = C.float(left.M8)
|
||||
cleft.m1 = C.float(left.M1)
|
||||
cleft.m4 = C.float(left.M4)
|
||||
cleft.m2 = C.float(left.M2)
|
||||
cleft.m14 = C.float(left.M14)
|
||||
cleft.m3 = C.float(left.M3)
|
||||
cleft.m7 = C.float(left.M7)
|
||||
C.rlSetMatrixViewOffsetStereo(cright, cleft)
|
||||
}
|
||||
|
||||
// LoadDrawCube - Load and draw a cube
|
||||
func LoadDrawCube() {
|
||||
C.rlLoadDrawCube()
|
||||
}
|
||||
|
||||
// LoadDrawQuad - Load and draw a quad
|
||||
func LoadDrawQuad() {
|
||||
C.rlLoadDrawQuad()
|
||||
}
|
787
raylib/rlgl_purego.go
Normal file
787
raylib/rlgl_purego.go
Normal file
|
@ -0,0 +1,787 @@
|
|||
//go:build !cgo && windows
|
||||
// +build !cgo,windows
|
||||
|
||||
package rl
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/ebitengine/purego"
|
||||
)
|
||||
|
||||
var rlMatrixMode func(mode int32)
|
||||
var rlPushMatrix func()
|
||||
var rlPopMatrix func()
|
||||
var rlLoadIdentity func()
|
||||
var rlTranslatef func(x float32, y float32, z float32)
|
||||
var rlRotatef func(angle float32, x float32, y float32, z float32)
|
||||
var rlScalef func(x float32, y float32, z float32)
|
||||
var rlFrustum func(left float64, right float64, bottom float64, top float64, znear float64, zfar float64)
|
||||
var rlOrtho func(left float64, right float64, bottom float64, top float64, znear float64, zfar float64)
|
||||
var rlViewport func(x int32, y int32, width int32, height int32)
|
||||
var rlBegin func(mode int32)
|
||||
var rlEnd func()
|
||||
var rlVertex2i func(x int32, y int32)
|
||||
var rlVertex2f func(x float32, y float32)
|
||||
var rlVertex3f func(x float32, y float32, z float32)
|
||||
var rlTexCoord2f func(x float32, y float32)
|
||||
var rlNormal3f func(x float32, y float32, z float32)
|
||||
var rlColor4ub func(r byte, g byte, b byte, a byte)
|
||||
var rlColor3f func(x float32, y float32, z float32)
|
||||
var rlColor4f func(x float32, y float32, z float32, w float32)
|
||||
var rlEnableVertexArray func(vaoId uint32) bool
|
||||
var rlDisableVertexArray func()
|
||||
var rlEnableVertexBuffer func(id uint32)
|
||||
var rlDisableVertexBuffer func()
|
||||
var rlEnableVertexBufferElement func(id uint32)
|
||||
var rlDisableVertexBufferElement func()
|
||||
var rlEnableVertexAttribute func(index uint32)
|
||||
var rlDisableVertexAttribute func(index uint32)
|
||||
var rlActiveTextureSlot func(slot int32)
|
||||
var rlEnableTexture func(id uint32)
|
||||
var rlDisableTexture func()
|
||||
var rlEnableTextureCubemap func(id uint32)
|
||||
var rlDisableTextureCubemap func()
|
||||
var rlTextureParameters func(id uint32, param int32, value int32)
|
||||
var rlCubemapParameters func(id uint32, param int32, value int32)
|
||||
var rlEnableShader func(id uint32)
|
||||
var rlDisableShader func()
|
||||
var rlEnableFramebuffer func(id uint32)
|
||||
var rlDisableFramebuffer func()
|
||||
var rlActiveDrawBuffers func(count int32)
|
||||
var rlEnableColorBlend func()
|
||||
var rlDisableColorBlend func()
|
||||
var rlEnableDepthTest func()
|
||||
var rlDisableDepthTest func()
|
||||
var rlEnableDepthMask func()
|
||||
var rlDisableDepthMask func()
|
||||
var rlEnableBackfaceCulling func()
|
||||
var rlDisableBackfaceCulling func()
|
||||
var rlSetCullFace func(mode int32)
|
||||
var rlEnableScissorTest func()
|
||||
var rlDisableScissorTest func()
|
||||
var rlScissor func(x int32, y int32, width int32, height int32)
|
||||
var rlEnableWireMode func()
|
||||
var rlEnablePointMode func()
|
||||
var rlDisableWireMode func()
|
||||
var rlSetLineWidth func(width float32)
|
||||
var rlGetLineWidth func() float32
|
||||
var rlEnableSmoothLines func()
|
||||
var rlDisableSmoothLines func()
|
||||
var rlEnableStereoRender func()
|
||||
var rlDisableStereoRender func()
|
||||
var rlIsStereoRenderEnabled func() bool
|
||||
var rlClearColor func(r byte, g byte, b byte, a byte)
|
||||
var rlClearScreenBuffers func()
|
||||
var rlCheckErrors func()
|
||||
var rlSetBlendMode func(mode int32)
|
||||
var rlSetBlendFactors func(glSrcFactor int32, glDstFactor int32, glEquation int32)
|
||||
var rlSetBlendFactorsSeparate func(glSrcRGB int32, glDstRGB int32, glSrcAlpha int32, glDstAlpha int32, glEqRGB int32, glEqAlpha int32)
|
||||
var rlglInit func(width int32, height int32)
|
||||
var rlglClose func()
|
||||
var rlGetVersion func() int32
|
||||
var rlSetFramebufferWidth func(width int32)
|
||||
var rlGetFramebufferWidth func() int32
|
||||
var rlSetFramebufferHeight func(height int32)
|
||||
var rlGetFramebufferHeight func() int32
|
||||
var rlGetTextureIdDefault func() uint32
|
||||
var rlGetShaderIdDefault func() uint32
|
||||
var rlDrawRenderBatchActive func()
|
||||
var rlCheckRenderBatchLimit func(vCount int32) bool
|
||||
var rlSetTexture func(id uint32)
|
||||
var rlLoadVertexArray func() uint32
|
||||
var rlUnloadVertexBuffer func(vboId uint32)
|
||||
var rlSetVertexAttributeDivisor func(index uint32, divisor int32)
|
||||
var rlLoadTextureDepth func(width int32, height int32, useRenderBuffer bool) uint32
|
||||
var rlLoadFramebuffer func(width int32, height int32) uint32
|
||||
var rlFramebufferAttach func(fboId uint32, texId uint32, attachType int32, texType int32, mipLevel int32)
|
||||
var rlFramebufferComplete func(id uint32) bool
|
||||
var rlUnloadFramebuffer func(id uint32)
|
||||
var rlLoadShaderCode func(vsCode string, fsCode string) uint32
|
||||
var rlCompileShader func(shaderCode string, _type int32) uint32
|
||||
var rlLoadShaderProgram func(vShaderId uint32, fShaderId uint32) uint32
|
||||
var rlUnloadShaderProgram func(id uint32)
|
||||
var rlGetLocationUniform func(shaderId uint32, uniformName string) int32
|
||||
var rlGetLocationAttrib func(shaderId uint32, attribName string) int32
|
||||
var rlSetUniformSampler func(locIndex int32, textureId uint32)
|
||||
var rlComputeShaderDispatch func(groupX uint32, groupY uint32, groupZ uint32)
|
||||
var rlGetShaderBufferSize func(id uint32) uint32
|
||||
var rlBindImageTexture func(id uint32, index uint32, format int32, readonly bool)
|
||||
var rlGetMatrixModelview func(matrix uintptr)
|
||||
var rlGetMatrixProjection func(matrix uintptr)
|
||||
var rlGetMatrixTransform func(matrix uintptr)
|
||||
var rlGetMatrixProjectionStereo func(matrix uintptr, eye int32)
|
||||
var rlGetMatrixViewOffsetStereo func(matrix uintptr, eye int32)
|
||||
var rlSetMatrixProjection func(proj uintptr)
|
||||
var rlSetMatrixModelview func(view uintptr)
|
||||
var rlSetMatrixProjectionStereo func(right uintptr, left uintptr)
|
||||
var rlSetMatrixViewOffsetStereo func(right uintptr, left uintptr)
|
||||
var rlLoadDrawCube func()
|
||||
var rlLoadDrawQuad func()
|
||||
|
||||
func initRlglPurego() {
|
||||
purego.RegisterLibFunc(&rlMatrixMode, raylibDll, "rlMatrixMode")
|
||||
purego.RegisterLibFunc(&rlPushMatrix, raylibDll, "rlPushMatrix")
|
||||
purego.RegisterLibFunc(&rlPopMatrix, raylibDll, "rlPopMatrix")
|
||||
purego.RegisterLibFunc(&rlLoadIdentity, raylibDll, "rlLoadIdentity")
|
||||
purego.RegisterLibFunc(&rlTranslatef, raylibDll, "rlTranslatef")
|
||||
purego.RegisterLibFunc(&rlRotatef, raylibDll, "rlRotatef")
|
||||
purego.RegisterLibFunc(&rlScalef, raylibDll, "rlScalef")
|
||||
purego.RegisterLibFunc(&rlFrustum, raylibDll, "rlFrustum")
|
||||
purego.RegisterLibFunc(&rlOrtho, raylibDll, "rlOrtho")
|
||||
purego.RegisterLibFunc(&rlViewport, raylibDll, "rlViewport")
|
||||
purego.RegisterLibFunc(&rlBegin, raylibDll, "rlBegin")
|
||||
purego.RegisterLibFunc(&rlEnd, raylibDll, "rlEnd")
|
||||
purego.RegisterLibFunc(&rlVertex2i, raylibDll, "rlVertex2i")
|
||||
purego.RegisterLibFunc(&rlVertex2f, raylibDll, "rlVertex2f")
|
||||
purego.RegisterLibFunc(&rlVertex3f, raylibDll, "rlVertex3f")
|
||||
purego.RegisterLibFunc(&rlTexCoord2f, raylibDll, "rlTexCoord2f")
|
||||
purego.RegisterLibFunc(&rlNormal3f, raylibDll, "rlNormal3f")
|
||||
purego.RegisterLibFunc(&rlColor4ub, raylibDll, "rlColor4ub")
|
||||
purego.RegisterLibFunc(&rlColor3f, raylibDll, "rlColor3f")
|
||||
purego.RegisterLibFunc(&rlColor4f, raylibDll, "rlColor4f")
|
||||
purego.RegisterLibFunc(&rlEnableVertexArray, raylibDll, "rlEnableVertexArray")
|
||||
purego.RegisterLibFunc(&rlDisableVertexArray, raylibDll, "rlDisableVertexArray")
|
||||
purego.RegisterLibFunc(&rlEnableVertexBuffer, raylibDll, "rlEnableVertexBuffer")
|
||||
purego.RegisterLibFunc(&rlDisableVertexBuffer, raylibDll, "rlDisableVertexBuffer")
|
||||
purego.RegisterLibFunc(&rlEnableVertexBufferElement, raylibDll, "rlEnableVertexBufferElement")
|
||||
purego.RegisterLibFunc(&rlDisableVertexBufferElement, raylibDll, "rlDisableVertexBufferElement")
|
||||
purego.RegisterLibFunc(&rlEnableVertexAttribute, raylibDll, "rlEnableVertexAttribute")
|
||||
purego.RegisterLibFunc(&rlDisableVertexAttribute, raylibDll, "rlDisableVertexAttribute")
|
||||
purego.RegisterLibFunc(&rlActiveTextureSlot, raylibDll, "rlActiveTextureSlot")
|
||||
purego.RegisterLibFunc(&rlEnableTexture, raylibDll, "rlEnableTexture")
|
||||
purego.RegisterLibFunc(&rlDisableTexture, raylibDll, "rlDisableTexture")
|
||||
purego.RegisterLibFunc(&rlEnableTextureCubemap, raylibDll, "rlEnableTextureCubemap")
|
||||
purego.RegisterLibFunc(&rlDisableTextureCubemap, raylibDll, "rlDisableTextureCubemap")
|
||||
purego.RegisterLibFunc(&rlTextureParameters, raylibDll, "rlTextureParameters")
|
||||
purego.RegisterLibFunc(&rlCubemapParameters, raylibDll, "rlCubemapParameters")
|
||||
purego.RegisterLibFunc(&rlEnableShader, raylibDll, "rlEnableShader")
|
||||
purego.RegisterLibFunc(&rlDisableShader, raylibDll, "rlDisableShader")
|
||||
purego.RegisterLibFunc(&rlEnableFramebuffer, raylibDll, "rlEnableFramebuffer")
|
||||
purego.RegisterLibFunc(&rlDisableFramebuffer, raylibDll, "rlDisableFramebuffer")
|
||||
purego.RegisterLibFunc(&rlActiveDrawBuffers, raylibDll, "rlActiveDrawBuffers")
|
||||
purego.RegisterLibFunc(&rlEnableColorBlend, raylibDll, "rlEnableColorBlend")
|
||||
purego.RegisterLibFunc(&rlDisableColorBlend, raylibDll, "rlDisableColorBlend")
|
||||
purego.RegisterLibFunc(&rlEnableDepthTest, raylibDll, "rlEnableDepthTest")
|
||||
purego.RegisterLibFunc(&rlDisableDepthTest, raylibDll, "rlDisableDepthTest")
|
||||
purego.RegisterLibFunc(&rlEnableDepthMask, raylibDll, "rlEnableDepthMask")
|
||||
purego.RegisterLibFunc(&rlDisableDepthMask, raylibDll, "rlDisableDepthMask")
|
||||
purego.RegisterLibFunc(&rlEnableBackfaceCulling, raylibDll, "rlEnableBackfaceCulling")
|
||||
purego.RegisterLibFunc(&rlDisableBackfaceCulling, raylibDll, "rlDisableBackfaceCulling")
|
||||
purego.RegisterLibFunc(&rlSetCullFace, raylibDll, "rlSetCullFace")
|
||||
purego.RegisterLibFunc(&rlEnableScissorTest, raylibDll, "rlEnableScissorTest")
|
||||
purego.RegisterLibFunc(&rlDisableScissorTest, raylibDll, "rlDisableScissorTest")
|
||||
purego.RegisterLibFunc(&rlScissor, raylibDll, "rlScissor")
|
||||
purego.RegisterLibFunc(&rlEnableWireMode, raylibDll, "rlEnableWireMode")
|
||||
purego.RegisterLibFunc(&rlEnablePointMode, raylibDll, "rlEnablePointMode")
|
||||
purego.RegisterLibFunc(&rlDisableWireMode, raylibDll, "rlDisableWireMode")
|
||||
purego.RegisterLibFunc(&rlSetLineWidth, raylibDll, "rlSetLineWidth")
|
||||
purego.RegisterLibFunc(&rlGetLineWidth, raylibDll, "rlGetLineWidth")
|
||||
purego.RegisterLibFunc(&rlEnableSmoothLines, raylibDll, "rlEnableSmoothLines")
|
||||
purego.RegisterLibFunc(&rlDisableSmoothLines, raylibDll, "rlDisableSmoothLines")
|
||||
purego.RegisterLibFunc(&rlEnableStereoRender, raylibDll, "rlEnableStereoRender")
|
||||
purego.RegisterLibFunc(&rlDisableStereoRender, raylibDll, "rlDisableStereoRender")
|
||||
purego.RegisterLibFunc(&rlIsStereoRenderEnabled, raylibDll, "rlIsStereoRenderEnabled")
|
||||
purego.RegisterLibFunc(&rlClearColor, raylibDll, "rlClearColor")
|
||||
purego.RegisterLibFunc(&rlClearScreenBuffers, raylibDll, "rlClearScreenBuffers")
|
||||
purego.RegisterLibFunc(&rlCheckErrors, raylibDll, "rlCheckErrors")
|
||||
purego.RegisterLibFunc(&rlSetBlendMode, raylibDll, "rlSetBlendMode")
|
||||
purego.RegisterLibFunc(&rlSetBlendFactors, raylibDll, "rlSetBlendFactors")
|
||||
purego.RegisterLibFunc(&rlSetBlendFactorsSeparate, raylibDll, "rlSetBlendFactorsSeparate")
|
||||
purego.RegisterLibFunc(&rlglInit, raylibDll, "rlglInit")
|
||||
purego.RegisterLibFunc(&rlglClose, raylibDll, "rlglClose")
|
||||
purego.RegisterLibFunc(&rlGetVersion, raylibDll, "rlGetVersion")
|
||||
purego.RegisterLibFunc(&rlSetFramebufferWidth, raylibDll, "rlSetFramebufferWidth")
|
||||
purego.RegisterLibFunc(&rlGetFramebufferWidth, raylibDll, "rlGetFramebufferWidth")
|
||||
purego.RegisterLibFunc(&rlSetFramebufferHeight, raylibDll, "rlSetFramebufferHeight")
|
||||
purego.RegisterLibFunc(&rlGetFramebufferHeight, raylibDll, "rlGetFramebufferHeight")
|
||||
purego.RegisterLibFunc(&rlGetTextureIdDefault, raylibDll, "rlGetTextureIdDefault")
|
||||
purego.RegisterLibFunc(&rlGetShaderIdDefault, raylibDll, "rlGetShaderIdDefault")
|
||||
purego.RegisterLibFunc(&rlDrawRenderBatchActive, raylibDll, "rlDrawRenderBatchActive")
|
||||
purego.RegisterLibFunc(&rlCheckRenderBatchLimit, raylibDll, "rlCheckRenderBatchLimit")
|
||||
purego.RegisterLibFunc(&rlSetTexture, raylibDll, "rlSetTexture")
|
||||
purego.RegisterLibFunc(&rlLoadVertexArray, raylibDll, "rlLoadVertexArray")
|
||||
purego.RegisterLibFunc(&rlUnloadVertexBuffer, raylibDll, "rlUnloadVertexBuffer")
|
||||
purego.RegisterLibFunc(&rlSetVertexAttributeDivisor, raylibDll, "rlSetVertexAttributeDivisor")
|
||||
purego.RegisterLibFunc(&rlLoadTextureDepth, raylibDll, "rlLoadTextureDepth")
|
||||
purego.RegisterLibFunc(&rlLoadFramebuffer, raylibDll, "rlLoadFramebuffer")
|
||||
purego.RegisterLibFunc(&rlFramebufferAttach, raylibDll, "rlFramebufferAttach")
|
||||
purego.RegisterLibFunc(&rlFramebufferComplete, raylibDll, "rlFramebufferComplete")
|
||||
purego.RegisterLibFunc(&rlUnloadFramebuffer, raylibDll, "rlUnloadFramebuffer")
|
||||
purego.RegisterLibFunc(&rlLoadShaderCode, raylibDll, "rlLoadShaderCode")
|
||||
purego.RegisterLibFunc(&rlCompileShader, raylibDll, "rlCompileShader")
|
||||
purego.RegisterLibFunc(&rlLoadShaderProgram, raylibDll, "rlLoadShaderProgram")
|
||||
purego.RegisterLibFunc(&rlUnloadShaderProgram, raylibDll, "rlUnloadShaderProgram")
|
||||
purego.RegisterLibFunc(&rlGetLocationUniform, raylibDll, "rlGetLocationUniform")
|
||||
purego.RegisterLibFunc(&rlGetLocationAttrib, raylibDll, "rlGetLocationAttrib")
|
||||
purego.RegisterLibFunc(&rlSetUniformSampler, raylibDll, "rlSetUniformSampler")
|
||||
purego.RegisterLibFunc(&rlComputeShaderDispatch, raylibDll, "rlComputeShaderDispatch")
|
||||
purego.RegisterLibFunc(&rlGetShaderBufferSize, raylibDll, "rlGetShaderBufferSize")
|
||||
purego.RegisterLibFunc(&rlBindImageTexture, raylibDll, "rlBindImageTexture")
|
||||
purego.RegisterLibFunc(&rlGetMatrixModelview, raylibDll, "rlGetMatrixModelview")
|
||||
purego.RegisterLibFunc(&rlGetMatrixProjection, raylibDll, "rlGetMatrixProjection")
|
||||
purego.RegisterLibFunc(&rlGetMatrixTransform, raylibDll, "rlGetMatrixTransform")
|
||||
purego.RegisterLibFunc(&rlGetMatrixProjectionStereo, raylibDll, "rlGetMatrixProjectionStereo")
|
||||
purego.RegisterLibFunc(&rlGetMatrixViewOffsetStereo, raylibDll, "rlGetMatrixViewOffsetStereo")
|
||||
purego.RegisterLibFunc(&rlSetMatrixProjection, raylibDll, "rlSetMatrixProjection")
|
||||
purego.RegisterLibFunc(&rlSetMatrixModelview, raylibDll, "rlSetMatrixModelview")
|
||||
purego.RegisterLibFunc(&rlSetMatrixProjectionStereo, raylibDll, "rlSetMatrixProjectionStereo")
|
||||
purego.RegisterLibFunc(&rlSetMatrixViewOffsetStereo, raylibDll, "rlSetMatrixViewOffsetStereo")
|
||||
purego.RegisterLibFunc(&rlLoadDrawCube, raylibDll, "rlLoadDrawCube")
|
||||
purego.RegisterLibFunc(&rlLoadDrawQuad, raylibDll, "rlLoadDrawQuad")
|
||||
}
|
||||
|
||||
// SetMatrixProjection - Set a custom projection matrix (replaces internal projection matrix)
|
||||
func SetMatrixProjection(proj Matrix) {
|
||||
rlSetMatrixProjection(uintptr(unsafe.Pointer(&proj)))
|
||||
}
|
||||
|
||||
// SetMatrixModelview - Set a custom modelview matrix (replaces internal modelview matrix)
|
||||
func SetMatrixModelview(view Matrix) {
|
||||
rlSetMatrixModelview(uintptr(unsafe.Pointer(&view)))
|
||||
}
|
||||
|
||||
// MatrixMode - Choose the current matrix to be transformed
|
||||
func MatrixMode(mode int32) {
|
||||
rlMatrixMode(mode)
|
||||
}
|
||||
|
||||
// PushMatrix - Push the current matrix to stack
|
||||
func PushMatrix() {
|
||||
rlPushMatrix()
|
||||
}
|
||||
|
||||
// PopMatrix - Pop lattest inserted matrix from stack
|
||||
func PopMatrix() {
|
||||
rlPopMatrix()
|
||||
}
|
||||
|
||||
// LoadIdentity - Reset current matrix to identity matrix
|
||||
func LoadIdentity() {
|
||||
rlLoadIdentity()
|
||||
}
|
||||
|
||||
// Translatef - Multiply the current matrix by a translation matrix
|
||||
func Translatef(x float32, y float32, z float32) {
|
||||
rlTranslatef(x, y, z)
|
||||
}
|
||||
|
||||
// Rotatef - Multiply the current matrix by a rotation matrix
|
||||
func Rotatef(angle float32, x float32, y float32, z float32) {
|
||||
rlRotatef(angle, x, y, z)
|
||||
}
|
||||
|
||||
// Scalef - Multiply the current matrix by a scaling matrix
|
||||
func Scalef(x float32, y float32, z float32) {
|
||||
rlScalef(x, y, z)
|
||||
}
|
||||
|
||||
// Frustum .
|
||||
func Frustum(left float64, right float64, bottom float64, top float64, znear float64, zfar float64) {
|
||||
rlFrustum(left, right, bottom, top, znear, zfar)
|
||||
}
|
||||
|
||||
// Ortho .
|
||||
func Ortho(left float64, right float64, bottom float64, top float64, znear float64, zfar float64) {
|
||||
rlOrtho(left, right, bottom, top, znear, zfar)
|
||||
}
|
||||
|
||||
// Viewport - Set the viewport area
|
||||
func Viewport(x int32, y int32, width int32, height int32) {
|
||||
rlViewport(x, y, width, height)
|
||||
}
|
||||
|
||||
// Begin - Initialize drawing mode (how to organize vertex)
|
||||
func Begin(mode int32) {
|
||||
rlBegin(mode)
|
||||
}
|
||||
|
||||
// End - Finish vertex providing
|
||||
func End() {
|
||||
rlEnd()
|
||||
}
|
||||
|
||||
// Vertex2i - Define one vertex (position) - 2 int
|
||||
func Vertex2i(x int32, y int32) {
|
||||
rlVertex2i(x, y)
|
||||
}
|
||||
|
||||
// Vertex2f - Define one vertex (position) - 2 float
|
||||
func Vertex2f(x float32, y float32) {
|
||||
rlVertex2f(x, y)
|
||||
}
|
||||
|
||||
// Vertex3f - Define one vertex (position) - 3 float
|
||||
func Vertex3f(x float32, y float32, z float32) {
|
||||
rlVertex3f(x, y, z)
|
||||
}
|
||||
|
||||
// TexCoord2f - Define one vertex (texture coordinate) - 2 float
|
||||
func TexCoord2f(x float32, y float32) {
|
||||
rlTexCoord2f(x, y)
|
||||
}
|
||||
|
||||
// Normal3f - Define one vertex (normal) - 3 float
|
||||
func Normal3f(x float32, y float32, z float32) {
|
||||
rlNormal3f(x, y, z)
|
||||
}
|
||||
|
||||
// Color4ub - Define one vertex (color) - 4 byte
|
||||
func Color4ub(r uint8, g uint8, b uint8, a uint8) {
|
||||
rlColor4ub(r, g, b, a)
|
||||
}
|
||||
|
||||
// Color3f - Define one vertex (color) - 3 float
|
||||
func Color3f(x float32, y float32, z float32) {
|
||||
rlColor3f(x, y, z)
|
||||
}
|
||||
|
||||
// Color4f - Define one vertex (color) - 4 float
|
||||
func Color4f(x float32, y float32, z float32, w float32) {
|
||||
rlColor4f(x, y, z, w)
|
||||
}
|
||||
|
||||
// EnableVertexArray - Enable vertex array (VAO, if supported)
|
||||
func EnableVertexArray(vaoId uint32) bool {
|
||||
return rlEnableVertexArray(vaoId)
|
||||
}
|
||||
|
||||
// DisableVertexArray - Disable vertex array (VAO, if supported)
|
||||
func DisableVertexArray() {
|
||||
rlDisableVertexArray()
|
||||
}
|
||||
|
||||
// EnableVertexBuffer - Enable vertex buffer (VBO)
|
||||
func EnableVertexBuffer(id uint32) {
|
||||
rlEnableVertexBuffer(id)
|
||||
}
|
||||
|
||||
// DisableVertexBuffer - Disable vertex buffer (VBO)
|
||||
func DisableVertexBuffer() {
|
||||
rlDisableVertexBuffer()
|
||||
}
|
||||
|
||||
// EnableVertexBufferElement - Enable vertex buffer element (VBO element)
|
||||
func EnableVertexBufferElement(id uint32) {
|
||||
rlEnableVertexBufferElement(id)
|
||||
}
|
||||
|
||||
// DisableVertexBufferElement - Disable vertex buffer element (VBO element)
|
||||
func DisableVertexBufferElement() {
|
||||
rlDisableVertexBufferElement()
|
||||
}
|
||||
|
||||
// EnableVertexAttribute - Enable vertex attribute index
|
||||
func EnableVertexAttribute(index uint32) {
|
||||
rlEnableVertexAttribute(index)
|
||||
}
|
||||
|
||||
// DisableVertexAttribute - Disable vertex attribute index
|
||||
func DisableVertexAttribute(index uint32) {
|
||||
rlDisableVertexAttribute(index)
|
||||
}
|
||||
|
||||
// ActiveTextureSlot - Select and active a texture slot
|
||||
func ActiveTextureSlot(slot int32) {
|
||||
rlActiveTextureSlot(slot)
|
||||
}
|
||||
|
||||
// EnableTexture - Enable texture
|
||||
func EnableTexture(id uint32) {
|
||||
rlEnableTexture(id)
|
||||
}
|
||||
|
||||
// DisableTexture - Disable texture
|
||||
func DisableTexture() {
|
||||
rlDisableTexture()
|
||||
}
|
||||
|
||||
// EnableTextureCubemap - Enable texture cubemap
|
||||
func EnableTextureCubemap(id uint32) {
|
||||
rlEnableTextureCubemap(id)
|
||||
}
|
||||
|
||||
// DisableTextureCubemap - Disable texture cubemap
|
||||
func DisableTextureCubemap() {
|
||||
rlDisableTextureCubemap()
|
||||
}
|
||||
|
||||
// TextureParameters - Set texture parameters (filter, wrap)
|
||||
func TextureParameters(id uint32, param int32, value int32) {
|
||||
rlTextureParameters(id, param, value)
|
||||
}
|
||||
|
||||
// CubemapParameters - Set cubemap parameters (filter, wrap)
|
||||
func CubemapParameters(id uint32, param int32, value int32) {
|
||||
rlCubemapParameters(id, param, value)
|
||||
}
|
||||
|
||||
// EnableShader - Enable shader program
|
||||
func EnableShader(id uint32) {
|
||||
rlEnableShader(id)
|
||||
}
|
||||
|
||||
// DisableShader - Disable shader program
|
||||
func DisableShader() {
|
||||
rlDisableShader()
|
||||
}
|
||||
|
||||
// EnableFramebuffer - Enable render texture (fbo)
|
||||
func EnableFramebuffer(id uint32) {
|
||||
rlEnableFramebuffer(id)
|
||||
}
|
||||
|
||||
// DisableFramebuffer - Disable render texture (fbo), return to default framebuffer
|
||||
func DisableFramebuffer() {
|
||||
rlDisableFramebuffer()
|
||||
}
|
||||
|
||||
// ActiveDrawBuffers - Activate multiple draw color buffers
|
||||
func ActiveDrawBuffers(count int32) {
|
||||
rlActiveDrawBuffers(count)
|
||||
}
|
||||
|
||||
// EnableColorBlend - Enable color blending
|
||||
func EnableColorBlend() {
|
||||
rlEnableColorBlend()
|
||||
}
|
||||
|
||||
// DisableColorBlend - Disable color blending
|
||||
func DisableColorBlend() {
|
||||
rlDisableColorBlend()
|
||||
}
|
||||
|
||||
// EnableDepthTest - Enable depth test
|
||||
func EnableDepthTest() {
|
||||
rlEnableDepthTest()
|
||||
}
|
||||
|
||||
// DisableDepthTest - Disable depth test
|
||||
func DisableDepthTest() {
|
||||
rlDisableDepthTest()
|
||||
}
|
||||
|
||||
// EnableDepthMask - Enable depth write
|
||||
func EnableDepthMask() {
|
||||
rlEnableDepthMask()
|
||||
}
|
||||
|
||||
// DisableDepthMask - Disable depth write
|
||||
func DisableDepthMask() {
|
||||
rlDisableDepthMask()
|
||||
}
|
||||
|
||||
// EnableBackfaceCulling - Enable backface culling
|
||||
func EnableBackfaceCulling() {
|
||||
rlEnableBackfaceCulling()
|
||||
}
|
||||
|
||||
// DisableBackfaceCulling - Disable backface culling
|
||||
func DisableBackfaceCulling() {
|
||||
rlDisableBackfaceCulling()
|
||||
}
|
||||
|
||||
// SetCullFace - Set face culling mode
|
||||
func SetCullFace(mode int32) {
|
||||
rlSetCullFace(mode)
|
||||
}
|
||||
|
||||
// EnableScissorTest - Enable scissor test
|
||||
func EnableScissorTest() {
|
||||
rlEnableScissorTest()
|
||||
}
|
||||
|
||||
// DisableScissorTest - Disable scissor test
|
||||
func DisableScissorTest() {
|
||||
rlDisableScissorTest()
|
||||
}
|
||||
|
||||
// Scissor - Scissor test
|
||||
func Scissor(x int32, y int32, width int32, height int32) {
|
||||
rlScissor(x, y, width, height)
|
||||
}
|
||||
|
||||
// EnableWireMode - Enable wire mode
|
||||
func EnableWireMode() {
|
||||
rlEnableWireMode()
|
||||
}
|
||||
|
||||
// EnablePointMode - Enable point mode
|
||||
func EnablePointMode() {
|
||||
rlEnablePointMode()
|
||||
}
|
||||
|
||||
// DisableWireMode - Disable wire mode
|
||||
func DisableWireMode() {
|
||||
rlDisableWireMode()
|
||||
}
|
||||
|
||||
// SetLineWidth - Set the line drawing width
|
||||
func SetLineWidth(width float32) {
|
||||
rlSetLineWidth(width)
|
||||
}
|
||||
|
||||
// GetLineWidth - Get the line drawing width
|
||||
func GetLineWidth() float32 {
|
||||
return rlGetLineWidth()
|
||||
}
|
||||
|
||||
// EnableSmoothLines - Enable line aliasing
|
||||
func EnableSmoothLines() {
|
||||
rlEnableSmoothLines()
|
||||
}
|
||||
|
||||
// DisableSmoothLines - Disable line aliasing
|
||||
func DisableSmoothLines() {
|
||||
rlDisableSmoothLines()
|
||||
}
|
||||
|
||||
// EnableStereoRender - Enable stereo rendering
|
||||
func EnableStereoRender() {
|
||||
rlEnableStereoRender()
|
||||
}
|
||||
|
||||
// DisableStereoRender - Disable stereo rendering
|
||||
func DisableStereoRender() {
|
||||
rlDisableStereoRender()
|
||||
}
|
||||
|
||||
// IsStereoRenderEnabled - Check if stereo render is enabled
|
||||
func IsStereoRenderEnabled() bool {
|
||||
return rlIsStereoRenderEnabled()
|
||||
}
|
||||
|
||||
// ClearColor - Clear color buffer with color
|
||||
func ClearColor(r uint8, g uint8, b uint8, a uint8) {
|
||||
rlClearColor(r, g, b, a)
|
||||
}
|
||||
|
||||
// ClearScreenBuffers - Clear used screen buffers (color and depth)
|
||||
func ClearScreenBuffers() {
|
||||
rlClearScreenBuffers()
|
||||
}
|
||||
|
||||
// CheckErrors - Check and log OpenGL error codes
|
||||
func CheckErrors() {
|
||||
rlCheckErrors()
|
||||
}
|
||||
|
||||
// SetBlendMode - Set blending mode
|
||||
func SetBlendMode(mode int32) {
|
||||
rlSetBlendMode(mode)
|
||||
}
|
||||
|
||||
// SetBlendFactors - Set blending mode factor and equation (using OpenGL factors)
|
||||
func SetBlendFactors(glSrcFactor int32, glDstFactor int32, glEquation int32) {
|
||||
rlSetBlendFactors(glSrcFactor, glDstFactor, glEquation)
|
||||
}
|
||||
|
||||
// SetBlendFactorsSeparate - Set blending mode factors and equations separately (using OpenGL factors)
|
||||
func SetBlendFactorsSeparate(glSrcRGB int32, glDstRGB int32, glSrcAlpha int32, glDstAlpha int32, glEqRGB int32, glEqAlpha int32) {
|
||||
rlSetBlendFactorsSeparate(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha, glEqRGB, glEqAlpha)
|
||||
}
|
||||
|
||||
// glInit - Initialize rlgl (buffers, shaders, textures, states)
|
||||
func glInit(width int32, height int32) {
|
||||
rlglInit(width, height)
|
||||
}
|
||||
|
||||
// glClose - De-inititialize rlgl (buffers, shaders, textures)
|
||||
func glClose() {
|
||||
rlglClose()
|
||||
}
|
||||
|
||||
// GetVersion - Get current OpenGL version
|
||||
func GetVersion() int32 {
|
||||
return rlGetVersion()
|
||||
}
|
||||
|
||||
// SetFramebufferWidth - Set current framebuffer width
|
||||
func SetFramebufferWidth(width int32) {
|
||||
rlSetFramebufferWidth(width)
|
||||
}
|
||||
|
||||
// GetFramebufferWidth - Get default framebuffer width
|
||||
func GetFramebufferWidth() int32 {
|
||||
return rlGetFramebufferWidth()
|
||||
}
|
||||
|
||||
// SetFramebufferHeight - Set current framebuffer height
|
||||
func SetFramebufferHeight(height int32) {
|
||||
rlSetFramebufferHeight(height)
|
||||
}
|
||||
|
||||
// GetFramebufferHeight - Get default framebuffer height
|
||||
func GetFramebufferHeight() int32 {
|
||||
return rlGetFramebufferHeight()
|
||||
}
|
||||
|
||||
// GetTextureIdDefault - Get default texture id
|
||||
func GetTextureIdDefault() uint32 {
|
||||
return rlGetTextureIdDefault()
|
||||
}
|
||||
|
||||
// GetShaderIdDefault - Get default shader id
|
||||
func GetShaderIdDefault() uint32 {
|
||||
return rlGetShaderIdDefault()
|
||||
}
|
||||
|
||||
// DrawRenderBatchActive - Update and draw internal render batch
|
||||
func DrawRenderBatchActive() {
|
||||
rlDrawRenderBatchActive()
|
||||
}
|
||||
|
||||
// CheckRenderBatchLimit - Check internal buffer overflow for a given number of vertex
|
||||
func CheckRenderBatchLimit(vCount int32) bool {
|
||||
return rlCheckRenderBatchLimit(vCount)
|
||||
}
|
||||
|
||||
// SetTexture - Set current texture for render batch and check buffers limits
|
||||
func SetTexture(id uint32) {
|
||||
rlSetTexture(id)
|
||||
}
|
||||
|
||||
// LoadVertexArray - Load vertex array (vao) if supported
|
||||
func LoadVertexArray() uint32 {
|
||||
return rlLoadVertexArray()
|
||||
}
|
||||
|
||||
// UnloadVertexBuffer .
|
||||
func UnloadVertexBuffer(vboId uint32) {
|
||||
rlUnloadVertexBuffer(vboId)
|
||||
}
|
||||
|
||||
// SetVertexAttributeDivisor .
|
||||
func SetVertexAttributeDivisor(index uint32, divisor int32) {
|
||||
rlSetVertexAttributeDivisor(index, divisor)
|
||||
}
|
||||
|
||||
// LoadTextureDepth - Load depth texture/renderbuffer (to be attached to fbo)
|
||||
func LoadTextureDepth(width, height int32, useRenderBuffer bool) {
|
||||
rlLoadTextureDepth(width, height, useRenderBuffer)
|
||||
}
|
||||
|
||||
// LoadFramebuffer - Load an empty framebuffer
|
||||
func LoadFramebuffer(width int32, height int32) uint32 {
|
||||
return rlLoadFramebuffer(width, height)
|
||||
}
|
||||
|
||||
// FramebufferAttach - Attach texture/renderbuffer to a framebuffer
|
||||
func FramebufferAttach(fboId uint32, texId uint32, attachType int32, texType int32, mipLevel int32) {
|
||||
rlFramebufferAttach(fboId, texId, attachType, texType, mipLevel)
|
||||
}
|
||||
|
||||
// FramebufferComplete - Verify framebuffer is complete
|
||||
func FramebufferComplete(id uint32) bool {
|
||||
return rlFramebufferComplete(id)
|
||||
}
|
||||
|
||||
// UnloadFramebuffer - Delete framebuffer from GPU
|
||||
func UnloadFramebuffer(id uint32) {
|
||||
rlUnloadFramebuffer(id)
|
||||
}
|
||||
|
||||
// LoadShaderCode - Load shader from code strings
|
||||
func LoadShaderCode(vsCode string, fsCode string) uint32 {
|
||||
return rlLoadShaderCode(vsCode, fsCode)
|
||||
}
|
||||
|
||||
// CompileShader - Compile custom shader and return shader id (type: VERTEX_SHADER, FRAGMENT_SHADER, COMPUTE_SHADER)
|
||||
func CompileShader(shaderCode string, type_ int32) uint32 {
|
||||
return rlCompileShader(shaderCode, type_)
|
||||
}
|
||||
|
||||
// LoadShaderProgram - Load custom shader program
|
||||
func LoadShaderProgram(vShaderId uint32, fShaderId uint32) uint32 {
|
||||
return rlLoadShaderProgram(vShaderId, fShaderId)
|
||||
}
|
||||
|
||||
// UnloadShaderProgram - Unload shader program
|
||||
func UnloadShaderProgram(id uint32) {
|
||||
rlUnloadShaderProgram(id)
|
||||
}
|
||||
|
||||
// GetLocationUniform - Get shader location uniform
|
||||
func GetLocationUniform(shaderId uint32, uniformName string) int32 {
|
||||
return rlGetLocationUniform(shaderId, uniformName)
|
||||
}
|
||||
|
||||
// GetLocationAttrib - Get shader location attribute
|
||||
func GetLocationAttrib(shaderId uint32, attribName string) int32 {
|
||||
return rlGetLocationAttrib(shaderId, attribName)
|
||||
}
|
||||
|
||||
// SetUniformSampler - Set shader value sampler
|
||||
func SetUniformSampler(locIndex int32, textureId uint32) {
|
||||
rlSetUniformSampler(locIndex, textureId)
|
||||
}
|
||||
|
||||
// ComputeShaderDispatch - Dispatch compute shader (equivalent to *draw* for graphics pilepine)
|
||||
func ComputeShaderDispatch(groupX uint32, groupY uint32, groupZ uint32) {
|
||||
rlComputeShaderDispatch(groupX, groupY, groupZ)
|
||||
}
|
||||
|
||||
// GetShaderBufferSize - Get SSBO buffer size
|
||||
func GetShaderBufferSize(id uint32) uint32 {
|
||||
return rlGetShaderBufferSize(id)
|
||||
}
|
||||
|
||||
// BindImageTexture - Bind image texture
|
||||
func BindImageTexture(id uint32, index uint32, format int32, readonly bool) {
|
||||
rlBindImageTexture(id, index, format, readonly)
|
||||
}
|
||||
|
||||
// GetMatrixModelview - Get internal modelview matrix
|
||||
func GetMatrixModelview() Matrix {
|
||||
var matrix Matrix
|
||||
rlGetMatrixModelview(uintptr(unsafe.Pointer(&matrix)))
|
||||
return matrix
|
||||
}
|
||||
|
||||
// GetMatrixProjection - Get internal projection matrix
|
||||
func GetMatrixProjection() Matrix {
|
||||
var matrix Matrix
|
||||
rlGetMatrixProjection(uintptr(unsafe.Pointer(&matrix)))
|
||||
return matrix
|
||||
}
|
||||
|
||||
// GetMatrixTransform - Get internal accumulated transform matrix
|
||||
func GetMatrixTransform() Matrix {
|
||||
var matrix Matrix
|
||||
rlGetMatrixTransform(uintptr(unsafe.Pointer(&matrix)))
|
||||
return matrix
|
||||
}
|
||||
|
||||
// GetMatrixProjectionStereo - Get internal projection matrix for stereo render (selected eye)
|
||||
func GetMatrixProjectionStereo(eye int32) Matrix {
|
||||
var matrix Matrix
|
||||
rlGetMatrixProjectionStereo(uintptr(unsafe.Pointer(&matrix)), eye)
|
||||
return matrix
|
||||
}
|
||||
|
||||
// GetMatrixViewOffsetStereo - Get internal view offset matrix for stereo render (selected eye)
|
||||
func GetMatrixViewOffsetStereo(eye int32) Matrix {
|
||||
var matrix Matrix
|
||||
rlGetMatrixViewOffsetStereo(uintptr(unsafe.Pointer(&matrix)), eye)
|
||||
return matrix
|
||||
}
|
||||
|
||||
// SetMatrixProjectionStereo - Set eyes projection matrices for stereo rendering
|
||||
func SetMatrixProjectionStereo(right Matrix, left Matrix) {
|
||||
rlSetMatrixProjectionStereo(uintptr(unsafe.Pointer(&right)), uintptr(unsafe.Pointer(&left)))
|
||||
}
|
||||
|
||||
// SetMatrixViewOffsetStereo - Set eyes view offsets matrices for stereo rendering
|
||||
func SetMatrixViewOffsetStereo(right Matrix, left Matrix) {
|
||||
rlSetMatrixViewOffsetStereo(uintptr(unsafe.Pointer(&right)), uintptr(unsafe.Pointer(&left)))
|
||||
}
|
||||
|
||||
// LoadDrawCube - Load and draw a cube
|
||||
func LoadDrawCube() {
|
||||
rlLoadDrawCube()
|
||||
}
|
||||
|
||||
// LoadDrawQuad - Load and draw a quad
|
||||
func LoadDrawQuad() {
|
||||
rlLoadDrawQuad()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue