-
-
Notifications
You must be signed in to change notification settings - Fork 26
Models
A Model is a set of verticies, grouped into triangles, that form a 3D shape. Model verticies are in local space, meaning relative to the center of the model.
Entity.MakeModel is the
entity method for loading model Assets, like model vertex data,
into the engine. MakeModel relies on convention in order to combine multiple
assets into a renderable model.
eng.ImportAssets("pbr0.shd", "monkey0.glb") // load assets
scene := eng.AddScene(vu.Scene3D) // create scene
mh := scene.AddModel("shd:pbr0", "msh:monkey0", "mat:monkey0") // create model from assets
^ ^ ^
| | └ material
| └ mesh vertices
└ shader Asset names are based on the file they were loaded from.
In this example the model mesh and and material assets were loaded from
the monkey0.glb file.
Different combinations of shaders and 3D assets, produce different visual effects.
A model Entity has a location in 3D space. The location can be set once for
static objects or continuously updated for dynamic objects. Changing the
location of a model affects any children models.
See Entity.SetAt
Similarly a the model orientation can be changed.
See Entity.SetSpin
Changing the default scale (1,1,1) of a model also affects any children.
Scaling values larger than 1 make an model larger. Use positive fractional amounts,
between 0 and 1, to make a model smaller.
See Entity.SetScale
A model can have child models or other entities, ie:
Entity.AddModel method
on an existing model. Any position or orientation changes to a parent
also apply to all children.
Culling is used to control which models are rendered to a scene at any given time.
A model can be culled which removes the model and all its children from rendering.
See Entity.Cull