Lint
This commit is contained in:
parent
cca4bb4659
commit
61a393d4ce
8 changed files with 110 additions and 111 deletions
|
@ -204,10 +204,10 @@ func DrawCylinderWiresEx(startPos Vector3, endPos Vector3, startRadius float32,
|
|||
// DrawCapsule - Draw a capsule with the center of its sphere caps at startPos and endPos
|
||||
func DrawCapsule(startPos, endPos Vector3, radius float32, slices, rings int32, col color.RGBA) {
|
||||
cstartPos := startPos.cptr()
|
||||
cendPos := startPos.cptr()
|
||||
cendPos := endPos.cptr()
|
||||
cradius := (C.float)(radius)
|
||||
cslices := (C.int)(slices)
|
||||
crings := (C.int)(slices)
|
||||
crings := (C.int)(rings)
|
||||
ccolor := colorCptr(col)
|
||||
C.DrawCapsule(*cstartPos, *cendPos, cradius, cslices, crings, *ccolor)
|
||||
}
|
||||
|
@ -215,10 +215,10 @@ func DrawCapsule(startPos, endPos Vector3, radius float32, slices, rings int32,
|
|||
// DrawCapsuleWires - Draw capsule wireframe with the center of its sphere caps at startPos and endPos
|
||||
func DrawCapsuleWires(startPos, endPos Vector3, radius float32, slices, rings int32, col color.RGBA) {
|
||||
cstartPos := startPos.cptr()
|
||||
cendPos := startPos.cptr()
|
||||
cendPos := endPos.cptr()
|
||||
cradius := (C.float)(radius)
|
||||
cslices := (C.int)(slices)
|
||||
crings := (C.int)(slices)
|
||||
crings := (C.int)(rings)
|
||||
ccolor := colorCptr(col)
|
||||
C.DrawCapsuleWires(*cstartPos, *cendPos, cradius, cslices, crings, *ccolor)
|
||||
}
|
||||
|
@ -368,19 +368,19 @@ func DrawBillboardPro(camera Camera, texture Texture2D, sourceRec Rectangle, pos
|
|||
|
||||
// List of VaoIDs of meshes created by calling UploadMesh()
|
||||
// Used by UnloadMesh() to determine if mesh is go-managed or C-allocated
|
||||
var goManagedMeshIDs []uint32 = make([]uint32, 0)
|
||||
var goManagedMeshIDs = make([]uint32, 0)
|
||||
|
||||
// UploadMesh - Upload vertex data into a VAO (if supported) and VBO
|
||||
func UploadMesh(mesh *Mesh, dynamic bool) {
|
||||
//check if mesh has already been uploaded to prevent duplication
|
||||
// check if mesh has already been uploaded to prevent duplication
|
||||
if mesh.VaoID != 0 {
|
||||
TraceLog(LogWarning, "VAO: [ID %d] Trying to re-load an already loaded mesh", mesh.VaoID)
|
||||
return
|
||||
}
|
||||
|
||||
pinner := runtime.Pinner{}
|
||||
//Mesh pointer fields must be pinned to allow a Mesh pointer to be passed to C.UploadMesh() below
|
||||
//nil checks are required because Pin() will panic if passed nil
|
||||
// Mesh pointer fields must be pinned to allow a Mesh pointer to be passed to C.UploadMesh() below
|
||||
// nil checks are required because Pin() will panic if passed nil
|
||||
if mesh.Vertices != nil {
|
||||
pinner.Pin(mesh.Vertices)
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ func UploadMesh(mesh *Mesh, dynamic bool) {
|
|||
if mesh.BoneWeights != nil {
|
||||
pinner.Pin(mesh.BoneWeights)
|
||||
}
|
||||
//VboID of a new mesh should always be nil before uploading, but including this in case a mesh happens to have it set.
|
||||
// VboID of a new mesh should always be nil before uploading, but including this in case a mesh happens to have it set.
|
||||
if mesh.VboID != nil {
|
||||
pinner.Pin(mesh.VboID)
|
||||
}
|
||||
|
@ -422,7 +422,7 @@ func UploadMesh(mesh *Mesh, dynamic bool) {
|
|||
cMesh := mesh.cptr()
|
||||
C.UploadMesh(cMesh, C.bool(dynamic))
|
||||
|
||||
//Add new mesh VaoID to list
|
||||
// Add new mesh VaoID to list
|
||||
goManagedMeshIDs = append(goManagedMeshIDs, mesh.VaoID)
|
||||
|
||||
pinner.Unpin()
|
||||
|
@ -438,10 +438,10 @@ func UpdateMeshBuffer(mesh Mesh, index int, data []byte, offset int) {
|
|||
|
||||
// UnloadMesh - Unload mesh from memory (RAM and/or VRAM)
|
||||
func UnloadMesh(mesh *Mesh) {
|
||||
//Check list of go-managed mesh IDs
|
||||
// Check list of go-managed mesh IDs
|
||||
if slices.Contains(goManagedMeshIDs, mesh.VaoID) {
|
||||
//C.UnloadMesh() only needs to read the VaoID & VboID
|
||||
//passing a temporary struct with all other fields nil makes it safe for the C code to call free()
|
||||
// C.UnloadMesh() only needs to read the VaoID & VboID
|
||||
// passing a temporary struct with all other fields nil makes it safe for the C code to call free()
|
||||
tempMesh := Mesh{
|
||||
VaoID: mesh.VaoID,
|
||||
VboID: mesh.VboID,
|
||||
|
@ -449,7 +449,7 @@ func UnloadMesh(mesh *Mesh) {
|
|||
cmesh := tempMesh.cptr()
|
||||
C.UnloadMesh(*cmesh)
|
||||
|
||||
//remove mesh VaoID from list
|
||||
// remove mesh VaoID from list
|
||||
goManagedMeshIDs = slices.DeleteFunc(goManagedMeshIDs, func(id uint32) bool { return id == mesh.VaoID })
|
||||
} else {
|
||||
cmesh := mesh.cptr()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue