Public Member Functions | Properties

CC3MeshNode Class Reference

A CC3Node that draws a 3D mesh model. More...

#import <CC3MeshNode.h>

Inheritance diagram for CC3MeshNode:
CC3LocalContentNode CC3Node CC3Identifiable CC3PODMeshNode

List of all members.

Public Member Functions

(void) - draw
(void) - populateAsCenteredRectangleWithSize:andTexture:
(void) - populateAsRectangleWithSize:andPivot:andTexture:

Properties

ccColor3B color
CC3Materialmaterial
CC3MeshModelmeshModel
GLubyte opacity

Detailed Description

This class forms the base of all visible 3D mesh models in the 3D world.

CC3MeshNode is a type of CC3Node, and will often participate in a structural node assembly. An instance can be the child of another node, and the mesh node itself can have child nodes.

CC3MeshNodes encapsulate both a CC3Material instance and a CC3MeshModel instance. The CC3Material instance describes the material and texture properties covering the mesh, and the CC3MeshModel instance contains the mesh vertex data. When this node is drawn, it delegates to both the material and mesh model instances.

Each CC3MeshNode can have only one material. For large, complicated meshes that are covered by more than one material, the mesh must be broken into smaller meshes, each of which are covered by a single material. These smaller sub-meshes are sometimes referred to as "vertex groups". Each such sub-mesh is then wrapped in its own CC3MeshNode instance, along with the material that covers that sub-mesh. These CC3MeshNode instances can then be added as child nodes to a single parent CC3Node instance. This parent CC3Node can then be moved, rotated and scaled, and all of its child nodes will transform in sync. The assembly will behave and be seen as a single object.


Member Function Documentation

- (void) draw

Draws the content by invoking the following methods in this order:

  1. the draw method of the encapsulated material instance, or the CC3Material class-side unbind method if no material is associated with this node
  2. the draw method of the encapsulated mesh model.

This method is called automatically from the transformAndDraw method of this node. Usually, the application never needs to invoke this method directly.

- (void) populateAsCenteredRectangleWithSize: (CGSize)  rectSize
andTexture: (CC3Texture *)  texture 

Populates this instance as a simple textured rectangular mesh of the specified size, centered at the origin, and laid out on the X-Y plane.

As this node is translated, rotate and scaled, the textured rectangle will be re-oriented in 3D space.

This is a convenience method for creating a simple, but useful shape, which can be used to create walls, floors, etc.

- (void) populateAsRectangleWithSize: (CGSize)  rectSize
andPivot: (CGPoint)  pivot
andTexture: (CC3Texture *)  texture 

Populates this instance as a simple textured rectangular mesh of the specified size, with the specified pivot point at the origin, and laid out on the X-Y plane.

The pivot point can be any point within the rectangle's size. For example, if the pivot point is {0, 0}, the rectangle will be laid out so that the bottom-left corner is at the origin. Or, if the pivot point is in the center of the rectangle's size, the rectangle will be laid out centered on the origin, as in the populateAsCenteredRectangleWithSize:andTexture: method.

As this node is translated, rotate and scaled, the textured rectangle will be re-oriented in 3D space.

This is a convenience method for creating a simple, but useful shape, which can be used to create walls, floors, etc.


Property Documentation

- (ccColor3B) color [read, write, assign]

Implementation of the CCRGBAProtocol color property.

When setting this property, the RGB values are each converted to a floating point number between 0 and 1, and are set into both the ambientColor and diffuseColor properties of this node's material. The alpha of each of those properties remains unchanged.

Querying this property returns the RGB components of the material's diffuseColor property, converted from the floating point range (0 to 1), to the byte range (0 to 255).

- (CC3Material *) material [read, write, retain]

The material covering this mesh node.

- (CC3MeshModel *) meshModel [read, write, retain]

The mesh model that holds the vertex data for this mesh node.

- (GLubyte) opacity [read, write, assign]

Implementation of the CCRGBAProtocol opacity property.

When setting this property, the value is converted to a floating point number between 0 and 1, and is set into all of the ambientColor, diffuseColor, specularColor, and emissionColor properties of this node's material. The RGB components of each of those properties remains unchanged.

Querying this property returns the alpha component of the material's diffuseColor property, converted from the floating point range (0 to 1), to the byte range (0 to 255).


The documentation for this class was generated from the following file: