本文整理汇总了C#中Root.Initialise方法的典型用法代码示例。如果您正苦于以下问题:C# Root.Initialise方法的具体用法?C# Root.Initialise怎么用?C# Root.Initialise使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Root
的用法示例。
在下文中一共展示了Root.Initialise方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRoot
private Root CreateRoot()
{
var root = new Root();
root.RenderSystem = root.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
root.Initialise(false);
return root;
}
示例2: Init
public void Init()
{
// Create root object
mRoot = new Root();
// Define Resources
ConfigFile cf = new ConfigFile();
cf.Load("resources.cfg", "\t:=", true);
ConfigFile.SectionIterator seci = cf.GetSectionIterator();
String secName, typeName, archName;
while (seci.MoveNext())
{
secName = seci.CurrentKey;
ConfigFile.SettingsMultiMap settings = seci.Current;
foreach (KeyValuePair<string, string> pair in settings)
{
typeName = pair.Key;
archName = pair.Value;
ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName);
}
}
// Setup RenderSystem
RenderSystem rs = mRoot.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
// or use "OpenGL Rendering Subsystem"
mRoot.RenderSystem = rs;
rs.SetConfigOption("Full Screen", "No");
rs.SetConfigOption("Video Mode", "800 x 600 @ 32-bit colour");
// Create Render Window
mRoot.Initialise(false, "Main Ogre Window");
NameValuePairList misc = new NameValuePairList();
misc["externalWindowHandle"] = Handle.ToString();
mWindow = mRoot.CreateRenderWindow("Main RenderWindow", 800, 600, false, misc);
// Init resources
TextureManager.Singleton.DefaultNumMipmaps = 5;
ResourceGroupManager.Singleton.InitialiseAllResourceGroups();
// Create a Simple Scene
SceneManager mgr = mRoot.CreateSceneManager(SceneType.ST_GENERIC);
Camera cam = mgr.CreateCamera("Camera");
cam.AutoAspectRatio = true;
mWindow.AddViewport(cam);
Entity ent = mgr.CreateEntity("ninja", "ninja.mesh");
mgr.RootSceneNode.CreateChildSceneNode().AttachObject(ent);
cam.Position = new Vector3(0, 200, -400);
cam.LookAt(ent.BoundingBox.Center);
}
示例3: InitRenderWindow
/// <summary>
/// Creates the render window, tells it to use our WinForms window, and enables vsync
/// </summary>
private static RenderWindow InitRenderWindow(Root root, RenderSystem renderSystem)
{
Launch.Log("[Loading] Creating RenderWindow...");
//Ensure RenderSystem has been Initialised
root.RenderSystem = renderSystem;
var window = root.Initialise(true, "Ponykart");
window.SetVisible(false);
window.SetIcon(Resources.Icon_2);
window.SetDeactivateOnFocusChange(false);
return window;
}
示例4: Program
/// <summary>
/// set up ogre
/// </summary>
public Program()
{
root = new Root("plugins.cfg", "", "Ogre.log");
renderSystem = root.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
renderSystem.SetConfigOption("Full Screen", "No");
renderSystem.SetConfigOption("Video Mode", "1920 x 1200 @ 32-bit colour");
root.RenderSystem = renderSystem;
SetupResources();
window = root.Initialise(true, "shadow test");
sceneMgr = root.CreateSceneManager(SceneType.ST_GENERIC, "sceneMgr");
sceneMgr.AmbientLight = new ColourValue(0.8f, 0.8f, 0.8f);
camera = sceneMgr.CreateCamera("cam");
camera.Position = new Vector3(0.8f, 0.8f, 0.8f);
camera.LookAt(new Vector3(-1, 1, -1));
camera.SetAutoTracking(true, sceneMgr.RootSceneNode.CreateChildSceneNode(new Vector3(0, 0.4f, 0)));
camera.NearClipDistance = 0.1f;
camera.FarClipDistance = 2000;
viewport = window.AddViewport(camera);
viewport.BackgroundColour = ColourValue.Black;
camera.AspectRatio = (float) viewport.ActualWidth / (float) viewport.ActualHeight;
ResourceGroupManager.Singleton.InitialiseAllResourceGroups();
TextureManager.Singleton.DefaultNumMipmaps = 1;
CreateThings();
//SetupParticles();
//SetupShadows();
SetupInput();
root.FrameStarted += FrameStarted;
Console.WriteLine(
@"
Press 1, 2, 3, 4 to enable/disable lights, or Esc to quit.
The red and blue textures have PSSM and self-shadowing enabled.
The yellow one does not.
You can also use WASDQE to move the camera around."
);
}
示例5: Main
private static void Main()
{
using (var r = new Root())
{
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Select Render system:");
Console.WriteLine("1.) OpenGL");
Console.WriteLine("2.) Direct3D9");
while (true)
{
var k = Console.ReadKey(true);
int v;
if (!int.TryParse(k.KeyChar.ToString(), out v))
continue;
if (v > 2 || v == 0)
continue;
if (v == 1)
{
r.LoadPlugin("RenderSystem_GL");
r.RenderSystem = r.GetRenderSystemByName("OpenGL Rendering Subsystem");
}
else
{
r.LoadPlugin("RenderSystem_Direct3D9");
r.RenderSystem = r.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
}
break;
}
using (r.Initialise(false))
{
using (var w = r.RenderSystem._createRenderWindow("SL# Demo", 640, 480, false))
{
var win = new DemoWindow(r, w);
win.OnLoad();
r.FrameRenderingQueued += win.OnRenderFrame;
r.StartRendering();
win.OnUnload();
}
}
}
}
示例6: InitMogre
public void InitMogre()
{
//-----------------------------------------------------
// 1 enter ogre
//-----------------------------------------------------
root = new Root();
//-----------------------------------------------------
// 2 configure resource paths
//-----------------------------------------------------
ConfigFile cf = new ConfigFile();
cf.Load("resources.cfg", "\t:=", true);
// Go through all sections & settings in the file
ConfigFile.SectionIterator seci = cf.GetSectionIterator();
String secName, typeName, archName;
// Normally we would use the foreach syntax, which enumerates the values, but in this case we need CurrentKey too;
while (seci.MoveNext()) {
secName = seci.CurrentKey;
ConfigFile.SettingsMultiMap settings = seci.Current;
foreach (KeyValuePair<string, string> pair in settings) {
typeName = pair.Key;
archName = pair.Value;
ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName);
}
}
//-----------------------------------------------------
// 3 Configures the application and creates the window
//-----------------------------------------------------
bool foundit = false;
foreach (RenderSystem rs in root.GetAvailableRenderers()) {
root.RenderSystem = rs;
String rname = root.RenderSystem.Name;
if (rname == "Direct3D9 Rendering Subsystem") {
foundit = true;
break;
}
}
if (!foundit)
return; //we didn't find it... Raise exception?
//we found it, we might as well use it!
root.RenderSystem.SetConfigOption("Full Screen", "No");
root.RenderSystem.SetConfigOption("Video Mode", "640 x 480 @ 32-bit colour");
root.Initialise(false);
NameValuePairList misc = new NameValuePairList();
misc["externalWindowHandle"] = hWnd.ToString();
window = root.CreateRenderWindow("Simple Mogre Form Window", 0, 0, false, misc);
ResourceGroupManager.Singleton.InitialiseAllResourceGroups();
//-----------------------------------------------------
// 4 Create the SceneManager
//
// ST_GENERIC = octree
// ST_EXTERIOR_CLOSE = simple terrain
// ST_EXTERIOR_FAR = nature terrain (depreciated)
// ST_EXTERIOR_REAL_FAR = paging landscape
// ST_INTERIOR = Quake3 BSP
//-----------------------------------------------------
sceneMgr = root.CreateSceneManager(SceneType.ST_GENERIC, "SceneMgr");
sceneMgr.AmbientLight = new ColourValue(0.5f, 0.5f, 0.5f);
//-----------------------------------------------------
// 5 Create the camera
//-----------------------------------------------------
camera = sceneMgr.CreateCamera("SimpleCamera");
camera.Position = new Vector3(0f, 0f, 100f);
// Look back along -Z
camera.LookAt(new Vector3(0f, 0f, -300f));
camera.NearClipDistance = 5;
viewport = window.AddViewport(camera);
viewport.BackgroundColour = new ColourValue(0.0f, 0.0f, 0.0f, 1.0f);
Entity ent = sceneMgr.CreateEntity("ogre", "ogrehead.mesh");
SceneNode node = sceneMgr.RootSceneNode.CreateChildSceneNode("ogreNode");
node.AttachObject(ent);
}
示例7: InitRenderer
public void InitRenderer()
{
try
{
OgreRoot = new Root();
{ //Load config file data
ConfigFile cf = new ConfigFile();
cf.Load("./resources.cfg", "\t:=", true);
ConfigFile.SectionIterator seci = cf.GetSectionIterator();
String secName, typeName, archName;
while (seci.MoveNext())
{
secName = seci.CurrentKey;
ConfigFile.SettingsMultiMap settings = seci.Current;
foreach (KeyValuePair<String, String> pair in settings)
{
typeName = pair.Key;
archName = pair.Value;
ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName);
}
}
}
OgreRenderSystem = OgreRoot.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
OgreRenderSystem.SetConfigOption("Full Screen", "No");
OgreRenderSystem.SetConfigOption("Video Mode", "800 x 600 @ 32-bit colour");
OgreRoot.RenderSystem = OgreRenderSystem;
OgreRoot.Initialise(false, "Main Ogre Window");
NameValuePairList misc = new NameValuePairList();
misc["externalWindowHandle"] = RenderPanel.Handle.ToString();
misc["FSAA"] = "4";
OgreRenderWindow = OgreRoot.CreateRenderWindow("Main RenderWindow", 800, 600, false, misc);
OgreRenderWindow.IsActive = true;
OgreRenderWindow.IsAutoUpdated = true;
MaterialManager.Singleton.SetDefaultTextureFiltering(TextureFilterOptions.TFO_ANISOTROPIC);
//Trigger background resource load
StartResourceThread();
}
catch (Exception ex)
{
Console.WriteLine("Error during renderer initialization:" + ex.Message + "," + ex.StackTrace);
}
}
示例8: Setup
protected virtual bool Setup()
{
mRoot = new Root(mPluginsCfg);
RenderSystem renderSystem = null;
foreach (var rs in mRoot.GetAvailableRenderers())
{
if (rs.Name == "Direct3D9 Rendering Subsystem")
{
renderSystem = rs;
break;
}
}
renderSystem.SetConfigOption("Full Screen", "No");
renderSystem.SetConfigOption("Video Mode", "200 x 200 @ 32-bit colour");
renderSystem.SetConfigOption("FSAA", "0");
renderSystem.SetConfigOption("VSync", "No");
renderSystem.SetConfigOption("sRGB Gamma Conversion", "No");
mRoot.RenderSystem = renderSystem;
mWindow = mRoot.Initialise(true, "MSpriteRenderer Preview Window");
//if(!Configure())
// return false;
ChooseSceneManager();
CreateCamera();
CreateViewports();
TextureManager.Singleton.DefaultNumMipmaps = 5;
CreateResourceListener();
LoadResources();
CreateScene();
CreateFrameListeners();
mDebugOverlay = new DebugOverlay(mWindow);
mDebugOverlay.AdditionalInfo = "Bilinear";
return true;
}
示例9: InitMogre
public void InitMogre()
{
root = new Root();
#if DEBUG
root.LoadPlugin("RenderSystem_Direct3D9_d");
#else
root.LoadPlugin("RenderSystem_Direct3D9");
#endif
bool foundit = false;
foreach (RenderSystem rs in root.GetAvailableRenderers())
{
root.RenderSystem = rs;
String rname = root.RenderSystem.Name;
if (rname == "Direct3D9 Rendering Subsystem")
{
foundit = true;
break;
}
}
if (!foundit)
return; //we didn't find it... Raise exception?
//we found it, we might as well use it!
root.RenderSystem.SetConfigOption("Full Screen", "No");
root.RenderSystem.SetConfigOption("Video Mode",
String.Format("{0} x {1} @ 32-bit colour", windowSize.Width, windowSize.Height));
root.Initialise(false);
// other plugins
#if DEBUG
root.LoadPlugin("Plugin_CgProgramManager_d");
root.LoadPlugin("Plugin_OctreeSceneManager_d");
#else
root.LoadPlugin("Plugin_CgProgramManager");
root.LoadPlugin("Plugin_OctreeSceneManager");
#endif
NameValuePairList misc = new NameValuePairList();
misc["externalWindowHandle"] = hWnd.ToString();
window = root.CreateRenderWindow("Simple Mogre Form Window", 0, 0, false, misc);
ResourceGroupManager.Singleton.InitialiseAllResourceGroups();
sceneMgr = root.CreateSceneManager(SceneType.ST_GENERIC, "SceneMgr");
sceneMgr.AmbientLight = new ColourValue(0.5f, 0.5f, 0.5f);
camera = sceneMgr.CreateCamera("SimpleCamera");
camera.NearClipDistance = 0.1f;
camera.AutoAspectRatio = true;
viewport = window.AddViewport(camera);
viewport.BackgroundColour = new ColourValue(0.25f, 0.25f, 0.25f, 1.0f);
root.FrameStarted += new FrameListener.FrameStartedHandler(MogreFrameStarted);
}
示例10: Initialise
public void Initialise()
{
m_Root = new Root();
ConfigFile cf = new ConfigFile();
cf.Load("Resources.cfg", "\t:=", true);
ConfigFile.SectionIterator seci = cf.GetSectionIterator();
while (seci.MoveNext())
{
ConfigFile.SettingsMultiMap settings = seci.Current;
foreach (KeyValuePair<string, string> pair in settings)
ResourceGroupManager.Singleton.AddResourceLocation(pair.Value, pair.Key, seci.CurrentKey);
}
if (!m_Root.RestoreConfig())
if (!m_Root.ShowConfigDialog())
return;
m_RenderWindow = m_Root.Initialise(true);
ResourceGroupManager.Singleton.InitialiseAllResourceGroups();
m_SceneManager = m_Root.CreateSceneManager(SceneType.ST_GENERIC);
m_Camera = m_SceneManager.CreateCamera("MainCamera");
m_Viewport = m_RenderWindow.AddViewport(m_Camera);
m_Camera.NearClipDistance = 0.1f;
m_Camera.FarClipDistance = 1000.0f;
MOIS.ParamList pl = new MOIS.ParamList();
IntPtr windowHnd;
m_RenderWindow.GetCustomAttribute("WINDOW", out windowHnd);
pl.Insert("WINDOW", windowHnd.ToString());
m_InputManager = MOIS.InputManager.CreateInputSystem(pl);
m_Keyboard = (MOIS.Keyboard)m_InputManager.CreateInputObject(MOIS.Type.OISKeyboard, false);
m_Mouse = (MOIS.Mouse)m_InputManager.CreateInputObject(MOIS.Type.OISMouse, false);
m_NewtonWorld = new World();
m_NewtonDebugger = new Debugger(m_NewtonWorld);
m_NewtonDebugger.Init(m_SceneManager);
m_GameCamera = new GameCamera();
m_ObjectManager = new ObjectManager();
}
示例11: Initiliase
public bool Initiliase(bool autoCreateWindow)
{
root = new Root();
ConfigFile cf = new ConfigFile();
cf.Load("resources.cfg", "\t:=", true);
// Go through all sections & settings in the file
ConfigFile.SectionIterator seci = cf.GetSectionIterator();
String secName, typeName, archName;
// Normally we would use the foreach syntax, which enumerates the values, but in this case we need CurrentKey too;
while (seci.MoveNext())
{
secName = seci.CurrentKey;
ConfigFile.SettingsMultiMap settings = seci.Current;
foreach (KeyValuePair<string, string> pair in settings)
{
typeName = pair.Key;
archName = pair.Value;
ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName);
}
}
//-----------------------------------------------------
// 3 Configures the application and creates the window
//-----------------------------------------------------
string renderSystem = "Direct3D9 Rendering Subsystem";
if (!FindRenderSystem(renderSystem))
throw new Exception("Unable to find render system: " + renderSystem);
//we found it, we might as well use it!
root.RenderSystem.SetConfigOption("VSync", "Yes"); // graphics card doesn't work so hard, physics engine should be more stable
root.RenderSystem.SetConfigOption("Full Screen", "No");
root.RenderSystem.SetConfigOption("Video Mode", "1024 x 768 @ 32-bit colour");
// scene manager
sceneManager = root.CreateSceneManager(SceneType.ST_GENERIC);
// render window
this.renderWindow = root.Initialise(autoCreateWindow, "GlueEngine");
return true;
}
示例12: _InitOgre
protected bool _InitOgre()
{
lock (this)
{
IntPtr hWnd = IntPtr.Zero;
foreach (PresentationSource source in PresentationSource.CurrentSources)
{
var hwndSource = (source as HwndSource);
if (hwndSource != null)
{
hWnd = hwndSource.Handle;
break;
}
}
if (hWnd == IntPtr.Zero) return false;
CallResourceItemLoaded(new ResourceLoadEventArgs("Engine", 0));
// load the OGRE engine
//
_root = new Root();
// configure resource paths from : "resources.cfg" file
//
var configFile = new ConfigFile();
configFile.Load("resources.cfg", "\t:=", true);
// Go through all sections & settings in the file
//
ConfigFile.SectionIterator seci = configFile.GetSectionIterator();
// Normally we would use the foreach syntax, which enumerates the values,
// but in this case we need CurrentKey too;
while (seci.MoveNext())
{
string secName = seci.CurrentKey;
ConfigFile.SettingsMultiMap settings = seci.Current;
foreach (var pair in settings)
{
string typeName = pair.Key;
string archName = pair.Value;
ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName);
}
}
// Configures the application and creates the Window
// A window HAS to be created, even though we'll never use it.
//
bool foundit = false;
foreach (RenderSystem rs in _root.GetAvailableRenderers())
{
if (rs == null) continue;
_root.RenderSystem = rs;
String rname = _root.RenderSystem.Name;
if (rname == "Direct3D9 Rendering Subsystem")
{
foundit = true;
break;
}
}
if (!foundit)
return false;
_root.RenderSystem.SetConfigOption("Full Screen", "No");
_root.RenderSystem.SetConfigOption("Video Mode", "1024 x 768 @ 32-bit colour");
_root.Initialise(false);
var misc = new NameValuePairList();
misc["externalWindowHandle"] = hWnd.ToString();
_renderWindow = _root.CreateRenderWindow("OgreImageSource Windows", 0, 0, false, misc);
_renderWindow.IsAutoUpdated = false;
InitResourceLoad();
ResourceGroupManager.Singleton.InitialiseAllResourceGroups();
this.Dispatcher.Invoke(
(MethodInvoker)delegate
{
if (CreateDefaultScene)
{
//-----------------------------------------------------
// 4 Create the SceneManager
//
// ST_GENERIC = octree
// ST_EXTERIOR_CLOSE = simple terrain
// ST_EXTERIOR_FAR = nature terrain (depreciated)
// ST_EXTERIOR_REAL_FAR = paging landscape
// ST_INTERIOR = Quake3 BSP
//-----------------------------------------------------
_sceneManager = _root.CreateSceneManager(SceneType.ST_GENERIC, "SceneMgr");
_sceneManager.AmbientLight = new ColourValue(0.5f, 0.5f, 0.5f);
//-----------------------------------------------------
// 5 Create the camera
//.........这里部分代码省略.........
示例13: Initialise
public void Initialise()
{
Root = new Root();
ConfigFile cf = new ConfigFile();
cf.Load("Resources.cfg", "\t:=", true);
ConfigFile.SectionIterator seci = cf.GetSectionIterator();
while (seci.MoveNext())
{
ConfigFile.SettingsMultiMap settings = seci.Current;
foreach (KeyValuePair<string, string> pair in settings)
ResourceGroupManager.Singleton.AddResourceLocation(pair.Value, pair.Key, seci.CurrentKey);
}
if (!Root.RestoreConfig())
if (!Root.ShowConfigDialog())
return;
Root.RenderSystem.SetConfigOption("VSync", "Yes");
RenderWindow = Root.Initialise(true, "Kolejny epicki erpeg"); // @@@@@@@@@@@@@@@ Nazwa okna gry.
ResourceGroupManager.Singleton.InitialiseAllResourceGroups();
SceneManager = Root.CreateSceneManager(SceneType.ST_GENERIC);
Camera = SceneManager.CreateCamera("MainCamera");
Viewport = RenderWindow.AddViewport(Camera);
Camera.NearClipDistance = 0.1f;
Camera.FarClipDistance = 1000.0f;
Camera.AspectRatio = ((float)RenderWindow.Width / (float)RenderWindow.Height);
MOIS.ParamList pl = new MOIS.ParamList();
IntPtr windowHnd;
RenderWindow.GetCustomAttribute("WINDOW", out windowHnd);
pl.Insert("WINDOW", windowHnd.ToString());
InputManager = MOIS.InputManager.CreateInputSystem(pl);
Keyboard = (MOIS.Keyboard)InputManager.CreateInputObject(MOIS.Type.OISKeyboard, true);
Mouse = (MOIS.Mouse)InputManager.CreateInputObject(MOIS.Type.OISMouse, true);
NewtonWorld = new World();
NewtonDebugger = new Debugger(NewtonWorld);
NewtonDebugger.Init(SceneManager);
GameCamera = new GameCamera();
ObjectManager = new ObjectManager();
MaterialManager = new MaterialManager();
MaterialManager.Initialise();
Items = new Items();
PrizeManager = new PrizeManager(); //////////////////// @@ Brand nju staff. Nawet trochę działa :Δ
CharacterProfileManager = new CharacterProfileManager();
Quests = new Quests();
NPCManager = new NPCManager();
Labeler = new TextLabeler(5);
Random = new Random();
HumanController = new HumanController();
TypedInput = new TypedInput();
SoundManager = new SoundManager();
Dialog = new Dialog();
Mysz = new MOIS.MouseState_NativePtr();
Conversations = new Conversations();
TriggerManager = new TriggerManager();
Engine.Singleton.Keyboard.KeyPressed += new MOIS.KeyListener.KeyPressedHandler(TypedInput.onKeyPressed);
Mouse.MouseReleased += new MOIS.MouseListener.MouseReleasedHandler(MouseReleased);
IngameConsole = new IngameConsole();
IngameConsole.Init();
IngameConsole.AddCommand("dupa", "soundOddawajPiec");
IngameConsole.AddCommand("tp", "ZejscieDoPiwnicy");
IngameConsole.AddCommand("exit", "Exit", "Wychodzi z gry. Ale odkrywcze. Super. Musze sprawdzic jak sie zachowa konsola przy duzej dlugosci linii xD llllllllllllllllllllllllllllllllllllllllllllmmmmmmmmmmmmmmmmmmmmmiiiiiiiiiiiiiiii");
IngameConsole.AddCommand("play", "playSound", "Odtwarza dzwiek. Skladnia: play <sciezka do pliku>. Np. play other/haa.mp3");
IngameConsole.AddCommand("map", "ChangeMap");
IngameConsole.AddCommand("save", "SaveGame");
IngameConsole.AddCommand("load", "LoadGame");
IngameConsole.AddCommand("help", "ConsoleHelp");
IngameConsole.AddCommand("h", "CommandHelp");
}
示例14: Init
public void Init(String handle)
{
try
{
// Create root object
mRoot = new Root();
// Define Resources
ConfigFile cf = new ConfigFile();
cf.Load("./resources.cfg", "\t:=", true);
ConfigFile.SectionIterator seci = cf.GetSectionIterator();
String secName, typeName, archName;
while (seci.MoveNext())
{
secName = seci.CurrentKey;
ConfigFile.SettingsMultiMap settings = seci.Current;
foreach (KeyValuePair<string, string> pair in settings)
{
typeName = pair.Key;
archName = pair.Value;
ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName);
}
}
//Load the resources from resources.cfg and selected tab (_ConfigurationPaths)
//LoadResourceLocations(_ConfigurationPaths);
//example of manual add: _FileSystemPaths.Add("../../Media/models");
foreach (string foo in _ConfigurationPaths)
{
AddResourceLocation(foo);
}
// Setup RenderSystem
mRSys = mRoot.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
//mRSys = mRoot.GetRenderSystemByName("OpenGL Rendering Subsystem");
// or use "OpenGL Rendering Subsystem"
mRoot.RenderSystem = mRSys;
mRSys.SetConfigOption("Full Screen", "No");
mRSys.SetConfigOption("Video Mode", "800 x 600 @ 32-bit colour");
// Create Render Window
mRoot.Initialise(false, "Main Ogre Window");
NameValuePairList misc = new NameValuePairList();
misc["externalWindowHandle"] = handle;
misc["FSAA"] = "4";
// misc["VSync"] = "True"; //not sure how to enable vsync to remove those warnings in Ogre.log
mWindow = mRoot.CreateRenderWindow("Main RenderWindow", 800, 600, false, misc);
// Init resources
MaterialManager.Singleton.SetDefaultTextureFiltering(TextureFilterOptions.TFO_ANISOTROPIC);
TextureManager.Singleton.DefaultNumMipmaps = 5;
ResourceGroupManager.Singleton.InitialiseAllResourceGroups();
// Create a Simple Scene
//SceneNode node = null;
// mMgr = mRoot.CreateSceneManager(SceneType.ST_GENERIC, "SceneManager");
mMgr = mRoot.CreateSceneManager(SceneType.ST_EXTERIOR_CLOSE, "SceneManager");
mMgr.AmbientLight = new ColourValue(0.8f, 0.8f, 0.8f);
mCamera = mMgr.CreateCamera("Camera");
mWindow.AddViewport(mCamera);
mCamera.AutoAspectRatio = true;
mCamera.Viewport.SetClearEveryFrame(false);
//Entity ent = mMgr.CreateEntity(displayMesh, displayMesh);
//ent.SetMaterialName(displayMaterial);
//node = mMgr.RootSceneNode.CreateChildSceneNode(displayMesh + "node");
//node.AttachObject(ent);
mCamera.Position = new Vector3(0, 0, 0);
//mCamera.Position = new Vector3(0, 0, -400);
mCamera.LookAt(0, 0, 1);
//Create a single point light source
Light light2 = mMgr.CreateLight("MainLight");
light2.Position = new Vector3(0, 10, -25);
light2.Type = Light.LightTypes.LT_POINT;
light2.SetDiffuseColour(1.0f, 1.0f, 1.0f);
light2.SetSpecularColour(0.1f, 0.1f, 0.1f);
mWindow.WindowMovedOrResized();
IsInitialized = true;
// Create the camera's top node (which will only handle position).
cameraNode = mMgr.RootSceneNode.CreateChildSceneNode();
cameraNode.Position = new Vector3(0, 0, 0);
//cameraNode = mMgr->getRootSceneNode()->createChildSceneNode();
//cameraNode->setPosition(0, 0, 500);
// Create the camera's yaw node as a child of camera's top node.
cameraYawNode = cameraNode.CreateChildSceneNode();
//.........这里部分代码省略.........
示例15: Initialise
public void Initialise()
{
Root = new Root();
ConfigFile cf = new ConfigFile();
cf.Load("Resources.cfg", "\t:=", true);
ConfigFile.SectionIterator seci = cf.GetSectionIterator();
while (seci.MoveNext())
{
ConfigFile.SettingsMultiMap settings = seci.Current;
foreach (KeyValuePair<string, string> pair in settings)
ResourceGroupManager.Singleton.AddResourceLocation(pair.Value, pair.Key, seci.CurrentKey);
}
if (!Root.RestoreConfig())
if (!Root.ShowConfigDialog())
return;
Root.RenderSystem.SetConfigOption("VSync", "Yes");
RenderWindow = Root.Initialise(true, "WorldCreator"); // @@@@@@@@@@@@@@@ Nazwa okna gry.
ResourceGroupManager.Singleton.InitialiseAllResourceGroups();
SceneManager = Root.CreateSceneManager(SceneType.ST_GENERIC);
Camera = SceneManager.CreateCamera("MainCamera");
Viewport = RenderWindow.AddViewport(Camera);
Camera.NearClipDistance = 0.1f;
Camera.FarClipDistance = 1000.0f;
Camera.AspectRatio = ((float)RenderWindow.Width / (float)RenderWindow.Height);
MOIS.ParamList pl = new MOIS.ParamList();
IntPtr windowHnd;
RenderWindow.GetCustomAttribute("WINDOW", out windowHnd);
pl.Insert("WINDOW", windowHnd.ToString());
InputManager = MOIS.InputManager.CreateInputSystem(pl);
Keyboard = (MOIS.Keyboard)InputManager.CreateInputObject(MOIS.Type.OISKeyboard, false);
Mouse = (MOIS.Mouse)InputManager.CreateInputObject(MOIS.Type.OISMouse, false);
NewtonWorld = new World();
NewtonDebugger = new Debugger(NewtonWorld);
NewtonDebugger.Init(SceneManager);
ObjectManager = new ObjectManager();
MaterialManager = new MaterialManager();
MaterialManager.Initialise();
//CharacterProfileManager = new CharacterProfileManager();
Items = new Items();
//PrizeManager = new PrizeManager(); //////////////////// @@ Brand nju staff. Nawet trochę działa :Δ
//Quests = new Quests();
//NPCManager = new NPCManager();
Labeler = new TextLabeler(5);
User = new Player();
CharacterProfileManager = new CharacterProfileManager();
NPCManager = new NPCManager();
HumanController = new HumanController();
TypedInput = new TypedInput();
//SoundManager = new SoundManager();
}