Index: /GTP/trunk/App/Demos/Illum/Ogre/src/Moria/include/Moria.h
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/src/Moria/include/Moria.h	(revision 2377)
+++ /GTP/trunk/App/Demos/Illum/Ogre/src/Moria/include/Moria.h	(revision 2388)
@@ -24,8 +24,11 @@
 #include "ExampleApplication.h"
 #include "OgreIlluminationManager.h"
+#include "NXOgre.h"
 #include "SceneSerializer.h"
 
 AnimationState* mAnimState;
 bool cullCamera = true;
+Body *throwSphere = 0;
+Scene* NXScene = 0;
 
 // Listener class for frame updates
@@ -72,10 +75,21 @@
 	bool processUnbufferedKeyInput(const FrameEvent& evt)
     {
-		/*if (mInputDevice->isKeyDown(KC_C)&& mTimeUntilNextToggle <= 0)
-        {
-			cullCamera = ! cullCamera;
-			Root::getSingleton()._getCurrentSceneManager()->setOption("CullCamera", &cullCamera);
-			mTimeUntilNextToggle = 1;
-		}*/
+		
+		if (mInputDevice->isKeyDown(KC_SPACE)) {
+						
+			if(throwSphere == 0)
+			{
+				throwSphere = NXScene->createBody("throwSphere",
+													"sphere.mesh",
+													new SphereShape(0.5f),
+													Vector3(0,0,0),
+													"mass: 10");
+				throwSphere->getNode()->setScale(0.005,0.005,0.005);
+			}
+			//myCube->
+			throwSphere->setGlobalPosition(mCamera->getPosition());
+			throwSphere->addForce(mCamera->getDirection()*200);
+	
+		}
 		return ExampleFrameListener::processUnbufferedKeyInput(evt);
 	}
@@ -170,6 +184,19 @@
 		DataStreamPtr inputStream; 				
 		inputStream = ResourceGroupManager::getSingleton().openResource("moria.level");	//towers2.level	
+		World* NXWorld = new World("FrameListener: yes, log: html");
+		NXScene = NXWorld->createScene("Main", mSceneMgr, "gravity: yes, floor: yes"); 
+		s.setScene(NXScene);
+		s.setWorld(NXWorld);
 		s.parseScript(inputStream, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
 		s.parseEntryPoints("prmEntryPoints.text");
+/*
+		Body* b = NXScene->createBody("ize",
+							"sphere.mesh",
+							new SphereShape(0.5f),
+							Vector3(5,0,5),
+							"mass: 10");
+		b->getNode()->setScale(0.005,0.005,0.005);
+		b->setGlobalPosition(Vector3(5,10,5));*/
+
 /*
 	   ParticleSystem* pSys1 = mSceneMgr->createParticleSystem("psys1", "GTP/Moria/Smoke_Large");
Index: /GTP/trunk/App/Demos/Illum/Ogre/src/Moria/scripts/Moria.7.10.vcproj
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/src/Moria/scripts/Moria.7.10.vcproj	(revision 2315)
+++ /GTP/trunk/App/Demos/Illum/Ogre/src/Moria/scripts/Moria.7.10.vcproj	(revision 2388)
@@ -21,6 +21,6 @@
 				Optimization="0"
 				ImproveFloatingPointConsistency="TRUE"
-				AdditionalIncludeDirectories="..\include;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderingRuns;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderingRuns;..\..\Common\include"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;GAMETOOLS_ILLUMINATION_MODULE;GTP_VISIBILITY_MODIFIED_OGRE"
+				AdditionalIncludeDirectories="..\include;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderingRuns;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderingRuns;..\..\Common\include;&quot;$(NXOGRE_PATH)\include&quot;;&quot;$(PHYSX_DIR)\SDKs\Physics\include&quot;;&quot;$(PHYSX_DIR)\SDKs\Foundation\include&quot;;&quot;$(PHYSX_DIR)\SDKs\Cooking\include&quot;;&quot;$(PHYSX_DIR)\SDKs\NxCharacter\include&quot;;&quot;$(PHYSX_DIR)\SDKs\PhysXLoader\include&quot;"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;GAMETOOLS_ILLUMINATION_MODULE;GTP_VISIBILITY_MODIFIED_OGRE;NXOGRE"
 				MinimalRebuild="TRUE"
 				BasicRuntimeChecks="3"
@@ -35,8 +35,8 @@
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="OgreMain_d.lib IllumModule_Ogre.lib IllumModule.lib"
+				AdditionalDependencies="OgreMain_d.lib IllumModule_Ogre.lib IllumModule.lib NxOgre_d.lib"
 				OutputFile="$(OutDir)/Moria.exe"
 				LinkIncremental="2"
-				AdditionalLibraryDirectories="..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\bin\Debug;&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\bin\Debug"
+				AdditionalLibraryDirectories="..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\bin\Debug;&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\bin\Debug;&quot;$(NXOGRE_PATH)/lib&quot;"
 				IgnoreDefaultLibraryNames=""
 				GenerateDebugInformation="TRUE"
@@ -86,6 +86,6 @@
 				OptimizeForProcessor="2"
 				OptimizeForWindowsApplication="TRUE"
-				AdditionalIncludeDirectories="..\include;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderingRuns;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderingRuns;..\..\Common\include"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;GAMETOOLS_ILLUMINATION_MODULE;GTP_VISIBILITY_MODIFIED_OGRE"
+				AdditionalIncludeDirectories="..\include;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderingRuns;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderingRuns;..\..\Common\include;&quot;$(NXOGRE_PATH)\include&quot;;&quot;$(PHYSX_DIR)\SDKs\Physics\include&quot;;&quot;$(PHYSX_DIR)\SDKs\Foundation\include&quot;;&quot;$(PHYSX_DIR)\SDKs\Cooking\include&quot;;&quot;$(PHYSX_DIR)\SDKs\NxCharacter\include&quot;;&quot;$(PHYSX_DIR)\SDKs\PhysXLoader\include&quot;"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;GAMETOOLS_ILLUMINATION_MODULE;GTP_VISIBILITY_MODIFIED_OGRE;NXOGRE"
 				StringPooling="TRUE"
 				MinimalRebuild="TRUE"
@@ -101,8 +101,8 @@
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="OgreMain.lib IllumModule_Ogre.lib IllumModule.lib"
+				AdditionalDependencies="OgreMain.lib IllumModule_Ogre.lib IllumModule.lib NxOgre.lib"
 				OutputFile="$(OutDir)/Moria.exe"
 				LinkIncremental="1"
-				AdditionalLibraryDirectories="..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\bin\Release;&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\bin\Release"
+				AdditionalLibraryDirectories="..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\bin\Release;&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\bin\Release;&quot;$(NXOGRE_PATH)\lib&quot;"
 				GenerateDebugInformation="FALSE"
 				SubSystem="2"
Index: /GTP/trunk/App/Demos/Illum/Ogre/src/Common/include/SceneSerializer.h
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/src/Common/include/SceneSerializer.h	(revision 2186)
+++ /GTP/trunk/App/Demos/Illum/Ogre/src/Common/include/SceneSerializer.h	(revision 2388)
@@ -1,3 +1,8 @@
 #include "Ogre.h"
+
+#ifdef NXOGRE
+#include "NXOgre.h"
+using namespace NxOgre;
+#endif
 
 using namespace Ogre;
@@ -22,5 +27,17 @@
 	SceneNode* sceneNode;
 	std::map<String, String> meshFiles;	
-	std::map<String, unsigned int> pathMapResolutions;	
+	std::map<String, unsigned int> pathMapResolutions;
+	
+#ifdef NXOGRE
+	std::map<String, String> meshPhysXShapes;
+	std::map<String, String> meshPhysXShapeParams;
+	//float physXMass;
+	//float physXDensity;
+	//bool physXKinematic;
+	//bool physXStatic;
+	Scene* scene;
+	World* world;
+	Body* physXBody;
+#endif
 };
 
@@ -54,3 +71,10 @@
 	void parseEntryPoints(String filename);
 
+	#ifdef NXOGRE
+		public:
+			void setScene(Scene* scene){mScriptContext.scene = scene;}
+			void setWorld(World* world){mScriptContext.world = world;}
+		
+	#endif
+
 };
Index: /GTP/trunk/App/Demos/Illum/Ogre/src/Common/src/SceneSerializer.cpp
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/src/Common/src/SceneSerializer.cpp	(revision 2367)
+++ /GTP/trunk/App/Demos/Illum/Ogre/src/Common/src/SceneSerializer.cpp	(revision 2388)
@@ -1,4 +1,4 @@
+#include "OgreIlluminationManager.h"
 #include "SceneSerializer.h"
-#include "OgreIlluminationManager.h"
 
 void logParseError(const String& error, const SceneScriptContext& context)
@@ -20,4 +20,28 @@
 }
 
+#ifdef NXOGRE
+ShapeDescription* createShape(String params)
+{
+	std::vector<String> parameters = StringUtil::split(params);
+	
+	ShapeDescription* s = 0;
+	if(parameters[0] == "cube")
+		s = new CubeShape(StringConverter::parseReal(parameters[1]),//width
+							StringConverter::parseReal(parameters[2]),//height
+							StringConverter::parseReal(parameters[3]));//depth
+	else if(parameters[0] == "sphere")
+		s = new SphereShape(StringConverter::parseReal(parameters[1]));//radius
+	else if(parameters[0] == "capsule")
+		s = new CapsuleShape(StringConverter::parseReal(parameters[1]),//radius
+								StringConverter::parseReal(parameters[2]));//height
+	else if(parameters[0] == "convex_mesh")
+		s = new ConvexShape(parameters[1]);//mesh name
+	else if(parameters[0] == "free_mesh")
+		s = new MeshShape(parameters[1]);//mesh name
+
+	return s;
+}
+#endif
+
 bool parseMeshName(String& params, SceneScriptContext& context)
 {
@@ -27,11 +51,31 @@
 	//create the Entity with the given mesh, attach to a scene node
 	StringUtil::trim(params);
-	String meshfilename = context.meshFiles[params];
+	String meshfilename = "";
+	if(context.meshFiles.count(params) != 0)
+		meshfilename = context.meshFiles[params];
 	context.meshName = params;
+
+#ifdef NXOGRE	
+	if(context.meshPhysXShapes.count(context.meshName) != 0)
+	{
+		ShapeDescription *newShape = createShape(context.meshPhysXShapes[context.meshName]);
+		//LogManager::getSingleton().logMessage("meshname: " + meshfilename);
+		context.physXBody = context.scene->createBody(context.entityName, meshfilename, newShape, Vector3(0,0,0), context.meshPhysXShapeParams[context.meshName]); 
+		context.entity = context.physXBody->getEntity();
+		context.sceneNode = context.physXBody->getNode();
+	}
+	else
+	{
+		context.entity = context.sceneManager->createEntity(context.entityName, meshfilename);
+		SceneNode* root = context.sceneManager->getRootSceneNode();
+		context.sceneNode = root->createChildSceneNode(context.entityName);
+		context.sceneNode->attachObject(context.entity);	
+	}
+#else
 	context.entity = context.sceneManager->createEntity(context.entityName, meshfilename);
 	SceneNode* root = context.sceneManager->getRootSceneNode();
 	context.sceneNode = root->createChildSceneNode(context.entityName);
-	context.sceneNode->attachObject(context.entity);
-	context.entity->setCastShadows(true);
+	context.sceneNode->attachObject(context.entity);	
+#endif	
     return false;
 }
@@ -42,5 +86,4 @@
 		logParseError("No clusters given!", context);
 
-	//create the Entity with the given mesh, attach to a scene node
 	std::vector<String> parameters = StringUtil::split(params);
 	String subentityname = context.entityName + "_SE_" + parameters[0];
@@ -57,8 +100,64 @@
 }
 
+bool parseCastShadows(String& params, SceneScriptContext& context)
+{
+	context.entity->setCastShadows(StringConverter::parseBool(params));
+
+	return false;
+}
+
+#ifdef NXOGRE
+bool parsePhysXShape(String& params, SceneScriptContext& context)
+{
+	context.meshPhysXShapes[context.meshName] = params;
+
+	return false;
+}
+
+bool parsePhysXMass(String& params, SceneScriptContext& context)
+{
+	if(context.meshPhysXShapeParams.count(context.meshName) == 0)
+		context.meshPhysXShapeParams[context.meshName] = "";
+
+	context.meshPhysXShapeParams[context.meshName] += "mass: " + params + ",";
+
+	return false;
+}
+
+bool parsePhysXDensity(String& params, SceneScriptContext& context)
+{
+	if(context.meshPhysXShapeParams.count(context.meshName) == 0)
+		context.meshPhysXShapeParams[context.meshName] = "";
+
+	context.meshPhysXShapeParams[context.meshName] += "density: " + params + ",";
+	
+	return false;
+}
+
+bool parsePhysXKinematic(String& params, SceneScriptContext& context)
+{
+	if(context.meshPhysXShapeParams.count(context.meshName) == 0)
+		context.meshPhysXShapeParams[context.meshName] = "";
+
+	context.meshPhysXShapeParams[context.meshName] += "kinematic: " + params + ",";
+	
+	return false;
+}
+
+bool parsePhysXStatic(String& params, SceneScriptContext& context)
+{
+	if(context.meshPhysXShapeParams.count(context.meshName) == 0)
+		context.meshPhysXShapeParams[context.meshName] = "";
+
+	context.meshPhysXShapeParams[context.meshName] += "static: " + params + ",";
+	
+	return false;
+}
+
+#endif
+
 bool parseTransform(String& params, SceneScriptContext& context)
 {
 	Matrix4 transformMatrix = StringConverter::parseMatrix4(params);
-	context.sceneNode->setOrientation(transformMatrix.extractQuaternion());
 	
 	Vector4 x(1,0,0,0);
@@ -68,8 +167,29 @@
 	Vector4 z(0,0,1,0);
 	z = transformMatrix * z;
+
+#ifdef NXOGRE
+	if(context.meshPhysXShapes.count(context.meshName) != 0)
+	{
+		context.sceneNode->scale((Vector3(x.x,x.y,x.z)).length(),
+								(Vector3(y.x,y.y,y.z)).length(),
+								(Vector3(z.x,z.y,z.z)).length());
+		context.physXBody->setGlobalOrientation(transformMatrix.extractQuaternion());
+		context.physXBody->setGlobalPosition(transformMatrix.getTrans());	
+	}
+	else
+	{
+		context.sceneNode->setOrientation(transformMatrix.extractQuaternion());
+		context.sceneNode->scale((Vector3(x.x,x.y,x.z)).length(),
+								(Vector3(y.x,y.y,y.z)).length(),
+								(Vector3(z.x,z.y,z.z)).length());
+		context.sceneNode->translate(transformMatrix.getTrans());
+	}
+#else
+	context.sceneNode->setOrientation(transformMatrix.extractQuaternion());
 	context.sceneNode->scale((Vector3(x.x,x.y,x.z)).length(),
 								(Vector3(y.x,y.y,y.z)).length(),
 								(Vector3(z.x,z.y,z.z)).length());
 	context.sceneNode->translate(transformMatrix.getTrans());
+#endif
 	
 	return false;
@@ -125,5 +245,13 @@
 	mEntityAttribParsers.insert(AttribParserList::value_type("subentity", (SCENE_ATTRIBUTE_PARSER)parseClusters));
 	mEntityAttribParsers.insert(AttribParserList::value_type("pathmapfile", (SCENE_ATTRIBUTE_PARSER)parsePRMMapName));
-
+	mEntityAttribParsers.insert(AttribParserList::value_type("castShadows", (SCENE_ATTRIBUTE_PARSER)parseCastShadows));
+
+	#ifdef NXOGRE
+	mMeshAttribParsers.insert(AttribParserList::value_type("physXShape", (SCENE_ATTRIBUTE_PARSER)parsePhysXShape));
+	mMeshAttribParsers.insert(AttribParserList::value_type("physXMass", (SCENE_ATTRIBUTE_PARSER)parsePhysXMass));
+	mMeshAttribParsers.insert(AttribParserList::value_type("physXDensity", (SCENE_ATTRIBUTE_PARSER)parsePhysXDensity));
+	mMeshAttribParsers.insert(AttribParserList::value_type("physXKinematic", (SCENE_ATTRIBUTE_PARSER)parsePhysXKinematic));
+	mMeshAttribParsers.insert(AttribParserList::value_type("physXStatic", (SCENE_ATTRIBUTE_PARSER)parsePhysXStatic));
+	#endif
 }
 
