Page 1 of 1

[SOLVED] [C#] Need help loading DeleD maps

Posted: Thu Dec 07, 2006 9:35 am
by Grigor The Ox
I need help loading a simple map i made with DeleD. My code is based off of the .NET tutorial for loading the Quake 3 level. All of my meshes and textures load correctly and the console displays nothing is wrong but all I get is a grey screen. Here is my code...

Code: Select all

[C#]
using System;
using System.Collections.Generic;
using System.Text;
using Irrlicht;
using Irrlicht.Core;
using Irrlicht.Scene;
using Irrlicht.Video;

namespace LoadingLevels
{
    class Program
    {
        static void Main(string[] args)
        {
            IrrlichtDevice device = new IrrlichtDevice(DriverType.DIRECT3D9, new Dimension2D(1024, 768), 32, true, true, true);

            if (device == null)
            {
                Console.WriteLine("Device creation failed.");
                return;
            }
                      
            IAnimatedMesh mesh = device.SceneManager.GetMesh("C:\\Documents and Settings\\PC\\Desktop\\New Folder\\Basic Level.dmf");
            ISceneNode node = null;

            if (mesh != null)
                node = device.SceneManager.AddOctTreeSceneNode(mesh, null, 1);
                

            if (node != null)
                node.Position = (new Vector3D(-1300, -144, -1249));

            device.SceneManager.AddCameraSceneNodeFPS();

            device.CursorControl.Visible = false;

            int lastFPS = -1;

            while (device.Run())
            {
                if (device.WindowActive)
                {
                    device.VideoDriver.BeginScene(true, true, new Color(0, 200, 200, 200));
                    device.SceneManager.DrawAll();
                    device.VideoDriver.EndScene();

                    int fps = device.VideoDriver.FPS;
                    if (lastFPS != fps)
                    {
                        device.WindowCaption = "Irrlicht Engine - Loading Basic Levels [" +
                            device.VideoDriver.Name + "] FPS:" + fps.ToString();
                        lastFPS = fps;
                    }
                }
            }

            GC.Collect();
                
        }
    }
}
I have used the search engine on the forums but i have found no answer in C# form but there are alot of C++ examples. If anyone knows both languages please translate. Thanks everone for helping.

P.S.: I have only been using the engine for 2 days so dont bash me. :wink:

-The Ox Man

Posted: Thu Dec 07, 2006 1:22 pm
by Anteater
Try setting the lighting flag for the level to false and then set the camera's target to the level's position.

Posted: Thu Dec 07, 2006 9:38 pm
by Grigor The Ox
How would I go about doing this. I looked at the .NET documentation and I couldn't find anything satisfactory. Please know this is the first engine that I am working with and I don't know how to do alot of things right now. Thanks for the help though anteater, but unluckily I need help doing your solution also.

EDIT: Nevermind. While looking at someone's code i stumbled upon this:

Code: Select all

[C#]
node.SetMaterialFlag(MaterialFlag.LIGHTING, false);
If that is doing what you said then it doesn't work, because I still get the grey screen of death.

Thanks for trying anyway.

-The Ox Man

Posted: Fri Dec 08, 2006 2:46 am
by bgsteffens

Code: Select all

            if (node != null) 
                node.Position = (new Vector3D(-1300, -144, -1249)); 
Why are you relocating the level? Was it not designed around the origin? Try taking that out, you may be moving it too far away to see.

Posted: Fri Dec 08, 2006 4:47 am
by Grigor The Ox
Thank you bgsteffens, you were right. I didn't really know what I was doing. I now can see the level and there is nothing wrong with it.(Besides lighting, but I'll fix that.)

-The Ox Man