From 698c972d9fd3b024435f6b7a48195b519213f5bc Mon Sep 17 00:00:00 2001 From: jackji Date: Tue, 22 Jun 2021 22:10:29 +0800 Subject: [PATCH] remove LocationPointType and MaterialMapType, remain using const values --- raylib/raylib.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/raylib/raylib.go b/raylib/raylib.go index 845df84..06f8df8 100644 --- a/raylib/raylib.go +++ b/raylib/raylib.go @@ -716,10 +716,8 @@ const ( ) // Shader location point type -type LocationPointType int32 - const ( - LocVertexPosition LocationPointType = iota + LocVertexPosition = iota LocVertexTexcoord01 LocVertexTexcoord02 LocVertexNormal @@ -748,10 +746,8 @@ const ( ) // Material map type -type MaterialMapType int32 - const ( - MapAlbedo MaterialMapType = iota + MapAlbedo = iota MapMetalness MapNormal MapRoughness @@ -835,7 +831,7 @@ func newMaterialFromPointer(ptr unsafe.Pointer) Material { } // GetMap - Get pointer to MaterialMap by map type -func (mt Material) GetMap(index MaterialMapType) *MaterialMap { +func (mt Material) GetMap(index int32) *MaterialMap { return (*MaterialMap)(unsafe.Pointer(uintptr(unsafe.Pointer(mt.Maps)) + uintptr(index)*uintptr(unsafe.Sizeof(MaterialMap{})))) } @@ -930,12 +926,12 @@ func newShaderFromPointer(ptr unsafe.Pointer) Shader { } // GetLocation - Get shader value's location -func (sh Shader) GetLocation(index LocationPointType) int32 { +func (sh Shader) GetLocation(index int32) int32 { return *(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(sh.Locs)) + uintptr(index*4))) } // UpdateLocation - Update shader value's location -func (sh Shader) UpdateLocation(index LocationPointType, loc int32) { +func (sh Shader) UpdateLocation(index int32, loc int32) { *(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(sh.Locs)) + uintptr(index*4))) = loc }