Add new functions
This commit is contained in:
parent
f1fde08917
commit
c930274575
3 changed files with 24 additions and 65 deletions
|
@ -316,6 +316,22 @@ func UnloadMaterial(material Material) {
|
||||||
C.UnloadMaterial(*cmaterial)
|
C.UnloadMaterial(*cmaterial)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetMaterialTexture - Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...)
|
||||||
|
func SetMaterialTexture(material *Material, mapType int32, texture Texture2D) {
|
||||||
|
cmaterial := material.cptr()
|
||||||
|
cmapType := (C.int)(mapType)
|
||||||
|
ctexture := texture.cptr()
|
||||||
|
C.SetMaterialTexture(cmaterial, cmapType, *ctexture)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetModelMeshMaterial - Set material for a mesh
|
||||||
|
func SetModelMeshMaterial(model *Model, meshId int32, materialId int32) {
|
||||||
|
cmodel := model.cptr()
|
||||||
|
cmeshId := (C.int)(meshId)
|
||||||
|
cmaterialId := (C.int)(materialId)
|
||||||
|
C.SetModelMeshMaterial(cmodel, cmeshId, cmaterialId)
|
||||||
|
}
|
||||||
|
|
||||||
// DrawModel - Draw a model (with texture if set)
|
// DrawModel - Draw a model (with texture if set)
|
||||||
func DrawModel(model Model, position Vector3, scale float32, tint Color) {
|
func DrawModel(model Model, position Vector3, scale float32, tint Color) {
|
||||||
cmodel := model.cptr()
|
cmodel := model.cptr()
|
||||||
|
|
|
@ -706,9 +706,10 @@ const (
|
||||||
LocVertexTangent
|
LocVertexTangent
|
||||||
LocVertexColor
|
LocVertexColor
|
||||||
LocMatrixMvp
|
LocMatrixMvp
|
||||||
LocMatrixModel
|
|
||||||
LocMatrixView
|
LocMatrixView
|
||||||
LocMatrixProjection
|
LocMatrixProjection
|
||||||
|
LocMatrixModel
|
||||||
|
LocMatrixNormal
|
||||||
LocVectorView
|
LocVectorView
|
||||||
LocColorDiffuse
|
LocColorDiffuse
|
||||||
LocColorSpecular
|
LocColorSpecular
|
||||||
|
@ -736,13 +737,10 @@ const (
|
||||||
MapOcclusion
|
MapOcclusion
|
||||||
MapEmission
|
MapEmission
|
||||||
MapHeight
|
MapHeight
|
||||||
// NOTE: Uses GL_TEXTURE_CUBE_MAP
|
MapBrdg
|
||||||
MapCubemap
|
MapCubemap
|
||||||
// NOTE: Uses GL_TEXTURE_CUBE_MAP
|
|
||||||
MapIrradiance
|
MapIrradiance
|
||||||
// NOTE: Uses GL_TEXTURE_CUBE_MAP
|
|
||||||
MapPrefilter
|
MapPrefilter
|
||||||
MapBrdf
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Material map type
|
// Material map type
|
||||||
|
@ -807,7 +805,7 @@ type Material struct {
|
||||||
// Maps
|
// Maps
|
||||||
Maps [MaxMaterialMaps]MaterialMap
|
Maps [MaxMaterialMaps]MaterialMap
|
||||||
// Generic parameters (if required)
|
// Generic parameters (if required)
|
||||||
Params *float32
|
Params [4]float32
|
||||||
}
|
}
|
||||||
|
|
||||||
// newMaterialFromPointer - Returns new Material from pointer
|
// newMaterialFromPointer - Returns new Material from pointer
|
||||||
|
@ -829,13 +827,13 @@ type Model struct {
|
||||||
// Local transform matrix
|
// Local transform matrix
|
||||||
Transform Matrix
|
Transform Matrix
|
||||||
MeshCount int32
|
MeshCount int32
|
||||||
Meshes []Mesh
|
|
||||||
MaterialCount int32
|
MaterialCount int32
|
||||||
Materials []Material
|
Meshes *Mesh
|
||||||
|
Materials *Material
|
||||||
MeshMaterial *int32
|
MeshMaterial *int32
|
||||||
BoneCount int32
|
BoneCount int32
|
||||||
Bones []BoneInfo
|
Bones *BoneInfo
|
||||||
BindPose []Transform
|
BindPose *Transform
|
||||||
}
|
}
|
||||||
|
|
||||||
// newModelFromPointer - Returns new Model from pointer
|
// newModelFromPointer - Returns new Model from pointer
|
||||||
|
@ -874,56 +872,6 @@ func newRayFromPointer(ptr unsafe.Pointer) Ray {
|
||||||
return *(*Ray)(ptr)
|
return *(*Ray)(ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// VrDevice type
|
|
||||||
type VrDevice int32
|
|
||||||
|
|
||||||
// Head Mounted Display devices
|
|
||||||
const (
|
|
||||||
HmdDefaultDevice VrDevice = iota
|
|
||||||
HmdOculusRiftDk2
|
|
||||||
HmdOculusRiftCv1
|
|
||||||
HmdOculusGo
|
|
||||||
HmdValveHtcVive
|
|
||||||
HmdSonyPsvr
|
|
||||||
)
|
|
||||||
|
|
||||||
// VrDeviceInfo - Head-Mounted-Display device parameters
|
|
||||||
type VrDeviceInfo struct {
|
|
||||||
// HMD horizontal resolution in pixels
|
|
||||||
HResolution int32
|
|
||||||
// HMD vertical resolution in pixels
|
|
||||||
VResolution int32
|
|
||||||
// HMD horizontal size in meters
|
|
||||||
HScreenSize float32
|
|
||||||
// HMD vertical size in meters
|
|
||||||
VScreenSize float32
|
|
||||||
// HMD screen center in meters
|
|
||||||
VScreenCenter float32
|
|
||||||
// HMD distance between eye and display in meters
|
|
||||||
EyeToScreenDistance float32
|
|
||||||
// HMD lens separation distance in meters
|
|
||||||
LensSeparationDistance float32
|
|
||||||
// HMD IPD (distance between pupils) in meters
|
|
||||||
InterpupillaryDistance float32
|
|
||||||
// HMD lens distortion constant parameters
|
|
||||||
LensDistortionValues [4]float32
|
|
||||||
// HMD chromatic aberration correction parameters
|
|
||||||
ChromaAbCorrection [4]float32
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewVrDeviceInfo - Returns new VrDeviceInfo
|
|
||||||
func NewVrDeviceInfo(hResolution, vResolution int32, hScreenSize, vScreenSize, vScreenCenter, eyeToScreenDistance,
|
|
||||||
lensSeparationDistance, interpupillaryDistance float32, lensDistortionValues, chromaAbCorrection [4]float32) VrDeviceInfo {
|
|
||||||
|
|
||||||
return VrDeviceInfo{hResolution, vResolution, hScreenSize, vScreenSize, vScreenCenter, eyeToScreenDistance,
|
|
||||||
lensSeparationDistance, interpupillaryDistance, lensDistortionValues, chromaAbCorrection}
|
|
||||||
}
|
|
||||||
|
|
||||||
// newVrDeviceInfoFromPointer - Returns new VrDeviceInfo from pointer
|
|
||||||
func newVrDeviceInfoFromPointer(ptr unsafe.Pointer) VrDeviceInfo {
|
|
||||||
return *(*VrDeviceInfo)(ptr)
|
|
||||||
}
|
|
||||||
|
|
||||||
// BlendMode type
|
// BlendMode type
|
||||||
type BlendMode int32
|
type BlendMode int32
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,6 @@ import "C"
|
||||||
import "unsafe"
|
import "unsafe"
|
||||||
import "reflect"
|
import "reflect"
|
||||||
|
|
||||||
// cptr returns C pointer
|
|
||||||
func (v *VrDeviceInfo) cptr() *C.VrDeviceInfo {
|
|
||||||
return (*C.VrDeviceInfo)(unsafe.Pointer(v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// cptr returns C pointer
|
// cptr returns C pointer
|
||||||
func (s *Shader) cptr() *C.Shader {
|
func (s *Shader) cptr() *C.Shader {
|
||||||
return (*C.Shader)(unsafe.Pointer(s))
|
return (*C.Shader)(unsafe.Pointer(s))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue