Switch to mostly returning objects instead of pointers since

almost all objects contain only one pointer inside, making them
very small, so no point paying (de)allocation costs.

This has also been done to physx-c
This commit is contained in:
bloeys
2022-12-19 00:43:04 +04:00
parent 96c55ad30d
commit a01e4b6bbd
22 changed files with 221 additions and 177 deletions

View File

@ -14,7 +14,7 @@ package pgo
import "C"
type RigidDynamic struct {
cRd *C.struct_CPxRigidDynamic
cRd C.struct_CPxRigidDynamic
}
func (rd *RigidDynamic) AddForce(force *Vec3, fmode ForceMode, autoAwake bool) {
@ -121,8 +121,8 @@ func (rd *RigidDynamic) ToRigidActor() RigidActor {
}
}
func CreateDynamic(p *Physics, t *Transform, g *Geometry, m *Material, density float32, shapeOffset *Transform) *RigidDynamic {
return &RigidDynamic{
func CreateDynamic(p Physics, t *Transform, g Geometry, m Material, density float32, shapeOffset *Transform) RigidDynamic {
return RigidDynamic{
cRd: C.CPxCreateDynamic(p.cPhysics, &t.cT, g.cG, m.cM, C.float(density), &shapeOffset.cT),
}
}