Add new functions
This commit is contained in:
parent
ec25c4ec9e
commit
914ca1ffdc
3 changed files with 62 additions and 4 deletions
|
@ -194,6 +194,14 @@ func UnloadModel(model Model) {
|
||||||
C.UnloadModel(*cmodel)
|
C.UnloadModel(*cmodel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetModelBoundingBox - Compute model bounding box limits (considers all meshes
|
||||||
|
func GetModelBoundingBox(model Model) BoundingBox {
|
||||||
|
cmodel := model.cptr()
|
||||||
|
ret := C.GetModelBoundingBox(*cmodel)
|
||||||
|
v := newBoundingBoxFromPointer(unsafe.Pointer(&ret))
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
// UnloadMesh - Unload mesh from memory (RAM and/or VRAM)
|
// UnloadMesh - Unload mesh from memory (RAM and/or VRAM)
|
||||||
func UnloadMesh(mesh *Mesh) {
|
func UnloadMesh(mesh *Mesh) {
|
||||||
cmesh := mesh.cptr()
|
cmesh := mesh.cptr()
|
||||||
|
@ -208,6 +216,16 @@ func ExportMesh(mesh Mesh, fileName string) {
|
||||||
C.ExportMesh(*cmesh, cfileName)
|
C.ExportMesh(*cmesh, cfileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GenMeshPoly - Generate polygonal mesh
|
||||||
|
func GenMeshPoly(sides int, radius float32) Mesh {
|
||||||
|
csides := (C.int)(sides)
|
||||||
|
cradius := (C.float)(radius)
|
||||||
|
|
||||||
|
ret := C.GenMeshPoly(csides, cradius)
|
||||||
|
v := newMeshFromPointer(unsafe.Pointer(&ret))
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
// GenMeshPlane - Generate plane mesh (with subdivisions)
|
// GenMeshPlane - Generate plane mesh (with subdivisions)
|
||||||
func GenMeshPlane(width, length float32, resX, resZ int) Mesh {
|
func GenMeshPlane(width, length float32, resX, resZ int) Mesh {
|
||||||
cwidth := (C.float)(width)
|
cwidth := (C.float)(width)
|
||||||
|
@ -264,6 +282,17 @@ func GenMeshCylinder(radius, height float32, slices int) Mesh {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GenMeshCone - Generate cone/pyramid mesh
|
||||||
|
func GenMeshCone(radius, height float32, slices int) Mesh {
|
||||||
|
cradius := (C.float)(radius)
|
||||||
|
cheight := (C.float)(height)
|
||||||
|
cslices := (C.int)(slices)
|
||||||
|
|
||||||
|
ret := C.GenMeshCone(cradius, cheight, cslices)
|
||||||
|
v := newMeshFromPointer(unsafe.Pointer(&ret))
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
// GenMeshTorus - Generate torus mesh
|
// GenMeshTorus - Generate torus mesh
|
||||||
func GenMeshTorus(radius, size float32, radSeg, sides int) Mesh {
|
func GenMeshTorus(radius, size float32, radSeg, sides int) Mesh {
|
||||||
cradius := (C.float)(radius)
|
cradius := (C.float)(radius)
|
||||||
|
|
|
@ -133,15 +133,33 @@ func MeasureTextEx(font Font, text string, fontSize float32, spacing float32) Ve
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetGlyphIndex - Returns index position for a unicode character on spritefont
|
// GetGlyphIndex - Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found
|
||||||
func GetGlyphIndex(font Font, character int32) int32 {
|
func GetGlyphIndex(font Font, codepoint int32) int32 {
|
||||||
cfont := font.cptr()
|
cfont := font.cptr()
|
||||||
ccharacter := (C.int)(character)
|
ccodepoint := (C.int)(codepoint)
|
||||||
ret := C.GetGlyphIndex(*cfont, ccharacter)
|
ret := C.GetGlyphIndex(*cfont, ccodepoint)
|
||||||
v := (int32)(ret)
|
v := (int32)(ret)
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetGlyphInfo - Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found
|
||||||
|
func GetGlyphInfo(font Font, codepoint int32) GlyphInfo {
|
||||||
|
cfont := font.cptr()
|
||||||
|
ccodepoint := (C.int)(codepoint)
|
||||||
|
ret := C.GetGlyphInfo(*cfont, ccodepoint)
|
||||||
|
v := newGlyphInfoFromPointer(unsafe.Pointer(&ret))
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetGlyphAtlasRec - Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found
|
||||||
|
func GetGlyphAtlasRec(font Font, codepoint int32) Rectangle {
|
||||||
|
cfont := font.cptr()
|
||||||
|
ccodepoint := (C.int)(codepoint)
|
||||||
|
ret := C.GetGlyphAtlasRec(*cfont, ccodepoint)
|
||||||
|
v := newRectangleFromPointer(unsafe.Pointer(&ret))
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
// DrawFPS - Shows current FPS
|
// DrawFPS - Shows current FPS
|
||||||
func DrawFPS(posX int32, posY int32) {
|
func DrawFPS(posX int32, posY int32) {
|
||||||
cposX := (C.int)(posX)
|
cposX := (C.int)(posX)
|
||||||
|
|
|
@ -355,6 +355,17 @@ func ImageColorReplace(image *Image, color, replace Color) {
|
||||||
C.ImageColorReplace(cimage, *ccolor, *creplace)
|
C.ImageColorReplace(cimage, *ccolor, *creplace)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetImageColor - Get image pixel color at (x, y) position
|
||||||
|
func GetImageColor(image Image, x, y int32) Color {
|
||||||
|
cimage := image.cptr()
|
||||||
|
cx := (C.int)(x)
|
||||||
|
cy := (C.int)(y)
|
||||||
|
|
||||||
|
ret := C.GetImageColor(*cimage, cx, cy)
|
||||||
|
v := newColorFromPointer(unsafe.Pointer(&ret))
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
// ImageClearBackground - Clear image background with given color
|
// ImageClearBackground - Clear image background with given color
|
||||||
func ImageClearBackground(dst *Image, color Color) {
|
func ImageClearBackground(dst *Image, color Color) {
|
||||||
cdst := dst.cptr()
|
cdst := dst.cptr()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue