This example can be used to play around with material settings and watch the results. Only the default non-shader materials are used in here.
You have two nodes to make it easier to see which difference your settings will make. Additionally you have one lightscenenode and you can set the global ambient values.
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif
Main header file of the irrlicht, the only file needed to include.
Everything in the Irrlicht Engine can be found in this namespace.
Variables within the empty namespace are globals which are restricted to this file.
namespace
{
const wchar_t* const DriverTypeNames[] =
{
L"NULL",
L"SOFTWARE",
L"BURNINGSVIDEO",
L"DIRECT3D8",
L"DIRECT3D9",
L"OPENGL",
0,
};
enum EGUI_IDS
{
GUI_ID_OPEN_TEXTURE = 1,
GUI_ID_QUIT,
GUI_ID_MAX
};
};
Axis aligned bounding box in 3d dimensional space.
Class representing a 32 bit ARGB color.
Returns a new unique number on each call.
{
static int unique = GUI_ID_MAX;
++unique;
return unique;
}
signed int s32
32 bit signed variable.
Find out which vertex-type is needed for the given material type.
{
using namespace video;
switch ( materialType )
{
case EMT_SOLID:
return EVT_STANDARD;
case EMT_SOLID_2_LAYER:
return EVT_STANDARD;
case EMT_LIGHTMAP:
case EMT_LIGHTMAP_ADD:
case EMT_LIGHTMAP_M2:
case EMT_LIGHTMAP_M4:
case EMT_LIGHTMAP_LIGHTING:
case EMT_LIGHTMAP_LIGHTING_M2:
case EMT_LIGHTMAP_LIGHTING_M4:
return EVT_2TCOORDS;
case EMT_DETAIL_MAP:
return EVT_2TCOORDS;
case EMT_SPHERE_MAP:
return EVT_STANDARD;
case EMT_REFLECTION_2_LAYER:
return EVT_2TCOORDS;
case EMT_TRANSPARENT_ADD_COLOR:
return EVT_STANDARD;
case EMT_TRANSPARENT_ALPHA_CHANNEL:
return EVT_STANDARD;
case EMT_TRANSPARENT_ALPHA_CHANNEL_REF:
return EVT_STANDARD;
case EMT_TRANSPARENT_VERTEX_ALPHA:
return EVT_STANDARD;
case EMT_TRANSPARENT_REFLECTION_2_LAYER:
return EVT_2TCOORDS;
case EMT_NORMAL_MAP_SOLID:
case EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR:
case EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA:
case EMT_PARALLAX_MAP_SOLID:
case EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR:
case EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA:
return EVT_TANGENTS;
case EMT_ONETEXTURE_BLEND:
return EVT_STANDARD;
case EMT_FORCE_32BIT:
return EVT_STANDARD;
}
return EVT_STANDARD;
}
E_VERTEX_TYPE
Enumeration for all vertex types there are.
E_MATERIAL_TYPE
Abstracted and easy to use fixed function/programmable pipeline material modes.
Custom GUI-control to edit colorvalues.
{
public:
: gui::IGUIElement(gui::EGUIET_ELEMENT, guiEnv, parent,id, core::rect<
s32 >(pos, pos+core::dimension2d<
s32>(80, 75)))
, DirtyFlag(true)
, ColorStatic(0)
, EditAlpha(0)
, EditRed(0)
, EditGreen(0)
, EditBlue(0)
{
using namespace gui;
ButtonSetId = makeUniqueId();
const core::rect< s32 > rectControls(0,0,AbsoluteRect.getWidth(),AbsoluteRect.getHeight() );
IGUIStaticText * groupElement = guiEnv->
addStaticText (L
"", rectControls,
true,
false,
this, -1,
false);
SetEditsFromColor(Color);
}
virtual bool OnEvent(
const SEvent &event)
{
return false;
{
Color = GetColorFromEdits();
SetEditsFromColor(Color);
}
return false;
}
{
DirtyFlag = true;
Color = col;
SetEditsFromColor(Color);
}
{
return Color;
}
void resetDirty()
{
DirtyFlag = false;
}
bool isDirty() const
{
return DirtyFlag;
};
protected:
{
using namespace gui;
guiEnv->
addStaticText (text, rect,
false,
false, parent, -1,
false);
rect.LowerRightCorner.X += 20;
return edit;
}
{
if (EditAlpha)
{
if (alpha > 255)
alpha = 255;
}
if (EditRed)
{
if (red > 255)
red = 255;
}
if (EditGreen)
{
if (green > 255)
green = 255;
}
if (EditBlue)
{
if (blue > 255)
blue = 255;
}
return col;
}
{
DirtyFlag = true;
if ( EditAlpha )
if ( EditRed )
if ( EditGreen )
if ( EditBlue )
if ( ColorStatic )
ColorStatic->setBackgroundColor(col);
}
private:
bool DirtyFlag;
};
Single line edit box for editing simple text.
Base class of all GUI elements.
void setNotClipped(bool noClip)
Sets whether the element will ignore its parent's clipping rectangle.
virtual s32 getID() const
Returns id. Can be used to identify the element.
GUI Environment. Used as factory and manager of all other GUI elements.
virtual IGUIEditBox * addEditBox(const wchar_t *text, const core::rect< s32 > &rectangle, bool border=true, IGUIElement *parent=0, s32 id=-1)=0
Adds an edit box.
virtual IGUIStaticText * addStaticText(const wchar_t *text, const core::rect< s32 > &rectangle, bool border=false, bool wordWrap=true, IGUIElement *parent=0, s32 id=-1, bool fillBackground=false)=0
Adds a static text.
virtual IGUIButton * addButton(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1, const wchar_t *text=0, const wchar_t *tooltiptext=0)=0
Adds a button element.
Multi or single line text label.
void setBlue(u32 b)
Sets the blue component of the Color.
u32 getGreen() const
Returns the green component of the color.
u32 getRed() const
Returns the red component of the color.
void setAlpha(u32 a)
Sets the alpha component of the Color.
u32 getAlpha() const
Returns the alpha component of the color.
void setRed(u32 r)
Sets the red component of the Color.
void setGreen(u32 g)
Sets the green component of the Color.
u32 getBlue() const
Returns the blue component of the color.
unsigned int u32
32 bit unsigned variable.
gui::IGUIElement * Caller
IGUIElement who called the event.
gui::EGUI_EVENT_TYPE EventType
Type of GUI Event.
SEvents hold information about an event. See irr::IEventReceiver for details on event handling.
struct SGUIEvent GUIEvent
Custom GUI-control for to edit all colors typically used in materials and lights
{
public:
: gui::IGUIElement(gui::EGUIET_ELEMENT, guiEnv, parent,id, core::rect<
s32>(pos,pos+core::dimension2d<
s32>(60,250)))
, ControlAmbientColor(0), ControlDiffuseColor(0), ControlSpecularColor(0), ControlEmissiveColor(0)
{
guiEnv->
addStaticText (description, rect,
false,
false,
this, -1,
false);
}
virtual ~CAllColorsControl()
{
ControlAmbientColor->drop();
ControlDiffuseColor->drop();
if ( ControlEmissiveColor )
ControlEmissiveColor->drop();
ControlSpecularColor->drop();
}
{
}
{
if ( ControlAmbientColor->isDirty() )
if ( ControlDiffuseColor->isDirty() )
if ( ControlEmissiveColor->isDirty() )
if ( ControlSpecularColor->isDirty() )
}
{
}
{
if ( ControlAmbientColor->isDirty() )
if ( ControlDiffuseColor->isDirty() )
if ( ControlSpecularColor->isDirty() )
}
void resetDirty()
{
ControlAmbientColor->resetDirty();
ControlDiffuseColor->resetDirty();
ControlSpecularColor->resetDirty();
if ( ControlEmissiveColor )
ControlEmissiveColor->resetDirty();
}
protected:
{
ControlAmbientColor = new CColorControl( guiEnv, pos, L"ambient", this);
ControlSpecularColor =
new CColorControl( guiEnv, pos +
core::position2d<s32>(0, 150), L
"specular",
this );
if ( hasEmissive )
{
ControlEmissiveColor =
new CColorControl( guiEnv, pos +
core::position2d<s32>(0, 225), L
"emissive",
this );
}
}
private:
CColorControl* ControlAmbientColor;
CColorControl* ControlDiffuseColor;
CColorControl* ControlSpecularColor;
CColorControl* ControlEmissiveColor;
};
Class representing a color with four floats.
SColor toSColor() const
Converts this color to a SColor without floats.
Struct for holding parameters for a material renderer.
SColor EmissiveColor
Light emitted by this material. Default is to emit no light.
SColor SpecularColor
How much specular light (highlights from a light) is reflected.
SColor AmbientColor
How much ambient light (a global light) is reflected by this material.
SColor DiffuseColor
How much diffuse light coming from a light source is reflected by this material.
structure for holding data describing a dynamic point light.
SColorf AmbientColor
Ambient color emitted by the light.
SColorf DiffuseColor
Diffuse color emitted by the light.
SColorf SpecularColor
Specular color emitted by the light.
GUI-Control to offer a selection of available textures.
{
public:
: gui::IGUIElement(gui::EGUIET_ELEMENT, guiEnv, parent,id, core::rect<
s32>(pos,pos+core::dimension2d<
s32>(100,15)))
, DirtyFlag(true), ComboTexture(0)
{
core::rect<s32> rectCombo(0, 0, AbsoluteRect.getWidth(),AbsoluteRect.getHeight());
updateTextures(driver);
}
virtual bool OnEvent(
const SEvent &event)
{
return false;
{
DirtyFlag = true;
}
return false;
}
virtual bool bringToFront(IGUIElement* element)
{
bool result = gui::IGUIElement::bringToFront(element);
if ( Parent && element == ComboTexture )
result &= Parent->bringToFront(this);
return result;
}
const wchar_t * getSelectedTextureName() const
{
s32 selected = ComboTexture->getSelected();
if ( selected < 0 )
return 0;
return ComboTexture->getItem(selected);
}
void resetDirty()
{
DirtyFlag = false;
}
bool isDirty() const
{
return DirtyFlag;
};
{
s32 oldSelected = ComboTexture->getSelected();
if ( oldSelected >= 0 )
{
oldTextureName = ComboTexture->getItem(oldSelected);
}
ComboTexture->clear();
{
ComboTexture->addItem( name.c_str() );
if ( !oldTextureName.empty() && selectNew < 0 && name == oldTextureName )
selectNew = i;
}
ComboTexture->addItem( CLEAR_TEXTURE.c_str() );
if ( CLEAR_TEXTURE == oldTextureName )
selectNew = ComboTexture->getItemCount()-1;
if ( selectNew >= 0 )
ComboTexture->setSelected(selectNew);
DirtyFlag = true;
}
private:
bool DirtyFlag;
};
virtual IGUIComboBox * addComboBox(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
Adds a combo box to the environment.
Interface of a Video Driver dependent Texture.
const io::SNamedPath & getName() const
Get name of texture (in most cases this is the filename)
Interface to driver which is able to perform 2d and 3d graphics functions.
virtual u32 getTextureCount() const =0
Returns amount of textures currently loaded.
virtual ITexture * getTextureByIndex(u32 index)=0
Returns a texture by index.
Control which allows setting some of the material values for a meshscenenode
struct SMeshNodeControl
{
SMeshNodeControl()
: Initialized(false), Driver(0), MeshManipulator(0), SceneNode(0), SceneNode2T(0), SceneNodeTangents(0)
, AllColorsControl(0), ButtonLighting(0), InfoLighting(0), ComboMaterial(0), TextureControl1(0), TextureControl2(0), ControlVertexColors(0)
{
}
virtual ~SMeshNodeControl()
{
if ( TextureControl1 )
TextureControl1->drop();
if ( TextureControl2 )
TextureControl2->drop();
if ( ControlVertexColors )
ControlVertexColors->drop();
if ( AllColorsControl )
AllColorsControl->drop();
}
{
if ( Initialized || !node || !device)
return;
SceneNode = node;
SceneNode2T = smgr->
addMeshSceneNode(mesh2T, 0, -1, SceneNode->getPosition(), SceneNode->getRotation(), SceneNode->getScale() );
, SceneNode->getPosition(), SceneNode->getRotation(), SceneNode->getScale() );
AllColorsControl =
new CAllColorsControl(guiEnv, pos, description,
true, guiEnv->
getRootGUIElement());
AllColorsControl->setColorsToMaterialColors(material);
ButtonLighting = guiEnv->
addButton (rectBtn, 0, -1, L
"Lighting");
ButtonLighting->setPressed(material.
Lighting);
core::rect<s32> rectInfo( rectBtn.LowerRightCorner.X, rectBtn.UpperLeftCorner.Y, rectBtn.LowerRightCorner.X+40, rectBtn.UpperLeftCorner.Y+15 );
InfoLighting = guiEnv->
addStaticText(L
"", rectInfo,
true,
false );
core::rect<s32> rectCombo(pos.X, rectBtn.LowerRightCorner.Y, pos.X+100, rectBtn.LowerRightCorner.Y+15);
for ( int i=0; i <= (int)video::EMT_ONETEXTURE_BLEND; ++i )
{
}
TextureControl1 =
new CTextureControl(guiEnv, Driver, posTex, guiEnv->
getRootGUIElement());
posTex.Y += 15;
TextureControl2 =
new CTextureControl(guiEnv, Driver, posTex, guiEnv->
getRootGUIElement());
ControlVertexColors =
new CColorControl( guiEnv, posVertexColors, L
"Vertex colors", guiEnv->
getRootGUIElement());
if ( vertices )
{
ControlVertexColors->setColor(vertices[0].Color);
}
Initialized = true;
}
void update()
{
if ( !Initialized )
return;
s32 selectedMaterial = ComboMaterial->getSelected();
if ( selectedMaterial >= (
s32)video::EMT_SOLID && selectedMaterial <= (
s32)video::EMT_ONETEXTURE_BLEND)
{
switch ( vertexType )
{
case video::EVT_STANDARD:
SceneNode->setVisible(true);
SceneNode2T->setVisible(false);
SceneNodeTangents->setVisible(false);
break;
case video::EVT_2TCOORDS:
SceneNode->setVisible(false);
SceneNode2T->setVisible(true);
SceneNodeTangents->setVisible(false);
break;
case video::EVT_TANGENTS:
SceneNode->setVisible(false);
SceneNode2T->setVisible(false);
SceneNodeTangents->setVisible(true);
break;
}
}
updateMaterial(material);
updateMaterial(material2T);
updateMaterial(materialTangents);
if ( ButtonLighting->isPressed() )
InfoLighting->setText(L"on");
else
InfoLighting->setText(L"off");
AllColorsControl->resetDirty();
TextureControl1->resetDirty();
TextureControl2->resetDirty();
ControlVertexColors->resetDirty();
}
void updateTextures()
{
TextureControl1->updateTextures(Driver);
TextureControl2->updateTextures(Driver);
}
protected:
{
AllColorsControl->updateMaterialColors(material);
material.
Lighting = ButtonLighting->isPressed();
if ( TextureControl1->isDirty() )
{
}
if ( TextureControl2->isDirty() )
{
}
if ( ControlVertexColors->isDirty() )
{
MeshManipulator->setVertexColors (SceneNode->getMesh(), ControlVertexColors->getColor());
MeshManipulator->setVertexColors (SceneNode2T->getMesh(), ControlVertexColors->getColor());
MeshManipulator->setVertexColors (SceneNodeTangents->getMesh(), ControlVertexColors->getColor());
}
}
bool Initialized;
CAllColorsControl* AllColorsControl;
CTextureControl* TextureControl1;
CTextureControl* TextureControl2;
CColorControl* ControlVertexColors;
};
bool drop() const
Drops the object. Decrements the reference counter by one.
The Irrlicht device. You can create it with createDevice() or createDeviceEx().
virtual scene::ISceneManager * getSceneManager()=0
Provides access to the scene manager.
virtual video::IVideoDriver * getVideoDriver()=0
Provides access to the video driver for drawing 3d and 2d geometry.
virtual gui::IGUIEnvironment * getGUIEnvironment()=0
Provides access to the 2d user interface environment.
virtual u32 addItem(const wchar_t *text, u32 data=0)=0
Adds an item and returns the index of it.
virtual IGUIElement * getRootGUIElement()=0
Returns the root gui element.
virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical)=0
Sets text justification mode.
virtual const void * getVertices() const =0
Get access to vertex data. The data is an array of vertices.
Class which holds the geometry of an object.
virtual IMeshBuffer * getMeshBuffer(u32 nr) const =0
Get pointer to a mesh buffer.
An interface for easy manipulation of meshes.
virtual IMesh * createMeshWithTangents(IMesh *mesh, bool recalculateNormals=false, bool smooth=false, bool angleWeighted=false, bool recalculateTangents=true) const =0
Creates a copy of the mesh, which will only consist of S3DVertexTangents vertices.
virtual IMesh * createMeshWith2TCoords(IMesh *mesh) const =0
Creates a copy of the mesh, which will only consist of S3DVertex2TCoord vertices.
A scene node displaying a static mesh.
virtual IMesh * getMesh(void)=0
Get the currently defined mesh for display.
The Scene Manager manages scene nodes, mesh recources, cameras and all the other stuff.
virtual IMeshSceneNode * addMeshSceneNode(IMesh *mesh, ISceneNode *parent=0, s32 id=-1, const core::vector3df &position=core::vector3df(0, 0, 0), const core::vector3df &rotation=core::vector3df(0, 0, 0), const core::vector3df &scale=core::vector3df(1.0f, 1.0f, 1.0f), bool alsoAddIfMeshPointerZero=false)=0
Adds a scene node for rendering a static mesh.
virtual IMeshManipulator * getMeshManipulator()=0
Get pointer to the mesh manipulator.
SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES]
Texture layer array.
E_MATERIAL_TYPE MaterialType
Type of the material. Specifies how everything is blended together.
bool Lighting
Will this material be lighted? Default: true.
ITexture * Texture
Texture.
standard vertex used by the Irrlicht engine.
Control to allow setting the color values of a lightscenenode.
struct SLightNodeControl
{
SLightNodeControl() : Initialized(false), SceneNode(0), AllColorsControl(0)
{
}
virtual ~SLightNodeControl()
{
if ( AllColorsControl )
AllColorsControl->drop();
}
{
if ( Initialized || !node || !guiEnv)
return;
SceneNode = node;
AllColorsControl =
new CAllColorsControl(guiEnv, pos, description,
false, guiEnv->
getRootGUIElement());
AllColorsControl->setColorsToLightDataColors(lightData);
Initialized = true;
}
void update()
{
if ( !Initialized )
return;
AllColorsControl->updateLightColors(lightData);
}
protected:
bool Initialized;
CAllColorsControl* AllColorsControl;
};
Scene node which is a dynamic light.
Application configuration
struct SConfig
{
SConfig()
: RenderInBackground(true)
, DriverType(video::EDT_BURNINGSVIDEO)
, ScreenSize(640, 480)
{
}
bool RenderInBackground;
};
E_DRIVER_TYPE
An enum for all types of drivers the Irrlicht Engine supports.
Main application class
{
friend int main(int argc, char *argv[]);
public:
CApp()
: IsRunning(false)
, Device(0)
, Camera(0)
, GlobalAmbient(0)
{
}
~CApp()
{
}
void stopApp()
{
IsRunning = false;
}
virtual bool OnEvent(
const SEvent &event)
{
{
{
case gui::EGET_MENU_ITEM_SELECTED:
{
s32 id = menu->getItemCommandId(menu->getSelectedItem());
switch(id)
{
case GUI_ID_OPEN_TEXTURE:
break;
case GUI_ID_QUIT:
stopApp();
break;
}
}
break;
case gui::EGET_FILE_SELECTED:
{
}
break;
default:
break;
}
}
return false;
}
protected:
bool init(int argc, char *argv[])
{
Config.DriverType=driverChoiceConsole();
if (Config.DriverType==video::EDT_COUNT)
return false;
Device =
createDevice(Config.DriverType, Config.ScreenSize);
if (!Device)
return false;
Device->setWindowCaption( DriverTypeNames[Config.DriverType] );
Device->setEventReceiver(this);
if (font)
col3dHighLight.setAlpha(255);
skin->
setColor(gui::EGDC_HIGH_LIGHT, colHighLight );
skin->
setColor(gui::EGDC_3D_HIGH_LIGHT, col3dHighLight );
createDefaultTextures(driver);
menuBar->
addItem(L
"File", -1,
true,
true);
subMenuFile->
addItem(L
"Open texture ...", GUI_ID_OPEN_TEXTURE);
subMenuFile->
addItem(L
"Quit", GUI_ID_QUIT);
-1);
100.0f);
return true;
}
bool update()
{
if ( !Device->run() )
return false;
if ( Device->isWindowActive() || Config.RenderInBackground )
{
NodeLeft.update();
NodeRight.update();
LightControl.update();
if ( GlobalAmbient->isDirty() )
{
GlobalAmbient->resetDirty();
}
}
return true;
}
void run()
{
IsRunning = true;
if ( !Device )
return;
while(IsRunning)
{
if ( !update() )
break;
Device->sleep( 5 );
}
}
void quit()
{
IsRunning = false;
GlobalAmbient->drop();
GlobalAmbient = NULL;
if ( Device )
{
Device->closeDevice();
Device->drop();
Device = NULL;
}
}
{
if ( !imageA8R8G8B8 )
return;
for (
u32 y = 0; y < height; ++ y )
{
for (
u32 x = 0; x < pitch; ++x )
{
if ( y < height/3 )
{
if ( x < width/3 )
imageA8R8G8B8->
setPixel (x, y, SCOL_BLACK);
else if ( x < 2*width/3 )
imageA8R8G8B8->
setPixel (x, y, SCOL_BLUE);
else
imageA8R8G8B8->
setPixel (x, y, SCOL_CYAN);
}
else if ( y < 2*height/3 )
{
if ( x < width/3 )
imageA8R8G8B8->
setPixel (x, y, SCOL_GRAY);
else if ( x < 2*width/3 )
imageA8R8G8B8->
setPixel (x, y, SCOL_GREEN);
else
imageA8R8G8B8->
setPixel (x, y, SCOL_MAGENTA);
}
else
{
if ( x < width/3 )
imageA8R8G8B8->
setPixel (x, y, SCOL_RED);
else if ( x < 2*width/3 )
imageA8R8G8B8->
setPixel (x, y, SCOL_YELLOW);
else
imageA8R8G8B8->
setPixel (x, y, SCOL_WHITE);
}
}
}
imageA8R8G8B8->
fill(SCOL_WHITE);
imageA8R8G8B8->
fill(SCOL_BLACK);
for (
u32 y = 0; y < height; ++ y )
{
for (
u32 x = 0; x < pitch; ++x )
{
}
}
}
{
Device->getVideoDriver()->getTexture(name);
NodeLeft.updateTextures();
NodeRight.updateTextures();
}
private:
SConfig Config;
volatile bool IsRunning;
SMeshNodeControl NodeLeft;
SMeshNodeControl NodeRight;
SLightNodeControl LightControl;
CColorControl * GlobalAmbient;
};
Interface of an object which can receive events.
const T * c_str() const
Returns character string.
virtual IGUIFont * getFont(const io::path &filename)=0
Returns pointer to the font with the specified filename.
virtual IGUIContextMenu * addMenu(IGUIElement *parent=0, s32 id=-1)=0
Adds a menu to the environment.
virtual void drawAll()=0
Draws all gui elements by traversing the GUI environment starting at the root node.
virtual IGUISkin * getSkin() const =0
Returns pointer to the current gui skin.
virtual IGUIFileOpenDialog * addFileOpenDialog(const wchar_t *title=0, bool modal=true, IGUIElement *parent=0, s32 id=-1, bool restoreCWD=false, io::path::char_type *startDir=0)=0
Adds a file open dialog.
Standard file chooser dialog.
A skin modifies the look of the GUI elements.
virtual void setFont(IGUIFont *font, EGUI_DEFAULT_FONT which=EGDF_DEFAULT)=0
sets a default font
virtual void setColor(EGUI_DEFAULT_COLOR which, video::SColor newColor)=0
sets a default color
virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) const =0
returns default color
Scene Node which is a (controlable) camera.
virtual void drawAll()=0
Draws all the scene nodes.
virtual void setAmbientLight(const video::SColorf &ambientColor)=0
Sets ambient color of the scene.
virtual ICameraSceneNode * addCameraSceneNode(ISceneNode *parent=0, const core::vector3df &position=core::vector3df(0, 0, 0), const core::vector3df &lookat=core::vector3df(0, 0, 100), s32 id=-1, bool makeActive=true)=0
Adds a camera scene node to the scene graph and sets it as active camera.
virtual IMeshSceneNode * addCubeSceneNode(f32 size=10.0f, ISceneNode *parent=0, s32 id=-1, const core::vector3df &position=core::vector3df(0, 0, 0), const core::vector3df &rotation=core::vector3df(0, 0, 0), const core::vector3df &scale=core::vector3df(1.0f, 1.0f, 1.0f))=0
Adds a cube scene node.
virtual ILightSceneNode * addLightSceneNode(ISceneNode *parent=0, const core::vector3df &position=core::vector3df(0, 0, 0), video::SColorf color=video::SColorf(1.0f, 1.0f, 1.0f), f32 radius=100.0f, s32 id=-1)=0
Adds a dynamic light scene node to the scene graph.
virtual const video::SColorf & getAmbientLight() const =0
Get ambient color of the scene.
virtual video::SMaterial & getMaterial(u32 num)
Returns the material based on the zero based index i.
Interface for software image data.
virtual void fill(const SColor &color)=0
fills the surface with given color
virtual void setPixel(u32 x, u32 y, const SColor &color, bool blend=false)=0
Sets a pixel.
virtual u32 getPitch() const =0
Returns pitch of image.
virtual bool beginScene(bool backBuffer=true, bool zBuffer=true, SColor color=SColor(255, 0, 0, 0), const SExposedVideoData &videoData=SExposedVideoData(), core::rect< s32 > *sourceRect=0)=0
Applications must call this method before performing any rendering.
virtual bool endScene()=0
Presents the rendered image to the screen.
virtual IImage * createImage(ECOLOR_FORMAT format, const core::dimension2d< u32 > &size)=0
Creates an empty software image.
virtual ITexture * addTexture(const core::dimension2d< u32 > &size, const io::path &name, ECOLOR_FORMAT format=ECF_A8R8G8B8)=0
Creates an empty texture of specified size.
void set(u32 a, u32 r, u32 g, u32 b)
Sets all four components of the color at once.
bool BackfaceCulling
Is backface culling enabled? Default: true.
IRRLICHT_API IrrlichtDevice *IRRCALLCONV createDevice(video::E_DRIVER_TYPE deviceType=video::EDT_SOFTWARE, const core::dimension2d< u32 > &windowSize=(core::dimension2d< u32 >(640, 480)), u32 bits=16, bool fullscreen=false, bool stencilbuffer=false, bool vsync=false, IEventReceiver *receiver=0)
Creates an Irrlicht device. The Irrlicht device is the root object for using the engine.
A very short main as we do everything else in classes.
int main(int argc, char *argv[])
{
CApp APP;
if ( !APP.init(argc, argv) )
{
printf("init failed\n");
return 1;
}
APP.run();
APP.quit();
return 0;
}