Commit 9c33ae93 authored by hybrid's avatar hybrid

Merge revisions 1489:1494 from 1.4 branch. Mainly cleanup, removal of .NET...

Merge revisions 1489:1494 from 1.4 branch. Mainly cleanup, removal of .NET wrapper, and postEventFromUser patch to return if the event was absorbed.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1495 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 6bdb14fd
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.0.9466"
SchemaVersion = "1.0"
ProjectGuid = "{04123B67-C0DB-4BD7-86C9-CCCA17503D04}"
>
<Build>
<Settings
ApplicationIcon = "App.ico"
AssemblyKeyContainerName = ""
AssemblyName = "01.HelloWorld_7.0"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Exe"
RootNamespace = "_01.HelloWorld_7._0"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "true"
Optimize = "false"
OutputPath = "bin\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
Optimize = "true"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.XML"
HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
/>
<Reference
Name = "System.Windows.Forms"
AssemblyName = "System.Windows.Forms"
HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll"
/>
<Reference
Name = "Irrlicht.NET"
AssemblyName = "Irrlicht.NET"
HintPath = "..\..\bin\Win32-VisualStudio\Irrlicht.NET.dll"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "App.ico"
BuildAction = "Content"
/>
<File
RelPath = "AssemblyInfo.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Example.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "01.HelloWorld_7.0", "01.HelloWorld_7.0.csproj", "{04123B67-C0DB-4BD7-86C9-CCCA17503D04}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{04123B67-C0DB-4BD7-86C9-CCCA17503D04}.Debug.ActiveCfg = Debug|.NET
{04123B67-C0DB-4BD7-86C9-CCCA17503D04}.Debug.Build.0 = Debug|.NET
{04123B67-C0DB-4BD7-86C9-CCCA17503D04}.Release.ActiveCfg = Release|.NET
{04123B67-C0DB-4BD7-86C9-CCCA17503D04}.Release.Build.0 = Release|.NET
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal
using System.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
using System;
using Irrlicht; // compiler error here? Look at the next comment
using Irrlicht.Video;
using Irrlicht.Core;
using Irrlicht.Scene;
// PROBLEMS with this source?
// Some solutions wich might help:
//
// - If your compiler complains that 'Irrlicht' cannot be found,
// add the Irrlicht.NET.dll file (in bin\win32-VisualStudio) as Reference
// in the solution browser.
//
// - It compiles, but your program throws an exception like this:
// "An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.
// Additional information: File or assembly name Irrlicht.NET, or one of its dependencies,
// was not found."
// Solution: You are missing the file Irrlicht.DLL. Copy it where Visual studio can find it.
// For example where this program is.
namespace _01.HelloWorld
{
/// <summary>
/// Example application using Irrlicht.NET
/// A little bit more complicated than the C++ hello world example,
/// but hey, its the only one yet. Give me some time.
/// </summary>
class Example
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
// start up the engine
IrrlichtDevice device = new IrrlichtDevice(DriverType.OPENGL);
device.ResizeAble = true;
device.WindowCaption = "Irrlicht.NET C# example 01 - Hello World";
// load some textures
ITexture texSydney = device.VideoDriver.GetTexture(@"..\..\media\sydney.bmp");
ITexture texWall = device.VideoDriver.GetTexture(@"..\..\media\wall.bmp");
ITexture texLogo = device.VideoDriver.GetTexture(@"..\..\media\irrlichtlogoaligned.jpg");
// load the animated mesh of sydney
Irrlicht.Scene.IAnimatedMesh mesh =
device.SceneManager.GetMesh(@"..\..\media\sydney.md2");
if (mesh == null)
{
System.Windows.Forms.MessageBox.Show(
@"Could not load mesh ..\..\media\sydney.md2, exiting.",
"Problem starting program");
return;
}
// add a camera, a test scene node and the animated mesh to the scene
ICameraSceneNode cam =
device.SceneManager.AddCameraSceneNodeFPS(null, 100, 100, -1);
cam.Position = new Vector3D(20,0,-50);
ISceneNode node = device.SceneManager.AddCubeSceneNode(15,
null, -1, new Vector3D(30,-15,0));
node.SetMaterialTexture(0, texWall);
node = device.SceneManager.AddAnimatedMeshSceneNode(mesh, null, -1);
node.SetMaterialTexture(0, texSydney);
node.SetMaterialFlag(MaterialFlag.LIGHTING, false);
// make cursor invisible
device.CursorControl.Visible = false;
// start drawing loop
int fps = 0;
while(device.Run())
{
if (device.WindowActive)
{
device.VideoDriver.BeginScene(true, true, new Color(0,100,100,100));
device.SceneManager.DrawAll();
// draw the logo
device.VideoDriver.Draw2DImage(
texLogo, new Position2D(10,10),
new Rect(0,0,88,31),
new Rect(new Position2D(0,0),device.VideoDriver.ScreenSize),
new Color(0xffffff), false);
device.VideoDriver.EndScene();
if (fps != device.VideoDriver.FPS)
{
fps = device.VideoDriver.FPS;
device.WindowCaption = "Irrlicht.NET C# example 01 - Hello World ["+
device.VideoDriver.Name + "] fps:" + fps;
}
}
} // end drawing-loop
} // end main()
} // end class
} // end namespace
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "01.HelloWorld_vb_7.0", "01.HelloWorld_vb_7.0.vbproj", "{751D6701-0FA4-4963-936C-B75D046686F4}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{751D6701-0FA4-4963-936C-B75D046686F4}.Debug.ActiveCfg = Debug|.NET
{751D6701-0FA4-4963-936C-B75D046686F4}.Debug.Build.0 = Debug|.NET
{751D6701-0FA4-4963-936C-B75D046686F4}.Release.ActiveCfg = Release|.NET
{751D6701-0FA4-4963-936C-B75D046686F4}.Release.Build.0 = Release|.NET
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal
<VisualStudioProject>
<VisualBasic
ProjectType = "Local"
ProductVersion = "7.0.9466"
SchemaVersion = "1.0"
ProjectGuid = "{751D6701-0FA4-4963-936C-B75D046686F4}"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "01.HelloWorld_vb_7.0"
AssemblyOriginatorKeyFile = ""
AssemblyOriginatorKeyMode = "None"
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Exe"
OptionCompare = "Binary"
OptionExplicit = "On"
OptionStrict = "Off"
RootNamespace = "_01.HelloWorld_vb_7._0"
StartupObject = "_01.HelloWorld_vb_7._0.Module1"
>
<Config
Name = "Debug"
BaseAddress = "285212672"
ConfigurationOverrideFile = ""
DefineConstants = ""
DefineDebug = "true"
DefineTrace = "true"
DebugSymbols = "true"
IncrementalBuild = "true"
Optimize = "false"
OutputPath = "bin\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "1"
/>
<Config
Name = "Release"
BaseAddress = "285212672"
ConfigurationOverrideFile = ""
DefineConstants = ""
DefineDebug = "false"
DefineTrace = "true"
DebugSymbols = "false"
IncrementalBuild = "false"
Optimize = "true"
OutputPath = "bin\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "1"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.Xml"
/>
<Reference
Name = "Irrlicht.NET"
AssemblyName = "Irrlicht.NET"
HintPath = "..\..\bin\Win32-VisualStudio\Irrlicht.NET.dll"
/>
<Reference
Name = "System.Windows.Forms"
AssemblyName = "System.Windows.Forms"
HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll"
/>
</References>
<Imports>
<Import Namespace = "Microsoft.VisualBasic" />
<Import Namespace = "System" />
<Import Namespace = "System.Collections" />
<Import Namespace = "System.Data" />
<Import Namespace = "System.Diagnostics" />
</Imports>
</Build>
<Files>
<Include>
<File
RelPath = "AssemblyInfo.vb"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Module1.vb"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</VisualBasic>
</VisualStudioProject>
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("")>
<Assembly: AssemblyCopyright("")>
<Assembly: AssemblyTrademark("")>
<Assembly: CLSCompliant(True)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("2D372EBD-0DB9-4E7D-8142-21575E75AE79")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
<Assembly: AssemblyVersion("1.0.*")>
Imports Irrlicht ' compiler error here? Look at the next comment
Imports Irrlicht.Video
Imports Irrlicht.Core
Imports Irrlicht.Scene
' PROBLEMS with this source?
' Some solutions wich might help:
'
' - If your compiler complains that 'Irrlicht' cannot be found,
' add the Irrlicht.NET.dll file (in bin\Win32-VisualStudio) as Reference
' in the solution browser.
'
' - It compiles, but your program throws an exception like this:
' "An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.
' Additional information: File or assembly name Irrlicht.NET, or one of its dependencies,
' was not found."
' Solution: You are missing the file Irrlicht.DLL. Copy it where Visual studio can find it.
' For example where this program is.
' Example application using Irrlicht.NET
' A little bit more complicated than the C++ hello world example,
' but hey, its the only one yet. Give me some time.
Module Module1
' The main entry point for the application.
Sub Main()
' start up the engine
Dim device As New IrrlichtDevice(Irrlicht.Video.DriverType.OPENGL)
device.ResizeAble = True
device.WindowCaption = "Irrlicht.NET VisualBasic example 01 - Hello World"
' load some textures
Dim texSydney As ITexture = device.VideoDriver.GetTexture("..\..\media\sydney.bmp")
Dim texWall As ITexture = device.VideoDriver.GetTexture("..\..\media\wall.bmp")
Dim texLogo As ITexture = device.VideoDriver.GetTexture("..\..\media\irrlichtlogoaligned.jpg")
' load the animated mesh of sydney
Dim mesh As Irrlicht.Scene.IAnimatedMesh = device.SceneManager.GetMesh("..\..\media\sydney.md2")
If mesh Is Nothing Then
System.Windows.Forms.MessageBox.Show("Could not load mesh ..\..\media\sydney.md2, exiting.", "Problem starting program")
Return
End If
' add a camera, a test scene node and the animated mesh to the scene
Dim cam As ICameraSceneNode = device.SceneManager.AddCameraSceneNodeFPS(Nothing, 100, 100, -1)
cam.Position = New Vector3D(20, 0, -50)
Dim node As ISceneNode = device.SceneManager.AddCubeSceneNode(15, Nothing, -1, New Vector3D(30, -15, 0))
node.SetMaterialTexture(0, texWall)
node = device.SceneManager.AddAnimatedMeshSceneNode(mesh, Nothing, -1)
node.SetMaterialTexture(0, texSydney)
node.SetMaterialFlag(MaterialFlag.LIGHTING, False)
' disable mouse cursor
device.CursorControl.Visible = False
' start drawing loop
Dim fps As Integer = 0
While device.Run() = True
If device.WindowActive Then
device.VideoDriver.BeginScene(True, True, New Color(0, 100, 100, 100))
device.SceneManager.DrawAll()
' draw the logo
device.VideoDriver.Draw2DImage(texLogo, New Position2D(10, 10), New Rect(0, 0, 88, 31), New Rect(New Position2D(0, 0), device.VideoDriver.ScreenSize), New Color(255, 255, 255, 255), False)
device.VideoDriver.EndScene()
If (fps <> device.VideoDriver.FPS) Then
fps = device.VideoDriver.FPS
device.WindowCaption = "Irrlicht.NET Visual Basic example 01 - Hello World [" + device.VideoDriver.Name + "] fps:" + fps.ToString
End If
End If
End While
End Sub
End Module
namespace HelloWorld
import System
import Irrlicht
import Irrlicht.Video
import Irrlicht.Core
import Irrlicht.Scene
[Module]
class Example:
[STAThread()]
static def Main(args as (string)):
device as IrrlichtDevice = IrrlichtDevice(DriverType.OPENGL)
device.WindowCaption = 'Irrlicht.NET Boo example 01 - Hello World'
texSydney as ITexture = device.VideoDriver.GetTexture('sydney.bmp')
mesh as Irrlicht.Scene.IAnimatedMesh = device.SceneManager.GetMesh('sydney.md2')
cam as ICameraSceneNode = device.SceneManager.AddCameraSceneNodeFPS(null, 100, 100, -1)
cam.Position = Vector3D(20, 0, -50)
node as ISceneNode = device.SceneManager.AddAnimatedMeshSceneNode(mesh, null, -1)
node.SetMaterialTexture(0, texSydney)
node.SetMaterialFlag(MaterialFlag.LIGHTING, false)
device.CursorControl.Visible = false
fps as int = 0
while device.Run():
if device.WindowActive:
device.VideoDriver.BeginScene(true, true, Color(0, 100, 100, 100))
device.SceneManager.DrawAll()
device.VideoDriver.EndScene()
if fps != device.VideoDriver.FPS:
fps = device.VideoDriver.FPS
device.WindowCaption = 'Irrlicht.NET Boo example 01 - Hello World [' + device.VideoDriver.Name + '] fps:' + fps
\ No newline at end of file
These Tutorials have simply been copied from the Irrlicht Wiki at http://www.irrforge.org
They are written by different authors, and not guaranteed to work, they simply should provide
the c++ examples ported the Irrlicht.NET.
Please see the wiki for updates and more info.
A lot of thanks go to the people who wrote these examples.
\ No newline at end of file
/*
This Tutorial shows how to load a Quake 3 map into the
engine, create a SceneNode for optimizing the speed of
rendering and how to create a user controlled camera.
Lets start like the HelloWorld example: We include
the irrlicht header files and an additional file to be able
to ask the user for a driver type using the console.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.IO;
using Irrlicht;
using Irrlicht.Video;
using Irrlicht.Core;
using Irrlicht.Scene;
namespace _02.Quake3Map
{
class Program
{
/// <summary>
/// Main entry point for the program.
/// </summary>
/// <param name="args">Arguments to pass the software.</param>
[STAThread]
static void Main(string[] args)
{
/*
Like in the HelloWorld example, we create an IrrlichtDevice with
createDevice(). The difference now is that we ask the user to select
which hardware accelerated driver to use. The Software device would be
too slow to draw a huge Quake 3 map, but just for the fun of it, we make
this decision possible too.
*/
// ask user for driver
DriverType driverType;
// Ask user to select driver:
StringBuilder sb = new StringBuilder();
sb.AppendLine("Please select the driver you want for this example:");
sb.AppendLine("(a) Direct3D 9.0c\n(b) Direct3D 8.1\n(c) OpenGL 1.5");
sb.AppendLine("(d) Software Renderer\nApfelbaum Software Renderer");
sb.AppendLine("(f) Null Device\n(otherKey) exit\n\n");
// Get the user's input:
TextReader tIn = Console.In;
TextWriter tOut = Console.Out;
tOut.Write(sb.ToString());
string input = tIn.ReadLine();
// Select device based on user's input:
switch (input)
{
case "a":
driverType = DriverType.DIRECT3D9;
break;
case "b":
driverType = DriverType.DIRECT3D8;
break;
case "c":
driverType = DriverType.OPENGL;
break;
case "d":
driverType = DriverType.SOFTWARE;
break;
case "e":
driverType = DriverType.SOFTWARE2;
break;
case "f":
driverType = DriverType.NULL_DRIVER;
break;
default:
return;
}
// Create device and exit if creation fails:
IrrlichtDevice device = new IrrlichtDevice(driverType, new Dimension2D(1024, 768), 32, true, true, true);
if (device == null)
{
tOut.Write("Device creation failed.");
return;
}
/*
Get a pointer to the video driver and the SceneManager so that
we do not always have to write device->getVideoDriver() and
device->getSceneManager().
*/
// I just left these lines here for example purposes:
//irrv.IVideoDriver driver = device.VideoDriver;
//irrs.ISceneManager smgr = device.SceneManager;
/*
To display the Quake 3 map, we first need to load it. Quake 3 maps
are packed into .pk3 files wich are nothing other than .zip files.
So we add the .pk3 file to our FileSystem. After it was added,
we are able to read from the files in that archive as they would
directly be stored on disk.
*/
// I changed this to make it more obvious where to put the media files.
device.FileSystem.AddZipFileArchive(Application.StartupPath + "\\map-20kdm2.pk3");
/*
Now we can load the mesh by calling getMesh(). We get a pointer returned
to a IAnimatedMesh. As you know, Quake 3 maps are not really animated,
they are only a huge chunk of static geometry with some materials
attached. Hence the IAnimated mesh consists of only one frame,
so we get the "first frame" of the "animation", which is our quake level
and create an OctTree scene node with it, using addOctTreeSceneNode().
The OctTree optimizes the scene a little bit, trying to draw only geometry
which is currently visible. An alternative to the OctTree would be a
AnimatedMeshSceneNode, which would draw always the complete geometry of
the mesh, without optimization. Try it out: Write addAnimatedMeshSceneNode
instead of addOctTreeSceneNode and compare the primitives drawed by the
video driver. (There is a getPrimitiveCountDrawed() method in the
IVideoDriver class). Note that this optimization with the Octree is only
useful when drawing huge meshes consiting of lots of geometry.
*/
// I changed this to make it more obvious where to put the media files.
IAnimatedMesh mesh = device.SceneManager.GetMesh("20kdm2.bsp");
ISceneNode node = null;
if (mesh != null)
node = device.SceneManager.AddOctTreeSceneNode(mesh, null, 0);
/*
Because the level was modelled not around the origin (0,0,0), we translate
the whole level a little bit.
*/
if (node != null)
node.Position = (new Vector3D(-1300, -144, -1249));
/*
Now we only need a Camera to look at the Quake 3 map.
And we want to create a user controlled camera. There are some
different cameras available in the Irrlicht engine. For example the
Maya Camera which can be controlled compareable to the camera in Maya:
Rotate with left mouse button pressed, Zoom with both buttons pressed,
translate with right mouse button pressed. This could be created with
addCameraSceneNodeMaya(). But for this example, we want to create a
camera which behaves like the ones in first person shooter games (FPS).
*/
device.SceneManager.AddCameraSceneNodeFPS();
/*
The mouse cursor needs not to be visible, so we make it invisible.
*/
device.CursorControl.Visible = false;
/*
We have done everything, so lets draw it. We also write the current
frames per second and the drawn primitives to the caption of the
window. The 'if (device->isWindowActive())' line is optional, but
prevents the engine render to set the position of the mouse cursor
after task switching when other program are active.
*/
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 - Quake 3 Map example [" +
device.VideoDriver.Name + "] FPS:" + fps.ToString();
lastFPS = fps;
}
}
}
/*
In the end, delete the Irrlicht device.
*/
// Instead of device->drop, we'll use:
GC.Collect();
}
}
}
//Retrieved from "http://www.irrforge.org/index.php/CS_Tutorial_2"
// This page has been accessed 237 times. This page was last modified 19:19, 20 Jan 2006.
// empty
\ No newline at end of file
/*
This Tutorial shows how to move and animate SceneNodes. The
basic concept of SceneNodeAnimators is shown as well as manual
movement of nodes using the keyboard.
*/
using System;
using System.Text;
using System.IO;
using Irrlicht;
using Irrlicht.Video;
using Irrlicht.Core;
using Irrlicht.Scene;
namespace _04.Movement
{
/*
In this tutorial, one of our goals is to move a scene node using some
keys on the keyboard. We store a pointer to the scene node we want to
move with the keys here.
The other pointer is a pointer to the Irrlicht Device, which we need
int the EventReceiver to manipulate the scene node and to get the
active camera.
*/
/*
To get events like mouse and keyboard input, or GUI events like
"the OK button has been clicked", we need an object wich is derived from the
IEventReceiver object. There is only one method to override: OnEvent.
This method will be called by the engine when an event happened.
We will use this input to move the scene node with the keys W and S.
*/
class Program : IEventReceiver
{
// Use this line for the default path to the Irrlicht standard media.
//string path = "../../../../media/";
// the_bob just puts the media in the executable folder, so I'm using this:
string path = string.Empty;
ISceneNode node = null;
IrrlichtDevice device = null;
/// <summary>
/// Main entry point for the program.
/// </summary>
/// <param name="args">Arguments to pass the software.</param>
[STAThread]
static void Main(string[] args)
{
Program prog = new Program();
prog.run();
}
public bool OnEvent(Event p_e)
{
if (node != null && p_e.Type == EventType.KeyInput &&
!p_e.KeyPressedDown)
{
switch (p_e.Key)
{
case KeyCode.KEY_ESCAPE:
device.CloseDevice();
break;
case KeyCode.KEY_KEY_W:
case KeyCode.KEY_KEY_S:
{
Vector3D v = node.Position;
v.Y += p_e.Key == KeyCode.KEY_KEY_W ? 2.0f : -2.0f;
node.Position = v;
}
return true;
}
}
return false;
}
public void run()
{
/* Like in the HelloWorld example, we create an IrrlichtDevice with
new(). The difference now is that we ask the user to select
which hardware accelerated driver to use. The Software device would be
too slow to draw a huge Quake 3 map, but just for the fun of it, we make
this decision possible too.
*/
// ask user for driver
DriverType driverType;
// Ask user to select driver:
StringBuilder sb = new StringBuilder();
sb.Append("Please select the driver you want for this example:\n");
sb.Append("\n(a) Direct3D 9.0c\n(b) Direct3D 8.1\n(c) OpenGL 1.5");
sb.Append("\n(d) Software Renderer\n(e)Apfelbaum Software Renderer");
sb.Append("\n(f) Null Device\n(otherKey) exit\n\n");
// Get the user's input:
TextReader tIn = Console.In;
TextWriter tOut = Console.Out;
tOut.Write(sb.ToString());
string input = tIn.ReadLine();
// Select device based on user's input:
switch (input)
{
case "a":
driverType = DriverType.DIRECT3D9;
break;
case "b":
driverType = DriverType.DIRECT3D8;
break;
case "c":
driverType = DriverType.OPENGL;
break;
case "d":
driverType = DriverType.SOFTWARE;
break;
case "e":
driverType = DriverType.SOFTWARE2;
break;
case "f":
driverType = DriverType.NULL_DRIVER;
break;
default:
return;
}
// Create device and exit if creation fails:
device = new IrrlichtDevice(driverType, new Dimension2D(1024, 768), 32, true, true, true); // Bob changed this.
if (device == null)
{
tOut.Write("Device creation failed.");
return;
}
/* set this as event receiver*/
device.EventReceiver = this;
/*
Get a reference to the video driver and the SceneManager so that
we do not always have to write device.VideoDriver and
device.SceneManager.
*/
ISceneManager smgr = device.SceneManager;
IVideoDriver driver = device.VideoDriver;
/*Create the node for moving it with the 'W' and 'S' key. We create a
'test node', which is a cube built in into the engine for testing purposes.
We place the node a (0,0,30) and we assign a texture to it to let it look a
little bit more interesting.*/
node = smgr.AddCubeSceneNode(10, null, 0, new Vector3D(0, 0, 30), new Vector3D(), new Vector3D(1, 1, 1));
node.SetMaterialTexture(0, driver.GetTexture(path + "wall.bmp"));
node.SetMaterialFlag(MaterialFlag.LIGHTING, false);
/* Now we create another node, moving using a scene node animator. Scene
node animators modify scene nodes and can be attached to any scene node
like mesh scene nodes, billboards, lights and even camera scene nodes.
Scene node animators are not only able to modify the position of a scene
node, they can also animate the textures of an object for example. We create
a test scene node again an attach a 'fly circle' scene node to it, letting
this node fly around our first test scene node.*/
ISceneNode n = smgr.AddTestSceneNode(10, null, 0, new Vector3D(), new Vector3D(), new Vector3D(1, 1, 1));
n.SetMaterialTexture(0, driver.GetTexture(path + "t351sml.jpg"));
ISceneNodeAnimator anim = smgr.CreateFlyCircleAnimator(new Vector3D(0, 0, 30), 20, 0.001f);
n.AddAnimator(anim);
//is this really necessary?
anim.__dtor();
/*The last scene node we add to show possibilities of scene node animators
is a md2 model, which uses a 'fly straight' animator to run between two
points.*/
IAnimatedMeshSceneNode anms = smgr.AddAnimatedMeshSceneNode(
smgr.GetMesh(path + "sydney.md2"), null, 0);
if (anms != null)
{
anim = smgr.CreateFlyStraightAnimator(new Vector3D(100, 0, 60), new Vector3D(-100, 0, 60), 10000, true);
anms.AddAnimator(anim);
anim.__dtor();
/*To make to model look better, we disable lighting (we have created no lights,
and so the model would be black), set the frames between which the animation
should loop, rotate the model around 180 degrees, and adjust the animation
speed and the texture.
To set the right animation (frames and speed), we would also be able to just
call "anms->setMD2Animation(scene::EMAT_RUN)" for the 'run' animation
instead of "setFrameLoop" and "setAnimationSpeed", but this only works with
MD2 animations, and so you know how to start other animations.*/
anms.Position = new Vector3D(0, 0, 40);
anms.SetMaterialFlag(MaterialFlag.LIGHTING, false);
anms.SetFrameLoop(320, 360);
anms.AnimationSpeed = 30;
anms.Rotation = new Vector3D(0, 180, 0);
anms.SetMaterialTexture(0, driver.GetTexture(path + "sydney.BMP"));
}
/*To be able to look at and move around in this scene, we create a first person
* shooter style camera and make the mouse cursor invisible.*/
ICameraSceneNode camera = smgr.AddCameraSceneNodeFPS(null, 100, 100, 0);
camera.Position = new Vector3D(0, 0, 0);
device.CursorControl.Visible = false;
/*
We have done everything, so lets draw it. We also write the current
frames per second and the drawn primitives to the caption of the
window.
*/
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 - Movement example [" +
device.VideoDriver.Name + "] FPS:" + fps.ToString();
lastFPS = fps;
}
}
}
/*
In the end, delete the Irrlicht device.
*/
// Instead of device->drop, we'll use:
GC.Collect();
}
}
}
// Retrieved from "http://www.irrforge.org/index.php/CS_Tutorial_4"
// This page has been accessed 243 times. This page was last modified 06:03, 20 Jan 2006.
/* This tutorial shows how to use the built in User Interface
of the Irrlicht Engine. It will give a brief overview and show
how to create and use windows, buttons, scroll bars, static texts
and list boxes.
Lets start like the HelloWorld example: We include
the irrlicht header files and an additional file to be able
to ask the user for a driver type using the console.
*/
using System;
using System.Text;
using System.IO;
using Irrlicht;
using Irrlicht.Video;
using Irrlicht.GUI;
using Irrlicht.Core;
using Irrlicht.Scene;
namespace _05.UserInterface
{
class Program : IEventReceiver
{
// path to standard Irrlicht media folder
//string path = "../../../../media/";
// empty path for executable folder:
string path = string.Empty;
IrrlichtDevice device;
int cnt = 0;
IGUIListBox listbox;
/// <summary>
/// Main entry point for the program.
/// </summary>
/// <param name="args">Arguments to pass the software.</param>
[STAThread]
static void Main(string[] args)
{
Program prog = new Program();
prog.run();
}
/*The Event Receiver is not only capable of getting keyboard and mouse input events,
but also events of the graphical user interface (gui). There are events for almost
everything: Button click, Listbox selection change, events that say that a element
was hovered and so on. To be able to react to some of these events, we create an
event receiver. We only react to gui events, and if it's such an event, we get the
id of the caller (the gui element which caused the event) and get the pointer to the
gui environment.*/
public bool OnEvent(Event p_e)
{
if (p_e.Type == EventType.GUIEvent)
{
int id = p_e.GUIEventCaller.ID;
IGUIEnvironment env = device.GUIEnvironment;
switch (p_e.GUIEventType)
{
case (GUIEvent.SCROLL_BAR_CHANGED):
if (id == 104)
{
// I think this is still not implemented
//int pos=p_e.GUIEventCaller.Position;
}
break;
/*If a button was clicked, it could be one of 'our' three buttons.
If it is the first, we shut down the engine. If it is the second,
we create a little window with some text on it. We also add a string
to the list box to log what happened. And if it is the third button,
we create a file open dialog, and add also this as string to the list
box. That's all for the event receiver.*/
case (GUIEvent.BUTTON_CLICKED):
if (id == 101)
{
device.CloseDevice();
return true;
}
if (id == 102)
{
listbox.AddItem("Window Created");
cnt += 30;
if (cnt > 200)
cnt = 0;
IGUIElement window = env.AddWindow(
new Rect(100 + cnt, 100 + cnt, 300 + cnt, 200 + cnt),
false, //modal?
"Test Window",
null, //parent
0); // id
env.AddStaticText("Please close me",
new Rect(35, 35, 140, 50),
true, //border
false, //wordwrap
window, //parent
0); //id
return true;
}
if (id == 103)
{
listbox.AddItem("File open");
env.AddFileOpenDialog("Please choose a file", false, null, 0);
return true;
}
break;
}
}
return false;
}
public void run()
{
// ask user for driver
DriverType driverType;
// Ask user to select driver:
StringBuilder sb = new StringBuilder();
sb.Append("Please select the driver you want for this example:\n");
sb.Append("\n(a) Direct3D 9.0c\n(b) Direct3D 8.1\n(c) OpenGL 1.5");
sb.Append("\n(d) Software Renderer\n(e) Apfelbaum Software Renderer");
sb.Append("\n(f) Null Device\n(otherKey) exit\n\n");
// Get the user's input:
TextReader tIn = Console.In;
TextWriter tOut = Console.Out;
tOut.Write(sb.ToString());
string input = tIn.ReadLine();
// Select device based on user's input:
switch (input)
{
case "a":
driverType = DriverType.DIRECT3D9;
break;
case "b":
driverType = DriverType.DIRECT3D8;
break;
case "c":
driverType = DriverType.OPENGL;
break;
case "d":
driverType = DriverType.SOFTWARE;
break;
case "e":
driverType = DriverType.SOFTWARE2;
break;
case "f":
driverType = DriverType.NULL_DRIVER;
break;
default:
return;
}
// Create device and exit if creation fails:
device = new IrrlichtDevice(driverType, new Dimension2D(1024, 768), 32, false, true, true);
if (device == null)
{
tOut.Write("Device creation failed.");
return;
}
/* set this as event receiver*/
device.EventReceiver = this;
/*
Get a pointer to the video driver and the SceneManager so that
we do not always have to write device.VideoDriver and
device.SceneManager and device.GUIEnvironment.
*/
ISceneManager smgr = device.SceneManager;
IVideoDriver driver = device.VideoDriver;
IGUIEnvironment env = device.GUIEnvironment;
/*We add three buttons. The first one closes the engine. The second creates
a window and the third opens a file open dialog. The third parameter is
the id of the button, with which we can easily identify the button in the
event receiver.*/
env.AddButton(new Rect(10, 210, 100, 240), null, 101, "Quit");
env.AddButton(new Rect(10, 250, 100, 290), null, 102, "New Window");
env.AddButton(new Rect(10, 300, 100, 340), null, 103, "File Open");
/*Now, we add a static text and a scrollbar, which modifies the transparency
of all gui elements. We set the maximum value of the scrollbar to 255,
because that's the maximal value for a color value. Then we create an other
static text and a list box.*/
env.AddStaticText("Transparent Control:", new Rect(150, 20, 350, 40), true, false, null, 0);
IGUIElement scrollbar = env.AddScrollBar(true, new Rect(150, 45, 350, 60), null, 104);
//nopt implemented yet
//scrollbar.Max=255;
env.AddStaticText("Logging Listbox:", new Rect(50, 80, 250, 100), true, false, null, 0);
listbox = env.AddListBox(new Rect(50, 110, 250, 180), null, 0, true);
/*To make the font a little bit nicer, we load an external font and set it as
new font in the skin. An at last, we create a nice Irrlicht Engine logo in the
top left corner. */
IGUISkin skin = env.Skin;
IGUIFont font = env.GetFont(path + "fonthaettenschweiler.bmp");
if (font != null)
{
skin.Font = font;
}
IGUIElement img = env.AddImage(driver.GetTexture(path + "irrlichtlogoalpha.tga"),
new Position2D(10, 10),
false, //UseAlphaChannel
null, //Parent
0, //ID
""); //Text
/*
We have done everything, so lets draw it.
*/
while (device.Run())
{
if (device.WindowActive)
{
device.VideoDriver.BeginScene(true, true, new Color(0, 122, 65, 171));
device.SceneManager.DrawAll();
device.GUIEnvironment.DrawAll();
device.VideoDriver.EndScene();
}
}
/*
In the end, delete the Irrlicht device.
*/
// Instead of device->drop, we'll use:
GC.Collect();
}
}
}
// Retrieved from "http://www.irrforge.org/index.php/CS_Tutorial_5"
// This page has been accessed 221 times. This page was last modified 06:10, 20 Jan 2006.
/* This Tutorial shows how to do 2d graphics with the Irrlicht
Engine. It shows how to draw images, keycolor based sprites,
transparent rectangles and different fonts. You will may
consider this useful if you want to make a 2d game with the
engine, or if you want to draw a cool interface or head up
display for your 3d game. */
using System;
using System.Text;
using System.IO;
using Irrlicht;
using Irrlicht.Video;
using Irrlicht.GUI;
using Irrlicht.Core;
using Irrlicht.Scene;
namespace _06._2DGraphics
{
class Program
{
// Path to default irrlicht media folder
// string path = "../../../../media/";
// Empty path - media in executable folder
string path = string.Empty;
IrrlichtDevice device;
/// <summary>
/// Main entry point for the program.
/// </summary>
/// <param name="args">Arguments to pass the software.</param>
[STAThread]
static void Main(string[] args)
{
Program prog = new Program();
prog.run();
}
public void run()
{
/* At first, we let the user select the driver type,
then start up the engine, set a caption, and get a
pointer to the video driver.
*/
// ask user for driver
DriverType driverType;
// Ask user to select driver:
StringBuilder sb = new StringBuilder();
sb.Append("Please select the driver you want for this example:\n");
sb.Append("\n(a) Direct3D 9.0c\n(b) Direct3D 8.1\n(c) OpenGL 1.5");
sb.Append("\n(d) Software Renderer\n(e) Apfelbaum Software Renderer");
sb.Append("\n(f) Null Device\n(otherKey) exit\n\n");
// Get the user's input:
TextReader tIn = Console.In;
TextWriter tOut = Console.Out;
tOut.Write(sb.ToString());
string input = tIn.ReadLine();
// Select device based on user's input:
switch (input)
{
case "a":
driverType = DriverType.DIRECT3D9;
break;
case "b":
driverType = DriverType.DIRECT3D8;
break;
case "c":
driverType = DriverType.OPENGL;
break;
case "d":
driverType = DriverType.SOFTWARE;
break;
case "e":
driverType = DriverType.SOFTWARE2;
break;
case "f":
driverType = DriverType.NULL_DRIVER;
break;
default:
return;
}
// Create device and exit if creation fails:
device = new IrrlichtDevice(driverType, new Dimension2D(1024, 768), 32, false, true, true);
if (device == null)
{
tOut.Write("Device creation failed.");
return;
}
/*
Get a pointer to the video driver and the SceneManager so that
we do not always have to write device.VideoDriver()
*/
IVideoDriver driver = device.VideoDriver;
/*All 2d graphics in this example are put together into one texture,
2ddemo.bmp. Because we want to draw colorkey based sprites, we need
to load this texture and tell the engine, which part of it should be
transparent based on a colorkey. In this example, we don't tell it
the color directly, we just say "Hey Irrlicht Engine, you'll find the
color I want at position (0,0) on the texture.". Instead, it would be
also possible to call driver.MakeColorKeyTexture(images, Color)
to make e.g. all black pixels transparent. Please note, that
makeColorKeyTexture just creates an alpha channel based on the color.*/
ITexture images = driver.GetTexture(path + "2ddemo.bmp");
driver.MakeColorKeyTexture(images, new Position2D(0, 0));
/*
To be able to draw some text with two different fonts,
we load them. Ok, we load just one, as first font we just
use the default font which is built into the engine.
Also, we define two rectangles, which specify the position
of the images of the red imps (little flying creatures) in
the texture.
*/
IGUIFont font = device.GUIEnvironment.BuiltInFont;
IGUIFont font2 = device.GUIEnvironment.GetFont(path + "fonthaettenschweiler.bmp");
Rect imp1 = new Rect(349, 15, 385, 78);
Rect imp2 = new Rect(387, 15, 423, 78);
/*
Everything is prepared, now we can draw everything in the draw loop,
between the begin scene and end scene calls. In this example, we are just
doing 2d graphics, but it would be no problem to mix them with 3d graphics.
Just try it out, and draw some 3d vertices or set up a scene with the scene
manager and draw it.
*/
while (device.Run() && driver != null)
{
if (device.WindowActive)
{
uint time = device.Timer.Time;
driver.BeginScene(true, true, new Color(0, 120, 102, 136));
/*
First, we draw 3 sprites, using the alpha channel we created with
makeColorKeyTexture. The last parameter specifiys that the drawing
method should use thiw alpha channel. The parameter before the last
one specifies a color, with which the sprite should be colored.
(255,255,255,255) is full white, so the sprite will look like the
original. The third sprite is drawed colored based on the time.*/
// draw fire & dragons background world
driver.Draw2DImage(images, new Position2D(50, 50),
new Rect(0, 0, 342, 224),
new Color(255, 255, 255, 255), true);
// draw flying imp
driver.Draw2DImage(images, new Position2D(164, 125),
(time / 500 % 2) == 0 ? imp1 : imp2,
new Color(255, 255, 255, 255), true);
// draw second flying imp with colorcylce
driver.Draw2DImage(images, new Position2D(270, 105),
(time / 500 % 2) == 0 ? imp1 : imp2,
new Color(255, ((int)(time) % 255), 255, 255), true);
// Drawing text is really simple. The code should be self explanatory.
if (font != null)
{
font.Draw("This is some text",
new Rect(130, 10, 300, 50),
new Color(255, 255, 255, 255), false, false);
}
if (font2 != null)
{
font2.Draw("This is some text",
new Rect(130, 20, 300, 60),
new Color(255, (int)time % 255, (int)time % 255, 255),
false, false);
}
/*At last, we draw the Irrlicht Engine logo (without using
a color or an alpha channel) and a transparent 2d Rectangle
at the position of the mouse cursor.*/
// draw logo
driver.Draw2DImage(images, new Position2D(10, 10),
new Rect(354, 87, 442, 118), new Color(255, 255, 255, 255), false);
// draw transparent rect under cursor
Position2D m = device.CursorControl.Position;
driver.Draw2DRectangle(new Color(100, 255, 255, 255),
new Rect(m.X - 20, m.Y - 20, m.X + 20, m.Y + 20));
driver.EndScene();
}
}
/*
In the end, delete the Irrlicht device.
*/
// Instead of device->drop, we'll use:
GC.Collect();
}
}
}
// Retrieved from "http://www.irrforge.org/index.php/CS_Tutorial_6"
// This page has been accessed 220 times. This page was last modified 06:10, 20 Jan 2006.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
Lets start like the HelloWorld example: We include
the irrlicht header files and an additional file to be able
to ask the user for a driver type using the console.
*/
using System;
using System.Text;
using System.IO;
using Irrlicht;
using Irrlicht.Video;
using Irrlicht.Core;
using Irrlicht.Scene;
using Irrlicht.GUI;
namespace _12.TerrainRendering
{
class Program: IEventReceiver
{
string path="../../../../media/";
ITerrainSceneNode terrain;
bool isWireframe=false;
//ISceneNode node=null;
/// <summary>
/// Main entry point for the program.
/// </summary>
/// <param name="args">Arguments to pass the software.</param>
[STAThread]
static void Main(string[] args)
{
Program prog = new Program();
prog.run();
}
/* In the beginning there is nothing special. We include the needed header files
and create an event listener to listen if the user presses the 'W' key so we
can switch to wireframe mode and if he presses 'D' we toggle to material
between solid and detail mapped.
*/
public bool OnEvent(Event p_event)
{
// check if user presses the key 'W' or 'D'
if (p_event.Type == EventType.KeyInput &&
!p_event.KeyPressedDown)
{
switch(p_event.Key)
{
case KeyCode.KEY_KEY_W:
isWireframe=!isWireframe;
terrain.SetMaterialFlag(MaterialFlag.WIREFRAME,isWireframe);
break;
case KeyCode.KEY_KEY_D:
terrain.SetMaterialType(
terrain.GetMaterial(0).Type==MaterialType.SOLID?
MaterialType.DETAIL_MAP : MaterialType.SOLID);
return true;
}
}
return false;
}
public void run()
{
/* The start of the main function starts like in most other example.
We ask the user for the desired renderer and start it up.
*/
// ask user for driver
DriverType driverType;
// Ask user to select driver:
StringBuilder sb = new StringBuilder();
sb.Append("Please select the driver you want for this example:\n");
sb.Append("\n(a) Direct3D 9.0c\n(b) Direct3D 8.1\n(c) OpenGL 1.5");
sb.Append("\n(d) Software Renderer\n(e)Apfelbaum Software Renderer");
sb.Append("\n(f) Null Device\n(otherKey) exit\n\n");
// Get the user's input:
TextReader tIn = Console.In;
TextWriter tOut = Console.Out;
tOut.Write(sb.ToString());
string input = tIn.ReadLine();
// Select device based on user's input:
switch (input)
{
case "a":
driverType = DriverType.DIRECT3D9;
break;
case "b":
driverType = DriverType.DIRECT3D8;
break;
case "c":
driverType = DriverType.OPENGL;
break;
case "d":
driverType = DriverType.SOFTWARE;
break;
case "e":
driverType = DriverType.SOFTWARE2;
break;
case "f":
driverType = DriverType.NULL_DRIVER;
break;
default:
return;
}
// Create device and exit if creation fails:
IrrlichtDevice device = new IrrlichtDevice(
driverType, new Dimension2D(640, 480), 32, false, true, true);
if (device == null)
{
tOut.Write("Device creation failed.");
return;
}
/* set this as event receiver*/
device.EventReceiver=this;
/*************************************************/
/* First, we add standard stuff to the scene: A nice irrlicht engine logo,
a small help text, a user controlled camera, and we disable the mouse
cursor.*/
ISceneManager smgr=device.SceneManager;
IVideoDriver driver=device.VideoDriver;
IGUIEnvironment env= device.GUIEnvironment;
driver.SetTextureCreationFlag(TextureCreationFlag.ALWAYS_32_BIT,true);
// add irrlicht logo
env.AddImage(driver.GetTexture(path+"irrlichtlogoalpha.tga"),
new Position2D(10,10),true,null,0,"");
// add some help text
IGUIStaticText text = env.AddStaticText(
"Press 'W' to change wireframe mode\nPress 'D' to toggle detail map",
new Rect(10,453,200,475), true, true, null, -1);
// add camera
ICameraSceneNode camera =
smgr.AddCameraSceneNodeFPS(null,100.0f,1200.0f,-1);
camera.Position=new Vector3D(1900*2,255*2,3700*2);
camera.Target= new Vector3D(2397*2,343*2,2700*2);
camera.FarValue=12000.0f;
// disable mouse cursor
device.CursorControl.Visible=false;
/* Here comes the terrain renderer scene node: We add it just like any other scene
node to the scene using ISceneManager::addTerrainSceneNode(). The only parameter
we use is a file name to the heightmap we use. A heightmap is simply a gray
scale texture. The terrain renderer loads it and creates the 3D terrain
from it.
To make the terrain look more big, we change the scale factor of it to
(40, 4.4, 40). Because we don't have any dynamic lights in the scene, we
switch off the lighting, and we set the file terrain-texture.jpg as texture
for the terrain and detailmap3.jpg as second texture, called detail map.
At last, we set the scale values for the texture: The first texture will be
repeated only one time over the whole terrain, and the second one (detail map)
20 times.
*/
// add terrain scene node
terrain = smgr.AddTerrainSceneNode(
path+"terrain-heightmap.bmp",null,-1,
new Vector3D(),new Vector3D(40, 4.4f, 40), new Color(255,255,255,255));
terrain.SetMaterialFlag(MaterialFlag.LIGHTING, false);
terrain.SetMaterialType(MaterialType.DETAIL_MAP);
terrain.SetMaterialTexture(0, driver.GetTexture(path+"terrain-texture.jpg"));
terrain.SetMaterialTexture(1, driver.GetTexture(path+"detailmap3.jpg"));
terrain.ScaleTexture(1.0f, 20.0f);
/* To be able to do collision with the terrain, we create a triangle selector.
If you want to know what triangle selectors do, just take a look into the
collision tutorial. The terrain triangle selector works together with the
terrain. To demonstrate this, we create a collision response animator and
attach it to the camera, so that the camera will not be able to fly through
the terrain.*/
// create triangle selector for the terrain
ITriangleSelector selector =
smgr.CreateTerrainTriangleSelector(terrain, 0);
// create collision response animator and attach it to the camera
ISceneNodeAnimator anim = smgr.CreateCollisionResponseAnimator(
selector, camera, new Vector3D(60,100,60),
new Vector3D(0,0,0),
new Vector3D(0,50,0),0.0005f);
camera.AddAnimator(anim);
//we add the skybox which we already used in lots of Irrlicht examples.
driver.SetTextureCreationFlag(TextureCreationFlag.CREATE_MIP_MAPS, false);
smgr.AddSkyBoxSceneNode(
driver.GetTexture(path+"irrlicht2_up.jpg"),
driver.GetTexture(path+"irrlicht2_dn.jpg"),
driver.GetTexture(path+"irrlicht2_lf.jpg"),
driver.GetTexture(path+"irrlicht2_rt.jpg"),
driver.GetTexture(path+"irrlicht2_ft.jpg"),
driver.GetTexture(path+"irrlicht2_bk.jpg"),null,0);
driver.SetTextureCreationFlag(TextureCreationFlag.CREATE_MIP_MAPS, true);
/* That's it, draw everything. Now you know how to use terrain
in Irrlicht.
*/
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 - Terrain example [" +
device.VideoDriver.Name + "] FPS:" + fps.ToString();
lastFPS = fps;
}
}
}
/*
In the end, delete the Irrlicht device.
*/
// Instead of device.drop, we'll use:
GC.Collect();
}
}
}
// Retrieved from "http://www.irrforge.org/index.php/CS_Tutorial_12"
// This page has been accessed 228 times. This page was last modified 06:58, 20 Jan 2006.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Irrlicht;
using Irrlicht.Core;
using Irrlicht.Scene;
namespace _14.WindowsForm
{
/// <summary>
/// Shows irrlicht running in a windows .net form
/// </summary>
/// <remarks>
/// Create as a normal windows application, add the usual irrlicht refs and dll's..
/// This has been collapsed from 3 files into one for posting.
/// </remarks>
public partial class Form1 : Form
{
IrrlichtDevice device;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// this is not necessarily the best place to load and
// initialise Irrlicht, however, it does work.
this.Show();
runIrrlichtInWindowsFormTest(pictureBox1);
}
void runIrrlichtInWindowsFormTest(Control c)
{
device = new IrrlichtDevice(Irrlicht.Video.DriverType.DIRECT3D9,
new Dimension2D(c.Width, c.Height),
32, false, false, false, true, c.Handle);
ICameraSceneNode cam = device.SceneManager.AddCameraSceneNode(null, new Vector3D(), new Vector3D(), -1);
ISceneNodeAnimator anim = device.SceneManager.CreateFlyCircleAnimator(new Vector3D(0, 10, 0), 30.0f, 0.003f);
cam.AddAnimator(anim);
ISceneNode cube = device.SceneManager.AddTestSceneNode(25, null, -1, new Vector3D());
cube.SetMaterialTexture(0, device.VideoDriver.GetTexture("../../../media/rockwall.bmp"));
cube.SetMaterialFlag(MaterialFlag.LIGHTING, false);
// draw everything
// Note, using device.WindowActive will not work on a control, since we don't
// really activate controls..
while (device.Run() && c.Enabled)
{
device.VideoDriver.BeginScene(true, true, new Irrlicht.Video.Color(255, 0, 0, 50));
device.SceneManager.DrawAll();
device.GUIEnvironment.DrawAll();
device.VideoDriver.EndScene();
}
}
private void button1_Click(object sender, EventArgs e)
{
pictureBox1.Enabled = false;
this.Close();
}
#region Ripped from the Form1.Designer.cs
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.pictureBox1.Location = new System.Drawing.Point(12, 37);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(267, 207);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// button1
//
this.button1.Location = new System.Drawing.Point(206, 250);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1;
this.button1.Text = "Quit";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 13);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(94, 13);
this.label1.TabIndex = 2;
this.label1.Text = "Irrlicht in a window";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 293);
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
this.Controls.Add(this.pictureBox1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
#endregion
#region ripped from Program.cs
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
#endregion
}
}
// Retrieved from "http://www.irrforge.org/index.php/CS_Tutorial_14"
// This page has been accessed 299 times. This page was last modified 17:29, 22 Jan 2006.
These Tutorials have simply been copied from the Irrlicht Wiki at http://www.irrforge.org
They are written by different authors, and not guaranteed to work, they simply should provide
the c++ examples ported the Irrlicht.NET.
Please see the wiki for updates and more info.
A lot of thanks go to the people who wrote these examples.
\ No newline at end of file
program HelloWorld_pas;
{$APPTYPE CONSOLE}
{%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.dll'} {%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Data.dll'} {%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Windows.Forms.dll'} {%DelphiDotNetAssemblyCompiler '..\..\bin\visualstudio\Irrlicht.NET.dll'}
uses
System.Windows.Forms,
Irrlicht,
Irrlicht.Video,
Irrlicht.Core,
Irrlicht.Scene;
var
device : IrrlichtDevice;
texSydney, texWall, texLogo : ITexture;
mesh : Irrlicht.Scene.IAnimatedMesh;
cam : ICameraSceneNode;
node : ISceneNode;
fps : integer;
s : char;
begin
WriteLn( 'Please select the driver you want for this example :' );
WriteLn( ' (a) Direct3D 9.0c' );
WriteLn( ' (b) Direct3D 8.1' );
WriteLn( ' (c) OpenGL 1.2' );
WriteLn( ' (d) Software Renderer' );
WriteLn( ' (e) NullDevice' );
WriteLn( ' (otherKey) exit' );
WriteLn( );
ReadLn( s );
// start up the engine
case s of
'a' : device := IrrlichtDevice.Create(DriverType.DIRECTX9);
'b' : device := IrrlichtDevice.Create(DriverType.DIRECTX8);
'c' : device := IrrlichtDevice.Create(DriverType.OPENGL);
'd' : device := IrrlichtDevice.Create(DriverType.SOFTWARE);
'e' : device := IrrlichtDevice.Create(DriverType.NULL_DRIVER);
else
exit;
end;
device.ResizeAble := true;
device.WindowCaption := 'Irrlicht.NET via Delphi.NET example 01 - Hello World [ '+ device.VideoDriver.Name + ' ] fps : ' + fps.ToString;
// load some textures
texSydney := device.VideoDriver.GetTexture('..\..\media\sydney.bmp');
texWall := device.VideoDriver.GetTexture('..\..\media\wall.bmp');
texLogo := device.VideoDriver.GetTexture('..\..\media\irrlichtlogoaligned.jpg');
// load the animated mesh of sydney
mesh := device.SceneManager.GetMesh('..\..\media\sydney.md2');
if (mesh = nil) then
begin
System.Windows.Forms.MessageBox.Show(
'Could not load mesh ..\..\media\sydney.md2, exiting.',
'Problem starting program');
exit;
end;
// add a camera, a test scene node and the animated mesh to the scene
cam := device.SceneManager.AddCameraSceneNodeFPS(nil, 100, 100, -1);
cam.Position := Vector3D.Create(20,0,-50);
node := device.SceneManager.AddTestSceneNode(15, nil, -1, Vector3D.Create(30,-15,0));
node.SetMaterialTexture(0, texWall);
node := device.SceneManager.AddAnimatedMeshSceneNode(mesh, nil, -1);
node.SetMaterialTexture(0, texSydney);
node.SetMaterialFlag(MaterialFlag.LIGHTING, false);
// make cursor invisible
device.CursorControl.Visible := false;
// start drawing loop
fps := 0;
while( device.Run ) do
begin
if (device.WindowActive) then
begin
device.VideoDriver.BeginScene( true, true, Color.Create( 0, 100, 100, 100 ) );
device.SceneManager.DrawAll();
// draw the logo
device.VideoDriver.Draw2DImage(
texLogo, Position2D.Create( 10, 10 ),
Rect.Create( 0,0,88,31 ),
Rect.Create( Position2D.Create( 0, 0 ),device.VideoDriver.ScreenSize),
Color.Create($ffffff), false);
device.VideoDriver.EndScene();
if (fps <> device.VideoDriver.FPS) then
begin
fps := device.VideoDriver.FPS;
device.WindowCaption := 'Irrlicht.NET via Delphi.NET example 01 - Hello World [ '+ device.VideoDriver.Name + ' ] fps : ' + fps.ToString;
end;
end;
end; // end drawing-loop
end.
program Quake3Map_pas;
{$APPTYPE CONSOLE}
{%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.dll'} {%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Data.dll'} {%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Windows.Forms.dll'} {%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Drawing.dll'} {%DelphiDotNetAssemblyCompiler '..\..\bin\win32-visualstudio\Irrlicht.NET.dll'}
uses
System.Windows.Forms,
Irrlicht,
Irrlicht.Video,
Irrlicht.Core,
Irrlicht.Scene;
var
device : IrrlichtDevice;
texLogo : ITexture;
mesh : Irrlicht.Scene.IAnimatedMesh;
node : ISceneNode;
fps : integer;
s : char;
driver : IVideoDriver;
smgr :ISceneManager;
begin
WriteLn( 'Please select the driver you want for this example :' );
WriteLn( ' (a) Direct3D 9.0c' );
WriteLn( ' (b) Direct3D 8.1' );
WriteLn( ' (c) OpenGL 1.2' );
WriteLn( ' (d) Software Renderer' );
WriteLn( ' (e) NullDevice' );
WriteLn( ' (otherKey) exit' );
WriteLn( );
ReadLn( s );
// start up the engine
case s of
'a' : device := IrrlichtDevice.Create(DriverType.DIRECTX9);
'b' : device := IrrlichtDevice.Create(DriverType.DIRECTX8);
'c' : device := IrrlichtDevice.Create(DriverType.OPENGL);
'd' : device := IrrlichtDevice.Create(DriverType.SOFTWARE);
'e' : device := IrrlichtDevice.Create(DriverType.NULL_DRIVER);
else
exit;
end;
device.ResizeAble := true;
device.WindowCaption := 'Irrlicht.NET via Delphi.NET example 02 - Quake3Map [ '+ device.VideoDriver.Name + ' ] fps : ' + fps.ToString;
driver := device.VideoDriver;
smgr := device.SceneManager;
{*
To display the Quake 3 map, we first need to load it. Quake 3 maps are packed into .pk3 files wich are nothing other than .zip files. So we add the .pk3 file to our FileSystem. After it was added, we are able to read from the files in that archive as they would directly be stored on disk. *}
device.FileSystem.AddZipFileArchive('../../media/map-20kdm2.pk3');
{*
Now we can load the mesh by calling getMesh(). We get a pointer returned to a IAnimatedMesh. As you know, Quake 3 maps are not really animated, they are only a huge chunk of static geometry with some materials attached. Hence the IAnimated mesh consists of only one frame, so we get the "first frame" of the "animation", which is our quake level and create an OctTree scene node with it, using addOctTreeSceneNode(). The OctTree optimizes the scene a little bit, trying to draw only geometry which is currently visible. An alternative to the OctTree would be a AnimatedMeshSceneNode, which would draw always the complete geometry of the mesh, without optimization. Try it out: Write addAnimatedMeshSceneNode instead of addOctTreeSceneNode and compare the primitives drawed by the video driver. (There is a getPrimitiveCountDrawed() method in the IVideoDriver class). Note that this optimization with the Octree is only useful when drawing huge meshes consiting of lots of geometry. *}
// load the animated mesh of sydney
mesh := smgr.GetMesh('20kdm2.bsp');
node := nil;
if (mesh <> nil) then
begin
node := smgr.addOctTreeSceneNode( mesh.GetMesh( 0 ), nil, 0 );
end;
{*
Because the level was modelled not around the origin (0,0,0), we translate the whole level a little bit. *} if (node <> nil) then node.Position := Vector3D.Create( -1300,-144,-1249 );
{*
Now we only need a Camera to look at the Quake 3 map. And we want to create a user controlled camera. There are some different cameras available in the Irrlicht engine. For example the Maya Camera which can be controlled compareable to the camera in Maya: Rotate with left mouse button pressed, Zoom with both buttons pressed, translate with right mouse button pressed. This could be created with addCameraSceneNodeMaya(). But for this example, we want to create a camera which behaves like the ones in first person shooter games (FPS). *} smgr.AddCameraSceneNodeFPS();
texLogo := driver.GetTexture('../../media/irrlichtlogoaligned.jpg');
// make cursor invisible
device.CursorControl.Visible := false;
// start drawing loop
fps := 0;
while( device.Run ) do
begin
if (device.WindowActive) then
begin
driver.BeginScene( true, true, Color.Create( 0, 200, 200, 200 ) );
smgr.DrawAll();
// draw the logo
driver.Draw2DImage(
texLogo, Position2D.Create( 10, 10 ),
Rect.Create( 0,0,88,31 ),
Rect.Create( Position2D.Create( 0, 0 ),device.VideoDriver.ScreenSize),
Color.Create($ffffff), false);
driver.EndScene();
if (fps <> driver.FPS) then
begin
fps := driver.FPS;
device.WindowCaption := 'Irrlicht.NET via Delphi.NET example 02 - Quake3Map [ '+ device.VideoDriver.Name + ' ] fps : ' + fps.ToString;
end;
end;
end; // end drawing-loop
end.
// Retrieved from "http://www.irrforge.org/index.php/Delphi.NET_version_of_Quake3Map"
// This page has been accessed 364 times. This page was last modified 07:00, 20 Jan 2006.
program Graphics2D_pas;
{$APPTYPE CONSOLE}
{%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.dll'} {%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Data.dll'} {%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Windows.Forms.dll'} {%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Drawing.dll'} {%DelphiDotNetAssemblyCompiler '..\..\bin\win32-visualstudio\Irrlicht.NET.dll'} {%TogetherDiagram 'ModelSupport\default.txaPackage'}
uses
System.Windows.Forms,
Irrlicht,
Irrlicht.Video,
Irrlicht.Core,
Irrlicht.Scene,
Irrlicht.GUI;
var
device : IrrlichtDevice;
texLogo : ITexture;
fps : integer;
s : char;
driver : IVideoDriver;
smgr :ISceneManager;
images : ITexture;
font, font2 : IGUIFont;
imp1, imp2 : rect;
time : Cardinal;
m : Position2D;
begin
WriteLn( 'Please select the driver you want for this example :' );
WriteLn( ' (a) Direct3D 9.0c' );
WriteLn( ' (b) Direct3D 8.1' );
WriteLn( ' (c) OpenGL 1.2' );
WriteLn( ' (d) Software Renderer' );
WriteLn( ' (e) NullDevice' );
WriteLn( ' (otherKey) exit' );
WriteLn( );
ReadLn( s );
// start up the engine
case s of
'a' : device := IrrlichtDevice.Create(DriverType.DIRECTX9);
'b' : device := IrrlichtDevice.Create(DriverType.DIRECTX8);
'c' : device := IrrlichtDevice.Create(DriverType.OPENGL);
'd' : device := IrrlichtDevice.Create(DriverType.SOFTWARE);
'e' : device := IrrlichtDevice.Create(DriverType.NULL_DRIVER);
else
exit;
end;
device.ResizeAble := true;
device.WindowCaption := 'Irrlicht.NET via Delphi.NET example 06 - - 2D Graphics Demo [ '+ device.VideoDriver.Name + ' ] fps : ' + fps.ToString;
driver := device.VideoDriver;
smgr := device.SceneManager;
images := driver.GetTexture( '../../media/2ddemo.bmp' );
driver.MakeColorKeyTexture(images, position2d.Create( 0, 0 ) );
font := device.GUIEnvironment.BuiltInFont;
font2 := device.GUIEnvironment.GetFont( '../../media/fonthaettenschweiler.bmp' );
imp1 := rect.Create(349,15,385,78);
imp2 := rect.Create(387,15,423,78);
// The logo
texLogo := driver.GetTexture('../../media/irrlichtlogoaligned.jpg');
// make cursor invisible
device.CursorControl.Visible := false;
// start drawing loop
fps := 0;
while( device.Run ) do
begin
if (device.WindowActive) then
begin
//time := device.GetTimer().getTime();
driver.BeginScene( true, true, Color.Create( 0, 120, 102, 136 ) );
// draw fire & dragons background world
driver.draw2DImage(images,
position2d.Create(50,50),
rect.Create(0,0,342,224),
Irrlicht.Video.Color.Create(255,255,255,255), true);
// draw flying imp
if ((time div 500) mod 2) = 0 then
driver.draw2DImage(images, position2d.Create(164,125),
imp1,
Irrlicht.Video.Color.Create(255,255,255,255), true)
else
driver.draw2DImage(images, position2d.Create(164,125),
imp2, Irrlicht.Video.Color.Create(255,255,255,255), true);
// draw second flying imp with colorcylce
if ((time div 500) mod 2) = 0 then
driver.draw2DImage(images, position2d.Create(270,105),
imp1,
Irrlicht.Video.Color.Create(255, time mod 255,255,255), true)
else
driver.draw2DImage(images, position2d.Create(270,105),
imp2,
Irrlicht.Video.Color.Create(255, time mod 255,255,255), true);
// draw some text
if (font <> nil )then
font.draw('This is some text.',
rect.Create(130,10,300,50),
Irrlicht.Video.Color.Create(255,255,255,255), false, false );
// draw some other text
if (font2 <> nil) then
font2.draw('This is some other text.',
rect.Create(130,20,300,60),
Irrlicht.Video.Color.Create(255,time mod 255,time mod 255,255), false, false );
// draw the logo
driver.Draw2DImage(
texLogo, Position2D.Create( 10, 10 ),
Rect.Create( 0,0,88,31 ),
Rect.Create( Position2D.Create( 0, 0 ),device.VideoDriver.ScreenSize),
Color.Create($ffffff), false);
// draw transparent rect under cursor
m := device.CursorControl.Position;
driver.draw2DRectangle(Irrlicht.Video.Color.Create(100,255,255,255),
rect.Create(m.X-20, m.Y-20, m.X+20, m.Y+20));
driver.EndScene();
if (fps <> driver.FPS) then
begin
fps := driver.FPS;
device.WindowCaption := 'Irrlicht.NET via Delphi.NET example 06 - - 2D Graphics Demo [ '+ device.VideoDriver.Name + ' ] fps : ' + fps.ToString;
end;
end;
end; // end drawing-loop
end.
Retrieved from "http://www.irrforge.org/index.php/Delphi.NET_version_of_Graphics2D"
This page has been accessed 258 times. This page was last modified 07:01, 20 Jan 2006.
These Tutorials have simply been copied from the Irrlicht Wiki at http://www.irrforge.org
They are written by different authors, and not guaranteed to work, they simply should provide
the c++ examples ported the Irrlicht.NET.
Please see the wiki for updates and more info.
A lot of thanks go to the people who wrote these examples.
\ No newline at end of file
This diff is collapsed.
These Tutorials have simply been copied from the Irrlicht Wiki at http://www.irrforge.org
They are written by different authors, and not guaranteed to work, they simply should provide
the c++ examples ported the Irrlicht.NET.
Please see the wiki for updates and more info.
A lot of thanks go to the people who wrote these examples.
\ No newline at end of file
If you are searching for executeables of the examples and the techdemo,
you'll find some for Windows in the directory
/bin/Win32-VisualStudio.
...@@ -231,7 +231,7 @@ namespace scene ...@@ -231,7 +231,7 @@ namespace scene
{ {
for (u32 i=0; i<Buffer.size(); ++i) for (u32 i=0; i<Buffer.size(); ++i)
Buffer[i]->drop(); Buffer[i]->drop();
}; }
SMD3Header MD3Header; SMD3Header MD3Header;
core::stringc Name; core::stringc Name;
......
...@@ -45,7 +45,6 @@ public: ...@@ -45,7 +45,6 @@ public:
/** \param topColor: stores the color of the top vertices /** \param topColor: stores the color of the top vertices
\param bottomColor: stores the color of the bottom vertices */ \param bottomColor: stores the color of the bottom vertices */
virtual void getColor(video::SColor & topColor, video::SColor & bottomColor) const = 0; virtual void getColor(video::SColor & topColor, video::SColor & bottomColor) const = 0;
}; };
} // end namespace scene } // end namespace scene
......
...@@ -60,9 +60,6 @@ namespace gui ...@@ -60,9 +60,6 @@ namespace gui
IGUIButton(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIButton(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_BUTTON, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_BUTTON, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIButton() {}
//! Sets another skin independent font. //! Sets another skin independent font.
/** If this is set to zero, the button uses the font of the skin. /** If this is set to zero, the button uses the font of the skin.
\param font: New font to set. */ \param font: New font to set. */
......
...@@ -21,9 +21,6 @@ namespace gui ...@@ -21,9 +21,6 @@ namespace gui
IGUICheckBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUICheckBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_CHECK_BOX, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_CHECK_BOX, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUICheckBox() {}
//! Set if box is checked. //! Set if box is checked.
virtual void setChecked(bool checked) = 0; virtual void setChecked(bool checked) = 0;
......
...@@ -20,9 +20,6 @@ namespace gui ...@@ -20,9 +20,6 @@ namespace gui
//! constructor //! constructor
IGUIColorSelectDialog(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIColorSelectDialog(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_COLOR_SELECT_DIALOG, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_COLOR_SELECT_DIALOG, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIColorSelectDialog() {}
}; };
......
...@@ -21,9 +21,6 @@ namespace gui ...@@ -21,9 +21,6 @@ namespace gui
IGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_COMBO_BOX, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_COMBO_BOX, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIComboBox() {}
//! Returns amount of items in box //! Returns amount of items in box
virtual u32 getItemCount() const = 0; virtual u32 getItemCount() const = 0;
......
...@@ -21,9 +21,6 @@ namespace gui ...@@ -21,9 +21,6 @@ namespace gui
IGUIContextMenu(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIContextMenu(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_CONTEXT_MENU, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_CONTEXT_MENU, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIContextMenu() {};
//! Get amount of menu items //! Get amount of menu items
virtual u32 getItemCount() const = 0; virtual u32 getItemCount() const = 0;
......
...@@ -23,9 +23,6 @@ namespace gui ...@@ -23,9 +23,6 @@ namespace gui
IGUIEditBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIEditBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_EDIT_BOX, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_EDIT_BOX, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIEditBox() {};
//! Sets another skin independent font. //! Sets another skin independent font.
/** If this is set to zero, the button uses the font of the skin. /** If this is set to zero, the button uses the font of the skin.
\param font: New font to set. */ \param font: New font to set. */
......
...@@ -27,9 +27,6 @@ namespace gui ...@@ -27,9 +27,6 @@ namespace gui
{ {
public: public:
// destructor
virtual ~IGUIElementFactory() {}
//! adds an element to the gui environment based on its type id //! adds an element to the gui environment based on its type id
/** \param type: Type of the element to add. /** \param type: Type of the element to add.
\param parent: Parent scene node of the new element, can be null to add to the root. \param parent: Parent scene node of the new element, can be null to add to the root.
......
...@@ -62,9 +62,6 @@ class IGUIEnvironment : public virtual IReferenceCounted ...@@ -62,9 +62,6 @@ class IGUIEnvironment : public virtual IReferenceCounted
{ {
public: public:
//! destructor
virtual ~IGUIEnvironment() {};
//! Draws all gui elements by traversing the GUI environment starting //! Draws all gui elements by traversing the GUI environment starting
//! at the root node. //! at the root node.
virtual void drawAll() = 0; virtual void drawAll() = 0;
...@@ -527,7 +524,6 @@ public: ...@@ -527,7 +524,6 @@ public:
//! reads an element //! reads an element
virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* parent) =0; virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* parent) =0;
}; };
......
...@@ -21,9 +21,6 @@ namespace gui ...@@ -21,9 +21,6 @@ namespace gui
IGUIFileOpenDialog(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIFileOpenDialog(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_FILE_OPEN_DIALOG, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_FILE_OPEN_DIALOG, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIFileOpenDialog() {}
//! Returns the filename of the selected file. Returns NULL, if no file was selected. //! Returns the filename of the selected file. Returns NULL, if no file was selected.
virtual const wchar_t* getFileName() const = 0; virtual const wchar_t* getFileName() const = 0;
}; };
......
...@@ -39,9 +39,6 @@ class IGUIFont : public virtual IReferenceCounted ...@@ -39,9 +39,6 @@ class IGUIFont : public virtual IReferenceCounted
{ {
public: public:
//! Destructor
virtual ~IGUIFont() {}
//! Draws an text and clips it to the specified rectangle if wanted. //! Draws an text and clips it to the specified rectangle if wanted.
/** \param text: Text to draw /** \param text: Text to draw
\param position: Rectangle specifying position where to draw the text. \param position: Rectangle specifying position where to draw the text.
......
...@@ -18,9 +18,6 @@ class IGUIFontBitmap : public IGUIFont ...@@ -18,9 +18,6 @@ class IGUIFontBitmap : public IGUIFont
{ {
public: public:
//! Destructor
virtual ~IGUIFontBitmap() {}
//! Returns the type of this font //! Returns the type of this font
virtual EGUI_FONT_TYPE getType() const { return EGFT_BITMAP; } virtual EGUI_FONT_TYPE getType() const { return EGFT_BITMAP; }
......
...@@ -25,9 +25,6 @@ namespace gui ...@@ -25,9 +25,6 @@ namespace gui
IGUIImage(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIImage(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_IMAGE, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_IMAGE, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIImage() {}
//! Sets an image //! Sets an image
virtual void setImage(video::ITexture* image) = 0; virtual void setImage(video::ITexture* image) = 0;
......
...@@ -32,9 +32,6 @@ namespace gui ...@@ -32,9 +32,6 @@ namespace gui
IGUIInOutFader(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIInOutFader(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_IN_OUT_FADER, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_IN_OUT_FADER, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIInOutFader() {}
//! Gets the color to fade out to or to fade in from. //! Gets the color to fade out to or to fade in from.
virtual video::SColor getColor() const = 0; virtual video::SColor getColor() const = 0;
......
...@@ -39,9 +39,6 @@ namespace gui ...@@ -39,9 +39,6 @@ namespace gui
IGUIListBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIListBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_LIST_BOX, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_LIST_BOX, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIListBox() {}
//! returns amount of list items //! returns amount of list items
virtual u32 getItemCount() const = 0; virtual u32 getItemCount() const = 0;
......
...@@ -32,9 +32,6 @@ namespace gui ...@@ -32,9 +32,6 @@ namespace gui
IGUIMeshViewer(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIMeshViewer(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_MESH_VIEWER, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_MESH_VIEWER, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIMeshViewer() {}
//! Sets the mesh to be shown //! Sets the mesh to be shown
virtual void setMesh(scene::IAnimatedMesh* mesh) = 0; virtual void setMesh(scene::IAnimatedMesh* mesh) = 0;
......
...@@ -21,9 +21,6 @@ namespace gui ...@@ -21,9 +21,6 @@ namespace gui
IGUIScrollBar(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIScrollBar(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_SCROLL_BAR, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_SCROLL_BAR, environment, parent, id, rectangle) {}
//! destructor
~IGUIScrollBar() {};
//! gets the maximum value of the scrollbar. //! gets the maximum value of the scrollbar.
virtual s32 getMax() const = 0; virtual s32 getMax() const = 0;
......
...@@ -326,9 +326,6 @@ namespace gui ...@@ -326,9 +326,6 @@ namespace gui
{ {
public: public:
//! destructor
virtual ~IGUISkin() {};
//! returns default color //! returns default color
virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) const = 0; virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) const = 0;
...@@ -505,7 +502,7 @@ namespace gui ...@@ -505,7 +502,7 @@ namespace gui
const core::rect<s32>& pos, const core::rect<s32>* clip = 0) = 0; const core::rect<s32>& pos, const core::rect<s32>* clip = 0) = 0;
//! get the type of this skin //! get the type of this skin
virtual EGUI_SKIN_TYPE getType() const { return EGST_UNKNOWN; }; virtual EGUI_SKIN_TYPE getType() const { return EGST_UNKNOWN; }
}; };
......
...@@ -23,9 +23,6 @@ namespace gui ...@@ -23,9 +23,6 @@ namespace gui
s32 id, core::rect<s32> rectangle) s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_SPIN_BOX, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_SPIN_BOX, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUISpinBox() {}
//! Access the edit box used in the spin control //! Access the edit box used in the spin control
virtual IGUIEditBox* getEditBox() const = 0; virtual IGUIEditBox* getEditBox() const = 0;
......
...@@ -31,7 +31,8 @@ struct SGUISpriteFrame ...@@ -31,7 +31,8 @@ struct SGUISpriteFrame
//! A sprite composed of several frames. //! A sprite composed of several frames.
struct SGUISprite struct SGUISprite
{ {
SGUISprite() : Frames(), frameTime(0) { }; SGUISprite() : Frames(), frameTime(0) {}
core::array<SGUISpriteFrame> Frames; core::array<SGUISpriteFrame> Frames;
u32 frameTime; u32 frameTime;
}; };
...@@ -42,9 +43,6 @@ class IGUISpriteBank : public virtual IReferenceCounted ...@@ -42,9 +43,6 @@ class IGUISpriteBank : public virtual IReferenceCounted
{ {
public: public:
//! Destructor
virtual ~IGUISpriteBank() {}
//! Returns the list of rectangles held by the sprite bank //! Returns the list of rectangles held by the sprite bank
virtual core::array< core::rect<s32> >& getPositions() = 0; virtual core::array< core::rect<s32> >& getPositions() = 0;
...@@ -64,10 +62,11 @@ public: ...@@ -64,10 +62,11 @@ public:
virtual void setTexture(u32 index, video::ITexture* texture) = 0; virtual void setTexture(u32 index, video::ITexture* texture) = 0;
//! Draws a sprite in 2d with position and color //! Draws a sprite in 2d with position and color
virtual void draw2DSprite(u32 index, const core::position2di& pos, const core::rect<s32>* clip=0, virtual void draw2DSprite(u32 index, const core::position2di& pos,
const core::rect<s32>* clip=0,
const video::SColor& color= video::SColor(255,255,255,255), const video::SColor& color= video::SColor(255,255,255,255),
u32 starttime=0, u32 currenttime=0, bool loop=true, bool center=false) = 0; u32 starttime=0, u32 currenttime=0,
bool loop=true, bool center=false) = 0;
}; };
......
...@@ -23,9 +23,6 @@ namespace gui ...@@ -23,9 +23,6 @@ namespace gui
IGUIStaticText(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIStaticText(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_STATIC_TEXT, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_STATIC_TEXT, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIStaticText() {}
//! Sets another skin independent font. //! Sets another skin independent font.
/** If this is set to zero, the button uses the font of the skin. /** If this is set to zero, the button uses the font of the skin.
\param font: New font to set. */ \param font: New font to set. */
......
...@@ -22,9 +22,6 @@ namespace gui ...@@ -22,9 +22,6 @@ namespace gui
IGUITab(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUITab(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_TAB, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_TAB, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUITab() {}
//! Returns number of tab if in tabcontrol. //! Returns number of tab if in tabcontrol.
/** Can be accessed later IGUITabControl::getTab() by this number. */ /** Can be accessed later IGUITabControl::getTab() by this number. */
virtual s32 getNumber() const = 0; virtual s32 getNumber() const = 0;
...@@ -57,9 +54,6 @@ namespace gui ...@@ -57,9 +54,6 @@ namespace gui
IGUITabControl(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUITabControl(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_TAB_CONTROL, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_TAB_CONTROL, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUITabControl() {}
//! Adds a tab //! Adds a tab
virtual IGUITab* addTab(const wchar_t* caption, s32 id=-1) = 0; virtual IGUITab* addTab(const wchar_t* caption, s32 id=-1) = 0;
......
...@@ -26,9 +26,6 @@ namespace gui ...@@ -26,9 +26,6 @@ namespace gui
IGUIToolBar(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIToolBar(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_TOOL_BAR, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_TOOL_BAR, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIToolBar() {}
//! Adds a button to the tool bar //! Adds a button to the tool bar
virtual IGUIButton* addButton(s32 id=-1, const wchar_t* text=0,const wchar_t* tooltiptext=0, virtual IGUIButton* addButton(s32 id=-1, const wchar_t* text=0,const wchar_t* tooltiptext=0,
video::ITexture* img=0, video::ITexture* pressedimg=0, video::ITexture* img=0, video::ITexture* pressedimg=0,
......
...@@ -23,9 +23,6 @@ namespace gui ...@@ -23,9 +23,6 @@ namespace gui
IGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_WINDOW, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_WINDOW, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIWindow() {}
//! Returns pointer to the close button //! Returns pointer to the close button
virtual IGUIButton* getCloseButton() const = 0; virtual IGUIButton* getCloseButton() const = 0;
......
...@@ -26,9 +26,6 @@ class IImageLoader : public virtual IReferenceCounted ...@@ -26,9 +26,6 @@ class IImageLoader : public virtual IReferenceCounted
{ {
public: public:
//! Destructor
virtual ~IImageLoader() {}
//! Check if the file might be loaded by this class //! Check if the file might be loaded by this class
/** Check is based on the file extension (e.g. ".tga") /** Check is based on the file extension (e.g. ".tga")
\param fileName Name of file to check. \param fileName Name of file to check.
......
...@@ -23,9 +23,6 @@ namespace video ...@@ -23,9 +23,6 @@ namespace video
class IImageWriter : public IReferenceCounted class IImageWriter : public IReferenceCounted
{ {
public: public:
//! Destructor
virtual ~IImageWriter() { }
//! Check if this writer can write a file with the given extension //! Check if this writer can write a file with the given extension
/** \param fileName Name of the file to check. /** \param fileName Name of the file to check.
\return True if file extension specifies a writable type. */ \return True if file extension specifies a writable type. */
......
...@@ -51,7 +51,7 @@ public: ...@@ -51,7 +51,7 @@ public:
\param services: Interface providing some methods for changing \param services: Interface providing some methods for changing
advanced, internal states of a IVideoDriver. */ advanced, internal states of a IVideoDriver. */
virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial,
bool resetAllRenderstates, IMaterialRendererServices* services) {}; bool resetAllRenderstates, IMaterialRendererServices* services) {}
//! Called every time before a new bunch of geometry is being drawn using this material with for example drawIndexedTriangleList() call. //! Called every time before a new bunch of geometry is being drawn using this material with for example drawIndexedTriangleList() call.
/** OnSetMaterial should normally only be called if the renderer decides /** OnSetMaterial should normally only be called if the renderer decides
...@@ -71,7 +71,7 @@ public: ...@@ -71,7 +71,7 @@ public:
example if he doesn't support the specified vertex type. This is example if he doesn't support the specified vertex type. This is
actually done in D3D8 and D3D9 when using a normal mapped material with actually done in D3D8 and D3D9 when using a normal mapped material with
a vertex type other than EVT_TANGENTS. */ a vertex type other than EVT_TANGENTS. */
virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype) { return true; }; virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype) { return true; }
//! Called by the IVideoDriver to unset this material. //! Called by the IVideoDriver to unset this material.
/** Called during the IVideoDriver::setMaterial() call before the new /** Called during the IVideoDriver::setMaterial() call before the new
......
...@@ -1342,7 +1342,6 @@ namespace scene ...@@ -1342,7 +1342,6 @@ namespace scene
//! Returns ambient color of the scene //! Returns ambient color of the scene
virtual const video::SColorf& getAmbientLight() const = 0; virtual const video::SColorf& getAmbientLight() const = 0;
}; };
......
...@@ -68,6 +68,8 @@ namespace scene ...@@ -68,6 +68,8 @@ namespace scene
return ESNAT_UNKNOWN; return ESNAT_UNKNOWN;
} }
}; };
} // end namespace scene } // end namespace scene
} // end namespace irr } // end namespace irr
......
...@@ -88,6 +88,8 @@ namespace scene ...@@ -88,6 +88,8 @@ namespace scene
//! Get the current triangle selector containing all triangles for collision detection. //! Get the current triangle selector containing all triangles for collision detection.
virtual ITriangleSelector* getWorld() const = 0; virtual ITriangleSelector* getWorld() const = 0;
}; };
} // end namespace scene } // end namespace scene
} // end namespace irr } // end namespace irr
......
...@@ -194,7 +194,7 @@ namespace irr ...@@ -194,7 +194,7 @@ namespace irr
input, you can use this to post key or mouse input events to input, you can use this to post key or mouse input events to
the engine. Internally, this method only delegates the events the engine. Internally, this method only delegates the events
further to the scene manager and the GUI environment. */ further to the scene manager and the GUI environment. */
virtual void postEventFromUser(const SEvent& event) = 0; virtual bool postEventFromUser(const SEvent& event) = 0;
//! Sets the input receiving scene manager. //! Sets the input receiving scene manager.
/** If set to null, the main scene manager (returned by /** If set to null, the main scene manager (returned by
......
...@@ -35,7 +35,7 @@ namespace scene ...@@ -35,7 +35,7 @@ namespace scene
// drop meshes // drop meshes
for (u32 i=0; i<Meshes.size(); ++i) for (u32 i=0; i<Meshes.size(); ++i)
Meshes[i]->drop(); Meshes[i]->drop();
}; }
//! Gets the frame count of the animated mesh. //! Gets the frame count of the animated mesh.
......
...@@ -224,7 +224,7 @@ namespace video ...@@ -224,7 +224,7 @@ namespace video
//! Calculates a 16 bit A1R5G5B5 value of this color. //! Calculates a 16 bit A1R5G5B5 value of this color.
/** \return 16 bit A1R5G5B5 value of this color. */ /** \return 16 bit A1R5G5B5 value of this color. */
u16 toA1R5G5B5() const { return A8R8G8B8toA1R5G5B5(color); }; u16 toA1R5G5B5() const { return A8R8G8B8toA1R5G5B5(color); }
//! Converts color to OpenGL color format //! Converts color to OpenGL color format
/** From ARGB to RGBA in 4 byte components for endian aware /** From ARGB to RGBA in 4 byte components for endian aware
...@@ -236,7 +236,7 @@ namespace video ...@@ -236,7 +236,7 @@ namespace video
*++dest = getGreen(); *++dest = getGreen();
*++dest = getBlue(); *++dest = getBlue();
*++dest = getAlpha(); *++dest = getAlpha();
}; }
//! Sets all four components of the color at once. //! Sets all four components of the color at once.
/** Constructs the color from 4 values representing the alpha, /** Constructs the color from 4 values representing the alpha,
...@@ -373,7 +373,7 @@ namespace video ...@@ -373,7 +373,7 @@ namespace video
no green (=black) and 1.0f, meaning full green. no green (=black) and 1.0f, meaning full green.
\param bb: Blue color component. Should be a value between 0.0f meaning \param bb: Blue color component. Should be a value between 0.0f meaning
no blue (=black) and 1.0f, meaning full blue. */ no blue (=black) and 1.0f, meaning full blue. */
void set(f32 rr, f32 gg, f32 bb) {r = rr; g =gg; b = bb; }; void set(f32 rr, f32 gg, f32 bb) {r = rr; g =gg; b = bb; }
//! Sets all four color components to new values at once. //! Sets all four color components to new values at once.
/** \param aa: Alpha component. Should be a value between 0.0f meaning /** \param aa: Alpha component. Should be a value between 0.0f meaning
...@@ -384,7 +384,7 @@ namespace video ...@@ -384,7 +384,7 @@ namespace video
no green and 1.0f, meaning full green. no green and 1.0f, meaning full green.
\param bb: Blue color component. Should be a value between 0.0f meaning \param bb: Blue color component. Should be a value between 0.0f meaning
no blue and 1.0f, meaning full blue. */ no blue and 1.0f, meaning full blue. */
void set(f32 aa, f32 rr, f32 gg, f32 bb) {a = aa; r = rr; g =gg; b = bb; }; void set(f32 aa, f32 rr, f32 gg, f32 bb) {a = aa; r = rr; g =gg; b = bb; }
//! Interpolates the color with a f32 value to another color //! Interpolates the color with a f32 value to another color
/** \param other: Other color /** \param other: Other color
......
...@@ -35,11 +35,11 @@ class aabbox3d ...@@ -35,11 +35,11 @@ class aabbox3d
//! Equality operator //! Equality operator
/** \param other box to compare with. /** \param other box to compare with.
\return True if both boxes are equal, else false. */ \return True if both boxes are equal, else false. */
inline bool operator==(const aabbox3d<T>& other) const { return (MinEdge == other.MinEdge && other.MaxEdge == MaxEdge);}; inline bool operator==(const aabbox3d<T>& other) const { return (MinEdge == other.MinEdge && other.MaxEdge == MaxEdge);}
//! Inequality operator //! Inequality operator
/** \param other box to compare with. /** \param other box to compare with.
\return True if both boxes are different, else false. */ \return True if both boxes are different, else false. */
inline bool operator!=(const aabbox3d<T>& other) const { return !(MinEdge == other.MinEdge && other.MaxEdge == MaxEdge);}; inline bool operator!=(const aabbox3d<T>& other) const { return !(MinEdge == other.MinEdge && other.MaxEdge == MaxEdge);}
// functions // functions
...@@ -109,7 +109,7 @@ class aabbox3d ...@@ -109,7 +109,7 @@ class aabbox3d
return (p.X >= MinEdge.X && p.X <= MaxEdge.X && return (p.X >= MinEdge.X && p.X <= MaxEdge.X &&
p.Y >= MinEdge.Y && p.Y <= MaxEdge.Y && p.Y >= MinEdge.Y && p.Y <= MaxEdge.Y &&
p.Z >= MinEdge.Z && p.Z <= MaxEdge.Z); p.Z >= MinEdge.Z && p.Z <= MaxEdge.Z);
}; }
//! Determines if a point is within this box and its borders. //! Determines if a point is within this box and its borders.
/** \param p: Point to check. /** \param p: Point to check.
...@@ -119,7 +119,7 @@ class aabbox3d ...@@ -119,7 +119,7 @@ class aabbox3d
return (p.X > MinEdge.X && p.X < MaxEdge.X && return (p.X > MinEdge.X && p.X < MaxEdge.X &&
p.Y > MinEdge.Y && p.Y < MaxEdge.Y && p.Y > MinEdge.Y && p.Y < MaxEdge.Y &&
p.Z > MinEdge.Z && p.Z < MaxEdge.Z); p.Z > MinEdge.Z && p.Z < MaxEdge.Z);
}; }
//! Determines if the box intersects with another box. //! Determines if the box intersects with another box.
/** \param other: Other box to check a intersection with. /** \param other: Other box to check a intersection with.
......
...@@ -44,10 +44,10 @@ namespace core ...@@ -44,10 +44,10 @@ namespace core
vector3d<T> operator/(const T v) const { T i=(T)1.0/v; return vector3d<T>(X * i, Y * i, Z * i); } vector3d<T> operator/(const T v) const { T i=(T)1.0/v; return vector3d<T>(X * i, Y * i, Z * i); }
vector3d<T>& operator/=(const T v) { T i=(T)1.0/v; X*=i; Y*=i; Z*=i; return *this; } vector3d<T>& operator/=(const T v) { T i=(T)1.0/v; X*=i; Y*=i; Z*=i; return *this; }
bool operator<=(const vector3d<T>&other) const { return X<=other.X && Y<=other.Y && Z<=other.Z;}; bool operator<=(const vector3d<T>&other) const { return X<=other.X && Y<=other.Y && Z<=other.Z;}
bool operator>=(const vector3d<T>&other) const { return X>=other.X && Y>=other.Y && Z>=other.Z;}; bool operator>=(const vector3d<T>&other) const { return X>=other.X && Y>=other.Y && Z>=other.Z;}
bool operator<(const vector3d<T>&other) const { return X<other.X && Y<other.Y && Z<other.Z;}; bool operator<(const vector3d<T>&other) const { return X<other.X && Y<other.Y && Z<other.Z;}
bool operator>(const vector3d<T>&other) const { return X>other.X && Y>other.Y && Z>other.Z;}; bool operator>(const vector3d<T>&other) const { return X>other.X && Y>other.Y && Z>other.Z;}
//! use weak float compare //! use weak float compare
bool operator==(const vector3d<T>& other) const bool operator==(const vector3d<T>& other) const
......
#using <mscorlib.dll>
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly:AssemblyTitleAttribute("Irrlicht.NET")];
[assembly:AssemblyDescriptionAttribute("Irrlicht.NET Wrapper")];
[assembly:AssemblyConfigurationAttribute("")];
[assembly:AssemblyCompanyAttribute("")];
[assembly:AssemblyProductAttribute("")];
[assembly:AssemblyCopyrightAttribute("(c) 2004-2005 by Nikolaus Gebhardt")];
[assembly:AssemblyTrademarkAttribute("")];
[assembly:AssemblyCultureAttribute("")];
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the value or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly:AssemblyVersionAttribute("0.11.*")];
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project directory.
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly:AssemblyDelaySignAttribute(false)];
[assembly:AssemblyKeyFileAttribute("")];
[assembly:AssemblyKeyNameAttribute("")];
This diff is collapsed.
This diff is collapsed.
// Copyright (C) 2002-2006 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#pragma once
#using <mscorlib.dll>
namespace Irrlicht
{
namespace Core
{
/// <summary>
/// Specifies a two dimensional size.
/// </summary>
public __value class Dimension2D
{
public:
/// <summary> Constructs a dimension of widht 0 and height 0. </summary>
Dimension2D()
: Width(0), Height(0)
{
}
/// <summary> Constructs a dimension of specified size. </summary>
Dimension2D(int width, int height)
: Width(width), Height(height)
{
}
/// <summary>
/// Compares the size to another size.
/// </summary>
bool Equals(Object* rhs)
{
Dimension2D* c = dynamic_cast<Dimension2D *>(rhs);
if(!c)
return false;
return c->Width == Width && c->Height == Height;
}
int Width, Height;
};
/// <summary>
/// Specifies a two dimensional size.
/// </summary>
public __value class Dimension2Df
{
public:
/// <summary> Constructs a dimension of widht 0 and height 0. </summary>
Dimension2Df()
: Width(0), Height(0)
{
}
/// <summary> Constructs a dimension of specified size. </summary>
Dimension2Df(float width, float height)
: Width(width), Height(height)
{
}
/// <summary>
/// Compares the size to another size.
/// </summary>
bool Equals(Object* rhs)
{
Dimension2Df* c = dynamic_cast<Dimension2Df *>(rhs);
if(!c)
return false;
return c->Width == Width && c->Height == Height;
}
float Width, Height;
};
} // end namespace Core
} // end namespace Irrlicht
This diff is collapsed.
using System.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
This diff is collapsed.
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{16FB9D0E-3B9E-4192-B6C7-246CEC037718}"
>
<Build>
<Settings
ApplicationIcon = "App.ico"
AssemblyKeyContainerName = ""
AssemblyName = "ExampleApp.NET"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Exe"
PreBuildEvent = ""
PostBuildEvent = ""
RootNamespace = "ExampleApp"
RunPostBuildEvent = "OnBuildSuccess"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "true"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "bin\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.Xml"
HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
/>
<Reference
Name = "Irrlicht.NET"
Project = "{70E64FA1-D175-4441-B112-A667E3FF1B68}"
Package = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"
/>
<Reference
Name = "System.Windows.Forms"
AssemblyName = "System.Windows.Forms"
HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "App.ico"
BuildAction = "Content"
/>
<File
RelPath = "AssemblyInfo.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "ExampleApp.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
// Copyright (C) 2002-2006 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "IBillboardSceneNode.h"
#include "NativeConverter.h"
namespace Irrlicht
{
namespace Scene
{
IBillboardSceneNode::IBillboardSceneNode(irr::scene::IBillboardSceneNode* realSceneNode)
: ISceneNode(realSceneNode)
{
}
Core::Dimension2Df IBillboardSceneNode::get_Size()
{
return irr::NativeConverter::getNETDim(getBillBoardSceneNode()->getSize());
}
void IBillboardSceneNode::set_Size(Core::Dimension2Df dim)
{
getBillBoardSceneNode()->setSize(irr::NativeConverter::getNativeDim(dim));
}
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment