Add api and example for mesh drawing.
This commit is contained in:
parent
ace572fead
commit
15ed58856b
7 changed files with 510 additions and 18 deletions
|
@ -716,8 +716,10 @@ const (
|
|||
)
|
||||
|
||||
// Shader location point type
|
||||
type LocationPointType int32
|
||||
|
||||
const (
|
||||
LocVertexPosition = iota
|
||||
LocVertexPosition LocationPointType = iota
|
||||
LocVertexTexcoord01
|
||||
LocVertexTexcoord02
|
||||
LocVertexNormal
|
||||
|
@ -746,8 +748,10 @@ const (
|
|||
)
|
||||
|
||||
// Material map type
|
||||
type MaterialMapType int32
|
||||
|
||||
const (
|
||||
MapAlbedo = iota
|
||||
MapAlbedo MaterialMapType = iota
|
||||
MapMetalness
|
||||
MapNormal
|
||||
MapRoughness
|
||||
|
@ -830,6 +834,11 @@ func newMaterialFromPointer(ptr unsafe.Pointer) Material {
|
|||
return *(*Material)(ptr)
|
||||
}
|
||||
|
||||
// GetMap - Get pointer to MaterialMap by map type
|
||||
func (mt Material) GetMap(index MaterialMapType) *MaterialMap {
|
||||
return (*MaterialMap)(unsafe.Pointer(uintptr(unsafe.Pointer(mt.Maps)) + uintptr(index)*uintptr(unsafe.Sizeof(MaterialMap{}))))
|
||||
}
|
||||
|
||||
// MaterialMap type
|
||||
type MaterialMap struct {
|
||||
// Texture
|
||||
|
@ -920,6 +929,16 @@ func newShaderFromPointer(ptr unsafe.Pointer) Shader {
|
|||
return *(*Shader)(ptr)
|
||||
}
|
||||
|
||||
// GetLocation - Get shader value's location
|
||||
func (sh Shader) GetLocation(index LocationPointType) 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) {
|
||||
*(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(sh.Locs)) + uintptr(index*4))) = loc
|
||||
}
|
||||
|
||||
// CharInfo - Font character info
|
||||
type CharInfo struct {
|
||||
// Character value (Unicode)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue