Environment Mapping (esp. for GuiObjectView)
by Robert Nall · in Torque Game Engine · 08/02/2004 (9:39 am) · 2 replies
Hey all, I was hoping to get some direction into enabling environment mapping in the guiObjectView resource. I noticed showTSShape had some code for emaps, but I don't know enough about openGl to figure out how it's supposed to work and my copy and paste attempt at implementing the showTSShape emaps in GuiObjectView didn't work out ;) So, if anyone out there happens to know a thing or two about emapping, I'd appreciate some help with this.
Thanks,
-rob
Thanks,
-rob
Torque Owner Robert Nall
In GuiObjectView.cc near the top after the other globals I put in my emap globals:
... static const S32 MaxAnimations = 6; // emap additions //change this to point to your environment map const char * emapMatName[] = { "starter.racing/data/skies/guiView_env.jpg" }; MaterialList emapMatList(1,emapMatName); //end emap additions IMPLEMENT_CONOBJECT( GuiObjectView ); ...Go down to GuiObjectView::meshObjects::load() and after the skin loading code add in these three lines:
... materialList->mMaterials[0] = texture; } // emap additions emapMatList.load(MeshTexture,0,true); mMesh[index].mesh->setEnvironmentMap(emapMatList.getMaterial(0)); mMesh[index].mesh->setEnvironmentMapOn(true, 2.0); // second number sets the level of emap (0 = off) // end of emap additions if (pNode == -1) ...And that should be it. It turned out to be much easier than I thought. Hope someone else finds it useful ^_^
Ciao
-rob