Make rlgl types public and add missung functions
This commit is contained in:
parent
251b88bcb4
commit
79286ba625
3 changed files with 90 additions and 35 deletions
|
@ -52,36 +52,36 @@ const (
|
||||||
ComputeShader = 0x91B9 // GL_COMPUTE_SHADER
|
ComputeShader = 0x91B9 // GL_COMPUTE_SHADER
|
||||||
)
|
)
|
||||||
|
|
||||||
// rlVertexBuffer - Dynamic vertex buffers (position + texcoords + colors + indices arrays)
|
// VertexBuffer - Dynamic vertex buffers (position + texcoords + colors + indices arrays)
|
||||||
type rlVertexBuffer struct {
|
type VertexBuffer struct {
|
||||||
elementCount int32
|
ElementCount int32
|
||||||
vertices []float32
|
Vertices *float32
|
||||||
texcoords []float32
|
Texcoords *float32
|
||||||
colors []uint8
|
Colors *uint8
|
||||||
indices []uint32
|
Indices *uint32
|
||||||
vaoId uint32
|
VaoId uint32
|
||||||
vboId [4]uint32
|
VboId [4]uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
// rlDrawCall - Draw call type
|
// DrawCall - Draw call type
|
||||||
// NOTE: Only texture changes register a new draw, other state-change-related elements are not
|
// NOTE: Only texture changes register a new draw, other state-change-related elements are not
|
||||||
// used at this moment (vaoId, shaderId, matrices), raylib just forces a batch draw call if any
|
// used at this moment (vaoId, shaderId, matrices), raylib just forces a batch draw call if any
|
||||||
// of those state-change happens (this is done in core module)
|
// of those state-change happens (this is done in core module)
|
||||||
type rlDrawCall struct {
|
type DrawCall struct {
|
||||||
mode int32
|
Mode int32
|
||||||
vertexCount int32
|
VertexCount int32
|
||||||
vertexAlignment int32
|
VertexAlignment int32
|
||||||
textureId uint32
|
TextureId uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
// rlRenderBatch type
|
// RenderBatch type
|
||||||
type rlRenderBatch struct {
|
type RenderBatch struct {
|
||||||
bufferCount int32
|
BufferCount int32
|
||||||
currentBuffer int32
|
CurrentBuffer int32
|
||||||
vertexBuffer []rlVertexBuffer
|
VertexBuffer *VertexBuffer
|
||||||
draws []rlDrawCall
|
Draws *DrawCall
|
||||||
drawCounter int32
|
DrawCounter int32
|
||||||
currentDepth float32
|
DurrentDepth float32
|
||||||
}
|
}
|
||||||
|
|
||||||
// OpenGL version
|
// OpenGL version
|
||||||
|
@ -93,7 +93,8 @@ const (
|
||||||
OpenglEs20 int32 = 5
|
OpenglEs20 int32 = 5
|
||||||
)
|
)
|
||||||
|
|
||||||
type rlGlVersion = int32
|
// GlVersion type
|
||||||
|
type GlVersion = int32
|
||||||
|
|
||||||
// Shader attribute data types
|
// Shader attribute data types
|
||||||
const (
|
const (
|
||||||
|
@ -103,7 +104,8 @@ const (
|
||||||
ShaderAttribVec4 int32 = 3
|
ShaderAttribVec4 int32 = 3
|
||||||
)
|
)
|
||||||
|
|
||||||
type rlShaderAttributeDataType = int32
|
// ShaderAttributeDataType type
|
||||||
|
type ShaderAttributeDataType = int32
|
||||||
|
|
||||||
// Framebuffer attachment type
|
// Framebuffer attachment type
|
||||||
// NOTE: By default up to 8 color channels defined but it can be more
|
// NOTE: By default up to 8 color channels defined but it can be more
|
||||||
|
@ -120,7 +122,8 @@ const (
|
||||||
AttachmentStencil int32 = 200
|
AttachmentStencil int32 = 200
|
||||||
)
|
)
|
||||||
|
|
||||||
type rlFramebufferAttachType = int32
|
// FramebufferAttachType type
|
||||||
|
type FramebufferAttachType = int32
|
||||||
|
|
||||||
// Framebuffer texture attachment type
|
// Framebuffer texture attachment type
|
||||||
const (
|
const (
|
||||||
|
@ -134,4 +137,5 @@ const (
|
||||||
AttachmentRenderbuffer int32 = 200
|
AttachmentRenderbuffer int32 = 200
|
||||||
)
|
)
|
||||||
|
|
||||||
type rlFramebufferAttachTextureType = int32
|
// FramebufferAttachTextureType type
|
||||||
|
type FramebufferAttachTextureType = int32
|
||||||
|
|
|
@ -472,15 +472,15 @@ func SetBlendFactorsSeparate(glSrcRGB int32, glDstRGB int32, glSrcAlpha int32, g
|
||||||
C.rlSetBlendFactorsSeparate(cglSrcRGB, cglDstRGB, cglSrcAlpha, cglDstAlpha, cglEqRGB, cglEqAlpha)
|
C.rlSetBlendFactorsSeparate(cglSrcRGB, cglDstRGB, cglSrcAlpha, cglDstAlpha, cglEqRGB, cglEqAlpha)
|
||||||
}
|
}
|
||||||
|
|
||||||
// glInit - Initialize rlgl (buffers, shaders, textures, states)
|
// GlInit - Initialize rlgl (buffers, shaders, textures, states)
|
||||||
func glInit(width int32, height int32) {
|
func GlInit(width int32, height int32) {
|
||||||
cwidth := C.int(width)
|
cwidth := C.int(width)
|
||||||
cheight := C.int(height)
|
cheight := C.int(height)
|
||||||
C.rlglInit(cwidth, cheight)
|
C.rlglInit(cwidth, cheight)
|
||||||
}
|
}
|
||||||
|
|
||||||
// glClose - De-inititialize rlgl (buffers, shaders, textures)
|
// GlClose - De-inititialize rlgl (buffers, shaders, textures)
|
||||||
func glClose() {
|
func GlClose() {
|
||||||
C.rlglClose()
|
C.rlglClose()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,6 +521,27 @@ func GetShaderIdDefault() uint32 {
|
||||||
return uint32(C.rlGetShaderIdDefault())
|
return uint32(C.rlGetShaderIdDefault())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoadRenderBatch - Load a render batch system
|
||||||
|
func LoadRenderBatch(numBuffers int32, bufferElements int32) RenderBatch {
|
||||||
|
ret := C.rlLoadRenderBatch(C.int(numBuffers), C.int(bufferElements))
|
||||||
|
return *(*RenderBatch)(unsafe.Pointer(&ret))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnloadRenderBatch - Unload render batch system
|
||||||
|
func UnloadRenderBatch(batch RenderBatch) {
|
||||||
|
C.rlUnloadRenderBatch(*(*C.rlRenderBatch)(unsafe.Pointer(&batch)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DrawRenderBatch - Draw render batch data (Update->Draw->Reset)
|
||||||
|
func DrawRenderBatch(batch *RenderBatch) {
|
||||||
|
C.rlDrawRenderBatch((*C.rlRenderBatch)(unsafe.Pointer(batch)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRenderBatchActive - Set the active render batch for rlgl (NULL for default internal)
|
||||||
|
func SetRenderBatchActive(batch *RenderBatch) {
|
||||||
|
C.rlSetRenderBatchActive((*C.rlRenderBatch)(unsafe.Pointer(batch)))
|
||||||
|
}
|
||||||
|
|
||||||
// DrawRenderBatchActive - Update and draw internal render batch
|
// DrawRenderBatchActive - Update and draw internal render batch
|
||||||
func DrawRenderBatchActive() {
|
func DrawRenderBatchActive() {
|
||||||
C.rlDrawRenderBatchActive()
|
C.rlDrawRenderBatchActive()
|
||||||
|
|
|
@ -86,6 +86,10 @@ var rlSetFramebufferHeight func(height int32)
|
||||||
var rlGetFramebufferHeight func() int32
|
var rlGetFramebufferHeight func() int32
|
||||||
var rlGetTextureIdDefault func() uint32
|
var rlGetTextureIdDefault func() uint32
|
||||||
var rlGetShaderIdDefault func() uint32
|
var rlGetShaderIdDefault func() uint32
|
||||||
|
var rlLoadRenderBatch func(batch uintptr, numBuffers int32, bufferElements int32)
|
||||||
|
var rlUnloadRenderBatch func(batch uintptr)
|
||||||
|
var rlDrawRenderBatch func(batch *RenderBatch)
|
||||||
|
var rlSetRenderBatchActive func(batch *RenderBatch)
|
||||||
var rlDrawRenderBatchActive func()
|
var rlDrawRenderBatchActive func()
|
||||||
var rlCheckRenderBatchLimit func(vCount int32) bool
|
var rlCheckRenderBatchLimit func(vCount int32) bool
|
||||||
var rlSetTexture func(id uint32)
|
var rlSetTexture func(id uint32)
|
||||||
|
@ -197,6 +201,10 @@ func initRlglPurego() {
|
||||||
purego.RegisterLibFunc(&rlGetFramebufferHeight, raylibDll, "rlGetFramebufferHeight")
|
purego.RegisterLibFunc(&rlGetFramebufferHeight, raylibDll, "rlGetFramebufferHeight")
|
||||||
purego.RegisterLibFunc(&rlGetTextureIdDefault, raylibDll, "rlGetTextureIdDefault")
|
purego.RegisterLibFunc(&rlGetTextureIdDefault, raylibDll, "rlGetTextureIdDefault")
|
||||||
purego.RegisterLibFunc(&rlGetShaderIdDefault, raylibDll, "rlGetShaderIdDefault")
|
purego.RegisterLibFunc(&rlGetShaderIdDefault, raylibDll, "rlGetShaderIdDefault")
|
||||||
|
purego.RegisterLibFunc(&rlLoadRenderBatch, raylibDll, "rlLoadRenderBatch")
|
||||||
|
purego.RegisterLibFunc(&rlUnloadRenderBatch, raylibDll, "rlUnloadRenderBatch")
|
||||||
|
purego.RegisterLibFunc(&rlDrawRenderBatch, raylibDll, "rlDrawRenderBatch")
|
||||||
|
purego.RegisterLibFunc(&rlSetRenderBatchActive, raylibDll, "rlSetRenderBatchActive")
|
||||||
purego.RegisterLibFunc(&rlDrawRenderBatchActive, raylibDll, "rlDrawRenderBatchActive")
|
purego.RegisterLibFunc(&rlDrawRenderBatchActive, raylibDll, "rlDrawRenderBatchActive")
|
||||||
purego.RegisterLibFunc(&rlCheckRenderBatchLimit, raylibDll, "rlCheckRenderBatchLimit")
|
purego.RegisterLibFunc(&rlCheckRenderBatchLimit, raylibDll, "rlCheckRenderBatchLimit")
|
||||||
purego.RegisterLibFunc(&rlSetTexture, raylibDll, "rlSetTexture")
|
purego.RegisterLibFunc(&rlSetTexture, raylibDll, "rlSetTexture")
|
||||||
|
@ -581,13 +589,13 @@ func SetBlendFactorsSeparate(glSrcRGB int32, glDstRGB int32, glSrcAlpha int32, g
|
||||||
rlSetBlendFactorsSeparate(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha, glEqRGB, glEqAlpha)
|
rlSetBlendFactorsSeparate(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha, glEqRGB, glEqAlpha)
|
||||||
}
|
}
|
||||||
|
|
||||||
// glInit - Initialize rlgl (buffers, shaders, textures, states)
|
// GlInit - Initialize rlgl (buffers, shaders, textures, states)
|
||||||
func glInit(width int32, height int32) {
|
func GlInit(width int32, height int32) {
|
||||||
rlglInit(width, height)
|
rlglInit(width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
// glClose - De-inititialize rlgl (buffers, shaders, textures)
|
// GlClose - De-inititialize rlgl (buffers, shaders, textures)
|
||||||
func glClose() {
|
func GlClose() {
|
||||||
rlglClose()
|
rlglClose()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -626,6 +634,28 @@ func GetShaderIdDefault() uint32 {
|
||||||
return rlGetShaderIdDefault()
|
return rlGetShaderIdDefault()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoadRenderBatch - Load a render batch system
|
||||||
|
func LoadRenderBatch(numBuffers int32, bufferElements int32) RenderBatch {
|
||||||
|
var batch RenderBatch
|
||||||
|
rlLoadRenderBatch(uintptr(unsafe.Pointer(&batch)), numBuffers, bufferElements)
|
||||||
|
return batch
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnloadRenderBatch - Unload render batch system
|
||||||
|
func UnloadRenderBatch(batch RenderBatch) {
|
||||||
|
rlUnloadRenderBatch(uintptr(unsafe.Pointer(&batch)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DrawRenderBatch - Draw render batch data (Update->Draw->Reset)
|
||||||
|
func DrawRenderBatch(batch *RenderBatch) {
|
||||||
|
rlDrawRenderBatch(batch)
|
||||||
|
}
|
||||||
|
|
||||||
|
// rlSetRenderBatchActive - Set the active render batch for rlgl (NULL for default internal)
|
||||||
|
func SetRenderBatchActive(batch *RenderBatch) {
|
||||||
|
rlSetRenderBatchActive(batch)
|
||||||
|
}
|
||||||
|
|
||||||
// DrawRenderBatchActive - Update and draw internal render batch
|
// DrawRenderBatchActive - Update and draw internal render batch
|
||||||
func DrawRenderBatchActive() {
|
func DrawRenderBatchActive() {
|
||||||
rlDrawRenderBatchActive()
|
rlDrawRenderBatchActive()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue