grizzley90
26-01-2007 01:00:20
Third demo for the night. I am not working too hard... its really copy paste...
EnvMappingApp.cs:
Program.cs:
![Very Happy :D]({SMILIES_PATH}/icon_biggrin.gif)
EnvMappingApp.cs:
using System;
using System.Collections.Generic;
using System.Text;
using Mogre;
namespace EnvMapping
{
class EnvMappingApp : Mogre.Demo.ExampleApplication.Example
{
public override void CreateScene()
{
// Just override the mandatory create scene method
// Set ambient light
sceneMgr.AmbientLight = new ColourValue(0.5f, 0.5f, 0.5f);
// Create a point light
Light l = sceneMgr.CreateLight("MainLight");
// Accept default settings: point light, white diffuse, just set position
// NB I could attach the light to a SceneNode if I wanted it to move automatically with
// other objects, but I don't
l.Position = new Vector3(20,80,50);
Entity ent = sceneMgr.CreateEntity("head", "ogrehead.mesh");
// Set material loaded from Example.material
ent.SetMaterialName("Examples/EnvMappedRustySteel");
// Add entity to the root scene node
sceneMgr.RootSceneNode.CreateChildSceneNode().AttachObject(ent);
}
}
}
Program.cs:
using System;
using System.Collections.Generic;
using System.Text;
namespace EnvMapping
{
class Program
{
static void Main(string[] args)
{
try
{
EnvMappingApp app = new EnvMappingApp();
app.Go();
}
catch
{
// Check if it's an Ogre Exception
if (Mogre.OgreException.IsThrown)
Mogre.Demo.ExampleApplication.Example.ShowOgreException();
else
throw;
}
}
}
}