Models and Meshes

To use Wasabi Scenegraph effectively you should be familiar with the following terminology.

material
A dictionary of parameters that configure the appearance of a mesh.
mesh
A collection of geometry that is drawn with the same material. A mesh is made up of vertices, normals, texture coordinates etc. Each mesh is associated with exactly one material.
model
A collection of meshes. Not to be confused with a model node, this is a template that can be instantiated into the scene several times.
model node
An instance of a model that can appear in the scene.

Models and Materials

class wasabisg.model.Model(meshes=, []name=None)[source]
class wasabisg.model.Material[source]

A bunch of attributes relating to display of a Mesh.

Model Loading

The simplest way of getting a custom model into Wasabi Scenegraph is to load it from a .obj file. This is a text representation that can be exported by most 3D graphics programs.

.obj files are associated with a .mtl file that contains named material definitions. The ObjFileLoader will load models together with the associated materials from a .mtl file.

class wasabisg.loaders.objloader.ObjFileLoader[source]

Load models from Wavefront .obj files.

load_obj(filename, swapyz=False)[source]

Load a Wavefront OBJ file and return a Model.

Generated Meshes

Meshes are a collection of vertex, normal and texture coordinate data that are associated with a Material. If necessary a Mesh can be constructed procedurally. Note that if you want to construct simple 3D shapes such as spheres or planes, then concrete subclasses are available to construct these for you.

class wasabisg.model.Mesh(mode, vertices, normals, texcoords, indices, material, name=None)[source]

A bunch of geometry, with linked materials.

3D Primitive Meshes

class wasabisg.plane.Quad(points=[Point3(-1.00, 0.00, -1.00), Point3(-1.00, 0.00, 1.00), Point3(1.00, 0.00, 1.00), Point3(1.00, 0.00, 0.00)], normals=None, material=None)[source]

A single quad.

points should be a list of 4 coplanar euclid.Point3 that represent the vertices of the quad.

normals should be a list of 4 euclid.Vector3. If omitted or None, then these will be computed such that the quad is shaded as flat.

class wasabisg.plane.Plane(center=Point3(0.00, 0.00, 0.00), normal=Vector3(0.00, 1.00, 0.00), size=1000.0, divisions=1, material=None)[source]

Construct a single square mesh.

If divisions == 1, then this will be a single quad, otherwise the quad will be subdivided that number of times in each direction. For example, if divisions == 4 then the Plane mesh will consist of 16 squares.

class wasabisg.sphere.Sphere(radius=1, inside=False, latitude_divisions=20, longitude_divisions=40, material=None)[source]

Construct a Mesh that is a 3D UV sphere.

If inside is given then the normals and vertex winding will be reversed such that the camera will render the inside of the sphere rather than the outside. This is useful for skydomes etc.

Table Of Contents

Previous topic

Scenegraph Classes

Next topic

Modelling with Blender

This Page