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
|
||||
)
|
||||
|
||||
// rlVertexBuffer - Dynamic vertex buffers (position + texcoords + colors + indices arrays)
|
||||
type rlVertexBuffer struct {
|
||||
elementCount int32
|
||||
vertices []float32
|
||||
texcoords []float32
|
||||
colors []uint8
|
||||
indices []uint32
|
||||
vaoId uint32
|
||||
vboId [4]uint32
|
||||
// VertexBuffer - Dynamic vertex buffers (position + texcoords + colors + indices arrays)
|
||||
type VertexBuffer struct {
|
||||
ElementCount int32
|
||||
Vertices *float32
|
||||
Texcoords *float32
|
||||
Colors *uint8
|
||||
Indices *uint32
|
||||
VaoId 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
|
||||
// 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)
|
||||
type rlDrawCall struct {
|
||||
mode int32
|
||||
vertexCount int32
|
||||
vertexAlignment int32
|
||||
textureId uint32
|
||||
type DrawCall struct {
|
||||
Mode int32
|
||||
VertexCount int32
|
||||
VertexAlignment int32
|
||||
TextureId uint32
|
||||
}
|
||||
|
||||
// rlRenderBatch type
|
||||
type rlRenderBatch struct {
|
||||
bufferCount int32
|
||||
currentBuffer int32
|
||||
vertexBuffer []rlVertexBuffer
|
||||
draws []rlDrawCall
|
||||
drawCounter int32
|
||||
currentDepth float32
|
||||
// RenderBatch type
|
||||
type RenderBatch struct {
|
||||
BufferCount int32
|
||||
CurrentBuffer int32
|
||||
VertexBuffer *VertexBuffer
|
||||
Draws *DrawCall
|
||||
DrawCounter int32
|
||||
DurrentDepth float32
|
||||
}
|
||||
|
||||
// OpenGL version
|
||||
|
@ -93,7 +93,8 @@ const (
|
|||
OpenglEs20 int32 = 5
|
||||
)
|
||||
|
||||
type rlGlVersion = int32
|
||||
// GlVersion type
|
||||
type GlVersion = int32
|
||||
|
||||
// Shader attribute data types
|
||||
const (
|
||||
|
@ -103,7 +104,8 @@ const (
|
|||
ShaderAttribVec4 int32 = 3
|
||||
)
|
||||
|
||||
type rlShaderAttributeDataType = int32
|
||||
// ShaderAttributeDataType type
|
||||
type ShaderAttributeDataType = int32
|
||||
|
||||
// Framebuffer attachment type
|
||||
// NOTE: By default up to 8 color channels defined but it can be more
|
||||
|
@ -120,7 +122,8 @@ const (
|
|||
AttachmentStencil int32 = 200
|
||||
)
|
||||
|
||||
type rlFramebufferAttachType = int32
|
||||
// FramebufferAttachType type
|
||||
type FramebufferAttachType = int32
|
||||
|
||||
// Framebuffer texture attachment type
|
||||
const (
|
||||
|
@ -134,4 +137,5 @@ const (
|
|||
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)
|
||||
}
|
||||
|
||||
// glInit - Initialize rlgl (buffers, shaders, textures, states)
|
||||
func glInit(width int32, height int32) {
|
||||
// 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() {
|
||||
// GlClose - De-inititialize rlgl (buffers, shaders, textures)
|
||||
func GlClose() {
|
||||
C.rlglClose()
|
||||
}
|
||||
|
||||
|
@ -521,6 +521,27 @@ func GetShaderIdDefault() uint32 {
|
|||
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
|
||||
func DrawRenderBatchActive() {
|
||||
C.rlDrawRenderBatchActive()
|
||||
|
|
|
@ -86,6 +86,10 @@ var rlSetFramebufferHeight func(height int32)
|
|||
var rlGetFramebufferHeight func() int32
|
||||
var rlGetTextureIdDefault 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 rlCheckRenderBatchLimit func(vCount int32) bool
|
||||
var rlSetTexture func(id uint32)
|
||||
|
@ -197,6 +201,10 @@ func initRlglPurego() {
|
|||
purego.RegisterLibFunc(&rlGetFramebufferHeight, raylibDll, "rlGetFramebufferHeight")
|
||||
purego.RegisterLibFunc(&rlGetTextureIdDefault, raylibDll, "rlGetTextureIdDefault")
|
||||
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(&rlCheckRenderBatchLimit, raylibDll, "rlCheckRenderBatchLimit")
|
||||
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)
|
||||
}
|
||||
|
||||
// glInit - Initialize rlgl (buffers, shaders, textures, states)
|
||||
func glInit(width int32, height int32) {
|
||||
// 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() {
|
||||
// GlClose - De-inititialize rlgl (buffers, shaders, textures)
|
||||
func GlClose() {
|
||||
rlglClose()
|
||||
}
|
||||
|
||||
|
@ -626,6 +634,28 @@ func GetShaderIdDefault() uint32 {
|
|||
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
|
||||
func DrawRenderBatchActive() {
|
||||
rlDrawRenderBatchActive()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue