Game Development Community

HELP !! howto install light for InteriorMap?

by kingkong · in Torque Game Engine · 01/11/2007 (7:52 pm) · 1 replies

I just notice that there is InteriorMap Object which can read (*.MAP) file.

i want to use this object for building lego blocks and users can paint with tile texture and save it.

but i don't know how to install light for this..

can anybody help??

void InteriorMap::renderObject(SceneState* state, SceneRenderImage*)
{
	// Check we are in Canonical State.
	AssertFatal(dglIsInCanonicalState(), "Error, GL not in canonical state on entry");

	// Save state.
	RectI viewport;

	glColor4f(1.0f, 1.0f,1.0f, 1.0f);

   if (mEnableLights && mRenderMode != BrushColors && mRenderMode != FaceColors && mRenderMode != BspPolys && mRenderMode != CollisionHulls)
   {
      ColorF oneColor(1,1,1,1);
      glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, oneColor);
	  gClientSceneGraph->getLightManager()->sgSetupLights(this);
   }
	

   // Save Projection Matrix so we can restore Canonical state at exit.
	glMatrixMode(GL_PROJECTION);
	glPushMatrix();

	// Save Viewport so we can restore Canonical state at exit.
	dglGetViewport(&viewport);

	// Setup the projection to the current frustum.
	//
	// NOTE:-	You should let the SceneGraph drive the frustum as it
	//			determines portal clipping etc.
	//			It also leaves us with the MODELVIEW current.
	//
	state->setupBaseProjection();

	// Save ModelView Matrix so we can restore Canonical state at exit.
	glPushMatrix();

	// Transform by the objects' transform e.g move it.
	dglMultMatrix(&getTransform());
   
	//glScalef(mObjScale.x, mObjScale.y, mObjScale.z);
   glScalef(mObjScale.x * mInteriorRes->mBrushScale, mObjScale.y * mInteriorRes->mBrushScale, mObjScale.z * mInteriorRes->mBrushScale);

	// I separated out the actual render function to make this a little cleaner
   if (mRenderMode != Edges && mRenderMode != BspPolys && mRenderMode != CollisionHulls)
	   render();

   if (mEnableLights && mRenderMode != BrushColors && mRenderMode != FaceColors && mRenderMode != BspPolys && mRenderMode != CollisionHulls)
      gClientSceneGraph->getLightManager()->sgResetLights();


	// Restore our canonical matrix state.
	glPopMatrix();
	glMatrixMode(GL_PROJECTION);
	glPopMatrix();
	glMatrixMode(GL_MODELVIEW);
	// Restore our canonical viewport state.
	dglSetViewport(viewport);

	// Check we have restored Canonical State.
	AssertFatal(dglIsInCanonicalState(), "Error, GL not in canonical state on exit");
}


thanks.

#1
01/12/2007 (10:19 am)
You're question is a little vague, but there are several ways to light interiors.

Firstly, you can just add a light, the object sgLightObject, through the mission editor and place it inside the interior. Alternatively, you can place a 'light_omni' inside the map itself and have the lightmap embedded in the dif itself.

Or is this not what you are looking for?