Esempio n. 1
0
void sceneLightEnum(INode* node, SContext* sc, MtlBaseLib* mtls)
{
	// For each child of this node, we recurse into ourselves 
	// until no more children are found.
	for (int c = 0; c < node->NumberOfChildren(); c++) {
		sceneLightEnum(node->GetChildNode(c), sc, mtls);
	}

	// Get the ObjectState.
	// The ObjectState is the structure that flows up the pipeline.
	// It contains a matrix, a material index, some flags for channels,
	// and a pointer to the object in the pipeline.
	ObjectState ostate = node->EvalWorldState(0);
	if (ostate.obj==NULL) 
		return;

	// Examine the superclass ID in order to figure out what kind
	// of object we are dealing with.
	if (ostate.obj->SuperClassID() == LIGHT_CLASS_ID) {
		// Get the light object from the ObjectState
		LightObject *light = (LightObject*)ostate.obj;

		// Is this light turned on?
		if (light->GetUseLight()) {
			// Create a RenderLight and append it to our list of lights
            // to fix compiler error
            LightInfo* li = new LightInfo(node, mtls);
            sc->lightTab.Append(1, &(li));
			//sc->lightTab.Append(1, &(new LightInfo(node, mtls)));
		}
	}
}