GamerCNDG
09-03-2013 09:57:43
Hello dear forum,
I am writing an Editor for a game in C# with Visual Studio 2012. This game uses .mesh and .scene files for its 3D graphics. With my editor, I want to be able to view these meshes together with their according materials.
First, I could successfully build my own MOGRE with the great MogreBuilder. I then imporpted the built Mogre.dll and the MogreTutorialFramework.dll (From the SDK) into my application. Of course I also copied all the necessary files (Plugins, *.cfgs..) in the folder of my programm and I am compiling for x86 in Release mode. The following function is being called with the Path to the .mesh file. The game requieres that in the same folder, there has to be a "Scene.material" file and the according textures.
However, all I get when loading a mesh is this:
It doesn't load the textures or cast any shadows.
The Scene.material files of that mesh looks like this:
And as you can see from the filesystem tree in the editor in the left, the textures ARE there.
Another example. It's a textureless sword mesh. It gets displayed this way:
But every common editor (here e.g. MeshEditor) shows it this way:
What am I doing wrong here?
I am writing an Editor for a game in C# with Visual Studio 2012. This game uses .mesh and .scene files for its 3D graphics. With my editor, I want to be able to view these meshes together with their according materials.
First, I could successfully build my own MOGRE with the great MogreBuilder. I then imporpted the built Mogre.dll and the MogreTutorialFramework.dll (From the SDK) into my application. Of course I also copied all the necessary files (Plugins, *.cfgs..) in the folder of my programm and I am compiling for x86 in Release mode. The following function is being called with the Path to the .mesh file. The game requieres that in the same folder, there has to be a "Scene.material" file and the according textures.
void CreateRenderWindowFromResource(string resource)
{
//Create new Window
var window = new MogreFramework.OgreWindow();
window.Show(); //Show it
window.InitializeOgre(); //Initialize OGRE
//Set the Shadows
window.SceneManager.ShadowTechnique = ShadowTechnique.SHADOWTYPE_STENCIL_MODULATIVE;
window.SceneManager.AmbientLight = ColourValue.White;
//Add the folder where the mesh is dynamicly to the ressources
window.Root.AddResourceLocation(System.IO.Path.GetDirectoryName(resource), "FileSystem");
//Create the Entity itself
var mesh2 = window.SceneManager.CreateEntity("Custom", Path.GetFileName(resource));
//let it cast shadows
mesh2.CastShadows = true;
//Set the material from the Scene.material file
mesh2.SetMaterialName("Scene");
//Create a Node, scale it with factor 5 (because the models are sometimes really small
SceneNode node2 = window.SceneManager.RootSceneNode.CreateChildSceneNode("Custom");
node2.Scale(5,5,5); //5-Fach scalen
node2.ShowBoundingBox = true; //just a little gimick
node2.AttachObject(mesh2); //Atach the mesh to the node
//run
window.Go();
}
However, all I get when loading a mesh is this:
It doesn't load the textures or cast any shadows.
The Scene.material files of that mesh looks like this:
material Airship
{
receive_shadows on
technique
{
pass
{
cull_hardware none
ambient 1.000000 1.000000 1.000000 1.000000
diffuse 1.000000 1.000000 1.000000 1.000000
specular 0.153002 0.153002 0.153002 1.000000 12.500000
emissive 0.000000 0.000000 0.000000 1.000000
texture_unit
{
texture airship_uv.png
tex_address_mode wrap
filtering trilinear
}
}
}
}
And as you can see from the filesystem tree in the editor in the left, the textures ARE there.
Another example. It's a textureless sword mesh. It gets displayed this way:
But every common editor (here e.g. MeshEditor) shows it this way:
What am I doing wrong here?