* irr upgrade PART 1: remove irrlicht 1.3

This commit is contained in:
false_genesis 2008-04-03 16:58:02 +00:00
parent 85b1e1d3d7
commit ed316ab946
827 changed files with 3 additions and 295505 deletions

View File

@ -18,7 +18,7 @@ namespace irr
}
bool CM2MeshFileLoader::isALoadableFileExtension(const c8* filename)
bool CM2MeshFileLoader::isALoadableFileExtension(const c8* filename) const
{
return strstr(filename, ".m2")!=0;
}

View File

@ -19,7 +19,7 @@ namespace irr
//! returns true if the file maybe is able to be loaded by this class
//! based on the file extension (e.g. ".cob")
virtual bool isALoadableFileExtension(const c8* fileName);
virtual bool isALoadableFileExtension(const c8* fileName) const;
//! creates/loads an animated mesh from the file.
//! \return Pointer to the created mesh. Returns 0 if loading failed.

View File

@ -124,7 +124,7 @@ public:
mouse.right = false;
}
bool OnEvent(SEvent event)
virtual bool OnEvent(const SEvent& event)
{
bool value = false;

View File

@ -182,14 +182,8 @@ ShTlTerrainSceneNode::ShTlTerrainSceneNode(scene::ISceneManager* pSceneManager,
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, mmflag);
// irrlicht 1.4
/*
Material[0].TextureLayer[1].Texture = CTexture;
Material[0].TextureLayer[1].TextureWrap = video::ETC_CLAMP_TO_EDGE;
*/
// irrlicht 1.3:
Material[0].Textures[1] = CTexture;
Material[0].TextureWrap[1] = video::ETC_CLAMP_TO_EDGE;
// setup UV coordinates of vertices on 2nd texture layer
f32 ax = (f32)MeshSize.Width / CTexture->getSize().Width / MeshSize.Width;

View File

@ -1,55 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_DRIVER_TYPES_H_INCLUDED__
#define __E_DRIVER_TYPES_H_INCLUDED__
namespace irr
{
namespace video
{
//! An enum for all types of drivers the Irrlicht Engine supports.
enum E_DRIVER_TYPE
{
//! Null device, useful for applications to run the engine without visualisation.
//! The null device is able to load textures, but does not render and display
//! any graphics.
EDT_NULL,
//! The Irrlicht Engine Software renderer, runs on all platforms,
//! with every hardware. It should only be used for 2d graphics,
//! but it can also perform some primitive 3d functions. These 3d drawing
//! functions are quite fast, but very inaccurate, and don't even support
//! clipping in 3D mode.
EDT_SOFTWARE,
//! The Burning's Software Renderer, an alternative software renderer for Irrlicht.
//! Basically it can be described as the Irrlicht Software renderer on steroids. It rasterizes
//! 3D geometry perfectly: It is able to perform correct 3d clipping, perspective
//! correct texture mapping, perspective correct color mapping, and renders
//! sub pixel correct, sub texel correct primitives. In addition, it does
//! bilinear texel filtering and supports more materials than the EDT_SOFTWARE driver.
//! This renderer has been written entirely by Thomas Alten, thanks a lot for this huge
//! contribution.
EDT_BURNINGSVIDEO,
//! Direct3D 8 device, only available on Win32 platforms including Win95, Win98, WinNT,
//! Win2K, WinXP. Performs hardware accelerated rendering of 3D and 2D primitives.
EDT_DIRECT3D8,
//! Direct3D 9 device, only available on Win32 platforms including Win95, Win98, WinNT,
//! Win2K, WinXP. Performs hardware accelerated rendering of 3D and 2D primitives.
EDT_DIRECT3D9,
//! OpenGL device, available on all Win32 platforms and on Linux.
//! Performs hardware accelerated rendering of 3D and 2D primitives.
EDT_OPENGL
};
} // end namespace video
} // end namespace irr
#endif

View File

@ -1,119 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_GUI_ELEMENT_TYPES_H_INCLUDED__
#define __E_GUI_ELEMENT_TYPES_H_INCLUDED__
namespace irr
{
namespace gui
{
//! List of all basic Irrlicht GUI elements.
/** An IGUIElement returns this when calling IGUIElement::getType(); */
enum EGUI_ELEMENT_TYPE
{
//! A button (IGUIButton)
EGUIET_BUTTON = 0,
//! A check box (IGUICheckBox)
EGUIET_CHECK_BOX,
//! A combo box (IGUIComboBox)
EGUIET_COMBO_BOX,
//! A context menu (IGUIContextMenu)
EGUIET_CONTEXT_MENU,
//! A menu (IGUIMenu)
EGUIET_MENU,
//! An edit box (IGUIEditBox)
EGUIET_EDIT_BOX,
//! A file open dialog (IGUIFileOpenDialog)
EGUIET_FILE_OPEN_DIALOG,
//! A color select open dialog (IGUIColorSelectDialog)
EGUIET_COLOR_SELECT_DIALOG,
//! A in/out fader (IGUIInOutFader)
EGUIET_IN_OUT_FADER,
//! An image (IGUIImage)
EGUIET_IMAGE,
//! A list box (IGUIListBox)
EGUIET_LIST_BOX,
//! A mesh viewer (IGUIMeshViewer)
EGUIET_MESH_VIEWER,
//! A message box (IGUIWindow)
EGUIET_MESSAGE_BOX,
//! A modal screen
EGUIET_MODAL_SCREEN,
//! A scroll bar (IGUIScrollBar)
EGUIET_SCROLL_BAR,
//! A static text (IGUIStaticText)
EGUIET_STATIC_TEXT,
//! A tab (IGUITab)
EGUIET_TAB,
//! A tab control
EGUIET_TAB_CONTROL,
//! A tool bar (IGUIToolBar)
EGUIET_TOOL_BAR,
//! A window
EGUIET_WINDOW,
//! Not an element, amount of elements in there
EGUIET_COUNT,
//! Unknown type.
EGUIET_ELEMENT,
//! This enum is never used, it only forces the compiler to
//! compile these enumeration values to 32 bit.
EGUIET_FORCE_32_BIT = 0x7fffffff
};
//! Names for built-in element types
const c8* const GUIElementTypeNames[] =
{
"button",
"checkBox",
"comboBox",
"contextMenu",
"menu",
"editBox",
"fileOpenDialog",
"colorSelectDialog",
"inOutFader",
"image",
"listBox",
"meshViewer",
"messageBox",
"modalScreen",
"scrollBar",
"staticText",
"tab",
"tabControl",
"toolBar",
"window",
0
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,52 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_SCENE_NODE_ANIMATOR_TYPES_H_INCLUDED__
#define __E_SCENE_NODE_ANIMATOR_TYPES_H_INCLUDED__
namespace irr
{
namespace scene
{
//! An enumeration for all types of built-in scene node animators
enum ESCENE_NODE_ANIMATOR_TYPE
{
//! Fly circle scene node animator
ESNAT_FLY_CIRCLE = 0,
//! Fly straight scene node animator
ESNAT_FLY_STRAIGHT,
//! Follow spline scene node animator
ESNAT_FOLLOW_SPLINE,
//! Rotation scene node animator
ESNAT_ROTATION,
//! Texture scene node animator
ESNAT_TEXTURE,
//! Deletion scene node animator
ESNAT_DELETION,
//! Collision respose scene node animator
ESNAT_COLLISION_RESPONSE,
//! Amount of build in scene node animators
ESNAT_COUNT,
//! Unknown scene node animator
ESNAT_UNKNOWN,
//! This enum is never used, it only forces the compiler to
//! compile these enumeration values to 32 bit.
ESNAT_FORCE_32_BIT = 0x7fffffff
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,130 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_SCENE_NODE_TYPES_H_INCLUDED__
#define __E_SCENE_NODE_TYPES_H_INCLUDED__
namespace irr
{
namespace scene
{
//! An enumeration for all types of built-in scene nodes
enum ESCENE_NODE_TYPE
{
//! simple cube scene node
ESNT_CUBE = 0,
//! Sphere scene node
ESNT_SPHERE,
//! Text Scene Node
ESNT_TEXT,
//! Water Surface Scene Node
ESNT_WATER_SURFACE,
//! Terrain Scene Node
ESNT_TERRAIN,
//! Sky Box Scene Node
ESNT_SKY_BOX,
//! Shadow Volume Scene Node
ESNT_SHADOW_VOLUME,
//! OctTree Scene Node
ESNT_OCT_TREE,
//! Mesh Scene Node
ESNT_MESH,
//! Light Scene Node
ESNT_LIGHT,
//! Empty Scene Node
ESNT_EMPTY,
//! Dummy Transformation Scene Node
ESNT_DUMMY_TRANSFORMATION,
//! Camera Scene Node
ESNT_CAMERA,
//! Maya Camera Scene Node
ESNT_CAMERA_MAYA,
//! First Person Shooter style Camera
ESNT_CAMERA_FPS,
//! Billboard Scene Node
ESNT_BILLBOARD,
//! Animated Mesh Scene Node
ESNT_ANIMATED_MESH,
//! Particle System Scene Node
ESNT_PARTICLE_SYSTEM,
//! Quake3 Model Scene Node ( has tag to link to )
ESNT_MD3_SCENE_NODE,
//! Amount of build in Scene Nodes
ESNT_COUNT,
//! Unknown scene node
ESNT_UNKNOWN,
//! This enum is never used, it only forces the compiler to
//! compile these enumeration values to 32 bit.
ESNT_FORCE_32_BIT = 0x7fffffff
};
//! An enumeration for all types of automatic culling for built-in scene nodes
enum E_CULLING_TYPE
{
EAC_OFF = 0,
EAC_BOX,
EAC_FRUSTUM_BOX,
EAC_FRUSTUM_SPHERE
};
//! Names for culling type
const c8* const AutomaticCullingNames[] =
{
"false",
"box", // camera box against node box
"frustum_box", // camera frustum against node box
"frustum_sphere", // camera frustum against node sphere
0
};
//! An enumeration for all types of debug data for built-in scene nodes (flags)
enum E_DEBUG_SCENE_TYPE
{
//! No Debug Data ( Default )
EDS_OFF = 0,
//! Show Bounding Boxes of SceneNode
EDS_BBOX = 1,
//! Show Vertex Normals
EDS_NORMALS = 2,
//! Shows Skeleton/Tags
EDS_SKELETON = 4,
//! Overlays Mesh Wireframe
EDS_MESH_WIRE_OVERLAY = 8,
//! Temporary use transparency Material Type
EDS_HALF_TRANSPARENCY = 16,
//! Show Bounding Boxes of all MeshBuffers
EDS_BBOX_BUFFERS = 32,
EDS_FULL = EDS_BBOX | EDS_NORMALS | EDS_SKELETON | EDS_MESH_WIRE_OVERLAY
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,35 +0,0 @@
// 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
#ifndef __E_TERRAIN_ELEMENTS_H__
#define __E_TERRAIN_ELEMENTS_H__
namespace irr
{
namespace scene
{
//! enumeration for patch sizes specifying the size of patches in the TerrainSceneNode
enum E_TERRAIN_PATCH_SIZE
{
//! patch size of 9, at most, use 4 levels of detail with this patch size.
ETPS_9 = 9,
//! patch size of 17, at most, use 5 levels of detail with this patch size.
ETPS_17 = 17,
//! patch size of 33, at most, use 6 levels of detail with this patch size.
ETPS_33 = 33,
//! patch size of 65, at most, use 7 levels of detail with this patch size.
ETPS_65 = 65,
//! patch size of 129, at most, use 8 levels of detail with this patch size.
ETPS_129 = 129
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,115 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_ANIMATED_MESH_H_INCLUDED__
#define __I_ANIMATED_MESH_H_INCLUDED__
#include "IUnknown.h"
#include "IMesh.h"
#include "matrix4.h"
namespace irr
{
namespace scene
{
enum E_ANIMATED_MESH_TYPE
{
//! Unknown animated mesh type.
EAMT_UNKNOWN = 0,
//! Quake 2 MD2 model file
EAMT_MD2,
//! Quake 3 MD3 model file
EAMT_MD3,
//! Milkshape 3d skeletal animation file
EAMT_MS3D,
//! Maya .obj not animated model
EAMT_OBJ,
//! Quake 3 .bsp Map, not animated
EAMT_BSP,
//! 3D Studio .3ds file
EAMT_3DS,
//! Microsoft Direct3D .x-file. Can contain static and skeletal animated
//! skinned meshes. This is the standard and best supported
//! format of the Irrlicht Engine.
EAMT_X,
//! My3D Mesh, the file format by Zhuck Dimitry
EAMT_MY3D,
//! Pulsar LMTools (.lmts) file. The Irrlicht loader for this was written by
//! Jonas Petersen
EAMT_LMTS,
//! Cartography Shop .csm file. The loader for this was created by Saurav Mohapatra.
EAMT_CSM,
//! .oct file for Paul Nette's FSRad or from Murphy McCauley's Blender .oct exporter.
//! The oct file format contains 3D geometry and lightmaps and can
//! be loaded directly by Irrlicht
EAMT_OCT,
//! Blitz Basic .b3d file, the file format by Mark Sibly
EAMT_B3D
};
//! Interface for an animated mesh.
/** There are already simple implementations of this interface available so
you don't have to implement this interface on your own if you need to:
You might want to use irr::scene::SAnimatedMesh, irr::scene::SMesh,
irr::scene::SMeshBuffer etc. */
class IAnimatedMesh : public virtual IUnknown
{
public:
//! destructor
virtual ~IAnimatedMesh() {};
//! Gets the frame count of the animated mesh.
/** \return Returns the amount of frames. If the amount is 1, it is a
static, non animated mesh. */
virtual s32 getFrameCount() = 0;
//! Returns the IMesh interface for a frame.
/** \param frame: Frame number as zero based index. The maximum frame number is
getFrameCount() - 1;
\param detailLevel: Level of detail. 0 is the lowest,
255 the highest level of detail. Most meshes will ignore the detail level.
\param startFrameLoop: Because some animated meshes (.MD2) are blended between 2
static frames, and maybe animated in a loop, the startFrameLoop and the endFrameLoop
have to be defined, to prevent the animation to be blended between frames which are
outside of this loop.
If startFrameLoop and endFrameLoop are both -1, they are ignored.
\param endFrameLoop: see startFrameLoop.
\return Returns the animated mesh based on a detail level. */
virtual IMesh* getMesh(s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1) = 0;
//! Returns an axis aligned bounding box of the mesh.
/** \return A bounding box of this mesh is returned. */
virtual const core::aabbox3d<f32>& getBoundingBox() const = 0;
//! Returns the type of the animated mesh.
/** In most cases it is not neccessary to use this method.
This is useful for making a save downcast, for example
if getMeshType() returns EAMT_MD2, its save to cast the
IAnimatedMesh to IAnimatedMeshMD2.
\returns Type of the mesh. */
virtual E_ANIMATED_MESH_TYPE getMeshType() const
{
return EAMT_UNKNOWN;
}
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,96 +0,0 @@
// 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
#ifndef __I_ANIMATED_MESH_B3D_H_INCLUDED__
#define __I_ANIMATED_MESH_B3D_H_INCLUDED__
#include "ISceneNode.h"
#include "IAnimatedMesh.h"
namespace irr
{
namespace scene
{
//! Interface for using some special functions of B3d meshes
/** Please note that the B3d Mesh's frame numbers are scaled by 100 */
class IAnimatedMeshB3d : public IAnimatedMesh
{
public:
//! Returns a pointer to a transformation matrix of a part of the
//! mesh based on a frame time. This is used for being able to attach
//! objects to parts of animated meshes. For example a weapon to an animated
//! hand.
//! \param jointNumber: Zero based index of joint. The last joint has the number
//! IAnimatedMeshB3d::getJointCount()-1;
//! \param frame: Frame of the animation.
//! \return Returns a pointer to the matrix of the mesh part or
//! null if an error occured.
virtual core::matrix4* getMatrixOfJoint(s32 jointNumber, s32 frame) = 0;
//! Returns a pointer to a local matrix of a Joint, can be used to control the animation
virtual core::matrix4* getLocalMatrixOfJoint(s32 jointNumber) = 0;
//! Returns a pointer to a matrix of a part of the mesh unanimated
virtual core::matrix4* getMatrixOfJointUnanimated(s32 jointNumber) = 0;
//! Move this Joint's local matrix when animating
//! \param jointNumber: Zero based index of joint. The last joint has the number
//! IAnimatedMeshB3d::getJointCount()-1;
//! \param On: False= Leave joint's local matrix, True= Animate
//! (not used yet)
virtual void setJointAnimation(s32 jointNumber, bool On) = 0;
//! Gets joint count.
//! \return Returns amount of joints in the skeletal animated mesh.
virtual s32 getJointCount() const = 0;
//! Gets the name of a joint.
//! \param number: Zero based index of joint. The last joint has the number
//! IAnimatedMeshB3d::getJointCount()-1;
//! \return Returns name of joint and null if an error happened.
virtual const c8* getJointName(s32 number) const = 0;
//! Gets a joint number from its name
//! \param name: Name of the joint.
//! \return Returns the number of the joint or -1 if not found.
virtual s32 getJointNumber(const c8* name) const = 0;
//!Update Normals when Animating
//!False= Don't (default)
//!True= Update normals, slower
virtual void updateNormalsWhenAnimating(bool on) = 0;
//!Sets Interpolation Mode
//!0- Constant
//!1- Linear (default)
virtual void setInterpolationMode(s32 mode) = 0;
//!Want should happen on when animating
//!0-Nothing
//!1-Update nodes only
//!2-Update skin only
//!3-Update both nodes and skin (default)
virtual void setAnimateMode(s32 mode) = 0;
//!Convert all mesh buffers to use tangent vertices
virtual void convertToTangents() =0;
virtual void recoverJointsFromMesh(core::array<ISceneNode*> &JointChildSceneNodes)=0;
virtual void tranferJointsToMesh(core::array<ISceneNode*> &JointChildSceneNodes)=0;
virtual void createJoints(core::array<ISceneNode*> &JointChildSceneNodes, ISceneNode* AnimatedMeshSceneNode, ISceneManager* SceneManager)=0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,78 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_ANIMATED_MESH_MD2_H_INCLUDED__
#define __I_ANIMATED_MESH_MD2_H_INCLUDED__
#include "IAnimatedMesh.h"
namespace irr
{
namespace scene
{
//! Types of standard md2 animations
enum EMD2_ANIMATION_TYPE
{
EMAT_STAND = 0,
EMAT_RUN,
EMAT_ATTACK,
EMAT_PAIN_A,
EMAT_PAIN_B,
EMAT_PAIN_C,
EMAT_JUMP,
EMAT_FLIP,
EMAT_SALUTE,
EMAT_FALLBACK,
EMAT_WAVE,
EMAT_POINT,
EMAT_CROUCH_STAND,
EMAT_CROUCH_WALK,
EMAT_CROUCH_ATTACK,
EMAT_CROUCH_PAIN,
EMAT_CROUCH_DEATH,
EMAT_DEATH_FALLBACK,
EMAT_DEATH_FALLFORWARD,
EMAT_DEATH_FALLBACKSLOW,
EMAT_BOOM,
//! Not an animation, but amount of animation types.
EMAT_COUNT
};
//! Interface for using some special functions of MD2 meshes
class IAnimatedMeshMD2 : public IAnimatedMesh
{
public:
//! Returns the beginframe, endframe and frames per second for a default MD2 animation type.
//! \param l: The EMD2_ANIMATION_TYPE to get the frames for.
//! \param outBegin: The returned beginning frame for animation type specified.
//! \param outEnd: The returned ending frame for the animation type specified.
//! \param outFPS: The number of frames per second, this animation should be played at.
virtual void getFrameLoop(EMD2_ANIMATION_TYPE l, s32& outBegin,
s32& outEnd, s32& outFPS) const = 0;
//! Returns the beginframe, endframe and frames per second for a special MD2 animation type.
//! \param name: Name of the animation.
//! \param outBegin: The returned beginning frame for animation type specified.
//! \param outEnd: The returned ending frame for the animation type specified.
//! \param outFPS: The number of frames per second, this animation should be played at.
virtual bool getFrameLoop(const c8* name,
s32& outBegin, s32& outEnd, s32& outFPS) const = 0;
//! Returns amount of md2 animations in this file.
virtual s32 getAnimationCount() const = 0;
//! Returns name of md2 animation.
//! \param nr: Zero based index of animation.
virtual const c8* getAnimationName(s32 nr) const = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,269 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt / Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_ANIMATED_MESH_MD3_H_INCLUDED__
#define __I_ANIMATED_MESH_MD3_H_INCLUDED__
#include "IAnimatedMesh.h"
#include "IQ3Shader.h"
#include "quaternion.h"
namespace irr
{
namespace scene
{
enum eMD3Models
{
EMD3_HEAD = 0,
EMD3_UPPER,
EMD3_LOWER,
EMD3_WEAPON,
EMD3_NUMMODELS
};
// Animation list
enum EMD3_ANIMATION_TYPE
{
// Animations for both lower and upper parts of the player
EMD3_BOTH_DEATH_1 = 0,
EMD3_BOTH_DEAD_1,
EMD3_BOTH_DEATH_2,
EMD3_BOTH_DEAD_2,
EMD3_BOTH_DEATH_3,
EMD3_BOTH_DEAD_3,
// Animations for the upper part
EMD3_TORSO_GESTURE,
EMD3_TORSO_ATTACK_1,
EMD3_TORSO_ATTACK_2,
EMD3_TORSO_DROP,
EMD3_TORSO_RAISE,
EMD3_TORSO_STAND_1,
EMD3_TORSO_STAND_2,
// Animations for the lower part
EMD3_LEGS_WALK_CROUCH,
EMD3_LEGS_WALK,
EMD3_LEGS_RUN,
EMD3_LEGS_BACK,
EMD3_LEGS_SWIM,
EMD3_LEGS_JUMP_1,
EMD3_LEGS_LAND_1,
EMD3_LEGS_JUMP_2,
EMD3_LEGS_LAND_2,
EMD3_LEGS_IDLE,
EMD3_LEGS_IDLE_CROUCH,
EMD3_LEGS_TURN,
//! Not an animation, but amount of animation types.
EMD3_ANIMATION_COUNT
};
struct SMD3AnimationInfo
{
s32 first; // First frame
s32 num; // Last frame
s32 looping; // Looping frames
s32 fps; // Frames per second
};
// byte-align structures
#ifdef _MSC_VER
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
// this holds the header info of the MD3 file
struct SMD3Header
{
c8 headerID[4]; //id of file, always "IDP3"
s32 Version; //this is a version number, always 15
s8 fileName[68]; //sometimes left Blank... 65 chars, 32bit aligned == 68 chars
s32 numFrames; //number of KeyFrames
s32 numTags; //number of 'tags' per frame
s32 numMeshes; //number of meshes/skins
s32 numMaxSkins; //maximum number of unique skins used in md3 file
s32 headerSize; //always equal to the length of this header
s32 tagStart; //starting position of tag-structures
s32 tagEnd; //ending position of tag-structures/starting position of mesh-structures
s32 fileSize;
};
struct SMD3MeshHeader
{
c8 meshID[4]; //id, must be IDP3
c8 meshName[68]; //name of mesh 65 chars, 32 bit aligned == 68 chars
s32 numFrames; //number of meshframes in mesh
s32 numShader; //number of skins in mesh
s32 numVertices; //number of vertices
s32 numTriangles; //number of Triangles
s32 offset_triangles; //starting position of Triangle data, relative to start of Mesh_Header
s32 offset_shaders; //size of header
s32 offset_st; //starting position of texvector data, relative to start of Mesh_Header
s32 vertexStart; //starting position of vertex data,relative to start of Mesh_Header
s32 offset_end;
};
//! Compressed Vertex Data
struct SMD3Vertex
{
s16 position[3];
u8 normal[2];
};
//! Texure Coordinate
struct SMD3TexCoord
{
f32 u;
f32 v;
};
//! Triangle Index
struct SMD3Face
{
s32 Index[3];
};
// Default alignment
#ifdef _MSC_VER
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
//! Holding Frame Data for a Mesh
struct SMD3MeshBuffer : public IUnknown
{
virtual ~ SMD3MeshBuffer () {}
SMD3MeshHeader MeshHeader;
core::array < core::stringc > Shader;
core::array < s32 > Indices;
core::array < SMD3Vertex > Vertices;
core::array < SMD3TexCoord > Tex;
};
//! hold a tag info for connecting meshes
//! basically its an alternate way to describe a transformation
struct SMD3QuaterionTag
{
SMD3QuaterionTag() {}
SMD3QuaterionTag( const core::stringc& name )
: Name ( name ) {}
// construct from a matrix
SMD3QuaterionTag ( const core::stringc& name, const core::matrix4 &m )
{
Name = name;
position = m.getTranslation ();
rotation = m;
}
// set to matrix
void setto ( core::matrix4 &m )
{
rotation.getMatrix ( m );
m.setTranslation ( position );
}
// construct from a position and euler angles in degrees
SMD3QuaterionTag ( const core::vector3df&pos, const core::vector3df &angle )
{
position = pos;
rotation.set ( angle.X * core::DEGTORAD, angle.Y * core::DEGTORAD, angle.Z * core::DEGTORAD );
}
virtual ~SMD3QuaterionTag() {}
core::stringc Name;
core::vector3df position;
core::quaternion rotation;
bool operator < ( const SMD3QuaterionTag &other ) const
{
return Name < other.Name;
}
};
// holds a assoziative list of named quaternions
struct SMD3QuaterionTagList : public virtual IUnknown
{
SMD3QuaterionTagList () {}
virtual ~SMD3QuaterionTagList () {}
SMD3QuaterionTag* get ( const core::stringc& name )
{
SMD3QuaterionTag search ( name );
s32 index = Container.linear_search ( search );
if ( index >= 0 )
return &Container[index];
return 0;
}
u32 size () const
{
return Container.size();
}
SMD3QuaterionTag& operator[] (u32 index )
{
return Container[index];
}
core::array < SMD3QuaterionTag > Container;
};
//! Holding Frames Buffers and Tag Infos
struct SMD3Mesh: public IUnknown
{
virtual ~SMD3Mesh()
{
for (u32 i=0; i<Buffer.size(); ++i)
Buffer[i]->drop();
};
SMD3Header MD3Header;
core::stringc Name;
core::array < SMD3MeshBuffer * > Buffer;
SMD3QuaterionTagList TagList;
};
//! Interface for using some special functions of MD3 meshes
class IAnimatedMeshMD3 : public IAnimatedMesh
{
public:
//! tune how many frames you want to render inbetween
virtual void setInterpolationShift ( u32 shift, u32 loopMode ) = 0;
virtual SMD3QuaterionTagList *getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop) = 0;
virtual SMD3Mesh * getOriginalMesh () = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,51 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt / Fabio Concas / Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_ANIMATED_MESH_MS3D_H_INCLUDED__
#define __I_ANIMATED_MESH_MS3D_H_INCLUDED__
#include "IAnimatedMesh.h"
namespace irr
{
namespace scene
{
//! Interface for using some special functions of MS3D meshes
class IAnimatedMeshMS3D : public IAnimatedMesh
{
public:
//! Returns a pointer to a transformation matrix of a part of the
//! mesh based on a frame time. This is used for being able to attach
//! objects to parts of animated meshes. For example a weapon to an animated
//! hand.
//! \param jointNumber: Zero based index of joint. The last joint has the number
//! IAnimatedMeshMS3D::getJointCount()-1;
//! \param frame: Frame of the animation.
//! \return Returns a pointer to the matrix of the mesh part or
//! null if an error occured.
virtual core::matrix4* getMatrixOfJoint(s32 jointNumber, s32 frame) = 0;
//! Gets joint count.
//! \return Returns amount of joints in the skeletal animated mesh.
virtual s32 getJointCount() const = 0;
//! Gets the name of a joint.
//! \param number: Zero based index of joint. The last joint has the number
//! IAnimatedMeshMS3D::getJointCount()-1;
//! \return Returns name of joint and null if an error happened.
virtual const c8* getJointName(s32 number) const = 0;
//! Gets a joint number from its name
//! \param name: Name of the joint.
//! \return Returns the number of the joint or -1 if not found.
virtual s32 getJointNumber(const c8* name) const = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,208 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__
#define __I_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__
#include "ISceneNode.h"
#include "IAnimatedMeshMD2.h"
#include "IAnimatedMeshMD3.h"
#include "IShadowVolumeSceneNode.h"
namespace irr
{
namespace scene
{
class IAnimatedMeshSceneNode;
//! Callback interface for catching events of ended animations.
/** Implement this interface and use
IAnimatedMeshSceneNode::setAnimationEndCallback to be able to
be notified if an animation playback has ended.
**/
class IAnimationEndCallBack : public virtual IUnknown
{
public:
//! Will be called when the animation playback has ended.
//! See IAnimatedMeshSceneNode::setAnimationEndCallback for
//! more informations.
//! \param node: Node of which the animation has ended.
virtual void OnAnimationEnd(IAnimatedMeshSceneNode* node) = 0;
};
//! Scene node capable of displaying an animated mesh and its shadow.
/** The shadow is optional: If a shadow should be displayed too, just invoke
the IAnimatedMeshSceneNode::createShadowVolumeSceneNode().*/
class IAnimatedMeshSceneNode : public ISceneNode
{
public:
//! Constructor
IAnimatedMeshSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
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))
: ISceneNode(parent, mgr, id, position, rotation, scale) {}
//! Destructor
virtual ~IAnimatedMeshSceneNode() {};
//! Sets the current frame number.
//! From now on the animation is played from this frame.
//! \param frame: Number of the frame to let the animation be started from.
//! The frame number must be a valid frame number of the IMesh used by this
//! scene node. Set IAnimatedMesh::getMesh() for details.
virtual void setCurrentFrame(s32 frame) = 0;
//! Sets the frame numbers between the animation is looped.
//! The default is 0 - MaximalFrameCount of the mesh.
//! \param begin: Start frame number of the loop.
//! \param end: End frame number of the loop.
//! \return Returns true if successful, false if not.
virtual bool setFrameLoop(s32 begin, s32 end) = 0;
//! Sets the speed with witch the animation is played.
//! \param framesPerSecond: Frames per second played.
virtual void setAnimationSpeed(f32 framesPerSecond) = 0;
//! Creates shadow volume scene node as child of this node
//! and returns a pointer to it. The shadow can be rendered using the ZPass
//! or the zfail method. ZPass is a little bit faster because the shadow volume
//! creation is easier, but with this method there occur ugly looking artifacs
//! when the camera is inside the shadow volume. These error do not occur
//! with the ZFail method.
//! \param id: Id of the shadow scene node. This id can be used to identify
//! the node later.
//! \param zfailmethod: If set to true, the shadow will use the zfail method,
//! if not, zpass is used.
//! \param infinity: Value used by the shadow volume algorithm to scale the
//! shadow volume.
//! \return Returns pointer to the created shadow scene node.
//! This pointer should not be dropped. See IUnknown::drop() for more information.
virtual IShadowVolumeSceneNode* addShadowVolumeSceneNode(s32 id=-1,
bool zfailmethod=true, f32 infinity=10000.0f) = 0;
//! Returns a pointer to a child node, wich has the same transformation as
//! the corresponding joint, if the mesh in this scene node is a ms3d mesh.
//! Otherwise 0 is returned. With this method it is possible to
//! attach scene nodes to joints more easily. In this way, it is
//! for example possible to attach a weapon to the left hand of an
//! animated model. This example shows how:
//! \code
//! ISceneNode* hand =
//! yourMS3DAnimatedMeshSceneNode->getMS3DJointNode("LeftHand");
//! hand->addChild(weaponSceneNode);
//! \endcode
//! Please note that the SceneNode returned by this method may not exist
//! before this call and is created by it.
//! \param jointName: Name of the joint.
//! \return Returns a pointer to the scene node which represents the joint
//! with the specified name. Returns 0 if the contained mesh is not an
//! ms3d mesh or the name of the joint could not be found.
virtual ISceneNode* getMS3DJointNode(const c8* jointName) = 0;
//! Returns a pointer to a child node, which has the same transformation as
//! the corresponding joint, if the mesh in this scene node is a x mesh.
//! Otherwise 0 is returned. With this method it is possible to
//! attach scene nodes to joints more easily. In this way, it is
//! for example possible to attach a weapon to the left hand of an
//! animated model. This example shows how:
//! \code
//! ISceneNode* hand =
//! yourMS3DAnimatedMeshSceneNode->getXJointNode("LeftHand");
//! hand->addChild(weaponSceneNode);
//! \endcode
//! Please note that the SceneNode returned by this method may not exist
//! before this call and is created by it.
//! \param jointName: Name of the joint.
//! \return Returns a pointer to the scene node which represents the joint
//! with the specified name. Returns 0 if the contained mesh is not an
//! ms3d mesh or the name of the joint could not be found.
virtual ISceneNode* getXJointNode(const c8* jointName) = 0;
//! Returns a pointer to a child node, wich has the same transformation as
//! the corresponding joint, if the mesh in this scene node is a b3d mesh.
//! Otherwise 0 is returned. With this method it is possible to
//! attach scene nodes to joints more easily. In this way, it is
//! for example possible to attach a weapon to the left hand of an
//! animated model. This example shows how:
//! \code
//! ISceneNode* hand =
//! yourB3DAnimatedMeshSceneNode->getB3DJointNode("LeftHand");
//! hand->addChild(weaponSceneNode);
//! \endcode
//! Please note that the SceneNode returned by this method may not exist
//! before this call and is created by it.
//! \param jointName: Name of the joint.
//! \return Returns a pointer to the scene node which represents the joint
//! with the specified name. Returns 0 if the contained mesh is not an
//! ms3d mesh or the name of the joint could not be found.
virtual ISceneNode* getB3DJointNode(const c8* jointName) = 0;
//! Starts a default MD2 animation.
//! With this method it is easily possible to start a Run, Attack,
//! Die or whatever animation, if the mesh contained in this scene
//! node is an md2 mesh. Otherwise, nothing happens.
//! \param anim: An MD2 animation type, which should be played, for
//! example EMAT_STAND for the standing animation.
//! \return Returns true if successful, and false if not, for example
//! if the mesh in the scene node is not a md2 mesh.
virtual bool setMD2Animation(EMD2_ANIMATION_TYPE anim) = 0;
//! Starts a special MD2 animation.
//! With this method it is easily possible to start a Run, Attack,
//! Die or whatever animation, if the mesh contained in this scene
//! node is an md2 mesh. Otherwise, nothing happens. This method uses
//! a character string to identify the animation. If the animation is a
//! standard md2 animation, you might want to start this animation
//! with the EMD2_ANIMATION_TYPE enumeration instead.
//! \param animationName: Name of the animation which should be played.
//! \return Returns true if successful, and false if not, for example
//! if the mesh in the scene node is not an md2 mesh, or no animation
//! with this name could be found.
virtual bool setMD2Animation(const c8* animationName) = 0;
//! Returns the current displayed frame number.
virtual s32 getFrameNr() = 0;
//! Returns the current start frame number.
virtual s32 getStartFrame() = 0;
//! Returns the current end frame number.
virtual s32 getEndFrame() = 0;
//! Sets looping mode which is on by default. If set to false,
//! animations will not be played looped.
virtual void setLoopMode(bool playAnimationLooped) = 0;
//! Sets a callback interface which will be called if an animation
//! playback has ended. Set this to 0 to disable the callback again.
//! Please note that this will only be called when in non looped mode,
//! see IAnimatedMeshSceneNode::setLoopMode().
virtual void setAnimationEndCallback(IAnimationEndCallBack* callback=0) = 0;
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes
referencing this mesh to change too. */
virtual void setReadOnlyMaterials(bool readonly) = 0;
//! Returns if the scene node should not copy the materials of the mesh but use them in a read only style
virtual bool isReadOnlyMaterials() = 0;
//! Sets a new mesh
virtual void setMesh(IAnimatedMesh* mesh) = 0;
//! Returns the current mesh
virtual IAnimatedMesh* getMesh(void) = 0;
// returns the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh,
// or the absolutetransformation if it's a normal scenenode
virtual const SMD3QuaterionTag& getAbsoluteTransformation( const core::stringc & tagname) = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,80 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_ANIMATED_MESH_X_H_INCLUDED__
#define __I_ANIMATED_MESH_X_H_INCLUDED__
#include "IAnimatedMesh.h"
#include "irrArray.h"
namespace irr
{
namespace scene
{
//! Interface for using some special functions of X meshes
class IAnimatedMeshX : public IAnimatedMesh
{
public:
//! Returns a pointer to a transformation matrix of a part of the
//! mesh based on a frame time. This is used for being able to attach
//! objects to parts of animated meshes. For example a weapon to an animated
//! hand.
//! \param jointNumber: Zero based index of joint. The last joint has the number
//! IAnimatedMeshX::getJointCount()-1;
//! \param frame: Frame of the animation.
//! \return Returns a pointer to the matrix of the mesh part or
//! null if an error occured.
virtual core::matrix4* getMatrixOfJoint(s32 jointNumber, s32 frame) = 0;
//! Gets joint count.
//! \return Returns amount of joints in the skeletal animated mesh.
virtual s32 getJointCount() const = 0;
//! Gets the name of a joint.
//! \param number: Zero based index of joint. The last joint has the number
//! IAnimatedMeshX::getJointCount()-1;
//! \return Returns name of joint and null if an error happened.
virtual const c8* getJointName(s32 number) const = 0;
//! Gets a joint number from its name
//! \param name: Name of the joint.
//! \return Returns the number of the joint or -1 if not found.
virtual s32 getJointNumber(const c8* name) const = 0;
//! Returns a pointer to list of points containing the skeleton.
//! Draw a line between point 1 and 2, and 3 and 4 and 5 and 6
//! and so on to visualize this. Only for debug purposes. If you
//! use an .x-File with the IAnimatedMeshSceneNode and turn DebugDataVisible
//! to true, the Scene node will visualize the skeleton using this
//! method.
virtual const core::array<core::vector3df>* getDrawableSkeleton(s32 frame) = 0;
//! Returns amount of animations in .X-file.
virtual s32 getAnimationCount() const = 0;
//! Returns the name of an animation.
//! \param idx: Zero based Index of the animation. Must be a value between
//! 0 and getAnimationCount()-1;
//! \return Returns pointer to the string of the name of the animation.
//! Returns 0 if an animation with this index does not exist.
virtual const c8* getAnimationName(s32 idx) const = 0;
//! Sets an animation as animation to play back.
//! \param idx: Zero based Index of the animation. Must be a value between
//! 0 and getAnimationCount()-1;
virtual void setCurrentAnimation(s32 idx) = 0;
//! Sets an animation as animation to play back.
//! \param name: Name of the animtion.
//! \return Returns true if successful, and false if the specified animation
//! does not exist.
virtual bool setCurrentAnimation(const c8* name) = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,71 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_ATTRIBUTE_EXCHANGING_OBJECT_H_INCLUDED__
#define __I_ATTRIBUTE_EXCHANGING_OBJECT_H_INCLUDED__
#include "IUnknown.h"
namespace irr
{
namespace io
{
class IAttributes;
//! Enumation flags passed through SAttributeReadWriteOptions to the IAttributeExchangingObject object
enum E_ATTRIBUTE_READ_WRITE_FLAGS
{
//! Serialization/Deserializion is done for an xml file
EARWF_FOR_FILE = 0x00000001,
//! Serialization/Deserializion is done for an editor property box
EARWF_FOR_EDITOR = 0x00000002,
//! When writing filenames, relative paths should be used
EARWF_USE_RELATIVE_PATHS = 0x00000004
};
//! struct holding data describing options
struct SAttributeReadWriteOptions
{
//! constructor
SAttributeReadWriteOptions()
: Flags(0), Filename(0)
{
}
//! Combination of E_ATTRIBUTE_READ_WRITE_FLAGS or other, custom ones
s32 Flags;
//! optional filename
const c8* Filename;
};
//! An object which is able to serialize and deserialize its attributes into an attributes object
class IAttributeExchangingObject : public virtual IUnknown
{
public:
//! Writes attributes of the object.
//! Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) {}
//! Reads attributes of the object.
//! Implement this to set the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml deserialization purposes.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) {}
};
} // end namespace io
} // end namespace irr
#endif

View File

@ -1,725 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_ATTRIBUTES_H_INCLUDED__
#define __I_ATTRIBUTES_H_INCLUDED__
#include "IUnknown.h"
#include "SColor.h"
#include "vector3d.h"
#include "vector2d.h"
#include "line2d.h"
#include "line3d.h"
#include "triangle3d.h"
#include "quaternion.h"
#include "position2d.h"
#include "rect.h"
#include "matrix4.h"
#include "quaternion.h"
#include "plane3d.h"
#include "triangle3d.h"
#include "line2d.h"
#include "line3d.h"
#include "irrString.h"
#include "irrArray.h"
#include "IXMLReader.h"
namespace irr
{
namespace video
{
class ITexture;
} // end namespace video
namespace io
{
class IXMLWriter;
//! Types of attributes available for IAttributes
enum E_ATTRIBUTE_TYPE
{
// integer attribute
EAT_INT = 0,
// float attribute
EAT_FLOAT,
// string attribute
EAT_STRING,
// boolean attribute
EAT_BOOL,
// enumeration attribute
EAT_ENUM,
// color attribute
EAT_COLOR,
// floating point color attribute
EAT_COLORF,
// 3d vector attribute
EAT_VECTOR3D,
// 2d position attribute
EAT_POSITION2D,
// vector 2d
EAT_VECTOR2D,
// rectangle attribute
EAT_RECT,
// matrix attribute
EAT_MATRIX,
// quaternion attribute
EAT_QUATERNION,
// 3d bounding box
EAT_BBOX,
// plane
EAT_PLANE,
// 3d triangle
EAT_TRIANGLE3D,
// line 2d
EAT_LINE2D,
// line 3d
EAT_LINE3D,
// array of stringws attribute
EAT_STRINGWARRAY,
// array of float
EAT_FLOATARRAY,
// array of int
EAT_INTARRAY,
// binary data attribute
EAT_BINARY,
// texture reference attribute
EAT_TEXTURE,
// known attribute type count
EAT_COUNT,
// unknown attribute
EAT_UNKNOWN
};
//! Provides a generic interface for attributes and their values and the possiblity to serialize them
class IAttributes : public virtual IUnknown
{
public:
//! Returns amount of attributes in this collection of attributes.
virtual s32 getAttributeCount() = 0;
//! Returns attribute name by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual const c8* getAttributeName(s32 index) = 0;
//! Returns the type of an attribute
//! \param attributeName: Name for the attribute
virtual E_ATTRIBUTE_TYPE getAttributeType(const c8* attributeName) = 0;
//! Returns attribute type by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual E_ATTRIBUTE_TYPE getAttributeType(s32 index) = 0;
//! Returns the type string of the attribute
//! \param attributeName: String for the attribute type
virtual const wchar_t* getAttributeTypeString(const c8* attributeName) = 0;
//! Returns the type string of the attribute by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual const wchar_t* getAttributeTypeString(s32 index) = 0;
//! Returns if an attribute with a name exists
virtual bool existsAttribute(const c8* attributeName) = 0;
//! Returns attribute index from name, -1 if not found
virtual s32 findAttribute(const c8* attributeName) = 0;
//! Removes all attributes
virtual void clear() = 0;
//! Reads attributes from a xml file.
//! \param readCurrentElementOnly: If set to true, reading only works if current element has the name 'attributes'.
//! If set to false, the first appearing list attributes are read.
virtual bool read(irr::io::IXMLReader* reader, bool readCurrentElementOnly=false) = 0;
//! Write these attributes into a xml file
//! \param writer: The XML writer to write to
//! \param writeXMLHeader: Writes a header to the XML file, required if at the beginning of the file
//! and you haven't already written one with writer->writeXMLHeader()
virtual bool write(io::IXMLWriter* writer, bool writeXMLHeader=false) = 0;
/*
Integer Attribute
*/
//! Adds an attribute as integer
virtual void addInt(const c8* attributeName, s32 value) = 0;
//! Sets an attribute as integer value
virtual void setAttribute(const c8* attributeName, s32 value) = 0;
//! Gets an attribute as integer value
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
virtual s32 getAttributeAsInt(const c8* attributeName) = 0;
//! Gets an attribute as integer value
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual s32 getAttributeAsInt(s32 index) = 0;
//! Sets an attribute as integer value
virtual void setAttribute(s32 index, s32 value) = 0;
/*
Float Attribute
*/
//! Adds an attribute as float
virtual void addFloat(const c8* attributeName, f32 value) = 0;
//! Sets a attribute as float value
virtual void setAttribute(const c8* attributeName, f32 value) = 0;
//! Gets an attribute as float value
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
virtual f32 getAttributeAsFloat(const c8* attributeName) = 0;
//! Gets an attribute as float value
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual f32 getAttributeAsFloat(s32 index) = 0;
//! Sets an attribute as float value
virtual void setAttribute(s32 index, f32 value) = 0;
/*
String Attribute
*/
//! Adds an attribute as string
virtual void addString(const c8* attributeName, const c8* value) = 0;
//! Sets an attribute value as string.
//! \param attributeName: Name for the attribute
//! \param value: Value for the attribute. Set this to 0 to delete the attribute
virtual void setAttribute(const c8* attributeName, const c8* value) = 0;
//! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
//! or 0 if attribute is not set.
virtual core::stringc getAttributeAsString(const c8* attributeName) = 0;
//! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get.
//! \param target: Buffer where the string is copied to.
virtual void getAttributeAsString(const c8* attributeName, c8* target) = 0;
//! Returns attribute value as string by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::stringc getAttributeAsString(s32 index) = 0;
//! Sets an attribute value as string.
//! \param attributeName: Name for the attribute
virtual void setAttribute(s32 index, const c8* value) = 0;
// wide strings
//! Adds an attribute as string
virtual void addString(const c8* attributeName, const wchar_t* value) = 0;
//! Sets an attribute value as string.
//! \param attributeName: Name for the attribute
//! \param value: Value for the attribute. Set this to 0 to delete the attribute
virtual void setAttribute(const c8* attributeName, const wchar_t* value) = 0;
//! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
//! or 0 if attribute is not set.
virtual core::stringw getAttributeAsStringW(const c8* attributeName) = 0;
//! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get.
//! \param target: Buffer where the string is copied to.
virtual void getAttributeAsStringW(const c8* attributeName, wchar_t* target) = 0;
//! Returns attribute value as string by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::stringw getAttributeAsStringW(s32 index) = 0;
//! Sets an attribute value as string.
//! \param attributeName: Name for the attribute
virtual void setAttribute(s32 index, const wchar_t* value) = 0;
/*
Binary Data Attribute
*/
//! Adds an attribute as binary data
virtual void addBinary(const c8* attributeName, void* data, s32 dataSizeInBytes) = 0;
//! Sets an attribute as binary data
virtual void setAttribute(const c8* attributeName, void* data, s32 dataSizeInBytes ) = 0;
//! Gets an attribute as binary data
//! \param attributeName: Name of the attribute to get.
virtual void getAttributeAsBinaryData(const c8* attributeName, void* outData, s32 maxSizeInBytes) = 0;
//! Gets an attribute as binary data
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual void getAttributeAsBinaryData(s32 index, void* outData, s32 maxSizeInBytes) = 0;
//! Sets an attribute as binary data
virtual void setAttribute(s32 index, void* data, s32 dataSizeInBytes ) = 0;
/*
Array Attribute
*/
//! Adds an attribute as wide string array
virtual void addArray(const c8* attributeName, core::array<core::stringw> value) = 0;
//! Sets an attribute value as a wide string array.
//! \param attributeName: Name for the attribute
//! \param value: Value for the attribute. Set this to 0 to delete the attribute
virtual void setAttribute(const c8* attributeName, const core::array<core::stringw> value) = 0;
//! Gets an attribute as an array of wide strings.
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
//! or 0 if attribute is not set.
virtual core::array<core::stringw> getAttributeAsArray(const c8* attributeName) = 0;
//! Returns attribute value as an array of wide strings by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::array<core::stringw> getAttributeAsArray(s32 index) = 0;
//! Sets an attribute as an array of wide strings
virtual void setAttribute(s32 index, core::array<core::stringw> value) = 0;
/*
Bool Attribute
*/
//! Adds an attribute as bool
virtual void addBool(const c8* attributeName, bool value) = 0;
//! Sets an attribute as boolean value
virtual void setAttribute(const c8* attributeName, bool value) = 0;
//! Gets an attribute as boolean value
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
virtual bool getAttributeAsBool(const c8* attributeName) = 0;
//! Gets an attribute as boolean value
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual bool getAttributeAsBool(s32 index) = 0;
//! Sets an attribute as boolean value
virtual void setAttribute(s32 index, bool value) = 0;
/*
Enumeration Attribute
*/
//! Adds an attribute as enum
virtual void addEnum(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) = 0;
//! Adds an attribute as enum
virtual void addEnum(const c8* attributeName, s32 enumValue, const c8* const* enumerationLiterals) = 0;
//! Sets an attribute as enumeration
virtual void setAttribute(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) = 0;
//! Gets an attribute as enumeration
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
virtual const c8* getAttributeAsEnumeration(const c8* attributeName) = 0;
//! Gets an attribute as enumeration
//! \param attributeName: Name of the attribute to get.
//! \param enumerationLiteralsToUse: Use these enumeration literals to get the index value instead of the set ones.
//! This is useful when the attribute list maybe was read from an xml file, and only contains the enumeration string, but
//! no information about its index.
//! \return Returns value of the attribute previously set by setAttribute()
virtual s32 getAttributeAsEnumeration(const c8* attributeName, const c8* const* enumerationLiteralsToUse) = 0;
//! Gets an attribute as enumeration
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual s32 getAttributeAsEnumeration(s32 index, const c8* const* enumerationLiteralsToUse) = 0;
//! Gets an attribute as enumeration
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual const c8* getAttributeAsEnumeration(s32 index) = 0;
//! Gets the list of enumeration literals of an enumeration attribute
//! \param attributeName: Name of the attribute to get.
virtual void getAttributeEnumerationLiteralsOfEnumeration(const c8* attributeName, core::array<core::stringc>& outLiterals) = 0;
//! Gets the list of enumeration literals of an enumeration attribute
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual void getAttributeEnumerationLiteralsOfEnumeration(s32 index, core::array<core::stringc>& outLiterals) = 0;
//! Sets an attribute as enumeration
virtual void setAttribute(s32 index, const c8* enumValue, const c8* const* enumerationLiterals) = 0;
/*
SColor Attribute
*/
//! Adds an attribute as color
virtual void addColor(const c8* attributeName, video::SColor value) = 0;
//! Sets a attribute as color
virtual void setAttribute(const c8* attributeName, video::SColor color) = 0;
//! Gets an attribute as color
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
virtual video::SColor getAttributeAsColor(const c8* attributeName) = 0;
//! Gets an attribute as color
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual video::SColor getAttributeAsColor(s32 index) = 0;
//! Sets an attribute as color
virtual void setAttribute(s32 index, video::SColor color) = 0;
/*
SColorf Attribute
*/
//! Adds an attribute as floating point color
virtual void addColorf(const c8* attributeName, video::SColorf value) = 0;
//! Sets a attribute as floating point color
virtual void setAttribute(const c8* attributeName, video::SColorf color) = 0;
//! Gets an attribute as floating point color
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
virtual video::SColorf getAttributeAsColorf(const c8* attributeName) = 0;
//! Gets an attribute as floating point color
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual video::SColorf getAttributeAsColorf(s32 index) = 0;
//! Sets an attribute as floating point color
virtual void setAttribute(s32 index, video::SColorf color) = 0;
/*
Vector3d Attribute
*/
//! Adds an attribute as 3d vector
virtual void addVector3d(const c8* attributeName, core::vector3df value) = 0;
//! Sets a attribute as 3d vector
virtual void setAttribute(const c8* attributeName, core::vector3df v) = 0;
//! Gets an attribute as 3d vector
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::vector3df getAttributeAsVector3d(const c8* attributeName) = 0;
//! Gets an attribute as 3d vector
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::vector3df getAttributeAsVector3d(s32 index) = 0;
//! Sets an attribute as vector
virtual void setAttribute(s32 index, core::vector3df v) = 0;
/*
Position2d Attribute
*/
//! Adds an attribute as 2d position
virtual void addPosition2d(const c8* attributeName, core::position2di value) = 0;
//! Sets a attribute as 2d position
virtual void setAttribute(const c8* attributeName, core::position2di v) = 0;
//! Gets an attribute as position
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::position2di getAttributeAsPosition2d(const c8* attributeName) = 0;
//! Gets an attribute as position
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::position2di getAttributeAsPosition2d(s32 index) = 0;
//! Sets an attribute as 2d position
virtual void setAttribute(s32 index, core::position2di v) = 0;
/*
Rectangle Attribute
*/
//! Adds an attribute as rectangle
virtual void addRect(const c8* attributeName, core::rect<s32> value) = 0;
//! Sets an attribute as rectangle
virtual void setAttribute(const c8* attributeName, core::rect<s32> v) = 0;
//! Gets an attribute as rectangle
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::rect<s32> getAttributeAsRect(const c8* attributeName) = 0;
//! Gets an attribute as rectangle
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::rect<s32> getAttributeAsRect(s32 index) = 0;
//! Sets an attribute as rectangle
virtual void setAttribute(s32 index, core::rect<s32> v) = 0;
/*
matrix attribute
*/
//! Adds an attribute as matrix
virtual void addMatrix(const c8* attributeName, core::matrix4 v) = 0;
//! Sets an attribute as matrix
virtual void setAttribute(const c8* attributeName, core::matrix4 v) = 0;
//! Gets an attribute as a matrix4
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::matrix4 getAttributeAsMatrix(const c8* attributeName) = 0;
//! Gets an attribute as matrix
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::matrix4 getAttributeAsMatrix(s32 index) = 0;
//! Sets an attribute as matrix
virtual void setAttribute(s32 index, core::matrix4 v) = 0;
/*
quaternion attribute
*/
//! Adds an attribute as quaternion
virtual void addQuaternion(const c8* attributeName, core::quaternion v) = 0;
//! Sets an attribute as quaternion
virtual void setAttribute(const c8* attributeName, core::quaternion v) = 0;
//! Gets an attribute as a quaternion
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::quaternion getAttributeAsQuaternion(const c8* attributeName) = 0;
//! Gets an attribute as quaternion
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::quaternion getAttributeAsQuaternion(s32 index) = 0;
//! Sets an attribute as quaternion
virtual void setAttribute(s32 index, core::quaternion v) = 0;
/*
3d bounding box
*/
//! Adds an attribute as axis aligned bounding box
virtual void addBox3d(const c8* attributeName, core::aabbox3df v) = 0;
//! Sets an attribute as axis aligned bounding box
virtual void setAttribute(const c8* attributeName, core::aabbox3df v) = 0;
//! Gets an attribute as a axis aligned bounding box
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::aabbox3df getAttributeAsBox3d(const c8* attributeName) = 0;
//! Gets an attribute as axis aligned bounding box
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::aabbox3df getAttributeAsBox3d(s32 index) = 0;
//! Sets an attribute as axis aligned bounding box
virtual void setAttribute(s32 index, core::aabbox3df v) = 0;
/*
plane
*/
//! Adds an attribute as 3d plane
virtual void addPlane3d(const c8* attributeName, core::plane3df v) = 0;
//! Sets an attribute as 3d plane
virtual void setAttribute(const c8* attributeName, core::plane3df v) = 0;
//! Gets an attribute as a 3d plane
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::plane3df getAttributeAsPlane3d(const c8* attributeName) = 0;
//! Gets an attribute as 3d plane
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::plane3df getAttributeAsPlane3d(s32 index) = 0;
//! Sets an attribute as 3d plane
virtual void setAttribute(s32 index, core::plane3df v) = 0;
/*
3d triangle
*/
//! Adds an attribute as 3d triangle
virtual void addTriangle3d(const c8* attributeName, core::triangle3df v) = 0;
//! Sets an attribute as 3d trianle
virtual void setAttribute(const c8* attributeName, core::triangle3df v) = 0;
//! Gets an attribute as a 3d triangle
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::triangle3df getAttributeAsTriangle3d(const c8* attributeName) = 0;
//! Gets an attribute as 3d triangle
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::triangle3df getAttributeAsTriangle3d(s32 index) = 0;
//! Sets an attribute as 3d triangle
virtual void setAttribute(s32 index, core::triangle3df v) = 0;
/*
line 2d
*/
//! Adds an attribute as a 2d line
virtual void addLine2d(const c8* attributeName, core::line2df v) = 0;
//! Sets an attribute as a 2d line
virtual void setAttribute(const c8* attributeName, core::line2df v) = 0;
//! Gets an attribute as a 2d line
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::line2df getAttributeAsLine2d(const c8* attributeName) = 0;
//! Gets an attribute as a 2d line
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::line2df getAttributeAsLine2d(s32 index) = 0;
//! Sets an attribute as a 2d line
virtual void setAttribute(s32 index, core::line2df v) = 0;
/*
line 3d
*/
//! Adds an attribute as a 3d line
virtual void addLine3d(const c8* attributeName, core::line3df v) = 0;
//! Sets an attribute as a 3d line
virtual void setAttribute(const c8* attributeName, core::line3df v) = 0;
//! Gets an attribute as a 3d line
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::line3df getAttributeAsLine3d(const c8* attributeName) = 0;
//! Gets an attribute as a 3d line
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::line3df getAttributeAsLine3d(s32 index) = 0;
//! Sets an attribute as a 3d line
virtual void setAttribute(s32 index, core::line3df v) = 0;
/*
Texture Attribute
*/
//! Adds an attribute as texture reference
virtual void addTexture(const c8* attributeName, video::ITexture* texture) = 0;
//! Sets an attribute as texture reference
virtual void setAttribute(const c8* attributeName, video::ITexture* texture ) = 0;
//! Gets an attribute as texture reference
//! \param attributeName: Name of the attribute to get.
virtual video::ITexture* getAttributeAsTexture(const c8* attributeName) = 0;
//! Gets an attribute as texture reference
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual video::ITexture* getAttributeAsTexture(s32 index) = 0;
//! Sets an attribute as texture reference
virtual void setAttribute(s32 index, video::ITexture* texture) = 0;
};
} // end namespace io
} // end namespace irr
#endif

View File

@ -1,56 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_BILLBOARD_SCENE_NODE_H_INCLUDED__
#define __I_BILLBOARD_SCENE_NODE_H_INCLUDED__
#include "ISceneNode.h"
namespace irr
{
namespace scene
{
//! A billboard scene node.
/** A billboard is like a 3d sprite: A 2d element,
which always looks to the camera. It is usually used for explosions, fire,
lensflares, particles and things like that.
*/
class IBillboardSceneNode : public ISceneNode
{
public:
//! constructor
IBillboardSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
const core::vector3df& position = core::vector3df(0,0,0))
: ISceneNode(parent, mgr, id, position) {}
//! Sets the size of the billboard.
virtual void setSize(const core::dimension2d<f32>& size) = 0;
//! Returns the size of the billboard.
virtual const core::dimension2d<f32>& getSize() = 0;
//! Set the color of all vertices of the billboard
//! \param overallColor: the color to set
virtual void setColor(const video::SColor & overallColor) = 0;
//! Set the color of the top and bottom vertices of the billboard
//! \param topColor: the color to set the top vertices
//! \param bottomColor: the color to set the bottom vertices
virtual void setColor(const video::SColor & topColor, const video::SColor & bottomColor) = 0;
//! Gets the color of the top and bottom vertices of the billboard
//! \param[out] topColor: stores the color of the top vertices
//! \param[out] bottomColor: stores the color of the bottom vertices
virtual void getColor(video::SColor & topColor, video::SColor & bottomColor) = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,149 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_CAMERA_SCENE_NODE_H_INCLUDED__
#define __I_CAMERA_SCENE_NODE_H_INCLUDED__
#include "ISceneNode.h"
#include "IEventReceiver.h"
#include "SViewFrustum.h"
namespace irr
{
namespace scene
{
//! Scene Node which is a (controlable) camera.
/** The whole scene will be
rendered from the cameras point of view. Because the ICameraScenNode
is a SceneNode, it can be attached to any other scene node, and will
follow its parents movement, rotation and so on.
*/
class ICameraSceneNode : public ISceneNode, public IEventReceiver
{
public:
//! Constructor
ICameraSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
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))
: ISceneNode(parent, mgr, id, position, rotation, scale), IsOrthogonal(false) {}
//! Destructor
virtual ~ICameraSceneNode() {};
//! Sets the projection matrix of the camera.
/** The core::matrix4 class has some methods
to build a projection matrix. e.g: core::matrix4::buildProjectionMatrixPerspectiveFovLH.
Note that the matrix will only stay as set by this method until one of
the following Methods are called: setNearValue, setFarValue, setAspectRatio, setFOV.
\param projection: The new projection matrix of the camera. */
virtual void setProjectionMatrix(const core::matrix4& projection) = 0;
//! Gets the current projection matrix of the camera.
/** \return Returns the current projection matrix of the camera. */
virtual const core::matrix4& getProjectionMatrix() = 0;
//! Gets the current view matrix of the camera.
/** \return Returns the current view matrix of the camera. */
virtual const core::matrix4& getViewMatrix() = 0;
//! It is possible to send mouse and key events to the camera.
/** Most cameras
may ignore this input, but camera scene nodes which are created for
example with ISceneManager::addMayaCameraSceneNode or
ISceneManager::addMeshViewerCameraSceneNode, may want to get this input
for changing their position, look at target or whatever. */
virtual bool OnEvent(SEvent event) = 0;
//! Sets the look at target of the camera
/** \param pos: Look at target of the camera. */
virtual void setTarget(const core::vector3df& pos) = 0;
//! Gets the current look at target of the camera
/** \return Returns the current look at target of the camera */
virtual core::vector3df getTarget() const = 0;
//! Sets the up vector of the camera.
/** \param pos: New upvector of the camera. */
virtual void setUpVector(const core::vector3df& pos) = 0;
//! Gets the up vector of the camera.
/** \return Returns the up vector of the camera. */
virtual core::vector3df getUpVector() const = 0;
//! Gets the value of the near plane of the camera.
/** \return Returns the value of the near plane of the camera. */
virtual f32 getNearValue() = 0;
//! Gets the value of the far plane of the camera.
/** \return Returns the value of the far plane of the camera. */
virtual f32 getFarValue() = 0;
//! Gets the aspect ratio of the camera.
/** \return Returns the aspect ratio of the camera. */
virtual f32 getAspectRatio() = 0;
//! Gets the field of view of the camera.
/** \return Returns the field of view of the camera in radiants. */
virtual f32 getFOV() = 0;
//! Sets the value of the near clipping plane. (default: 1.0f)
/** \param zn: New z near value. */
virtual void setNearValue(f32 zn) = 0;
//! Sets the value of the far clipping plane (default: 2000.0f)
/** \param zf: New z far value. */
virtual void setFarValue(f32 zf) = 0;
//! Sets the aspect ratio (default: 4.0f / 3.0f)
/** \param aspect: New aspect ratio. */
virtual void setAspectRatio(f32 aspect) = 0;
//! Sets the field of view (Default: PI / 2.5f)
/** \param fovy: New field of view in radiants. */
virtual void setFOV(f32 fovy) = 0;
//! Returns the view frustum.
/** Needed sometimes by bspTree or LOD render nodes.
\return Returns the current view frustum. */
virtual const SViewFrustum* getViewFrustum() const = 0;
//! Disables or enables the camera to get key or mouse inputs.
/** If this is set to true, the camera will respond to key inputs
otherwise not. */
virtual void setInputReceiverEnabled(bool enabled) = 0;
//! Returns if the input receiver of the camera is currently enabled.
virtual bool isInputReceiverEnabled() = 0;
//! Returns if a camera is orthogonal.
/** This setting does not change anything of the view or projection matrix. However
it influences how collision detection and picking is done with this camera. */
virtual bool isOrthogonal()
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsOrthogonal;
}
//! Sets if this camera should return if it is orthogonal.
/** This setting does not change anything of the view or projection matrix. However
it influences how collision detection and picking is done with this camera. */
void setIsOrthogonal( bool orthogonal )
{
IsOrthogonal = orthogonal;
}
private:
bool IsOrthogonal;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,71 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_CURSOR_CONTROL_H_INCLUDED__
#define __I_CURSOR_CONTROL_H_INCLUDED__
#include "position2d.h"
#include "IUnknown.h"
#include "irrTypes.h"
namespace irr
{
namespace gui
{
//! Interface to manipulate the mouse cursor.
class ICursorControl : public virtual IUnknown
{
public:
//! Changes the visible state of the mouse cursor.
/** \param visible: The new visible state. If true, the cursor will be visible,
if false, it will be invisible. */
virtual void setVisible(bool visible) = 0;
//! Returns if the cursor is currently visible.
/** \return Returns true if the cursor is visible, false if not. */
virtual bool isVisible() = 0;
//! Sets the new position of the cursor.
/** \param pos: New position of the cursor. The position must be between
(0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is
the top left corner and (1.0f, 1.0f) is the bottom right corner of the
render window. */
virtual void setPosition(const core::position2d<f32> &pos) = 0;
//! Sets the new position of the cursor.
/** \param pos: New position of the cursor. The position must be between
(0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is
the top left corner and (1.0f, 1.0f) is the bottom right corner of the
render window. */
virtual void setPosition(f32 x, f32 y) = 0;
//! Sets the new position of the cursor.
/** \param pos: New position of the cursor. The coordinates are pixel units. */
virtual void setPosition(const core::position2d<s32> &pos) = 0;
//! Sets the new position of the cursor.
/** \param pos: New position of the cursor. The coordinates are pixel units. */
virtual void setPosition(s32 x, s32 y) = 0;
//! Returns the current position of the mouse cursor.
/** \return Returns the current position of the cursor. The returned position
is the position of the mouse cursor in pixel units. */
virtual core::position2d<s32> getPosition() = 0;
//! Returns the current position of the mouse cursor.
/** \return Returns the current position of the cursor. The returned position
is a value between (0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is
the top left corner and (1.0f, 1.0f) is the bottom right corner of the
render window. */
virtual core::position2d<f32> getRelativePosition() = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,42 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_DUMMY_TRANSFORMATION_SCENE_NODE_H_INCLUDED__
#define __I_DUMMY_TRANSFORMATION_SCENE_NODE_H_INCLUDED__
#include "ISceneNode.h"
namespace irr
{
namespace scene
{
//! Dummy scene node for adding additional transformations to the scene graph.
/** This scene node does not render itself, and does not respond to set/getPosition,
set/getRotation and set/getScale. Its just a simple scene node that takes a
matrix as relative transformation, making it possible to insert any transformation
anywhere into the scene graph.
This scene node is for example used by the IAnimatedMeshSceneNode for emulating
joint scene nodes when playing skeletal animations.
*/
class IDummyTransformationSceneNode : public ISceneNode
{
public:
//! constructor
IDummyTransformationSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id)
: ISceneNode(parent, mgr, id) {}
//! Returns a reference to the current relative transformation matrix.
//! This is the matrix, this scene node uses instead of scale, translation
//! and rotation.
virtual core::matrix4& getRelativeTransformationMatrix() = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,225 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_EVENT_RECEIVER_H_INCLUDED__
#define __I_EVENT_RECEIVER_H_INCLUDED__
#include "ILogger.h"
#include "position2d.h"
#include "Keycodes.h"
namespace irr
{
//! Enumeration for all event types there are.
enum EEVENT_TYPE
{
//! An event of the graphical user interface.
EET_GUI_EVENT = 0,
//! A mouse input event.
EET_MOUSE_INPUT_EVENT,
//! A key input evant.
EET_KEY_INPUT_EVENT,
//! A log event
EET_LOG_TEXT_EVENT,
//! A user event with user data. This is not used by Irrlicht and can be used
//! to send user specific data though the system.
EET_USER_EVENT
};
//! Enumeration for all mouse input events
enum EMOUSE_INPUT_EVENT
{
//! Left mouse button was pressed down.
EMIE_LMOUSE_PRESSED_DOWN = 0,
//! Right mouse button was pressed down.
EMIE_RMOUSE_PRESSED_DOWN,
//! Middle mouse button was pressed down.
EMIE_MMOUSE_PRESSED_DOWN,
//! Left mouse button was left up.
EMIE_LMOUSE_LEFT_UP,
//! Right mouse button was left up.
EMIE_RMOUSE_LEFT_UP,
//! Middle mouse button was left up.
EMIE_MMOUSE_LEFT_UP,
//! The mouse cursor changed its position.
EMIE_MOUSE_MOVED,
//! The mouse wheel was moved. Use Wheel value in event data to find out
//! in what direction and how fast.
EMIE_MOUSE_WHEEL,
//! No real event. Just for convenience to get number of events
EMIE_COUNT
};
namespace gui
{
class IGUIElement;
//! Enumeration for all events which are sendable by the gui system
enum EGUI_EVENT_TYPE
{
//! A gui element has lost its focus.
EGET_ELEMENT_FOCUS_LOST = 0,
//! A gui element has got the focus.
EGET_ELEMENT_FOCUSED,
//! A gui element was hovered.
EGET_ELEMENT_HOVERED,
//! A hovered gui element was left
EGET_ELEMENT_LEFT,
//! A button was clicked.
EGET_BUTTON_CLICKED,
//! A scrollbar has changed its position.
EGET_SCROLL_BAR_CHANGED,
//! A checkbox has changed its check state.
EGET_CHECKBOX_CHANGED,
//! A new item in a listbox was seleted.
EGET_LISTBOX_CHANGED,
//! An item in the listbox was selected, which was already selected.
EGET_LISTBOX_SELECTED_AGAIN,
//! A file has been selected in the file dialog
EGET_FILE_SELECTED,
//! A file open dialog has been closed without choosing a file
EGET_FILE_CHOOSE_DIALOG_CANCELLED,
//! 'Yes' was clicked on a messagebox
EGET_MESSAGEBOX_YES,
//! 'No' was clicked on a messagebox
EGET_MESSAGEBOX_NO,
//! 'OK' was clicked on a messagebox
EGET_MESSAGEBOX_OK,
//! 'Cancel' was clicked on a messagebox
EGET_MESSAGEBOX_CANCEL,
//! In an editbox was pressed 'ENTER'
EGET_EDITBOX_ENTER,
//! The tab was changed in an tab control
EGET_TAB_CHANGED,
//! A menu item was selected in a (context) menu
EGET_MENU_ITEM_SELECTED,
//! The selection in a combo box has been changed
EGET_COMBO_BOX_CHANGED
};
} // end namespace gui
//! Struct for holding event data. An event can be a gui, mouse or keyboard event.
struct SEvent
{
EEVENT_TYPE EventType;
union
{
struct
{
//! IGUIElement who called the event
gui::IGUIElement* Caller;
//! Type of GUI Event
gui::EGUI_EVENT_TYPE EventType;
} GUIEvent;
struct
{
//! X position of mouse cursor
s32 X;
//! Y position of mouse cursor
s32 Y;
//! mouse wheel delta, usually 1.0 or -1.0.
/** Only valid if event was EMIE_MOUSE_WHEEL */
f32 Wheel;
//! type of mouse event
EMOUSE_INPUT_EVENT Event;
} MouseInput;
struct
{
//! Character corresponding to the key (0, if not a character)
wchar_t Char;
//! Key which has been pressed or released
EKEY_CODE Key;
//! if not pressed, then the key was left up
bool PressedDown;
//! true if shift was also pressed
bool Shift;
//! true if ctrl was also pressed
bool Control;
} KeyInput;
struct
{
//! pointer to text which has been logged
const c8* Text;
//! log level in which the text has been logged
ELOG_LEVEL Level;
} LogEvent;
struct
{
//! Some user specified data as int
s32 UserData1;
//! Another user specified data as int
s32 UserData2;
//! Some user specified data as float
f32 UserData3;
} UserEvent;
};
};
//! Interface of an object wich can receive events.
class IEventReceiver
{
public:
virtual ~IEventReceiver() {};
//! called if an event happened. returns true if event was processed
virtual bool OnEvent(SEvent event) = 0;
};
} // end namespace irr
#endif

View File

@ -1,58 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_FILE_LIST_H_INCLUDED__
#define __I_FILE_LIST_H_INCLUDED__
#include "IUnknown.h"
namespace irr
{
namespace io
{
//! The Filelist lists all files in a directory.
class IFileList : public virtual IUnknown
{
public:
//! destructor
virtual ~IFileList() {};
//! Returns the amount of files in the filelist.
//! \return
//! Returns the amount of files and directories in the file list.
virtual s32 getFileCount() = 0;
//! Gets the name of a file in the list, based on an index.
//! The path is not included in this name. Use getFullFileName for this.
//! \param index is the zero based index of the file which name should
//! be returned. The index has to be smaller than the amount getFileCount() returns.
//! \return
//! Returns the file name of the file. Returns 0, if an error occured.
virtual const c8* getFileName(s32 index) = 0;
//! Gets the full name of a file in the list, path included, based on an index.
//! \param index is the zero based index of the file which name should
//! be returned. The index has to be smaller than the amount getFileCount() returns.
//! \return
//! Returns the file name of the file. Returns 0, if an error occured.
virtual const c8* getFullFileName(s32 index) = 0;
//! Returns of the file is a directory
//! \param
//! index is the zero based index of the file which name should
//! be returned. The index has to be smaller than the amount getFileCount() returns.
//! \return
//! Returns true, if the file is a directory, and false, if it is not.
//! If an error occurs, the result is undefined.
virtual bool isDirectory(s32 index) = 0;
};
} // end namespace irr
} // end namespace io
#endif

View File

@ -1,193 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_FILE_SYSTEM_H_INCLUDED__
#define __I_FILE_SYSTEM_H_INCLUDED__
#include "IUnknown.h"
#include "IXMLReader.h"
#include "irrString.h"
namespace irr
{
namespace video
{
class IVideoDriver;
} // end namespace video
namespace io
{
class IReadFile;
class IWriteFile;
class IFileList;
class IXMLWriter;
class IAttributes;
//! The FileSystem manages files and archives and provides access to them.
/**
It manages where files are, so that modules which
use the the IO do not need to know where every file is located. A file
could be in a .zip-Archive or as file on disk, using the IFileSystem
makes no difference to this.
*/
class IFileSystem : public virtual IUnknown
{
public:
//! destructor
virtual ~IFileSystem() {};
//! Opens a file for read access.
/** \param filename: Name of file to open.
\return Returns a pointer to the created file interface.
The returned pointer should be dropped when no longer needed.
See IUnknown::drop() for more information. */
virtual IReadFile* createAndOpenFile(const c8* filename) = 0;
//! Creates an IReadFile interface for accessing memory like a file.
/** This allows you to use a pointer to memory where an IReadFile is requested.
\param memory: A pointer to the start of the file in memory
\param len: The length of the memory in bytes
\param fileName: The name given to this file
\param deleteMemoryWhenDropped: True if the memory should be deleted
along with the IReadFile when it is dropped.
\return Returns a pointer to the created file interface.
The returned pointer should be dropped when no longer needed.
See IUnknown::drop() for more information.
*/
virtual IReadFile* createMemoryReadFile(void* memory, s32 len, const c8* fileName, bool deleteMemoryWhenDropped=false) = 0;
//! Opens a file for write access.
/** \param filename: Name of file to open.
\param append: If the file already exist, all write operations are
appended to the file.
\return Returns a pointer to the created file interface. 0 is returned, if the
file could not created or opened for writing.
The returned pointer should be dropped when no longer needed.
See IUnknown::drop() for more information. */
virtual IWriteFile* createAndWriteFile(const c8* filename, bool append=false) = 0;
//! Adds an zip archive to the file system.
/** After calling this, the Irrlicht Engine will search and open files directly from this archive too.
This is useful for hiding data from the end user, speeding up file access and making it possible to
access for example Quake3 .pk3 files, which are nothing different than .zip files.
\param filename: Filename of the zip archive to add to the file system.
\param ignoreCase: If set to true, files in the archive can be accessed without
writing all letters in the right case.
\param ignorePaths: If set to true, files in the added archive can be accessed
without its complete path.
\return Returns true if the archive was added successful, false if not. */
virtual bool addZipFileArchive(const c8* filename, bool ignoreCase = true, bool ignorePaths = true) = 0;
//! Adds an unzipped archive ( or basedirectory with subdirectories..) to the file system.
/** Useful for handling data which will be in a zip file
\param filename: Filename of the unzipped zip archive base directory to add to the file system.
\param ignoreCase: If set to true, files in the archive can be accessed without
writing all letters in the right case.
\param ignorePaths: If set to true, files in the added archive can be accessed
without its complete path.
\return Returns true if the archive was added successful, false if not. */
virtual bool addFolderFileArchive(const c8* filename, bool ignoreCase = true, bool ignorePaths = true) = 0;
//! Adds an pak archive to the file system.
/** After calling this, the Irrlicht Engine will search and open files directly from this archive too.
This is useful for hiding data from the end user, speeding up file access and making it possible to
access for example Quake2/KingPin/Hexen2 .pak files
\param filename: Filename of the pak archive to add to the file system.
\param ignoreCase: If set to true, files in the archive can be accessed without
writing all letters in the right case.
\param ignorePaths: If set to true, files in the added archive can be accessed
without its complete path.(should not use with Quake2 paks
\return Returns true if the archive was added successful, false if not. */
virtual bool addPakFileArchive(const c8* filename, bool ignoreCase = true, bool ignorePaths = true) = 0;
//! Returns the string of the current working directory.
virtual const c8* getWorkingDirectory() = 0;
//! Changes the current Working Directory to the overgiven string.
/** \param ewDirectory is a string specifiing the new working directory.
The string is operating system dependent. Under Windows it has
the form "<drive>:\<directory>\<sudirectory>\<..>". An example would be: "C:\Windows\"
\return Returns true if successful, otherwise false. */
virtual bool changeWorkingDirectoryTo(const c8* newDirectory) = 0;
//! Converts a relative path to an absolute (unique) path, resolving symbolic links if required
virtual irr::core::stringc getAbsolutePath(irr::core::stringc &filename) = 0;
//! Creates a list of files and directories in the current working directory and returns it.
/** \return a Pointer to the created IFileList is returned. After the list has been used
it has to be deleted using its IFileList::drop() method.
See IUnknown::drop() for more information. */
virtual IFileList* createFileList() = 0;
//! Determinates if a file exists and would be able to be opened.
/** \param filename is the string identifying the file which should be tested for existance.
\return Returns true if file exsits, and false if it does not exist or an error occured. */
virtual bool existFile(const c8* filename) = 0;
//! Creates a XML Reader from a file which returns all parsed strings as wide characters (wchar_t*).
/** Use createXMLReaderUTF8() if you prefer char* instead of wchar_t*. See IIrrXMLReader for
more information on how to use the parser.
\return 0, if file could not be opened, otherwise a pointer to the created
IXMLReader is returned. After use, the reader
has to be deleted using its IXMLReader::drop() method.
See IUnknown::drop() for more information. */
virtual IXMLReader* createXMLReader(const c8* filename) = 0;
//! Creates a XML Reader from a file which returns all parsed strings as wide characters (wchar_t*).
/** Use createXMLReaderUTF8() if you prefer char* instead of wchar_t*. See IIrrXMLReader for
more information on how to use the parser.
\return 0, if file could not be opened, otherwise a pointer to the created
IXMLReader is returned. After use, the reader
has to be deleted using its IXMLReader::drop() method.
See IUnknown::drop() for more information. */
virtual IXMLReader* createXMLReader(IReadFile* file) = 0;
//! Creates a XML Reader from a file which returns all parsed strings as ASCII/UTF-8 characters (char*).
/** Use createXMLReader() if you prefer wchar_t* instead of char*. See IIrrXMLReader for
more information on how to use the parser.
\return 0, if file could not be opened, otherwise a pointer to the created
IXMLReader is returned. After use, the reader
has to be deleted using its IXMLReaderUTF8::drop() method.
See IUnknown::drop() for more information. */
virtual IXMLReaderUTF8* createXMLReaderUTF8(const c8* filename) = 0;
//! Creates a XML Reader from a file which returns all parsed strings as ASCII/UTF-8 characters (char*).
/** Use createXMLReader() if you prefer wchar_t* instead of char*. See IIrrXMLReader for
more information on how to use the parser.
\return 0, if file could not be opened, otherwise a pointer to the created
IXMLReader is returned. After use, the reader
has to be deleted using its IXMLReaderUTF8::drop() method.
See IUnknown::drop() for more information. */
virtual IXMLReaderUTF8* createXMLReaderUTF8(IReadFile* file) = 0;
//! Creates a XML Writer from a file.
/** \return 0, if file could not be opened, otherwise a pointer to the created
IXMLWriter is returned. After use, the reader
has to be deleted using its IXMLWriter::drop() method.
See IUnknown::drop() for more information. */
virtual IXMLWriter* createXMLWriter(const c8* filename) = 0;
//! Creates a XML Writer from a file.
/** \return 0, if file could not be opened, otherwise a pointer to the created
IXMLWriter is returned. After use, the reader
has to be deleted using its IXMLWriter::drop() method.
See IUnknown::drop() for more information. */
virtual IXMLWriter* createXMLWriter(IWriteFile* file) = 0;
//! Creates a new empty collection of attributes, usable for serialization and more.
/** \param: driver: Video driver to be used to load textures when specified as attribute values.
Can be null to prevent automatic texture loading by attributes.
\return Returns a pointer to the created object.
If you no longer need the object, you should call IAttributes::drop().
See IUnknown::drop() for more information. */
virtual IAttributes* createEmptyAttributes(video::IVideoDriver* driver=0) = 0;
};
} // end namespace io
} // end namespace irr
#endif

View File

@ -1,219 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GPU_PROGRAMMING_SERVICES_H_INCLUDED__
#define __I_GPU_PROGRAMMING_SERVICES_H_INCLUDED__
#include "IUnknown.h"
#include "SMaterial.h"
namespace irr
{
namespace io
{
class IReadFile;
} // end namespace io
namespace video
{
class IVideoDriver;
class IShaderConstantSetCallBack;
//! Compile target enumeration for the addHighLevelShaderMaterial() method.
enum E_VERTEX_SHADER_TYPE
{
EVST_VS_1_1 = 0,
EVST_VS_2_0,
EVST_VS_2_a,
EVST_VS_3_0,
//! This is not a type, but a value indicating how much types there are.
EVST_COUNT
};
//! Names for all vertex shader types, each entry corresponds to a E_VERTEX_SHADER_TYPE entry.
const c8* const VERTEX_SHADER_TYPE_NAMES[] = {
"vs_1_1",
"vs_2_0",
"vs_2_a",
"vs_3_0",
0 };
//! Compile target enumeration for the addHighLevelShaderMaterial() method.
enum E_PIXEL_SHADER_TYPE
{
EPST_PS_1_1 = 0,
EPST_PS_1_2,
EPST_PS_1_3,
EPST_PS_1_4,
EPST_PS_2_0,
EPST_PS_2_a,
EPST_PS_2_b,
EPST_PS_3_0,
//! This is not a type, but a value indicating how much types there are.
EPST_COUNT
};
//! Names for all pixel shader types, each entry corresponds to a E_PIXEL_SHADER_TYPE entry.
const c8* const PIXEL_SHADER_TYPE_NAMES[] = {
"ps_1_1",
"ps_1_2",
"ps_1_3",
"ps_1_4",
"ps_2_0",
"ps_2_a",
"ps_2_b",
"ps_3_0",
0 };
//! Interface making it possible to create and use programs running on the GPU.
class IGPUProgrammingServices
{
public:
//! destructor
virtual ~IGPUProgrammingServices() {}
//! Adds a new material renderer to the VideoDriver, based on a high level shading
//! language. Currently only HLSL/D3D9 and GLSL/OpenGL is supported.
//! \param vertexShaderProgram: String containing the source of the vertex shader program.
//! This can be 0 if no vertex program should be used.
//! \param Entry name of the function of the vertexShaderProgram
//! \param vsCompileTarget: Vertex shader version where the high level shader should be compiled to.
//! \param pixelShaderProgram: String containing the source of the pixel shader program.
//! This can be 0 if no pixel shader should be used.
//! \param pixelShaderEntryPointName: Entry name of the function of the pixelShaderEntryPointName
//! \param psCompileTarget: Pixel shader version where the high level shader should be compiled to.
//! \param callback: Pointer to an implementation of IShaderConstantSetCallBack in which you
//! can set the needed vertex and pixel shader program constants. Set this to 0 if you don't need this.
//! \param baseMaterial: Base material which renderstates will be used to shade the
//! material.
//! \param userData: a user data int. This int can be set to any value and will be set as parameter
//! in the callback method when calling OnSetConstants(). In this way it is easily possible to
//! use the same callback method for multiple materials and distinguish between them during the call.
//! \return Returns the number of the
//! material type which can be set in SMaterial::MaterialType to use the renderer.
//! -1 is returned if an error occured. -1 is returned for example if a vertex or pixel shader
//! program could not be compiled or a compile target is not reachable.
//! The error strings are then printed out into the error log, and
//! can be catched with a custom event receiver.
virtual s32 addHighLevelShaderMaterial(
const c8* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
const c8* pixelShaderProgram = 0,
const c8* pixelShaderEntryPointName = "main",
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0 ) = 0;
//! Like IGPUProgrammingServices::addShaderMaterial() (look there for a detailed description),
//! but tries to load the programs from files.
//! \param vertexShaderProgram: Text file containing the source of the vertex shader program.
//! Set to null if no shader should be created.
//! \param pixelShaderProgram: Text file containing the source of the pixel shader program. Set to
//! 0 if no shader should be created.
virtual s32 addHighLevelShaderMaterialFromFiles(
const c8* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
const c8* pixelShaderProgram = 0,
const c8* pixelShaderEntryPointName = "main",
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0;
//! Like IGPUProgrammingServices::addShaderMaterial() (look there for a detailed description),
//! but tries to load the programs from files.
//! \param vertexShaderProgram: Text file containing the source of the vertex shader program.
//! Set to null if no shader should be created.
//! \param pixelShaderProgram: Text file containing the source of the pixel shader program. Set to
//! 0 if no shader should be created.
virtual s32 addHighLevelShaderMaterialFromFiles(
io::IReadFile* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
io::IReadFile* pixelShaderProgram = 0,
const c8* pixelShaderEntryPointName = "main",
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0;
//! Adds a new material renderer to the VideoDriver, using pixel and/or
//! vertex shaders to render geometry.
//! Note that it is a good idea to call IVideoDriver::queryFeature() before to check
//! if the IVideoDriver supports the vertex and/or pixel shader version your are using.
//! The material is added to the VideoDriver like with IVideoDriver::addMaterialRenderer()
//! and can be used like it had been added with that method.
//! \param vertexShaderProgram: String containing the source of the vertex shader program. This can be
//! 0 if no vertex program should be used.
//! For DX8 programs, the will always input registers look like this:
//! v0: position, v1: normal,
//! v2: color, v3: texture cooridnates, v4: texture coordinates 2 if available.
//! For DX9 programs, you can manually set the registers using the dcl_ statements.
//! \param pixelShaderProgram: String containing the source of the pixel shader program.
//! This can be 0 if you don't want to use a pixel shader.
//! \param callback: Pointer to an implementation of IShaderConstantSetCallBack in which you
//! can set the needed vertex and pixel shader program constants. Set this to 0 if you don't need this.
//! \param baseMaterial: Base material which renderstates will be used to shade the
//! material.
//! \param userData: a user data int. This int can be set to any value and will be set as parameter
//! in the callback method when calling OnSetConstants(). In this way it is easily possible to
//! use the same callback method for multiple materials and distinguish between them during the call.
//! \return Returns the number of the
//! material type which can be set in SMaterial::MaterialType to use the renderer.
//! -1 is returned if an error occured. -1 is returned for example if a vertex or pixel shader
//! program could not be compiled, the error strings are then printed out into the error log, and
//! can be catched with a custom event receiver.
virtual s32 addShaderMaterial(const c8* vertexShaderProgram = 0,
const c8* pixelShaderProgram = 0,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0;
//! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the
//! programs from files.
//! \param vertexShaderProgram: Text file containing the source of the vertex shader program.
//! Set to null if no shader should be created.
//! \param pixelShaderProgram: Text file containing the source of the pixel shader program. Set to
//! 0 if no shader should be created.
//! \param callback: Pointer to an IShaderConstantSetCallback object to which the
//! OnSetConstants function is called.
//! \param baseMaterial: baseMaterial
virtual s32 addShaderMaterialFromFiles(io::IReadFile* vertexShaderProgram,
io::IReadFile* pixelShaderProgram,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0;
//! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the
//! programs from files.
//! \param vertexShaderProgramFileName: Text file name containing the source of the
//! vertex shader program.
//! Set to null if no shader should be created.
//! \param pixelShaderProgramFileName: Text file name containing the source of the
//! pixel shader program. Set to 0 if no shader should be created.
//! \param callback: Pointer to an IShaderConstantSetCallback object to which the
//! OnSetConstants function is called.
//! \param baseMaterial: baseMaterial
virtual s32 addShaderMaterialFromFiles(const c8* vertexShaderProgramFileName,
const c8* pixelShaderProgramFileName,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0;
};
} // end namespace video
} // end namespace irr
#endif

View File

@ -1,130 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_BUTTON_H_INCLUDED__
#define __I_GUI_BUTTON_H_INCLUDED__
#include "IGUIElement.h"
namespace irr
{
namespace video
{
class ITexture;
} // end namespace video
namespace gui
{
class IGUIFont;
class IGUISpriteBank;
enum EGUI_BUTTON_STATE
{
//! The button is not pressed
EGBS_BUTTON_UP=0,
//! The button is currently pressed down
EGBS_BUTTON_DOWN,
//! The mouse cursor is over the button
EGBS_BUTTON_MOUSE_OVER,
//! The mouse cursor is not over the button
EGBS_BUTTON_MOUSE_OFF,
//! The button has the focus
EGBS_BUTTON_FOCUSED,
//! The button doesn't have the focus
EGBS_BUTTON_NOT_FOCUSED,
//! not used, counts the number of enumerated items
EGBS_COUNT
};
//! Names for gui button state icons
const c8* const GUIButtonStateNames[] =
{
"buttonUp",
"buttonDown",
"buttonMouseOver",
"buttonMouseOff",
"buttonFocused",
"buttonNotFocused",
0,
0,
};
//! GUI Button interface.
class IGUIButton : public IGUIElement
{
public:
//! constructor
IGUIButton(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_BUTTON, environment, parent, id, rectangle) {}
//! destructor
~IGUIButton() {};
//! Sets another skin independent font.
/** If this is set to zero, the button uses the font of the skin.
\param font: New font to set. */
virtual void setOverrideFont(IGUIFont* font=0) = 0;
//! Sets an image which should be displayed on the button when it is in normal state.
/** \param image: Image to be displayed */
virtual void setImage(video::ITexture* image) = 0;
//! Sets a background image for the button when it is in normal state.
/** \param image: Texture containing the image to be displayed
\param pos: Position in the texture, where the image is located */
virtual void setImage(video::ITexture* image, const core::rect<s32>& pos) = 0;
//! Sets a background image for the button when it is in pressed state.
/** If no images is specified for the pressed state via
setPressedImage(), this image is also drawn in pressed state.
\param image: Image to be displayed */
virtual void setPressedImage(video::ITexture* image) = 0;
//! Sets an image which should be displayed on the button when it is in pressed state.
/** \param image: Texture containing the image to be displayed
\param pos: Position in the texture, where the image is located */
virtual void setPressedImage(video::ITexture* image, const core::rect<s32>& pos) = 0;
//! Sets the sprite bank used by the button
virtual void setSpriteBank(IGUISpriteBank* bank) = 0;
//! Sets the animated sprite for a specific button state
/** \param index: Number of the sprite within the sprite bank, use -1 for no sprite
\param state: State of the button to set the sprite for
\param index: The sprite number from the current sprite bank
\param color: The color of the sprite
\param loop: True if the animation should loop, false if not
*/
virtual void setSprite(EGUI_BUTTON_STATE state, s32 index,
video::SColor color=video::SColor(255,255,255,255), bool loop=false) = 0;
//! Sets if the button should behave like a push button.
/** Which means it can be in two states: Normal or Pressed. With a click on the button,
the user can change the state of the button. */
virtual void setIsPushButton(bool isPushButton) = 0;
//! Sets the pressed state of the button if this is a pushbutton
virtual void setPressed(bool pressed) = 0;
//! Returns if the button is currently pressed
virtual bool isPressed() = 0;
//! Sets if the alpha channel should be used for drawing background images on the button (default is false)
virtual void setUseAlphaChannel(bool useAlphaChannel) = 0;
//! Returns if the alpha channel should be used for drawing background images on the button
virtual bool getUseAlphaChannel() = 0;
//! Sets if the button should use the skin to draw its border (default is true)
virtual void setDrawBorder(bool border) = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,38 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_CHECKBOX_H_INCLUDED__
#define __I_GUI_CHECKBOX_H_INCLUDED__
#include "IGUIElement.h"
namespace irr
{
namespace gui
{
//! GUI Check box interface.
class IGUICheckBox : public IGUIElement
{
public:
//! constructor
IGUICheckBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_CHECK_BOX, environment, parent, id, rectangle) {}
//! destructor
~IGUICheckBox() {};
//! Set if box is checked.
virtual void setChecked(bool checked) = 0;
//! Returns true if box is checked.
virtual bool isChecked() = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,35 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_COLOR_SELECT_DIALOG_H_INCLUDED__
#define __I_GUI_COLOR_SELECT_DIALOG_H_INCLUDED__
#include "IGUIElement.h"
namespace irr
{
namespace gui
{
//! Standard file chooser dialog.
class IGUIColorSelectDialog : public IGUIElement
{
public:
//! constructor
IGUIColorSelectDialog(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_COLOR_SELECT_DIALOG, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIColorSelectDialog() {};
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,51 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_COMBO_BOX_H_INCLUDED__
#define __I_GUI_COMBO_BOX_H_INCLUDED__
#include "IGUIElement.h"
namespace irr
{
namespace gui
{
//! Combobox widget
class IGUIComboBox : public IGUIElement
{
public:
//! constructor
IGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_COMBO_BOX, environment, parent, id, rectangle) {}
//! destructor
~IGUIComboBox() {};
//! Returns amount of items in box
virtual s32 getItemCount() = 0;
//! returns string of an item. the idx may be a value from 0 to itemCount-1
virtual const wchar_t* getItem(s32 idx) = 0;
//! adds an item and returns the index of it
virtual s32 addItem(const wchar_t* text) = 0;
//! deletes all items in the combo box
virtual void clear() = 0;
//! returns id of selected item. returns -1 if no item is selected.
virtual s32 getSelected() = 0;
//! sets the selected item. Set this to -1 if no item should be selected
virtual void setSelected(s32 id) = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,103 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_CONTEXT_MENU_H_INCLUDED__
#define __I_GUI_CONTEXT_MENU_H_INCLUDED__
#include "IGUIElement.h"
namespace irr
{
namespace gui
{
//! GUI Context menu interface.
class IGUIContextMenu : public IGUIElement
{
public:
//! constructor
IGUIContextMenu(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_CONTEXT_MENU, environment, parent, id, rectangle) {}
//! destructor
~IGUIContextMenu() {};
//! Returns amount of menu items
virtual s32 getItemCount() const = 0;
//! Adds a menu item.
/** \param text: Text of menu item. Set this to 0 to create
an separator instead of a real item, which is the same like
calling addSeparator();
\param commandId: Command id of menu item, a simple id you may
set to whatever you want.
\param enabled: Specifies if the menu item should be enabled.
\param hasSubMenu: Set this to true if there should be a submenu
at this item. You can acess this submenu via getSubMenu().
\return Returns the index of the new item */
virtual s32 addItem(const wchar_t* text, s32 commandId=-1, bool enabled=true,
bool hasSubMenu=false,
bool checked=false
) = 0;
//! Adds a separator item to the menu
virtual void addSeparator() = 0;
//! Returns text of the menu item.
/** \param idx: Zero based index of the menu item */
virtual const wchar_t* getItemText(s32 idx) = 0;
//! Sets text of the menu item.
/** \param idx: Zero based index of the menu item
\param text: New text of the item. */
virtual void setItemText(s32 idx, const wchar_t* text) = 0;
//! Returns if a menu item is enabled
/** \param idx: Zero based index of the menu item */
virtual bool isItemEnabled(s32 idx) = 0;
//! Sets if the menu item should be enabled.
/** \param idx: Zero based index of the menu item
\param enabled: True if it is enabled, otherwise false. */
virtual void setItemEnabled(s32 idx, bool enabled) = 0;
//! Sets if the menu item should be checked.
/** \param idx: Zero based index of the menu item
\param enabled: True if it is enabled, otherwise false. */
virtual void setItemChecked(s32 idx, bool enabled) = 0;
//! Removes a menu item
/** \param idx: Zero based index of the menu item */
virtual void removeItem(s32 idx) = 0;
//! Removes all menu items
virtual void removeAllItems() = 0;
//! Returns the selected item in the menu
/** \return Index of the selected item, -1 if none selected. */
virtual s32 getSelectedItem() = 0;
//! Returns command id of a menu item
/** \param idx: Zero based index of the menu item */
virtual s32 getItemCommandId(s32 idx) = 0;
//! Sets the command id of a menu item
/** \param idx: Zero based index of the menu item
\param id: Command id of menu item, a simple id you may
set to whatever you want. */
virtual void setItemCommandId(s32 idx, s32 id) = 0;
//! \return Returns a pointer to the submenu of an item.
/** 0 is returned if there is no submenu
\param idx: Zero based index of the menu item */
virtual IGUIContextMenu* getSubMenu(s32 idx) = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,64 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_EDIT_BOX_H_INCLUDED__
#define __I_GUI_EDIT_BOX_H_INCLUDED__
#include "IGUIElement.h"
#include "SColor.h"
namespace irr
{
namespace gui
{
class IGUIFont;
//! Single line edit box for editing simple text.
class IGUIEditBox : public IGUIElement
{
public:
//! constructor
IGUIEditBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_EDIT_BOX, environment, parent, id, rectangle) {}
//! destructor
~IGUIEditBox() {};
//! Sets another skin independent font.
/** If this is set to zero, the button uses the font of the skin.
\param font: New font to set. */
virtual void setOverrideFont(IGUIFont* font=0) = 0;
//! Sets another color for the text.
/** If set, the edit box does not use the EGDC_BUTTON_TEXT color defined
in the skin, but the set color instead. You don't need to call
IGUIEditBox::enableOverrrideColor(true) after this, this is done
by this function.
If you set a color, and you want the text displayed with the color
of the skin again, call IGUIEditBox::enableOverrideColor(false);
\param color: New color of the text. */
virtual void setOverrideColor(video::SColor color) = 0;
//! Sets if the text should use the overide color or the color in the gui skin.
/** \param enable: If set to true, the override color, which can be set
with IGUIEditBox::setOverrideColor is used, otherwise the
EGDC_BUTTON_TEXT color of the skin. */
virtual void enableOverrideColor(bool enable) = 0;
//! Sets the maximum amount of characters which may be entered in the box.
/** \param max: Maximum amount of characters. If 0, the character amount is
infinity. */
virtual void setMax(s32 max) = 0;
//! Returns maximum amount of characters, previously set by setMax();
virtual s32 getMax() = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,706 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_ELEMENT_H_INCLUDED__
#define __I_GUI_ELEMENT_H_INCLUDED__
#include "IUnknown.h"
#include "irrList.h"
#include "rect.h"
#include "irrString.h"
#include "IEventReceiver.h"
#include "EGUIElementTypes.h"
#include "IAttributes.h"
#include "IAttributeExchangingObject.h"
namespace irr
{
namespace gui
{
class IGUIEnvironment;
enum EGUI_ALIGNMENT
{
//! Aligned to parent's top or left side (default)
EGUIA_UPPERLEFT=0,
//! Aligned to parent's bottom or right side
EGUIA_LOWERRIGHT,
//! Aligned to the center of parent
EGUIA_CENTER,
//! Scaled within its parent
EGUIA_SCALE
};
//! Names for alignments
const c8* const GUIAlignmentNames[] =
{
"upperLeft",
"lowerRight",
"center",
"scale",
0
};
//! Base class of all GUI elements.
class IGUIElement : public virtual io::IAttributeExchangingObject, public IEventReceiver
{
public:
//! Constructor
IGUIElement(EGUI_ELEMENT_TYPE type, IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle)
: Parent(0), RelativeRect(rectangle), AbsoluteRect(rectangle),
AbsoluteClippingRect(rectangle), DesiredRect(rectangle),
MaxSize(0,0), MinSize(1,1), IsVisible(true), IsEnabled(true),
IsSubElement(false), NoClip(false), ID(id),
AlignLeft(EGUIA_UPPERLEFT), AlignRight(EGUIA_UPPERLEFT), AlignTop(EGUIA_UPPERLEFT), AlignBottom(EGUIA_UPPERLEFT),
Environment(environment), Type(type)
{
// if we were given a parent to attach to
if (parent)
parent->addChild(this);
// if we succeeded in becoming a child
if (Parent)
{
LastParentRect = Parent->getAbsolutePosition();
AbsoluteRect += LastParentRect.UpperLeftCorner;
AbsoluteClippingRect = AbsoluteRect;
AbsoluteClippingRect.clipAgainst(Parent->AbsoluteClippingRect);
}
}
//! Destructor
virtual ~IGUIElement()
{
// delete all children
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
{
(*it)->Parent = 0;
(*it)->drop();
}
};
//! Returns parent of this element.
IGUIElement* getParent() const
{
return Parent;
}
//! Returns the relative rectangle of this element.
core::rect<s32> getRelativePosition() const
{
return RelativeRect;
}
//! Sets the relative rectangle of this element.
void setRelativePosition(const core::rect<s32>& r)
{
if (Parent)
{
core::rect<s32> r2(Parent->getAbsolutePosition());
core::dimension2df d((f32)r2.getSize().Width, (f32)r2.getSize().Height);
if (AlignLeft == EGUIA_SCALE)
ScaleRect.UpperLeftCorner.X = (f32)r.UpperLeftCorner.X / d.Width;
if (AlignRight == EGUIA_SCALE)
ScaleRect.LowerRightCorner.X = (f32)r.LowerRightCorner.X / d.Width;
if (AlignTop == EGUIA_SCALE)
ScaleRect.UpperLeftCorner.Y = (f32)r.UpperLeftCorner.Y / d.Height;
if (AlignBottom == EGUIA_SCALE)
ScaleRect.LowerRightCorner.Y = (f32)r.LowerRightCorner.Y / d.Height;
}
DesiredRect = r;
updateAbsolutePosition();
}
//! Sets the relative rectangle of this element.
void setRelativePosition(const core::rect<f32>& r)
{
if (!Parent)
return;
core::rect<s32> r2(Parent->getAbsolutePosition());
core::dimension2di d(r2.getSize());
DesiredRect = core::rect<s32>(
(s32)((f32)d.Width * r.UpperLeftCorner.X),
(s32)((f32)d.Height * r.UpperLeftCorner.Y),
(s32)((f32)d.Width * r.LowerRightCorner.X),
(s32)((f32)d.Height * r.LowerRightCorner.Y));
ScaleRect = r;
updateAbsolutePosition();
}
//! Returns the absolute rectangle of element.
core::rect<s32> getAbsolutePosition() const
{
return AbsoluteRect;
}
//! Sets whether the element will ignore its parent's clipping rectangle
void setNotClipped(bool noClip)
{
NoClip = noClip;
}
//! Gets whether the element will ignore its parent's clipping rectangle
bool isNotClipped()
{
return NoClip;
}
//! Sets the maximum size allowed for this element
/** If set to 0,0, there is no maximum size */
void setMaxSize(core::dimension2di size)
{
MaxSize = size;
updateAbsolutePosition();
}
//! Sets the minimum size allowed for this element
void setMinSize(core::dimension2di size)
{
MinSize = size;
if (MinSize.Width < 1)
MinSize.Width = 1;
if (MinSize.Height < 1)
MinSize.Height = 1;
updateAbsolutePosition();
}
void setAlignment(EGUI_ALIGNMENT left, EGUI_ALIGNMENT right, EGUI_ALIGNMENT top, EGUI_ALIGNMENT bottom)
{
AlignLeft = left;
AlignRight = right;
AlignTop = top;
AlignBottom = bottom;
if (Parent)
{
core::rect<s32> r(Parent->getAbsolutePosition());
core::dimension2df d((f32)r.getSize().Width, (f32)r.getSize().Height);
if (AlignLeft == EGUIA_SCALE)
ScaleRect.UpperLeftCorner.X = (f32)DesiredRect.UpperLeftCorner.X / d.Width;
if (AlignRight == EGUIA_SCALE)
ScaleRect.LowerRightCorner.X = (f32)DesiredRect.LowerRightCorner.X / d.Width;
if (AlignTop == EGUIA_SCALE)
ScaleRect.UpperLeftCorner.Y = (f32)DesiredRect.UpperLeftCorner.Y / d.Height;
if (AlignBottom == EGUIA_SCALE)
ScaleRect.LowerRightCorner.Y = (f32)DesiredRect.LowerRightCorner.Y / d.Height;
}
}
//! Updates the absolute position.
virtual void updateAbsolutePosition()
{
core::rect<s32> parentAbsolute(0,0,0,0);
core::rect<s32> parentAbsoluteClip;
s32 diffx, diffy;
f32 fw=0.f, fh=0.f;
if (Parent)
{
parentAbsolute = Parent->AbsoluteRect;
if (NoClip)
{
IGUIElement* p=this;
while (p && p->NoClip && p->Parent)
p = p->Parent;
if (p->Parent)
parentAbsoluteClip = p->Parent->AbsoluteClippingRect;
else
parentAbsoluteClip = p->AbsoluteClippingRect;
}
else
parentAbsoluteClip = Parent->AbsoluteClippingRect;
}
diffx = parentAbsolute.getWidth() - LastParentRect.getWidth();
diffy = parentAbsolute.getHeight() - LastParentRect.getHeight();
if (AlignLeft == EGUIA_SCALE || AlignRight == EGUIA_SCALE)
fw = (f32)parentAbsolute.getWidth();
if (AlignTop == EGUIA_SCALE || AlignBottom == EGUIA_SCALE)
fh = (f32)parentAbsolute.getHeight();
switch (AlignLeft)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.UpperLeftCorner.X += diffx;
break;
case EGUIA_CENTER:
DesiredRect.UpperLeftCorner.X += diffx/2;
break;
case EGUIA_SCALE:
DesiredRect.UpperLeftCorner.X = (s32)(ScaleRect.UpperLeftCorner.X * fw);
break;
}
switch (AlignRight)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.LowerRightCorner.X += diffx;
break;
case EGUIA_CENTER:
DesiredRect.LowerRightCorner.X += diffx/2;
break;
case EGUIA_SCALE:
DesiredRect.LowerRightCorner.X = (s32)(ScaleRect.LowerRightCorner.X * fw);
break;
}
switch (AlignTop)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.UpperLeftCorner.Y += diffy;
break;
case EGUIA_CENTER:
DesiredRect.UpperLeftCorner.Y += diffy/2;
break;
case EGUIA_SCALE:
DesiredRect.UpperLeftCorner.Y = (s32)(ScaleRect.UpperLeftCorner.Y * fh);
break;
}
switch (AlignBottom)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.LowerRightCorner.Y += diffy;
break;
case EGUIA_CENTER:
DesiredRect.LowerRightCorner.Y += diffy/2;
break;
case EGUIA_SCALE:
DesiredRect.LowerRightCorner.Y = (s32)(ScaleRect.LowerRightCorner.Y * fh);
break;
}
RelativeRect = DesiredRect;
s32 w = RelativeRect.getWidth();
s32 h = RelativeRect.getHeight();
// make sure the desired rectangle is allowed
if (w < MinSize.Width)
RelativeRect.LowerRightCorner.X = RelativeRect.UpperLeftCorner.X + MinSize.Width;
if (h < MinSize.Height)
RelativeRect.LowerRightCorner.Y = RelativeRect.UpperLeftCorner.Y + MinSize.Height;
if (MaxSize.Width && w > MaxSize.Width)
RelativeRect.LowerRightCorner.X = RelativeRect.UpperLeftCorner.X + MaxSize.Width;
if (MaxSize.Height && h > MaxSize.Height)
RelativeRect.LowerRightCorner.Y = RelativeRect.UpperLeftCorner.Y + MaxSize.Height;
RelativeRect.repair();
AbsoluteRect = RelativeRect + parentAbsolute.UpperLeftCorner;
if (!Parent)
parentAbsoluteClip = AbsoluteRect;
AbsoluteClippingRect = AbsoluteRect;
AbsoluteClippingRect.clipAgainst(parentAbsoluteClip);
LastParentRect = parentAbsolute;
// update all children
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
{
(*it)->updateAbsolutePosition();
}
}
//! Returns the child element, which is at the position of the point.
IGUIElement* getElementFromPoint(const core::position2d<s32>& point)
{
IGUIElement* target = 0;
// we have to search from back to front.
core::list<IGUIElement*>::Iterator it = Children.getLast();
if (IsVisible)
while(it != Children.end())
{
target = (*it)->getElementFromPoint(point);
if (target)
return target;
--it;
}
if (AbsoluteClippingRect.isPointInside(point) && IsVisible)
target = this;
return target;
}
//! Adds a GUI element as new child of this element.
virtual void addChild(IGUIElement* child)
{
if (child)
{
child->grab();
child->remove(); // remove from old parent
child->Parent = this;
Children.push_back(child);
}
}
//! Removes a child.
virtual void removeChild(IGUIElement* child)
{
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
if ((*it) == child)
{
(*it)->Parent = 0;
(*it)->drop();
Children.erase(it);
return;
}
}
//! Removes this element from its parent.
virtual void remove()
{
if (Parent)
Parent->removeChild(this);
}
//! Draws the element and its children.
virtual void draw()
{
if (!IsVisible)
return;
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
(*it)->draw();
}
//! animate the element and its children.
virtual void OnPostRender(u32 timeMs)
{
if (!IsVisible)
return;
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
(*it)->OnPostRender( timeMs );
}
//! Moves this element.
virtual void move(core::position2d<s32> absoluteMovement)
{
setRelativePosition(DesiredRect + absoluteMovement);
}
//! Returns true if element is visible.
virtual bool isVisible()
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsVisible;
}
//! Sets the visible state of this element.
virtual void setVisible(bool visible)
{
IsVisible = visible;
}
//! Returns true if this element was created as part of its parent control
virtual bool isSubElement()
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsSubElement;
}
//! Sets whether this control was created as part of its parent,
//! for example when a scrollbar is part of a listbox.
//! SubElements are not saved to disk when calling guiEnvironment->saveGUI()
virtual void setSubElement(bool subElement)
{
IsSubElement = subElement;
}
//! Returns true if element is enabled.
virtual bool isEnabled()
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsEnabled;
}
//! Sets the enabled state of this element.
virtual void setEnabled(bool enabled)
{
IsEnabled = enabled;
}
//! Sets the new caption of this element.
virtual void setText(const wchar_t* text)
{
Text = text;
}
//! Returns caption of this element.
virtual const wchar_t* getText()
{
return Text.c_str();
}
//! Sets the new caption of this element.
virtual void setToolTipText(const wchar_t* text)
{
ToolTipText = text;
}
//! Returns caption of this element.
virtual core::stringw &getToolTipText()
{
return ToolTipText;
}
//! Returns id. Can be used to identify the element.
virtual s32 getID()
{
return ID;
}
//! Sets the id of this element
virtual void setID(s32 id)
{
ID = id;
}
//! Called if an event happened.
virtual bool OnEvent(SEvent event)
{
if (Parent)
Parent->OnEvent(event);
return true;
}
//! Brings a child to front
/** \return Returns true if successful, false if not. */
virtual bool bringToFront(IGUIElement* element)
{
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
{
if (element == (*it))
{
Children.erase(it);
Children.push_back(element);
return true;
}
}
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return false;
}
//! Returns list with children of this element
virtual const core::list<IGUIElement*>& getChildren() const
{
return Children;
}
//! Finds the first element with the given id.
/** \param id: Id to search for.
\param searchchildren: Set this to true, if also children of this
element may contain the element with the searched id and they
should be searched too.
\return Returns the first element with the given id. If no element
with this id was found, 0 is returned. */
virtual IGUIElement* getElementFromId(s32 id, bool searchchildren=false) const
{
IGUIElement* e = 0;
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
{
if ((*it)->getID() == id)
return (*it);
if (searchchildren)
e = (*it)->getElementFromId(id, true);
if (e)
return e;
}
return e;
}
//! Returns the type of the gui element.
/** This is needed for the .NET wrapper but will be used
later for serializing and deserializing.
If you wrote your own GUIElements, you need to set the type for your element as first parameter
in the constructor of IGUIElement. For own (=unknown) elements, simply use EGUIET_ELEMENT as type */
EGUI_ELEMENT_TYPE getType()
{
return Type;
}
//! Returns the type name of the gui element.
/** This is needed serializing elements. For serializing your own elements, override this function
and return your own type name which is created by your IGUIElementFactory */
virtual const c8* getTypeName()
{
return GUIElementTypeNames[Type];
}
//! Writes attributes of the scene node.
//! Implement this to expose the attributes of your scene node for
//! scripting languages, editors, debuggers or xml serialization purposes.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0)
{
out->addInt("Id", ID );
out->addString("Caption", Text.c_str());
out->addRect("Rect", DesiredRect);
out->addPosition2d("MinSize", core::position2di(MinSize.Width, MinSize.Height));
out->addPosition2d("MaxSize", core::position2di(MaxSize.Width, MaxSize.Height));
out->addBool("NoClip", NoClip);
out->addEnum("LeftAlign", AlignLeft, GUIAlignmentNames);
out->addEnum("RightAlign", AlignRight, GUIAlignmentNames);
out->addEnum("TopAlign", AlignTop, GUIAlignmentNames);
out->addEnum("BottomAlign", AlignBottom, GUIAlignmentNames);
out->addBool("Visible", IsVisible );
out->addBool("Enabled", IsEnabled );
}
//! Reads attributes of the scene node.
//! Implement this to set the attributes of your scene node for
//! scripting languages, editors, debuggers or xml deserialization purposes.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
//! relative rect of element
ID = in->getAttributeAsInt("Id");
Text = in->getAttributeAsStringW("Caption").c_str();
IsVisible = in->getAttributeAsBool("Visible");
IsEnabled = in->getAttributeAsBool("Enabled");
core::position2di p = in->getAttributeAsPosition2d("MaxSize");
MaxSize = core::dimension2di(p.X,p.Y);
p = in->getAttributeAsPosition2d("MinSize");
MinSize = core::dimension2di(p.X,p.Y);
NoClip = in->getAttributeAsBool("NoClip");
AlignLeft = (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("LeftAlign", GUIAlignmentNames);
AlignRight = (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("RightAlign", GUIAlignmentNames);
AlignTop = (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("TopAlign", GUIAlignmentNames);
AlignBottom = (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("BottomAlign", GUIAlignmentNames);
setRelativePosition(in->getAttributeAsRect("Rect"));
}
protected:
//! List of all children of this element
core::list<IGUIElement*> Children;
//! Pointer to the parent
IGUIElement* Parent;
//! relative rect of element
core::rect<s32> RelativeRect;
//! absolute rect of element
core::rect<s32> AbsoluteRect;
//! absolute clipping rect of element
core::rect<s32> AbsoluteClippingRect;
//! the rectangle the element would prefer to be,
//! if it was not constrained by parent or max/min size
core::rect<s32> DesiredRect;
//! for calculating the difference when resizing parent
core::rect<s32> LastParentRect;
//! relative scale of the element inside its parent
core::rect<f32> ScaleRect;
//! maximum and minimum size of the element
core::dimension2di MaxSize, MinSize;
//! is visible?
bool IsVisible;
//! is enabled?
bool IsEnabled;
//! is a part of a larger whole and should not be serialized?
bool IsSubElement;
//! does this element ignore its parent's clipping rectangle?
bool NoClip;
//! caption
core::stringw Text;
//! tooltip
core::stringw ToolTipText;
//! id
s32 ID;
//! tells the element how to act when its parent is resized
EGUI_ALIGNMENT AlignLeft, AlignRight, AlignTop, AlignBottom;
//! GUI Environment
IGUIEnvironment* Environment;
//! type of element
EGUI_ELEMENT_TYPE Type;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,66 +0,0 @@
// 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
#ifndef __I_GUI_ELEMENT_FACTORY_H_INCLUDED__
#define __I_GUI_ELEMENT_FACTORY_H_INCLUDED__
#include "IUnknown.h"
#include "EGUIElementTypes.h"
namespace irr
{
namespace gui
{
class IGUIElement;
//! Interface making it possible to dynamicly create GUI elements
/** To be able to add custom elements to Irrlicht and to make it possible for the
scene manager to save and load them, simply implement this interface and register it
in your gui environment via IGUIEnvironment::registerGUIElementFactory.
Note: When implementing your own element factory, don't call IGUIEnvironment::grab() to
increase the reference counter of the environment. This is not necessary because the
it will grab() the factory anyway, and otherwise cyclic references will be created.
*/
class IGUIElementFactory : public virtual IUnknown
{
public:
//! adds an element to the gui environment based on its type id
/** \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.
\return Returns pointer to the new element or null if not successful. */
virtual IGUIElement* addGUIElement(EGUI_ELEMENT_TYPE type, IGUIElement* parent=0) = 0;
//! adds a GUI element to the GUI Environment based on its type name
/** \param typeName: Type name of the element to add.
\param parent: Parent scene node of the new element, can be null to add it to the root.
\return Returns pointer to the new element or null if not successful. */
virtual IGUIElement* addGUIElement(const c8* typeName, IGUIElement* parent=0) = 0;
//! returns amount of GUI element types this factory is able to create
virtual s32 getCreatableGUIElementTypeCount() = 0;
//! returns type of a createable element type
/** \param idx: Index of the element type in this factory. Must be a value between 0 and
getCreatableGUIElementTypeCount() */
virtual EGUI_ELEMENT_TYPE getCreateableGUIElementType(s32 idx) = 0;
//! returns type name of a createable GUI element type by index
/** \param idx: Index of the type in this factory. Must be a value between 0 and
getCreatableGUIElementTypeCount() */
virtual const c8* getCreateableGUIElementTypeName(s32 idx) = 0;
//! returns type name of a createable GUI element
/** \param type: Type of GUI element.
\return: Returns name of the type if this factory can create the type, otherwise 0. */
virtual const c8* getCreateableGUIElementTypeName(EGUI_ELEMENT_TYPE type) = 0;
};
} // end namespace gui
} // end namespace irr
#endif // __I_GUI_ELEMENT_FACTORY_H_INCLUDED__

View File

@ -1,395 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_ENVIRNMENT_H_INCLUDED__
#define __I_GUI_ENVIRNMENT_H_INCLUDED__
#include "rect.h"
#include "IUnknown.h"
#include "IEventReceiver.h"
#include "irrTypes.h"
#include "IGUIWindow.h"
#include "IGUISkin.h"
#include "IFileSystem.h"
namespace irr
{
namespace io
{
class IXMLWriter;
class IReadFile;
class IWriteFile;
} // end namespace io
namespace video
{
class IVideoDriver;
class ITexture;
} // end namespace video
namespace gui
{
class IGUIElement;
class IGUIFont;
class IGUISpriteBank;
class IGUIScrollBar;
class IGUIImage;
class IGUIMeshViewer;
class IGUICheckBox;
class IGUIListBox;
class IGUIFileOpenDialog;
class IGUIColorSelectDialog;
class IGUIInOutFader;
class IGUIStaticText;
class IGUIEditBox;
class IGUITabControl;
class IGUITab;
class IGUIContextMenu;
class IGUIComboBox;
class IGUIToolBar;
class IGUIElementFactory;
//! GUI Environment. Used as factory and manager of all other GUI elements.
class IGUIEnvironment : public virtual IUnknown
{
public:
//! destructor
virtual ~IGUIEnvironment() {};
//! Draws all gui elements.
virtual void drawAll() = 0;
//! Sets the focus to an element.
virtual void setFocus(IGUIElement* element) = 0;
//! Returns the element with the focus
virtual IGUIElement* getFocus() = 0;
//! Removes the focus from an element.
virtual void removeFocus(IGUIElement* element) = 0;
//! Returns if the element has focus
virtual bool hasFocus(IGUIElement* element) = 0;
//! Returns the current video driver.
virtual video::IVideoDriver* getVideoDriver() = 0;
//! Returns the file system.
virtual io::IFileSystem* getFileSystem() = 0;
//! removes all elements from the environment.
virtual void clear() = 0;
//! Posts an input event to the environment.
/** Usually you do not have to
use this method, it is used by the internal engine. */
virtual bool postEventFromUser(SEvent event) = 0;
//! This sets a new event receiver for gui events.
/** Usually you do not have to
use this method, it is used by the internal engine. */
virtual void setUserEventReceiver(IEventReceiver* evr) = 0;
//! Returns pointer to the current gui skin.
virtual IGUISkin* getSkin() = 0;
//! Sets a new GUI Skin
/** You can used this to change the appearance of the whole GUI Environment. You
can set one ot the built-in skins or implement your own class derived from
IGUISkin and set this useing this method.
To set for example the built-in Windows classic skin, use the following code:
\code
gui::IGUISkin* newskin = environment->createSkin(gui::EGST_WINDOWS_CLASSIC);
environment->setSkin(newskin);
newskin->drop();
\endcode
*/
virtual void setSkin(IGUISkin* skin) = 0;
//! Creates a new GUI Skin based on a template.
/** Use setSkin() to set the created skin.
\return Returns a pointer to the created skin.
If you no longer need the image, you should call IGUISkin::drop().
See IUnknown::drop() for more information. */
virtual IGUISkin* createSkin(EGUI_SKIN_TYPE type) = 0;
//! Returns pointer to the font with the specified file name.
/** Loads the font if it was not loaded before. Returns 0 if the font could not be loaded.
\return
returns a pointer to the font.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUIFont* getFont(const c8* filename) = 0;
//! Returns the default built-in font.
virtual IGUIFont* getBuiltInFont() = 0;
//! Returns pointer to the sprite bank with the specified file name.
/** Loads the bank if it was not loaded before. Returns 0 if it could not be loaded.
\return
returns a pointer to the sprite bank.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUISpriteBank* getSpriteBank(const c8* filename) = 0;
//! adds an empty sprite bank to the manager
virtual IGUISpriteBank* addEmptySpriteBank(const c8 *name) = 0;
//! Returns the root gui element.
/** This is the first gui element, parent of all other
gui elements. You'll never need to use this method, unless you are not creating
your own gui elements, trying to add them to the gui elements without a parent.
The returned pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUIElement* getRootGUIElement() = 0;
//! Adds an button element.
/** \return
Returns a pointer to the created button. Returns 0 if an error occured.
This pointer should not be dropped. See IUnknown::drop() for more information. */
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 an empty window element.
/** \param modal: Defines if the dialog is modal. This means, that all other
gui elements which were created before the message box cannot be used
until this messagebox is removed.
\return
Returns a pointer to the created window. Returns 0 if an error occured.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUIWindow* addWindow(const core::rect<s32>& rectangle, bool modal = false,
const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a modal screen. This control stops its parent's members from being
//! able to recieve input until its last child is removed, it then deletes its self.
/** \return
Returns a pointer to the created window. Returns 0 if an error occured.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUIElement* addModalScreen(IGUIElement* parent) = 0;
//! Adds a message box.
/** \param caption: Text to be displayed the title of the message box.
\param text: Text to be displayed in the body of the message box.
\param modal: Defines if the dialog is modal. This means, that all other
gui elements which were created before the message box cannot be used
until this messagebox is removed.
\param flags: Flags specifying the layout of the message box. For example
to create a message box with an OK and a CANCEL button on it, set this
to (EMBF_OK | EMBF_CANCEL).
\param parent: Parent gui element of the message box.
\param id: Id with which the gui element can be identified.
\return
Returns a pointer to the created message box. Returns 0 if an error occured.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0,
bool modal = true, s32 flags = EMBF_OK, IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a scrollbar.
/** \return
Returns a pointer to the created scrollbar. Returns 0 if an error occured.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds an image element.
/** \param image: Image to be displayed.
\param pos: Position of the image. The width and height of the image is taken
from the image.
\param useAlphaChannel: Sets if the image should use the alpha channel of the texture
to draw itself.
\return
Returns a pointer to the created image element. Returns 0 if an error occured.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUIImage* addImage(video::ITexture* image, core::position2d<s32> pos,
bool useAlphaChannel=true, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
//! Adds an image element.
/** Use IGUIImage::setImage later to set the image to be displayed.
\return
Returns a pointer to the created image element. Returns 0 if an error occured.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUIImage* addImage(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
//! Adds a checkbox element.
/** \return
Returns a pointer to the created check box. Returns 0 if an error occured.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUICheckBox* addCheckBox(bool checked, const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
//! Adds a list box element.
/** \return
Returns a pointer to the created list box. Returns 0 if an error occured.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUIListBox* addListBox(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) = 0;
//! Adds an mesh viewer. Not 100% implemented yet.
/** \return
Returns a pointer to the created mesh viewer. Returns 0 if an error occured.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUIMeshViewer* addMeshViewer(const core::rect<s32>& rectangle, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
//! Adds a file open dialog.
/** \param modal: Defines if the dialog is modal. This means, that all other
gui elements which were created before the message box cannot be used
until this messagebox is removed.
\return
Returns a pointer to the created file open dialog. Returns 0 if an error occured.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUIFileOpenDialog* addFileOpenDialog(const wchar_t* title = 0,
bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a color select dialog.
/** \param modal: Defines if the dialog is modal. This means, that all other
gui elements which were created before the message box cannot be used
until this messagebox is removed.
\return
Returns a pointer to the created file open dialog. Returns 0 if an error occured.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUIColorSelectDialog* addColorSelectDialog(const wchar_t* title = 0,
bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a static text.
/** The returned pointer must not be dropped.
\param text is the text to be displayed. Can be altered after creation with SetText().
\param rectangle is the position of the static text.
\param border has to be set to true if the static text should have a 3d border.
\param wordWrap specifies, if the text should be wrapped into multiple lines.
\param parent is the parent item of the element. E.g. a window. Set it to 0 to place the fader directly in the environment.
\param id is a s32 to identify the static text element.
\param fillBackground specifies if the background will be filled. Default: false.
\return
Returns a pointer to the created static text. Returns 0 if an error occured.
This pointer should not be dropped. See IUnknown::drop() for more information. */
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 an edit box.
/** Supports unicode input from every keyboard around the world,
scrolling, copying and pasting (exchanging data with the clipboard directly), maximum
character amount, marking and all shortcuts like ctrl+X, ctrl+V, ctrg+C,
shift+Left, shift+Right, Home, End, and so on.
\param text is the text to be displayed. Can be altered after creation with SetText().
\param rectangle is the position of the edit box.
\param border has to be set to true if the edit box should have a 3d border.
\param parent is the parent item of the element. E.g. a window. Set it to 0 to place the edit box directly in the environment.
\param id is a s32 to identify the edit box.
\return
Returns a pointer to the created static text. Returns 0 if an error occured.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle,
bool border=true, IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds an element for fading in or out.
/* \param rectangle: Pointer to rectangle specifing the borders of the element.
If the pointer is NULL, the whole screen is used.
\param parent: Parent item of the element. E.g. a window. Set it to 0 to place the static text directly in the environment.
\param id: A s32 to identify the text.
\return
Returns a pointer to the created in-out-fader. Returns 0 if an error occured.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUIInOutFader* addInOutFader(const core::rect<s32>* rectangle=0, IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a tab control to the environment.
/** \param rectangle is the position of the tab control.
\param parent is the parent item of the element. E.g. a window. Set it to 0 to place the tab control directly in the environment.
\param fillbackground specifies if the background of the tab control should be drawn to.
\param border specifiys if a flat 3d border should be drawn.
This is usually not necesarry unless you don't place the control directly into the environment without a window as parent.
\param id is a s32 to identify the tab control.
\return
Returns a pointer to the created tab control element. Returns 0 if an error occured.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUITabControl* addTabControl(const core::rect<s32>& rectangle,
IGUIElement* parent=0, bool fillbackground=false,
bool border=true, s32 id=-1) = 0;
//! Adds tab to the environment.
/** You can use this element to group other elements. This is not used for creating tabs on tab controls,
please use IGUITabControl::addTab() for this instead.
\param rectangle is the position of the tab.
\param parent is the parent item of the element. E.g. a window. Set it to 0 to place the tab directly in the environment.
\param id is a s32 to identify the tab. */
virtual IGUITab* addTab(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a context menu to the environment.
/** \param rectangle is the position of the menu. Note that the menu is
resizing itself based on what items you add.
\param parent is the parent item of the element. E.g. a window. Set it to 0 to place the menu directly in the environment.
\param id is a s32 to identify the menu. */
virtual IGUIContextMenu* addContextMenu(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a menu to the environment.
/* This is like the menu you can find on top of most windows in modern graphical user interfaces.
\param parent is the parent item of the element. E.g. a window. Set it to 0 to place the menu directly in the environment.
\param id is a s32 to identify the menu. */
virtual IGUIContextMenu* addMenu(IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a toolbar to the environment.
/** It is like a menu is always placed on top
in its parent, and contains buttons.
\param parent is the parent item of the element. E.g. a window. Set it to 0 to place the tool bar directly in the environment.
\param id is a s32 to identify the tool bar. */
virtual IGUIToolBar* addToolBar(IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a combo box to the environment.
/** \param parent is the parent item of the element. E.g. a window. Set it to 0 to place the combo box directly in the environment.
\param id is a s32 to identify the combo box. */
virtual IGUIComboBox* addComboBox(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1) = 0;
//! Returns the default element factory which can create all built in elements
virtual IGUIElementFactory* getDefaultGUIElementFactory() = 0;
//! Adds an element factory to the gui environment.
/** Use this to extend the gui environment with new element types which it should be
able to create automaticly, for example when loading data from xml files. */
virtual void registerGUIElementFactory(IGUIElementFactory* factoryToAdd) = 0;
//! Returns amount of registered scene node factories.
virtual s32 getRegisteredGUIElementFactoryCount() = 0;
//! Returns a scene node factory by index
virtual IGUIElementFactory* getGUIElementFactory(s32 index) = 0;
//! Adds a GUI Element by its name
virtual IGUIElement* addGUIElement(const c8* elementName, IGUIElement* parent=0) = 0;
//! Saves the current gui into a file.
//! \param filename: Name of the file.
virtual bool saveGUI(const c8* filename)=0;
//! Saves the current gui into a file.
virtual bool saveGUI(io::IWriteFile* file)=0;
//! Loads the gui. Note that the current gui is not cleared before.
//! \param filename: Name of the file .
virtual bool loadGUI(const c8* filename)=0;
//! Loads the gui. Note that the current gui is not cleared before.
virtual bool loadGUI(io::IReadFile* file)=0;
//! Writes attributes of the gui environment
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0)=0;
//! Reads attributes of the gui environment
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)=0;
//! writes an element
virtual void writeGUIElement(io::IXMLWriter* writer, IGUIElement* node) =0;
//! reads an element
virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* parent) =0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,37 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_FILE_OPEN_DIALOG_H_INCLUDED__
#define __I_GUI_FILE_OPEN_DIALOG_H_INCLUDED__
#include "IGUIElement.h"
namespace irr
{
namespace gui
{
//! Standard file chooser dialog.
class IGUIFileOpenDialog : public IGUIElement
{
public:
//! constructor
IGUIFileOpenDialog(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> 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.
virtual const wchar_t* getFilename() = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,99 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_FONT_H_INCLUDED__
#define __I_GUI_FONT_H_INCLUDED__
#include "IUnknown.h"
#include "rect.h"
#include "irrTypes.h"
#include "SColor.h"
#include "irrArray.h"
#include "ITexture.h"
namespace irr
{
namespace gui
{
//! An enum for the different types of GUI font.
enum EGUI_FONT_TYPE
{
//! Bitmap fonts loaded from an XML file or a texture.
EGFT_BITMAP = 0,
//! Scalable vector fonts loaded from an XML file.
//! These fonts reside in system memory and use no video memory
//! until they are displayed. These are slower than bitmap fonts
//! but can be easily scaled and rotated.
EGFT_VECTOR,
//! A font which uses a the native API provided by the operating system.
//! Currently not used.
EGFT_OS,
//! An external font type provided by the user.
EGFT_CUSTOM
};
//! Font interface.
class IGUIFont : public virtual IUnknown
{
public:
//! Destructor
virtual ~IGUIFont() {};
//! Draws an text and clips it to the specified rectangle if wanted.
/** \param text: Text to draw
\param position: Rectangle specifying position where to draw the text.
\param color: Color of the text
\param hcenter: Specifiies if the text should be centered horizontally into the rectangle.
\param vcenter: Specifiies if the text should be centered vertically into the rectangle.
\param clip: Optional pointer to a rectangle against which the text will be clipped.
If the pointer is null, no clipping will be done. */
virtual void draw(const wchar_t* text, const core::rect<s32>& position,
video::SColor color, bool hcenter=false, bool vcenter=false,
const core::rect<s32>* clip=0) = 0;
//! Calculates the dimension of a text.
/** \return Returns width and height of the area covered by the text if it would be
drawn. */
virtual core::dimension2d<s32> getDimension(const wchar_t* text) = 0;
//! Calculates the index of the character in the text which is on a specific position.
/** \param text: Text string.
\param pixel_x: X pixel position of which the index of the character will be returned.
\return Returns zero based index of the character in the text, and -1 if no no character
is on this position. (=the text is too short). */
virtual s32 getCharacterFromPos(const wchar_t* text, s32 pixel_x) = 0;
//! Returns the type of this font
virtual EGUI_FONT_TYPE getType() { return EGFT_CUSTOM; }
//! Sets global kerning for the font.
virtual void setKerningWidth (s32 kerning) = 0;
virtual void setKerningHeight (s32 kerning) = 0;
//! Gets kerning values (distance between letters) for the font. If no parameters are provided,
/** the global kerning distance is returned.
\param thisLetter: If this parameter is provided, the left side kerning for this letter is added
to the global kerning value. For example, a space might only be one pixel wide, but it may
be displayed as several pixels.
\param previousLetter: If provided, kerning is calculated for both letters and added to the global
kerning value. For example, in a font which supports kerning pairs a string such as 'Wo' may have
the 'o' tucked neatly under the 'W'.
*/
virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) = 0;
//! Returns the distance between letters
virtual s32 getKerningHeight() = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,50 +0,0 @@
// 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
#ifndef __I_GUI_FONT_BITMAP_H_INCLUDED__
#define __I_GUI_FONT_BITMAP_H_INCLUDED__
#include "IGUIFont.h"
#include "IGUISpriteBank.h"
namespace irr
{
namespace gui
{
//! Font interface.
class IGUIFontBitmap : public IGUIFont
{
public:
//! Destructor
virtual ~IGUIFontBitmap() {};
//! Returns the type of this font
virtual EGUI_FONT_TYPE getType() { return EGFT_BITMAP; }
//! returns the parsed Symbol Information
virtual IGUISpriteBank* getSpriteBank() = 0;
//! returns the sprite number from a given character
virtual u32 getSpriteNoFromChar(const wchar_t *c) = 0;
//! Gets kerning values (distance between letters) for the font. If no parameters are provided,
/** the global kerning distance is returned.
\param thisLetter: If this parameter is provided, the left side kerning for this letter is added
to the global kerning value. For example, a space might only be one pixel wide, but it may
be displayed as several pixels.
\param previousLetter: If provided, kerning is calculated for both letters and added to the global
kerning value. For example, EGFT_BITMAP will add the right kerning value of previousLetter to the
left side kerning value of thisLetter, then add the global value.
*/
virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,40 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_IMAGE_H_INCLUDED__
#define __I_GUI_IMAGE_H_INCLUDED__
#include "IGUIElement.h"
#include "ITexture.h"
namespace irr
{
namespace gui
{
//! GUI element displaying an image.
class IGUIImage : public IGUIElement
{
public:
//! constructor
IGUIImage(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_IMAGE, environment, parent, id, rectangle) {}
//! destructor
~IGUIImage() {};
//! sets an image
virtual void setImage(video::ITexture* image) = 0;
//! sets if the image should use its alpha channel to draw itself
virtual void setUseAlphaChannel(bool use) = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,69 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_IN_OUT_FADER_H_INCLUDED__
#define __I_GUI_IN_OUT_FADER_H_INCLUDED__
#include "IGUIElement.h"
#include "SColor.h"
namespace irr
{
namespace gui
{
//! Element for fading out or in
/** Here is a small example on how the class is used. In this example we fade
in from a total red screen in the beginning. As you can see, the fader is not
only useful for dramatic in and out fading, but also to show that the player
is hit in a first person shooter game for example.
\code
gui::IGUIInOutFader* fader = device->getGUIEnvironment()->addInOutFader();
fader->setColor(video::SColor(0,255,0,0));
fader->fadeIn(4000);
\endcode
*/
class IGUIInOutFader : public IGUIElement
{
public:
//! constructor
IGUIInOutFader(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_IN_OUT_FADER, environment, parent, id, rectangle) {}
//! destructor
~IGUIInOutFader() {};
//! Gets the color to fade out to or to fade in from.
virtual video::SColor getColor() const = 0;
//! Sets the color to fade out to or to fade in from.
//! \param color: Color to where it is faded out od from it is faded in.
virtual void setColor(video::SColor color) = 0;
virtual void setColor(video::SColor source, video::SColor dest) = 0;
//! Starts the fade in process. In the beginning the whole rect is drawn by
//! the set color (black by default) and at the end of the overgiven
//! time the color has faded out.
//! \param time: Time specifing how long it should need to fade in,
//! in milliseconds.
virtual void fadeIn(u32 time) = 0;
//! Starts the fade out process. In the beginning everything is visible,
//! and at the end of the time only the set color (black by the fault)
//! will be drawn.
//! \param time: Time specifing how long it should need to fade out,
//! in milliseconds.
virtual void fadeOut(u32 time) = 0;
//! Returns if the fade in or out process is done.
virtual bool isReady() const = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,70 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_LIST_BOX_BAR_H_INCLUDED__
#define __I_GUI_LIST_BOX_BAR_H_INCLUDED__
#include "IGUIElement.h"
#include "irrTypes.h"
namespace irr
{
namespace gui
{
class IGUIFont;
class IGUISpriteBank;
//! Default list box GUI element.
class IGUIListBox : public IGUIElement
{
public:
//! constructor
IGUIListBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_LIST_BOX, environment, parent, id, rectangle) {}
//! destructor
~IGUIListBox() {};
//! returns amount of list items
virtual s32 getItemCount() = 0;
//! returns string of a list item. the may id be a value from 0 to itemCount-1
virtual const wchar_t* getListItem(s32 id) = 0;
//! adds an list item, returns id of item
virtual s32 addItem(const wchar_t* text) = 0;
//! adds an list item with an icon
//! \param text Text of list entry
//! \param icon Sprite index of the Icon within the current sprite bank. Set it to -1 if you want no icon
//! \return
//! returns the id of the new created item
virtual s32 addItem(const wchar_t* text, s32 icon) = 0;
//! Removes an item from the list
virtual void removeItem(s32 index) = 0;
//! Sets the sprite bank which should be used to draw list icons. This font is set to the sprite bank of
//! the built-in-font by default. A sprite can be displayed in front of every list item.
//! An icon is an index within the icon sprite bank. Several default icons are available in the
//! skin through getIcon
virtual void setSpriteBank(IGUISpriteBank* bank) = 0;
//! clears the list, deletes all items in the listbox
virtual void clear() = 0;
//! returns id of selected item. returns -1 if no item is selected.
virtual s32 getSelected() = 0;
//! sets the selected item. Set this to -1 if no item should be selected
virtual void setSelected(s32 id) = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,54 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_MESH_VIEWER_H_INCLUDED__
#define __I_GUI_MESH_VIEWER_H_INCLUDED__
#include "IGUIElement.h"
namespace irr
{
namespace video
{
class SMaterial;
} // end namespace video
namespace scene
{
class IAnimatedMesh;
} // end namespace scene
namespace gui
{
//! 3d mesh viewing GUI element.
class IGUIMeshViewer : public IGUIElement
{
public:
//! constructor
IGUIMeshViewer(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_MESH_VIEWER, environment, parent, id, rectangle) {}
//! destructor
~IGUIMeshViewer() {};
//! sets the mesh to be shown
virtual void setMesh(scene::IAnimatedMesh* mesh) = 0;
//! sets the material
virtual void setMaterial(const video::SMaterial& material) = 0;
//! gets the material
virtual const video::SMaterial& getMaterial() = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,45 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_SCROLL_BAR_H_INCLUDED__
#define __I_GUI_SCROLL_BAR_H_INCLUDED__
#include "IGUIElement.h"
namespace irr
{
namespace gui
{
//! Default scroll bar GUI element.
class IGUIScrollBar : public IGUIElement
{
public:
//! constructor
IGUIScrollBar(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_SCROLL_BAR, environment, parent, id, rectangle) {}
//! destructor
~IGUIScrollBar() {};
//! sets the maximum value of the scrollbar. must be > 0
virtual void setMax(s32 max) = 0;
//! sets the small step value
virtual void setSmallStep(s32 step) = 0;
//! gets the current position of the scrollbar
virtual s32 getPos() = 0;
//! sets the current position of the scrollbar
virtual void setPos(s32 pos) = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,453 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_SKIN_H_INCLUDED__
#define __I_GUI_SKIN_H_INCLUDED__
#include "IAttributeExchangingObject.h"
#include "SColor.h"
#include "IGUISkin.h"
#include "rect.h"
namespace irr
{
namespace gui
{
class IGUIFont;
class IGUISpriteBank;
class IGUIElement;
//! Enumeration of available default skins.
/** To set one of the skins, use the following code, for example to set
the Windows classic skin:
\code
gui::IGUISkin* newskin = environment->createSkin(gui::EGST_WINDOWS_CLASSIC);
environment->setSkin(newskin);
newskin->drop();
\endcode
*/
enum EGUI_SKIN_TYPE
{
//! Default windows look and feel
EGST_WINDOWS_CLASSIC=0,
//! Like EGST_WINDOWS_CLASSIC, but with metallic shaded windows and buttons
EGST_WINDOWS_METALLIC,
//! Burning's skin
EGST_BURNING_SKIN,
//! An unknown skin, not serializable at present
EGST_UNKNOWN
};
//! Names for gui element types
const c8* const GUISkinTypeNames[] =
{
"windowsClassic",
"windowsMetallic",
"burning",
"unknown",
0,
};
//! Enumeration for skin colors
enum EGUI_DEFAULT_COLOR
{
//! Dark shadow for three-dimensional display elements.
EGDC_3D_DARK_SHADOW = 0,
//! Shadow color for three-dimensional display elements (for edges facing away from the light source).
EGDC_3D_SHADOW,
//! Face color for three-dimensional display elements and for dialog box backgrounds.
EGDC_3D_FACE,
//! Highlight color for three-dimensional display elements (for edges facing the light source.)
EGDC_3D_HIGH_LIGHT,
//! Light color for three-dimensional display elements (for edges facing the light source.)
EGDC_3D_LIGHT,
//! Active window border.
EGDC_ACTIVE_BORDER,
//! Active window title bar text.
EGDC_ACTIVE_CAPTION,
//! Background color of multiple document interface (MDI) applications.
EGDC_APP_WORKSPACE,
//! Text on a button
EGDC_BUTTON_TEXT,
//! Grayed (disabled) text.
EGDC_GRAY_TEXT,
//! Item(s) selected in a control.
EGDC_HIGH_LIGHT,
//! Text of item(s) selected in a control.
EGDC_HIGH_LIGHT_TEXT,
//! Inactive window border.
EGDC_INACTIVE_BORDER,
//! Inactive window caption.
EGDC_INACTIVE_CAPTION,
//! Tool tip color
EGDC_TOOLTIP,
//! Scrollbar gray area
EGDC_SCROLLBAR,
//! Window background
EGDC_WINDOW,
//! Window symbols like on close buttons, scroll bars and check boxes
EGDC_WINDOW_SYMBOL,
//! Icons in a list or tree
EGDC_ICON,
//! Selected icons in a list or tree
EGDC_ICON_HIGH_LIGHT,
//! this value is not used, it only specifies the amount of default colors
//! available.
EGDC_COUNT
};
//! Names for default skin colors
const c8* const GUISkinColorNames[] =
{
"3DDarkShadow",
"3DShadow",
"3DFace",
"3DHighlight",
"3DLight",
"ActiveBorder",
"ActiveCaption",
"AppWorkspace",
"ButtonText",
"GrayText",
"Highlight",
"HighlightText",
"InactiveBorder",
"InactiveCaption",
"ToolTip",
"ScrollBar",
"Window",
"WindowSymbol",
"Icon",
"IconHighlight",
0,
};
//! Enumeration for default sizes.
enum EGUI_DEFAULT_SIZE
{
//! default with / height of scrollbar
EGDS_SCROLLBAR_SIZE = 0,
//! height of menu
EGDS_MENU_HEIGHT,
//! width of a window button
EGDS_WINDOW_BUTTON_WIDTH,
//! width of a checkbox check
EGDS_CHECK_BOX_WIDTH,
//! width of a messagebox
EGDS_MESSAGE_BOX_WIDTH,
//! height of a messagebox
EGDS_MESSAGE_BOX_HEIGHT,
//! width of a default button
EGDS_BUTTON_WIDTH,
//! height of a default button
EGDS_BUTTON_HEIGHT,
//! distance for text from background
EGDS_TEXT_DISTANCE_X,
//! distance for text from background
EGDS_TEXT_DISTANCE_Y,
//! this value is not used, it only specifies the amount of default sizes
//! available.
EGDS_COUNT
};
//! Names for default skin sizes
const c8* const GUISkinSizeNames[] =
{
"ScrollBarSize",
"MenuHeight",
"WindowButtonWidth",
"CheckBoxWidth",
"MessageBoxWidth",
"MessageBoxHeight",
"ButtonWidth",
"ButtonHeight",
"TextDistanceX",
"TextDistanceY",
0,
};
enum EGUI_DEFAULT_TEXT
{
//! Text for the OK button on a message box
EGDT_MSG_BOX_OK = 0,
//! Text for the Cancel button on a message box
EGDT_MSG_BOX_CANCEL,
//! Text for the Yes button on a message box
EGDT_MSG_BOX_YES,
//! Text for the No button on a message box
EGDT_MSG_BOX_NO,
//! Tooltip text for window close button
EGDT_WINDOW_CLOSE,
//! Tooltip text for window maximize button
EGDT_WINDOW_MAXIMIZE,
//! Tooltip text for window minimize button
EGDT_WINDOW_MINIMIZE,
//! Tooltip text for window restore button
EGDT_WINDOW_RESTORE,
//! this value is not used, it only specifies the number of default texts
EGDT_COUNT
};
//! Names for default skin sizes
const c8* const GUISkinTextNames[] =
{
"MessageBoxOkay",
"MessageBoxCancel",
"MessageBoxYes",
"MessageBoxNo",
"WindowButtonClose",
"WindowButtonMaximize",
"WindowButtonMinimize",
"WindowButtonRestore",
0,
};
//! Customizable symbols for GUI
enum EGUI_DEFAULT_ICON
{
//! maximize window button
EGDI_WINDOW_MAXIMIZE = 0,
//! restore window button
EGDI_WINDOW_RESTORE,
//! close window button
EGDI_WINDOW_CLOSE,
//! minimize window button
EGDI_WINDOW_MINIMIZE,
//! scroll bar up button
EGDI_CURSOR_UP,
//! scroll bar down button
EGDI_CURSOR_DOWN,
//! scroll bar left button
EGDI_CURSOR_LEFT,
//! scroll bar right button
EGDI_CURSOR_RIGHT,
//! icon for menu children
EGDI_MENU_MORE,
//! tick for checkbox
EGDI_CHECK_BOX_CHECKED,
//! down arrow for dropdown menus
EGDI_DROP_DOWN,
//! smaller up arrow
EGDI_SMALL_CURSOR_UP,
//! smaller down arrow
EGDI_SMALL_CURSOR_DOWN,
//! selection dot in a radio button
EGDI_RADIO_BUTTON_CHECKED,
//! file icon for file selection
EGDI_FILE,
//! folder icon for file selection
EGDI_DIRECTORY,
//! value not used, it only specifies the number of icons
EGDI_COUNT
};
const c8* const GUISkinIconNames[] =
{
"windowMaximize",
"windowRestore",
"windowClose",
"windowMinimize",
"cursorUp",
"cursorDown",
"cursorLeft",
"cursorRight",
"menuMore",
"checkBoxChecked",
"dropDown",
"smallCursorUp",
"smallCursorDown",
"radioButtonChecked",
"file",
"directory",
0
};
//! A skin modifies the look of the GUI elements.
class IGUISkin : public virtual io::IAttributeExchangingObject
{
public:
//! destructor
~IGUISkin() {};
//! returns default color
virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) = 0;
//! sets a default color
virtual void setColor(EGUI_DEFAULT_COLOR which, video::SColor newColor) = 0;
//! returns default color
virtual s32 getSize(EGUI_DEFAULT_SIZE size) = 0;
//! Returns a default text.
/** For example for Message box button captions:
"OK", "Cancel", "Yes", "No" and so on. */
virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text) = 0;
//! Sets a default text.
/** For example for Message box button captions:
"OK", "Cancel", "Yes", "No" and so on. */
virtual void setDefaultText(EGUI_DEFAULT_TEXT which, const wchar_t* newText) = 0;
//! sets a default size
virtual void setSize(EGUI_DEFAULT_SIZE which, s32 size) = 0;
//! returns the default font
virtual IGUIFont* getFont() = 0;
//! sets a default font
virtual void setFont(IGUIFont* font) = 0;
//! returns the sprite bank
virtual IGUISpriteBank* getSpriteBank() = 0;
//! sets the sprite bank
virtual void setSpriteBank(IGUISpriteBank* bank) = 0;
//! Returns a default icon
/** Returns the sprite index within the sprite bank */
virtual u32 getIcon(EGUI_DEFAULT_ICON icon) = 0;
//! Sets a default icon
/** Sets the sprite index used for drawing icons like arrows,
close buttons and ticks in checkboxes
\param icon: Enum specifying which icon to change
\param index: The sprite index used to draw this icon */
virtual void setIcon(EGUI_DEFAULT_ICON icon, u32 index) = 0;
//! draws a standard 3d button pane
/** Used for drawing for example buttons in normal state.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by IGUISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DButtonPaneStandard(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0) = 0;
//! draws a pressed 3d button pane
/** Used for drawing for example buttons in pressed state.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by IGUISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DButtonPanePressed(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0) = 0;
//! draws a sunken 3d pane
/** Used for drawing the background of edit, combo or check boxes.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by IGUISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param bgcolor: Background color.
\param flat: Specifies if the sunken pane should be flat or displayed as sunken
deep into the ground.
\param fillBackGround: Specifies if the background should be filled with the background
color or not be drawn at all.
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DSunkenPane(IGUIElement* element,
video::SColor bgcolor, bool flat, bool fillBackGround,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0) = 0;
//! draws a window background
/** Used for drawing the background of dialogs and windows.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by IGUISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param titleBarColor: Title color.
\param drawTitleBar: True to enable title drawing.
\param rect: Defining area where to draw.
\param clip: Clip area.
\return Returns rect where it would be good to draw title bar text. */
virtual core::rect<s32> draw3DWindowBackground(IGUIElement* element,
bool drawTitleBar, video::SColor titleBarColor,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0) = 0;
//! draws a standard 3d menu pane
/** Used for drawing for menus and context menus.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by IGUISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DMenuPane(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0) = 0;
//! draws a standard 3d tool bar
/** Used for drawing for toolbars and menus.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by IGUISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DToolBar(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0) = 0;
//! draws a tab button
/** Used for drawing for tab buttons on top of tabs.
\param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by IGUISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param active: Specifies if the tab is currently active.
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DTabButton(IGUIElement* element, bool active,
const core::rect<s32>& rect, const core::rect<s32>* clip=0) = 0;
//! draws a tab control body
/** \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by IGUISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly.
\param border: Specifies if the border should be drawn.
\param background: Specifies if the background should be drawn.
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DTabBody(IGUIElement* element, bool border, bool background,
const core::rect<s32>& rect, const core::rect<s32>* clip=0) = 0;
//! draws an icon, usually from the skin's sprite bank
/** \param parent: Pointer to the element which wishes to draw this icon.
This parameter is usually not used by IGUISkin, but can be used for example
by more complex implementations to find out how to draw the part exactly.
\param icon: Specifies the icon to be drawn.
\param position: The position to draw the icon
\param starttime: The time at the start of the animation
\param currenttime: The present time, used to calculate the frame number
\param loop: Whether the animation should loop or not
\param clip: Clip area. */
virtual void drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
const core::position2di position, u32 starttime=0, u32 currenttime=0,
bool loop=false, const core::rect<s32>* clip=0) = 0;
//! get the type of this skin
virtual EGUI_SKIN_TYPE getType() { return EGST_UNKNOWN; };
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,73 +0,0 @@
#ifndef __I_GUI_SPRITE_BANK_H_INCLUDED__
#define __I_GUI_SPRITE_BANK_H_INCLUDED__
#include "IUnknown.h"
#include "irrArray.h"
#include "SColor.h"
#include "rect.h"
namespace irr
{
namespace video
{
class ITexture;
} // end namespace video
namespace gui
{
struct SGUISpriteFrame
{
u32 textureNumber;
u32 rectNumber;
};
struct SGUISprite
{
SGUISprite() : Frames(), frameTime(0) { };
core::array<SGUISpriteFrame> Frames;
u32 frameTime;
};
//! Sprite bank interface.
class IGUISpriteBank : public virtual IUnknown
{
public:
//! Destructor
virtual ~IGUISpriteBank() {};
//! Returns the list of rectangles held by the sprite bank
virtual core::array< core::rect<s32> >& getPositions() = 0;
//! Returns the array of animated sprites within the sprite bank
virtual core::array< SGUISprite >& getSprites() = 0;
//! Returns the number of textures held by the sprite bank
virtual u32 getTextureCount() = 0;
//! Gets the texture with the specified index
virtual video::ITexture* getTexture(u32 index) = 0;
//! Adds a texture to the sprite bank
virtual void addTexture(video::ITexture* texture) = 0;
//! Changes one of the textures in the sprite bank
virtual void setTexture(u32 index, video::ITexture* texture) = 0;
//! Draws a sprite in 2d with position and color
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),
u32 starttime=0, u32 currenttime=0, bool loop=true, bool center=false) = 0;
};
} // end namespace gui
} // end namespace irr
#endif // __I_GUI_SPRITE_BANK_H_INCLUDED__

View File

@ -1,90 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_STATIC_TEXT_H_INCLUDED__
#define __I_GUI_STATIC_TEXT_H_INCLUDED__
#include "IGUIElement.h"
#include "SColor.h"
namespace irr
{
namespace gui
{
class IGUIFont;
//! Multi or single line text label.
class IGUIStaticText : public IGUIElement
{
public:
//! constructor
IGUIStaticText(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_STATIC_TEXT, environment, parent, id, rectangle) {}
//! destructor
~IGUIStaticText() {};
//! Sets another skin independent font.
/** If this is set to zero, the button uses the font of the skin.
\param font: New font to set. */
virtual void setOverrideFont(IGUIFont* font=0) = 0;
//! Gets the override font (if any)
//! \return The override font (may be 0)
virtual IGUIFont * getOverrideFont(void) = 0;
//! Sets another color for the text.
/** If set, the static text does not use the EGDC_BUTTON_TEXT color defined
in the skin, but the set color instead. You don't need to call
IGUIStaticText::enableOverrrideColor(true) after this, this is done
by this function.
If you set a color, and you want the text displayed with the color
of the skin again, call IGUIStaticText::enableOverrideColor(false);
\param color: New color of the text. */
virtual void setOverrideColor(video::SColor color) = 0;
//! Gets the override color
//! \return: The override color
virtual video::SColor const & getOverrideColor(void) = 0;
//! Sets if the static text should use the overide color or the color in the gui skin.
/** \param enable: If set to true, the override color, which can be set
with IGUIStaticText::setOverrideColor is used, otherwise the
EGDC_BUTTON_TEXT color of the skin. */
virtual void enableOverrideColor(bool enable) = 0;
//! Checks if an override color is enabled
//! \return true if the override color is enabled, false otherwise
virtual bool isOverrideColorEnabled(void) = 0;
//! Enables or disables word wrap for using the static text as multiline text control.
/** \param enable: If set to true, words going over one line are
breaked to the next line. */
virtual void setWordWrap(bool enable) = 0;
//! Checks if word wrap is enabled
//! \return true if word wrap is enabled, false otherwise
virtual bool isWordWrapEnabled(void) = 0;
//! Returns the height of the text in pixels when it is drawn.
/** This is useful for adjusting the layout of gui elements based on the height
of the multiline text in this element.
\return Returns height of text in pixels. */
virtual s32 getTextHeight() = 0;
//! Returns the width of the current text, in the current font
/** If the text is broken, this returns the width of the widest line
\return The width of the text, or the widest broken line. */
virtual s32 getTextWidth(void) = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,81 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_TAB_CONTROL_H_INCLUDED__
#define __I_GUI_TAB_CONTROL_H_INCLUDED__
#include "IGUIElement.h"
#include "SColor.h"
namespace irr
{
namespace gui
{
//! A tab, onto which other gui elements could be added.
class IGUITab : public IGUIElement
{
public:
//! constructor
IGUITab(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_TAB, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUITab() {};
//! Returns number of tab if in tabcontrol.
/** Can be accessed later IGUITabControl::getTab() by this number. */
virtual s32 getNumber() = 0;
//! sets if the tab should draw its background
virtual void setDrawBackground(bool draw=true) = 0;
//! sets the color of the background, if it should be drawn.
virtual void setBackgroundColor(video::SColor c) = 0;
};
//! A standard tab control
class IGUITabControl : public IGUIElement
{
public:
//! constructor
IGUITabControl(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_TAB_CONTROL, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUITabControl() {};
//! Adds a tab
virtual IGUITab* addTab(const wchar_t* caption, s32 id=-1) = 0;
//! Returns amount of tabs in the tabcontrol
virtual s32 getTabcount() = 0;
//! Returns a tab based on zero based index
/** \param idx: zero based index of tab. Is a value betwenn 0 and getTabcount()-1;
\return Returns pointer to the Tab. Returns 0 if no tab
is corresponding to this tab. */
virtual IGUITab* getTab(s32 idx) = 0;
//! Brings a tab to front.
/** \param idx: number of the tab.
\return Returns true if successful. */
virtual bool setActiveTab(s32 idx) = 0;
//! Brings a tab to front.
/** \param idx: pointer to the tab.
\return Returns true if successful. */
virtual bool setActiveTab(IGUIElement *tab) = 0;
//! Returns which tab is currently active
virtual s32 getActiveTab() = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,43 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_TOOL_BAR_H_INCLUDED__
#define __I_GUI_TOOL_BAR_H_INCLUDED__
#include "IGUIElement.h"
namespace irr
{
namespace video
{
class ITexture;
} // end namespace video
namespace gui
{
class IGUIButton;
//! Stays at the top of its parent like the menu bar and contains tool buttons
class IGUIToolBar : public IGUIElement
{
public:
//! constructor
IGUIToolBar(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_TOOL_BAR, environment, parent, id, rectangle) {}
//! destructor
~IGUIToolBar() {};
//! Adds a button to the tool bar
virtual IGUIButton* addButton(s32 id=-1, const wchar_t* text=0,const wchar_t* tooltiptext=0,
video::ITexture* img=0, video::ITexture* pressedimg=0,
bool isPushButton=false, bool useAlphaChannel=false) = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,60 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_WINDOW_H_INCLUDED__
#define __I_GUI_WINDOW_H_INCLUDED__
#include "IGUIButton.h"
namespace irr
{
namespace gui
{
//! enumeration for message box layout flags
enum EMESSAGE_BOX_FLAG
{
//! Flag for the ok button
EMBF_OK = 0x1,
//! Flag for the cancel button
EMBF_CANCEL = 0x2,
//! Flag for the yes button
EMBF_YES = 0x4,
//! Flag for the no button
EMBF_NO = 0x8,
//! This value is not used. It only forces this enumeration to compile in 32 bit.
EMBF_FORCE_32BIT = 0x7fffffff
};
//! Default moveable window GUI element with border, caption and close icons.
class IGUIWindow : public IGUIElement
{
public:
//! constructor
IGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_WINDOW, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIWindow() {};
//! Returns pointer to the close button
virtual IGUIButton* getCloseButton() = 0;
//! Returns pointer to the minimize button
virtual IGUIButton* getMinimizeButton() = 0;
//! Returns pointer to the maximize button
virtual IGUIButton* getMaximizeButton() = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,104 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_IMAGE_H_INCLUDED__
#define __I_IMAGE_H_INCLUDED__
#include "IUnknown.h"
#include "position2d.h"
#include "SColor.h"
namespace irr
{
namespace video
{
//! An enum for the color format of textures used by the Irrlicht Engine.
/** A color format specifies how color information is stored. */
enum ECOLOR_FORMAT
{
//! 16 bit color format used by the software driver, and thus preferred
//! by all other irrlicht engine video drivers. There are 5 bits for every
//! color component, and a single bit is left for alpha information.
ECF_A1R5G5B5 = 0,
//! Standard 16 bit color format.
ECF_R5G6B5,
//! 24 bit color, no alpha channel, but 8 bit for red, green and blue.
ECF_R8G8B8,
//! Default 32 bit color format. 8 bits are used for every component:
//! red, green, blue and alpha.
ECF_A8R8G8B8
};
//! Interface for software image data.
/** Image loaders create these images from files. IVideoDrivers convert
these images into their (hardware) textures.
*/
class IImage : public virtual IUnknown
{
public:
//! destructor
virtual ~IImage() {};
//! Lock function. Use this to get a pointer to the image data. After you
//! don't need the pointer anymore, you must call unlock().
//! \return Returns pointer to the image data. What type of data
//! is pointed to depends on the color format of the image. For example
//! if the color format is ECF_A8R8G8B8, it is of s32.
//! Be sure to call unlock() after you don't need the pointer any more.
virtual void* lock() = 0;
//! Unlock function.
//! Should be called after the pointer received by lock() is not
//! needed anymore.
virtual void unlock() = 0;
//! Returns width and height of image data.
virtual const core::dimension2d<s32>& getDimension() = 0;
//! Returns bits per pixel.
virtual s32 getBitsPerPixel() = 0;
//! Returns bytes per pixel
virtual s32 getBytesPerPixel() = 0;
//! Returns image data size in bytes
virtual s32 getImageDataSizeInBytes() = 0;
//! Returns image data size in pixels
virtual s32 getImageDataSizeInPixels() = 0;
//! returns a pixel
virtual SColor getPixel(s32 x, s32 y) = 0;
//! returns the color format
virtual ECOLOR_FORMAT getColorFormat() const = 0;
//! returns mask for red value of a pixel
virtual u32 getRedMask() = 0;
//! returns mask for green value of a pixel
virtual u32 getGreenMask() = 0;
//! returns mask for blue value of a pixel
virtual u32 getBlueMask() = 0;
//! returns mask for alpha value of a pixel
virtual u32 getAlphaMask() = 0;
//! returns pitch of image
virtual u32 getPitch() const = 0;
};
} // end namespace video
} // end namespace irr
#endif

View File

@ -1,45 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_SURFACE_LOADER_H_INCLUDED__
#define __I_SURFACE_LOADER_H_INCLUDED__
#include "IUnknown.h"
#include "IReadFile.h"
#include "IImage.h"
namespace irr
{
namespace video
{
//! Class which is able to create a image from a file.
/** If you want the Irrlicht Engine be able to load textures of
currently unsupported file formats (e.g .gif), then implement
this and add your new Surface loader with
IVideoDriver::addExternalImageLoader() to the engine. */
class IImageLoader : public virtual IUnknown
{
public:
//! destructor
virtual ~IImageLoader() {};
//! returns true if the file maybe is able to be loaded by this class
//! based on the file extension (e.g. ".tga")
virtual bool isALoadableFileExtension(const c8* fileName) = 0;
//! returns true if the file maybe is able to be loaded by this class
virtual bool isALoadableFileFormat(irr::io::IReadFile* file) = 0;
//! creates a surface from the file
virtual IImage* loadImage(irr::io::IReadFile* file) = 0;
};
} // end namespace video
} // end namespace irr
#endif

View File

@ -1,43 +0,0 @@
#ifndef _I_IMAGE_WRITER_H_INCLUDED__
#define _I_IMAGE_WRITER_H_INCLUDED__
#include "irrTypes.h"
#include "IUnknown.h"
namespace irr
{
namespace io
{
class IWriteFile;
} // end namespace io
namespace video
{
class IImage;
//! Interface for writing software image data.
class IImageWriter : public IUnknown
{
public:
//! constructor
IImageWriter()
{
}
//! destructor
virtual ~IImageWriter()
{
};
//! return true if this writer can write a file with the given extension
virtual bool isAWriteableFileExtension(const c8* fileName) = 0;
//! write image to file
virtual bool writeImage(io::IWriteFile *file, IImage *image, u32 param = 0) = 0;
};
} // namespace video
} // namespace irr
#endif // _I_IMAGE_WRITER_H_INCLUDED__

View File

@ -1,46 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_LIGHT_SCENE_NODE_H_INCLUDED__
#define __I_LIGHT_SCENE_NODE_H_INCLUDED__
#include "ISceneNode.h"
#include "SLight.h"
namespace irr
{
namespace scene
{
//! Scene node which is a dynamic light.
/** You can switch the light on and off by
making it visible or not, and let it be animated by ordinary scene node animators.
If you set the light type to be directional, you will need to set the direction of the
light source manually in the SLight structure, the position of the scene node will have no
effect on this direction.
*/
class ILightSceneNode : public ISceneNode
{
public:
//! constructor
ILightSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
const core::vector3df& position = core::vector3df(0,0,0))
: ISceneNode(parent, mgr, id, position) {}
//! Sets the light data associated with this ILightSceneNode
virtual void setLightData(const video::SLight& light) = 0;
//! Gets the light data associated with this ILightSceneNode
//! \return Returns the light data.
virtual video::SLight& getLightData() = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,95 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_LOGGER_H_INCLUDED__
#define __I_LOGGER_H_INCLUDED__
#include "IUnknown.h"
namespace irr
{
enum ELOG_LEVEL
{
//! High log level, warnings, errors and important information
//! texts are printed out.
ELL_INFORMATION = 0,
//! Default log level, warnings and errors are printed out
ELL_WARNING,
//! Low log level, only errors are printed into the log
ELL_ERROR,
//! Nothing is printed out to the log
ELL_NONE
};
//! Interface for logging messages, warnings and errors
class ILogger : public virtual IUnknown
{
public:
//! destructor
virtual ~ILogger() {}
//! Returns the current set log level.
virtual ELOG_LEVEL getLogLevel() = 0;
//! Sets a new log level. With this value, texts which are sent to
//! the logger are filtered out. For example setting this value to
//! ELL_WARNING, only warnings and
//! errors are printed out. Setting it to ELL_INFORMATION, which is
//! the default setting, warnings,
//! errors and informational texts are printed out.
//! \param ll: new log level filter value.
virtual void setLogLevel(ELOG_LEVEL ll) = 0;
//! Prints out a text into the log
//! \param text: Text to print out.
//! \param ll: Log level of the text. If the text is an error, set
//! it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
//! is just an informational text, set it to ELL_INFORMATION. Texts are
//! filtered with these levels. If you want to be a text displayed,
//! independent on what level filter is set, use ELL_NONE.
virtual void log(const c8* text, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
//! Prints out a text into the log
//! \param text: Text to print out.
//! \param hint: Additional info. This string is added after a " :" to the
//! string.
//! \param ll: Log level of the text. If the text is an error, set
//! it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
//! is just an informational text, set it to ELL_INFORMATION. Texts are
//! filtered with these levels. If you want to be a text displayed,
//! independent on what level filter is set, use ELL_NONE.
virtual void log(const c8* text, const c8* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
//! Prints out a text into the log
//! \param text: Text to print out.
//! \param hint: Additional info. This string is added after a " :" to the
//! string.
//! \param ll: Log level of the text. If the text is an error, set
//! it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
//! is just an informational text, set it to ELL_INFORMATION. Texts are
//! filtered with these levels. If you want to be a text displayed,
//! independent on what level filter is set, use ELL_NONE.
virtual void log(const wchar_t* text, const wchar_t* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
//! Prints out a text into the log
//! \param text: Text to print out.
//! \param ll: Log level of the text. If the text is an error, set
//! it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
//! is just an informational text, set it to ELL_INFORMATION. Texts are
//! filtered with these levels. If you want to be a text displayed,
//! independent on what level filter is set, use ELL_NONE.
virtual void log(const wchar_t* text, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
};
} // end namespace
#endif

View File

@ -1,97 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_MATERIAL_RENDERER_H_INCLUDED__
#define __I_MATERIAL_RENDERER_H_INCLUDED__
#include "IUnknown.h"
#include "SMaterial.h"
#include "S3DVertex.h"
namespace irr
{
namespace video
{
class IVideoDriver;
class IMaterialRendererServices;
//! Interface for material rendering. Can be used to extend the engine with new materials.
/** Refer to IVideoDriver::addMaterialRenderer() for more informations on how to extend the engine
with new materials.
*/
class IMaterialRenderer : public virtual IUnknown
{
public:
//! destructor
virtual ~IMaterialRenderer() {};
//! Called by the IVideoDriver implementation the let the renderer set its needed render states.
/** This is called during the IVideoDriver::setMaterial() call.
When overriding this, you can set some renderstates or for example a vertex or pixel shader
if you like.
\param material: The new material parameters to be set. The renderer may change the material
flags in this material. For example if this material does not accept the zbuffer = true, it
can set it to false. This is useful, because in the next lastMaterial will be just the material
in this call.
\param lastMaterial: The material parameters which have been set before this material.
\param resetAllRenderstates: True if all renderstates should really be reset. This is usually
true if the last rendering mode was not a usual 3d rendering mode, but for example
a 2d rendering mode.
You should reset really all renderstates if this is true, no matter if the lastMaterial had
some similar settings. This is used because in most cases, some common renderstates are not
changed if they are already there, for example bilinear filtering, wireframe, gouraudshading,
lighting, zbuffer, zwriteenable, backfaceculling and fogenable.
\param services: Interface providing some methods for changing advanced, internal
states of a IVideoDriver. */
virtual void OnSetMaterial(SMaterial& material, const SMaterial& lastMaterial,
bool resetAllRenderstates, IMaterialRendererServices* services) {};
//! 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 that the renderstates should be changed, it won't be called if for
example two drawIndexedTriangleList() will be called with the same material set. This
method will be called every time. This is useful for example for materials with shaders,
which don't only set new renderstates but also shader constants.
\param service: Pointer to interface providing methos for setting constants and other things.
\param vtxtype: Vertex type with which the next rendering will be done. This can be used
by the material renderer to set some specific optimized shaders or if this is an incompatible
vertex type for this renderer, to refuse rendering for example.
\return Returns true if everything is ok, and false if nothing should be rendered.
The material renderer can choose to return false for 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 a vertex type other than EVT_TANGENTS. */
virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype) { return true; };
//! Called by the IVideoDriver to unset this material.
/** Called during the
IVideoDriver::setMaterial() call before the new material will get the OnSetMaterial()
call. */
virtual void OnUnsetMaterial() {};
//! Returns if the material is transparent.
/** The scene managment needs to know this
for being able to sort the materials by opaque and transparent. */
virtual bool isTransparent() { return false; }
//! Returns the render capability of the material.
/** Because some more complex materials
are implemented in multiple ways and need special hardware capabilities, it is possible
to query how the current material renderer is performing on the current hardware with this
function.
\return Returns 0 if everything is running fine. Any other value is material renderer
specific and means for example that the renderer switched back to a fall back material because
it cannot use the latest shaders. More specific examples:
Fixed function pipeline materials should return 0 in most cases, parallax mapped
material will only return 0 when at least pixel shader 1.4 is available on that machine. */
virtual s32 getRenderCapability() { return 0; }
};
} // end namespace video
} // end namespace irr
#endif

View File

@ -1,93 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_MATERIAL_RENDERER_SERVICES_H_INCLUDED__
#define __I_MATERIAL_RENDERER_SERVICES_H_INCLUDED__
#include "IUnknown.h"
#include "SMaterial.h"
#include "S3DVertex.h"
namespace irr
{
namespace video
{
class IVideoDriver;
//! Interface providing some methods for changing advanced, internal states of a IVideoDriver.
class IMaterialRendererServices
{
public:
//! destructor
virtual ~IMaterialRendererServices() {}
//! Can be called by an IMaterialRenderer to make its work easier.
//! Sets all basic renderstates if needed.
//! Basic render states are diffuse, ambient, specular, and emissive color, specular power,
//! bilinear and trilinear filtering, wireframe mode,
//! grouraudshading, lighting, zbuffer, zwriteenable, backfaceculling and fog enabling.
virtual void setBasicRenderStates(const SMaterial& material,
const SMaterial& lastMaterial,
bool resetAllRenderstates) = 0;
//! Sets a constant for the vertex shader based on a name. This can be used if you used
//! a high level shader language like GLSL or HLSL to create a shader. Example: If you
//! created a shader which has variables named 'mWorldViewProj' (containing the
//! WorldViewProjection matrix) and another one named 'fTime' containing one float,
//! you can set them in your IShaderConstantSetCallBack derived class like this:
//! \code
//! virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 userData)
//! {
//! video::IVideoDriver* driver = services->getVideoDriver();
//!
//! f32 time = (f32)os::Timer::getTime()/100000.0f;
//! services->setVertexShaderConstant("fTime", &time, 1);
//!
//! core::matrix4 worldViewProj(driver->getTransform(video::ETS_PROJECTION));
//! worldViewProj *= driver->getTransform(video::ETS_VIEW);
//! worldViewProj *= driver->getTransform(video::ETS_WORLD);
//! services->setVertexShaderConstant("mWorldViewProj", worldViewProj.M, 16);
//! }
//! \endcode
//! \param name: Name of the variable
//! \param floats: Pointer to array of floats
//! \param count: Amount of floats in array.
//! \return: Returns true if successful.
virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count) = 0;
//! Sets a vertex shader constant. Can be used if you created a shader using
//! pixel/vertex shader assembler or ARB_fragment_program or ARB_vertex_program.
//! \param data: Data to be set in the constants
//! \param startRegister: First register to be set
//! \param constantAmount: Amount of registers to be set. One register consists of 4 floats.
virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) = 0;
//! Sets a constant for the pixel shader based on a name. This can be used if you used
//! a high level shader language like GLSL or HLSL to create a shader. See
//! setVertexShaderConstant() for an example on how to use this.
//! \param name: Name of the variable
//! \param floats: Pointer to array of floats
//! \param count: Amount of floats in array.
//! \return: Returns true if successful.
virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count) = 0;
//! Sets a pixel shader constant. Can be used if you created a shader using
//! pixel/vertex shader assembler or ARB_fragment_program or ARB_vertex_program.
//! \param data: Data to be set in the constants
//! \param startRegister: First register to be set.
//! \param constantAmount: Amount of registers to be set. One register consists of 4 floats.
virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) = 0;
//! Returns a pointer to the IVideoDriver interface
virtual IVideoDriver* getVideoDriver() = 0;
};
} // end namespace video
} // end namespace irr
#endif

View File

@ -1,61 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_MESH_H_INCLUDED__
#define __I_MESH_H_INCLUDED__
#include "IUnknown.h"
#include "IMeshBuffer.h"
namespace irr
{
namespace scene
{
//! Class for accessing a mesh with multiple mesh buffers.
/** An IMesh is nothing more than a collection of some mesh buffers (IMeshBuffer).
SMesh is a simple implementation of an IMesh.
*/
class IMesh : public virtual IUnknown
{
public:
//! destructor
virtual ~IMesh(){};
//! Returns the amount of mesh buffers.
/** \return Returns the amount of mesh buffers (IMeshBuffer) in this mesh. */
virtual u32 getMeshBufferCount() const = 0;
//! Returns pointer to a mesh buffer.
/** \param nr: Zero based index of the mesh buffer. The maximum value is
getMeshBufferCount() - 1;
\return Returns the pointer to the mesh buffer or
NULL if there is no such mesh buffer. */
virtual IMeshBuffer* getMeshBuffer(u32 nr) const = 0;
//! Returns pointer to a mesh buffer which fits a material
/** \param material: material to search for
\return Returns the pointer to the mesh buffer or
NULL if there is no such mesh buffer. */
virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const { return 0; }
//! Returns an axis aligned bounding box of the mesh.
/** \return A bounding box of this mesh is returned. */
virtual const core::aabbox3d<f32>& getBoundingBox() const = 0;
//! set user axis aligned bounding box
virtual void setBoundingBox( const core::aabbox3df& box) = 0;
//! Sets a flag of all contained materials to a new value.
/** \param flag: Flag to set in all materials.
\param newvalue: New value to set in all materials. */
virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue) = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,106 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_MESH_BUFFER_H_INCLUDED__
#define __I_MESH_BUFFER_H_INCLUDED__
#include "IUnknown.h"
#include "SMaterial.h"
#include "aabbox3d.h"
#include "S3DVertex.h"
namespace irr
{
namespace scene
{
//! Enumeration for all vertex types there are.
enum E_PRIMITIVE_TYPE
{
//! All vertices are non-connected points.
EPT_POINTS=0,
//! All vertices form a single connected line.
EPT_LINE_STRIP,
//! Just as LINE_STRIP, but the last and the first vertex is also connected.
EPT_LINE_LOOP,
//! Every two vertices are connected creating n/2 lines.
EPT_LINES,
//! After the first two vertices each vertex defines a new triangle.
//! Always the two last and the new one form a new triangle.
EPT_TRIANGLE_STRIP,
//! After the first two vertices each vertex defines a new triangle.
//! All around the common first vertex.
EPT_TRIANGLE_FAN,
//! Explicitly set all vertices for each triangle.
EPT_TRIANGLES,
//! After the first two vertices each further tw vetices create a quad with the preceding two.
EPT_QUAD_STRIP,
//! Every four vertices create a quad.
EPT_QUADS,
//! Just as LINE_LOOP, but filled.
EPT_POLYGON
};
//! Struct for holding a mesh with a single material
/** SMeshBuffer is a simple implementation of a MeshBuffer. */
class IMeshBuffer : public virtual IUnknown
{
public:
//! destructor
virtual ~IMeshBuffer() {};
//! returns the material of this meshbuffer
virtual video::SMaterial& getMaterial() = 0;
//! returns the material of this meshbuffer
virtual const video::SMaterial& getMaterial() const = 0;
//! returns which type of vertex data is stored.
virtual video::E_VERTEX_TYPE getVertexType() const = 0;
//! returns the byte size (stride, pitch) of the vertex
virtual u32 getVertexPitch() const = 0;
//! returns pointer to vertex data. The data is an array of vertices. Which vertex
//! type is used can be determined with getVertexType().
virtual const void* getVertices() const = 0;
//! returns pointer to vertex data. The data is an array of vertices. Which vertex
//! type is used can be determined with getVertexType().
virtual void* getVertices() = 0;
//! returns amount of vertices
virtual u32 getVertexCount() const = 0;
//! returns pointer to Indices
virtual const u16* getIndices() const = 0;
//! returns pointer to Indices
virtual u16* getIndices() = 0;
//! returns amount of indices
virtual u32 getIndexCount() const = 0;
//! returns an axis aligned bounding box
virtual const core::aabbox3df& getBoundingBox() const = 0;
//! set user axis aligned bounding box
virtual void setBoundingBox( const core::aabbox3df& box) = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,86 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_MESH_CACHE_H_INCLUDED__
#define __I_MESH_CACHE_H_INCLUDED__
#include "irrTypes.h"
#include "IUnknown.h"
namespace irr
{
namespace scene
{
class IMesh;
class IAnimatedMesh;
class IAnimatedMeshSceneNode;
class IMeshLoader;
//! The mesh cache stores already loaded meshes and provides an interface to them.
/** You can access it using ISceneManager::getMeshCache(). All existing scene managers
will return a pointer to the same mesh cache, because it is shared between them. With
this interface, it is possible to manually add new loaded meshes (if
ISceneManager::getMesh() is not sufficient), to remove them and to iterate through
already loaded meshes. */
class IMeshCache : public virtual IUnknown
{
public:
//! destructor
virtual ~IMeshCache() {};
//! Adds a mesh to the internal list of loaded meshes.
/** Usually, ISceneManager::getMesh() is called to load a mesh from a file.
That method searches the list of loaded meshes if a mesh has already been loaded and
returns a pointer to if it is in that list and already in memory. Otherwise it loads
the mesh. With IMeshCache::addMesh(), it is possible to pretend that a mesh already
has been loaded. This method can be used for example by mesh loaders who need to
load more than one mesh with one call. They can add additional meshes with this
method to the scene manager. The COLLADA loader for example uses this method.
\param filename: Filename of the mesh. When called ISceneManager::getMesh() with this
parameter, the method will return the mesh parameter given with this method.
\param mesh: Pointer to a mesh which will now be referenced by this name. */
virtual void addMesh(const c8* filename, IAnimatedMesh* mesh) = 0;
//! Removes a mesh from the cache.
/** After loading a mesh with getMesh(), the mesh can be removed from the cache
using this method, freeing a lot of memory. */
virtual void removeMesh(IAnimatedMesh* mesh) = 0;
//! Returns amount of loaded meshes in the cache.
/** You can load new meshes into the cache using getMesh() and addMesh().
If you ever need to access the internal mesh cache, you can do this using
removeMesh(), getMeshNumber(), getMeshByIndex() and getMeshFilename() */
virtual s32 getMeshCount() = 0;
//! Returns current index number of the mesh, and -1 if it is not in the cache.
virtual s32 getMeshIndex(IAnimatedMesh* mesh) = 0;
//! Returns a mesh based on its index number.
/** \param index: Index of the mesh, number between 0 and getMeshCount()-1.
Note that this number is only valid until a new mesh is loaded or removed *
\return Returns pointer to the mesh or 0 if there is none with this number. */
virtual IAnimatedMesh* getMeshByIndex(s32 index) = 0;
//! Returns name of a mesh based on its index number.
/** \param index: Index of the mesh, number between 0 and getMeshCount()-1.
Note that this is only valid until a new mesh is loaded */
virtual const c8* getMeshFilename(s32 index) = 0;
//! Returns the filename of a loaded mesh, if there is any.
/** Returns 0 if there is none. */
virtual const c8* getMeshFilename(IAnimatedMesh* mesh) = 0;
//! Returns the filename of a loaded mesh, if there is any.
/* Returns 0 if there is none.*/
virtual const c8* getMeshFilename(IMesh* mesh) = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,45 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_MESH_LOADER_H_INCLUDED__
#define __I_MESH_LOADER_H_INCLUDED__
#include "IUnknown.h"
#include "IReadFile.h"
#include "IAnimatedMesh.h"
namespace irr
{
namespace scene
{
//! Class which is able to load an animated mesh from a file.
/** If you want the Irrlicht Engine be able to load meshes of
currently unsupported file formats (e.g .cob), then implement
this and add your new Surface loader with
ISceneManager::addExternalMeshLoader() to the engine. */
class IMeshLoader : public virtual IUnknown
{
public:
//! destructor
virtual ~IMeshLoader() {};
//! Returns true if the file maybe is able to be loaded by this class.
/** This decision should be based only on the file extension (e.g. ".cob") */
virtual bool isALoadableFileExtension(const c8* fileName) = 0;
//! Creates/loads an animated mesh from the file.
/** \return Pointer to the created mesh. Returns 0 if loading failed.
If you no longer need the mesh, you should call IAnimatedMesh::drop().
See IUnknown::drop() for more information. */
virtual IAnimatedMesh* createMesh(irr::io::IReadFile* file) = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,116 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_MESH_MANIPULATOR_H_INCLUDED__
#define __I_MESH_MANIPULATOR_H_INCLUDED__
#include "IUnknown.h"
#include "vector3d.h"
#include "IMeshBuffer.h"
#include "aabbox3d.h"
#include "IAnimatedMesh.h"
namespace irr
{
namespace scene
{
class IMesh;
class IAnimatedMesh;
struct SMesh;
//! An interface for easily manipulate meshes.
/** Scale, set alpha value, flip surfaces, and so on. This exists for fixing problems
with wrong imported or exported meshes quickly after loading. It is not intended for doing mesh
modifications and/or animations during runtime.
*/
class IMeshManipulator : public virtual IUnknown
{
public:
//! destructor
virtual ~IMeshManipulator() {};
//! Flips the direction of surfaces.
/** Changes backfacing triangles to frontfacing
triangles and vice versa.
\param mesh: Mesh on which the operation is performed. */
virtual void flipSurfaces(IMesh* mesh) const = 0;
//! Sets the alpha vertex color value of the whole mesh to a new value.
/** \param mesh: Mesh on which the operation is performed.
\param alpha: New alpha value. Must be a value between 0 and 255. */
virtual void setVertexColorAlpha(IMesh* mesh, s32 alpha) const = 0;
//! Sets the colors of all vertices to one color
virtual void setVertexColors(IMesh* mesh, video::SColor color) const = 0;
//! Recalculates all normals of the mesh.
/** \param mesh: Mesh on which the operation is performed. */
virtual void recalculateNormals(IMesh* mesh, bool smooth = false) const = 0;
//! Recalculates all normals of the mesh buffer.
/** \param buffer: Mesh buffer on which the operation is performed. */
virtual void recalculateNormals(IMeshBuffer* buffer, bool smooth = false) const = 0;
//! Scales the whole mesh.
/** \param mesh: Mesh on which the operation is performed.
\param scale: Scale factor. */
virtual void scaleMesh(IMesh* mesh, const core::vector3df& scale) const = 0;
//! Applies a transformation
/** \param mesh: Mesh on which the operation is performed.
\param m: transformation matrix. */
virtual void transformMesh(IMesh* mesh, const core::matrix4& m) const = 0;
//! Clones a static IMesh into a modifyable SMesh.
/** All meshbuffers in the returned SMesh
are of type SMeshBuffer or SMeshBufferLightMap.
\param mesh: Mesh to copy.
\return Returns the cloned mesh.
If you no longer need the cloned mesh, you should call SMesh::drop().
See IUnknown::drop() for more information. */
virtual SMesh* createMeshCopy(IMesh* mesh) const = 0;
//! Creates a planar texture mapping on the mesh
/** \param mesh: Mesh on which the operation is performed.
\param resolution: resolution of the planar mapping. This is the value
specifying which is the relation between world space and
texture coordinate space. */
virtual void makePlanarTextureMapping(IMesh* mesh, f32 resolution=0.001f) const = 0;
//! Creates a copy of the mesh, which will only consist of S3DVertexTangents vertices.
/** This is useful if you want to draw tangent space normal mapped geometry because
it calculates the tangent and binormal data which is needed there.
\param mesh: Input mesh
\return Mesh consiting only of S3DVertexTangents vertices.
If you no longer need the cloned mesh, you should call IMesh::drop().
See IUnknown::drop() for more information. */
virtual IMesh* createMeshWithTangents(IMesh* mesh) const = 0;
//! Unweld vertices
virtual IMesh* createMeshUniquePrimitives(IMesh* mesh) const = 0;
//! Recalculates the bounding box for a meshbuffer
virtual void recalculateBoundingBox(scene::IMeshBuffer* buffer) const = 0;
//! Returns amount of polygons in mesh.
virtual s32 getPolyCount(scene::IMesh* mesh) const = 0;
//! Returns amount of polygons in mesh.
virtual s32 getPolyCount(scene::IAnimatedMesh* mesh) const = 0;
//! create a new AnimatedMesh and adds the mesh to it
virtual IAnimatedMesh * createAnimatedMesh(scene::IMesh* mesh,
scene::E_ANIMATED_MESH_TYPE type = scene::EAMT_UNKNOWN) const = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,49 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_MESH_SCENE_NODE_H_INCLUDED__
#define __I_MESH_SCENE_NODE_H_INCLUDED__
#include "ISceneNode.h"
namespace irr
{
namespace scene
{
class IMesh;
//! A scene node displaying a static mesh
class IMeshSceneNode : public ISceneNode
{
public:
//! constructor
IMeshSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
const core::vector3df& position, const core::vector3df& rotation,
const core::vector3df& scale)
: ISceneNode(parent, mgr, id, position, rotation, scale) {}
//! Sets a new mesh to display
virtual void setMesh(IMesh* mesh) = 0;
//! Returns the current mesh
virtual IMesh* getMesh(void) = 0;
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes
referencing this mesh to change too. */
virtual void setReadOnlyMaterials(bool readonly) = 0;
//! Returns if the scene node should not copy the materials of the mesh but use them in a read only style
virtual bool isReadOnlyMaterials() = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,44 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_META_TRIANGLE_SELECTOR_H_INCLUDED__
#define __I_META_TRIANGLE_SELECTOR_H_INCLUDED__
#include "ITriangleSelector.h"
namespace irr
{
namespace scene
{
//! Interface for making multiple triangle selectors work as one big selector.
/** This is nothing more than a collection of one or more triangle selectors
providing together the interface of one triangle selector. In this way,
collision tests can be done with different triangle soups in one pass.
*/
class IMetaTriangleSelector : public ITriangleSelector
{
public:
//! Adds a triangle selector to the collection of triangle selectors
//! in this metaTriangleSelector.
//! \param toAdd: Pointer to an triangle selector to add to the list.
virtual void addTriangleSelector(ITriangleSelector* toAdd) = 0;
//! Removes a specific triangle selector which was added before from the collection.
//! \param toRemove: Pointer to an triangle selector which is in the list
//! but will be removed.
//! \return Returns true if successful, false if not.
virtual bool removeTriangleSelector(ITriangleSelector* toRemove) = 0;
//! Removes all triangle selectors from the collection.
virtual void removeAllTriangleSelectors() = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,49 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_OS_OPERATOR_H_INCLUDED__
#define __I_OS_OPERATOR_H_INCLUDED__
#include "IUnknown.h"
namespace irr
{
//! The Operating system operator provides operation system specific methods and informations.
/** Currently only 3 methods are supported. But it will be extended with more functionality
soon. */
class IOSOperator : public virtual IUnknown
{
public:
//! destructor
virtual ~IOSOperator() {}
//! returns the current operation system version as string.
virtual const wchar_t* getOperationSystemVersion() = 0;
//! copies text to the clipboard
virtual void copyToClipboard(const c8* text) = 0;
//! gets text from the clipboard
//! \return Returns 0 if no string is in there.
virtual c8* getTextFromClipboard() = 0;
//! gets the processor speed in megahertz
//! \param Mhz:
//! \return Returns true if successful, false if not
virtual bool getProcessorSpeedMHz(irr::u32* MHz) = 0;
//! gets the total and available system RAM
//! \param Total: will contain the total system memory
//! \param Avail: will contain the available memory
//! \return Returns true if successful, false if not
virtual bool getSystemMemory(irr::u32* Total, irr::u32* Avail) = 0;
};
} // end namespace
#endif

View File

@ -1,78 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_PARTICLE_AFFECTOR_H_INCLUDED__
#define __I_PARTICLE_AFFECTOR_H_INCLUDED__
#include "IAttributeExchangingObject.h"
#include "SParticle.h"
namespace irr
{
namespace scene
{
//! Types of built in particle affectors
enum E_PARTICLE_AFFECTOR_TYPE
{
EPAT_NONE = 0,
EPAT_FADE_OUT,
EPAT_GRAVITY,
EPAT_COUNT
};
//! Names for built in particle affectors
const c8* const ParticleAffectorTypeNames[] =
{
"None",
"FadeOut",
"Gravity",
0
};
//! A particle affector modifies particles.
class IParticleAffector : public virtual io::IAttributeExchangingObject
{
public:
//! constructor
IParticleAffector() : Enabled(true) {}
//! Affects an array of particles.
//! \param now: Current time. (Same as ITimer::getTime() would return)
//! \param particlearray: Array of particles.
//! \param count: Amount of particles in array.
virtual void affect(u32 now, SParticle* particlearray, u32 count) = 0;
//! Sets whether or not the affector is currently enabled.
virtual void setEnabled(bool enabled) {Enabled = enabled;}
//! Gets whether or not the affector is currently enabled.
virtual bool getEnabled() const { return Enabled;}
//! Writes attributes of the object.
//! Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) {}
//! Reads attributes of the object.
//! Implement this to set the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml deserialization purposes.
//! \param startIndex: start index where to start reading attributes.
//! \return: returns last index of an attribute read by this affector
virtual s32 deserializeAttributes(s32 startIndex, io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) { return 0; }
//! Get emitter type
virtual E_PARTICLE_AFFECTOR_TYPE getType() = 0;
protected:
bool Enabled;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,72 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_PARTICLE_EMITTER_H_INCLUDED__
#define __I_PARTICLE_EMITTER_H_INCLUDED__
#include "IAttributeExchangingObject.h"
#include "SParticle.h"
namespace irr
{
namespace scene
{
//! Types of built in particle emitters
enum E_PARTICLE_EMITTER_TYPE
{
EPET_POINT = 0,
EPET_BOX,
EPET_COUNT
};
//! Names for built in particle emitters
const c8* const ParticleEmitterTypeNames[] =
{
"Point",
"Box",
0
};
//! A particle emitter for using with particle systems.
/** A Particle emitter emitts new particles into a particle system.
*/
class IParticleEmitter : public virtual io::IAttributeExchangingObject
{
public:
//! destructor
virtual ~IParticleEmitter() {};
//! Prepares an array with new particles to emitt into the system
//! and returns how much new particles there are.
//! \param now: Current time.
//! \param timeSinceLastCall: Time elapsed since last call, in milliseconds.
//! \param outArray: Pointer which will point to the array with the new
//! particles to add into the system.
//! \return Returns amount of new particles in the array. Can be 0.
virtual s32 emitt(u32 now, u32 timeSinceLastCall, SParticle*& outArray) = 0;
//! Writes attributes of the object.
//! Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) {}
//! Reads attributes of the object.
//! Implement this to set the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml deserialization purposes.
//! \param startIndex: start index where to start reading attributes.
//! \return: returns last index of an attribute read by this affector
virtual s32 deserializeAttributes(s32 startIndex, io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) { return 0; }
//! Get emitter type
virtual E_PARTICLE_EMITTER_TYPE getType() = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,184 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_PARTICLE_SYSTEM_SCENE_NODE_H_INCLUDED__
#define __I_PARTICLE_SYSTEM_SCENE_NODE_H_INCLUDED__
#include "ISceneNode.h"
#include "IParticleEmitter.h"
#include "IParticleAffector.h"
#include "dimension2d.h"
namespace irr
{
namespace scene
{
//! A particle system scene node for creating snow, fire, exlosions, smoke...
/** A scene node controlling a particle System. The behavior of the particles
can be controlling by setting the right particle emitters and effectors.
You can for example easily a campfire by doing this:
\code
scene::IParticleSystemSceneNode* p = scenemgr->addParticleSystemSceneNode();
p->setParticleSize(core::dimension2d<f32>(20.0f, 10.0f));
scene::IParticleEmitter* em = p->createBoxEmitter(
core::aabbox3d<f32>(-5,0,-5,5,1,5),
core::vector3df(0.0f,0.03f,0.0f),
40,80, video::SColor(0,255,255,255),video::SColor(0,255,255,255), 1100,2000);
p->setEmitter(em);
em->drop();
scene::IParticleAffector* paf = p->createFadeOutParticleAffector();
p->addAffector(paf);
paf->drop();
\endcode
*/
class IParticleSystemSceneNode : public ISceneNode
{
public:
//! constructor
IParticleSystemSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
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))
: ISceneNode(parent, mgr, id, position, rotation, scale) {}
//! Sets the size of all particles.
virtual void setParticleSize(
const core::dimension2d<f32> &size = core::dimension2d<f32>(5.0f, 5.0f)) = 0;
//! Sets if the particles should be global. If it is, the particles are affected by
//! the movement of the particle system scene node too, otherwise they completely
//! ignore it. Default is true.
virtual void setParticlesAreGlobal(bool global) = 0;
//! Sets the particle emitter, which creates the particles.
//! A particle emitter can be created using one of the
//! methods. For example to create and use a simple PointEmitter,
//! call IParticleEmitter* p = createPointEmitter(); setEmitter(p); p->drop();
//! \param emitter: Sets the particle emitter. You can set this to 0
//! for removing the current emitter and stopping the particle system
//! emitting new particles.
virtual void setEmitter(IParticleEmitter* emitter) = 0;
//! Adds new particle effector to the particle system. A particle
//! affector modifies the particles. For example, the FadeOut
//! affector lets all particles fade out after some time. It is created
//! and used in this way: IParticleAffector* p = createFadeOutParticleAffector();
//! addAffector(p); p->drop();
//! Please note that a affector is not necessary for the particle
//! system to work.
//! \param affector: New affector.
virtual void addAffector(IParticleAffector* affector) = 0;
//! Removes all particle affectors in the particle system.
virtual void removeAllAffectors() = 0;
//! Creates a point particle emitter.
//! \param direction: Direction and speed of particle emission.
//! \param minParticlesPerSecond: Minimal amount of particles emitted
//! per second.
//! \param maxParticlesPerSecond: Maximal amount of particles emitted
//! per second.
//! \param minStartColor: Minimal initial start color of a particle.
//! The real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor.
//! \param maxStartColor: Maximal initial start color of a particle.
//! The real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor.
//! \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
//! \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
//! \param maxAngleDegrees: Maximal angle in degrees, the emitting direction
//! of the particle will differ from the orignial direction.
//! \return Returns a pointer to the created particle emitter.
//! To set this emitter as new emitter of this particle system,
//! just call setEmitter(). Note that you'll have to drop() the
//! returned pointer, after you don't need it any more, see
//! IUnknown::drop() for more informations.
virtual IParticleEmitter* createPointEmitter(
const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
u32 minParticlesPerSecond = 5,
u32 maxParticlesPerSecond = 10,
video::SColor minStartColor = video::SColor(255,0,0,0),
video::SColor maxStartColor = video::SColor(255,255,255,255),
u32 lifeTimeMin=2000, u32 lifeTimeMax=4000,
s32 maxAngleDegrees=0) = 0;
//! Creates a box particle emitter.
//! \param box: The box for the emitter.
//! \param direction: Direction and speed of particle emission.
//! \param minParticlesPerSecond: Minimal amount of particles emitted
//! per second.
//! \param maxParticlesPerSecond: Maximal amount of particles emitted
//! per second.
//! \param minStartColor: Minimal initial start color of a particle.
//! The real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor.
//! \param maxStartColor: Maximal initial start color of a particle.
//! The real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor.
//! \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
//! \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
//! \param maxAngleDegrees: Maximal angle in degrees, the emitting direction
//! of the particle will differ from the orignial direction.
//! \return Returns a pointer to the created particle emitter.
//! To set this emitter as new emitter of this particle system,
//! just call setEmitter(). Note that you'll have to drop() the
//! returned pointer, after you don't need it any more, see
//! IUnknown::drop() for more informations.
virtual IParticleEmitter* createBoxEmitter(
const core::aabbox3df& box = core::aabbox3df(-10,28,-10,10,30,10),
const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
u32 minParticlesPerSecond = 5,
u32 maxParticlesPerSecond = 10,
video::SColor minStartColor = video::SColor(255,0,0,0),
video::SColor maxStartColor = video::SColor(255,255,255,255),
u32 lifeTimeMin=2000, u32 lifeTimeMax=4000,
s32 maxAngleDegrees=0) = 0;
//! Creates a fade out particle affector. This affector modifies
//! the color of every particle and and reaches the final color
//! when the particle dies.
//! This affector looks really good, if the EMT_TRANSPARENT_VERTEX_ALPHA
//! material is used and the targetColor is video::SColor(0,0,0,0):
//! Particles are fading out into void with this setting.
//! \param targetColor: Color whereto the color of the particle is changed.
//! \param timeNeededToFadeOut: How much time in milli seconds
//! should the affector need to change the color to the targetColor.
//! \return Returns a pointer to the created particle affector.
//! To add this affector as new affector of this particle system,
//! just call addAffector(). Note that you'll have to drop() the
//! returned pointer, after you don't need it any more, see
//! IUnknown::drop() for more informations.
virtual IParticleAffector* createFadeOutParticleAffector(
video::SColor targetColor = video::SColor(0,0,0,0),
u32 timeNeededToFadeOut = 1000) = 0;
//! Creates a gravity affector. This affector modifies the direction
//! of the particle. It assumes that the particle is fired out of the
//! emitter with huge force, but is loosing this after some time
//! and is catched by the gravity then. This affector is ideal for
//! creating things like fountains.
//! \param gravity: Direction and force of gravity.
//! \param timeForceLost: Time in milli seconds when the force
//! of the emitter is totally lost and the particle does not move any more.
//! This is the time where gravity fully affects the particle.
//! \return Returns a pointer to the created particle affector.
//! To add this affector as new affector of this particle system,
//! just call addAffector(). Note that you'll have to drop() the
//! returned pointer, after you don't need it any more, see
//! IUnknown::drop() for more informations.
virtual IParticleAffector* createGravityAffector(
const core::vector3df& gravity = core::vector3df(0.0f,-0.03f,0.0f),
u32 timeForceLost = 1000) = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,45 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_Q3_LEVEL_MESH_H_INCLUDED__
#define __I_Q3_LEVEL_MESH_H_INCLUDED__
#include "IAnimatedMesh.h"
#include "IQ3Shader.h"
namespace irr
{
namespace scene
{
//! Interface for a Mesh wich can be loaded directly from a Quake3 .bsp-file.
/** The Mesh tries to load all textures of the map. There are currently
no additional methods in this class, but maybe there will be some in later
releases if there are feature requests. */
class IQ3LevelMesh : public IAnimatedMesh
{
public:
//! destructor
virtual ~IQ3LevelMesh() {};
//! releases a Mesh from the Q3 Loader
virtual void releaseMesh ( s32 index ) = 0;
//! loads the shader definition
// either from file ( we assume /scripts on fileNameIsValid == 0 )
virtual const quake3::SShader * getShader ( const c8 * filename, s32 fileNameIsValid ) = 0;
//! returns a already loaded Shader
virtual const quake3::SShader * getShader ( u32 index ) const = 0;
//! get's an interface to the entities
virtual const quake3::tQ3EntityList & getEntityList () = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,602 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt / Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_Q3_LEVEL_SHADER_H_INCLUDED__
#define __I_Q3_LEVEL_SHADER_H_INCLUDED__
#include "irrArray.h"
#include "fast_atof.h"
#include "IFileSystem.h"
#include "IVideoDriver.h"
#include "coreutil.h"
namespace irr
{
namespace scene
{
namespace quake3
{
//! Hold the different Mesh Types used for getMesh
enum eQ3MeshIndex
{
E_Q3_MESH_GEOMETRY = 0,
E_Q3_MESH_ITEMS,
E_Q3_MESH_BILLBOARD,
E_Q3_MESH_SIZE
};
// we are not using gamma, so quake3 is very dark.
// define the standard multiplication for lightmaps and vertex colors
const video::E_MATERIAL_TYPE defaultLightMap = video::EMT_LIGHTMAP_M2;
const video::E_MODULATE_FUNC defaultModulate = video::EMFN_MODULATE_2X;
// some useful typedefs
typedef core::array< core::stringc > tStringList;
typedef core::array< video::ITexture* > tTexArray;
// name = "a b c .."
struct SVariable
{
core::stringc name;
core::stringc content;
void clear ()
{
name = core::irrEmtpyStringc;
content = core::irrEmtpyStringc;
}
s32 isValid () const
{
return name.size();
}
bool operator < ( const SVariable &other ) const
{
return name < other.name;
}
};
// string helper.. TODO: move to generic files
inline s32 isEqual ( const core::stringc &string, u32 &pos, const c8 *list[], u32 listSize )
{
const char * in = string.c_str () + pos;
for ( u32 i = 0; i != listSize; ++i )
{
if (string.size() < pos)
return -2;
u32 len = (u32) strlen ( list[i] );
if (string.size() < pos+len)
continue;
if ( in [len] != 0 && in [len] != ' ' )
continue;
if ( strncmp ( in, list[i], len ) )
continue;
pos += len + 1;
return (s32) i;
}
return -2;
}
inline f32 getAsFloat ( const core::stringc &string, u32 &pos )
{
const char * in = string.c_str () + pos;
f32 value = 0.f;
pos += (u32) ( core::fast_atof_move ( in, value ) - in ) + 1;
return value;
}
inline core::vector3df getAsVector3df ( const core::stringc &string, u32 &pos )
{
core::vector3df v;
v.X = getAsFloat ( string, pos );
v.Z = getAsFloat ( string, pos );
v.Y = getAsFloat ( string, pos );
return v;
}
/*
extract substrings
*/
inline void getAsStringList ( tStringList &list, s32 max, const core::stringc &string, u32 &startPos )
{
list.clear ();
s32 finish = 0;
s32 endPos;
do
{
endPos = string.findNext ( ' ', startPos );
if ( endPos == -1 )
{
finish = 1;
endPos = string.size();
}
list.push_back ( string.subString ( startPos, endPos - startPos ) );
startPos = endPos + 1;
if ( list.size() >= (u32) max )
finish = 1;
} while ( !finish );
}
struct SBlendFunc
{
SBlendFunc () : type ( video::EMT_SOLID ), param ( 0.f ) {}
video::E_MATERIAL_TYPE type;
f32 param;
};
// parses the content of Variable cull
inline bool getBackfaceCulling ( const core::stringc &string )
{
if ( string.size() == 0 )
return true;
bool ret = true;
static const c8 * funclist[] = { "none", "disable" };
u32 pos = 0;
switch ( isEqual ( string, pos, funclist, 2 ) )
{
case 0:
case 1:
ret = false;
break;
}
return ret;
}
// parses the content of Variable depthfunc
// return a z-test
inline u32 getDepthFunction ( const core::stringc &string )
{
if ( string.size() == 0 )
return 1;
u32 ret = 1;
static const c8 * funclist[] = { "lequal","equal" };
u32 pos = 0;
switch ( isEqual ( string, pos, funclist, 2 ) )
{
case 0:
ret = 1;
case 1:
ret = 2;
break;
}
return ret;
}
// parses the content of Variable blendfunc,alphafunc
inline static void getBlendFunc ( const core::stringc &string, SBlendFunc &blendfunc )
{
if ( string.size() == 0 )
return;
// maps to E_BLEND_FACTOR
static const c8 * funclist[] =
{
"gl_zero",
"gl_one",
"gl_dst_color",
"gl_one_minus_dst_color",
"gl_src_color",
"gl_one_minus_src_color",
"gl_src_alpha",
"gl_one_minus_src_alpha",
"gl_dst_alpha",
"gl_one_minus_dst_alpha",
"gl_src_alpha_sat",
"add",
"filter",
"blend",
"ge128",
"gt0"
};
u32 pos = 0;
s32 srcFact = isEqual ( string, pos, funclist, 16 );
if ( srcFact < 0 )
return;
u32 resolved = 0;
s32 dstFact = isEqual ( string, pos, funclist, 16 );
switch ( srcFact )
{
case video::EBF_ONE:
switch ( dstFact )
{
// gl_one gl_zero
case video::EBF_ZERO:
blendfunc.type = video::EMT_SOLID;
resolved = 1;
break;
// gl_one gl_one
case video::EBF_ONE:
blendfunc.type = video::EMT_TRANSPARENT_ADD_COLOR;
resolved = 1;
break;
} break;
case video::EBF_SRC_ALPHA:
switch ( dstFact )
{
// gl_src_alpha gl_one_minus_src_alpha
case video::EBF_ONE_MINUS_SRC_ALPHA:
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
blendfunc.param = 1.f / 255.f;
resolved = 1;
break;
} break;
case 11:
// add
blendfunc.type = video::EMT_TRANSPARENT_ADD_COLOR;
resolved = 1;
break;
case 12:
// filter = gl_dst_color gl_zero
blendfunc.type = video::EMT_ONETEXTURE_BLEND;
blendfunc.param = video::pack_texureBlendFunc ( video::EBF_DST_COLOR, video::EBF_ZERO, defaultModulate );
resolved = 1;
break;
case 13:
// blend
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
blendfunc.param = 1.f / 255.f;
resolved = 1;
break;
case 14:
// alphafunc ge128
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
blendfunc.param = 0.5f;
resolved = 1;
break;
case 15:
// alphafunc gt0
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
blendfunc.param = 1.f / 255.f;
resolved = 1;
break;
}
// use the generic blender
if ( 0 == resolved )
{
blendfunc.type = video::EMT_ONETEXTURE_BLEND;
blendfunc.param = video::pack_texureBlendFunc (
(video::E_BLEND_FACTOR) srcFact,
(video::E_BLEND_FACTOR) dstFact,
defaultModulate);
}
}
struct SModifierFunction
{
SModifierFunction ()
: masterfunc0 ( 0 ), masterfunc1(0), func ( 0 ),
tcgen( 8 ), base ( 0 ), amp ( 1 ), phase ( 0 ), freq ( 1 ), wave(1) {}
// "tcmod","deformvertexes","rgbgen", "tcgen"
s32 masterfunc0;
// depends
s32 masterfunc1;
// depends
s32 func;
s32 tcgen;
union
{
f32 base;
f32 bulgewidth;
};
union
{
f32 amp;
f32 bulgeheight;
};
f32 phase;
union
{
f32 freq;
f32 bulgespeed;
};
f32 wave;
f32 evaluate ( f32 dt ) const
{
// phase in 0 and 1..
f32 x = core::fract( (dt + phase ) * freq );
f32 y = 0.f;
switch ( func )
{
// sin
case 0:
y = (f32) sin ( x * core::PI64 * 2.0 );
break;
// cos
case 1:
y = (f32) cos ( x * core::PI64 * 2.0 );
break;
// square
case 2:
y = x < 0.5f ? 1.f : -1.f;
break;
// triangle
case 3:
y = x < 0.5f ? ( 2.f * x ) - 1.f : ( -2.f * x ) + 2.f;
break;
// sawtooth:
case 4:
y = x;
break;
// inverse sawtooth:
case 5:
y = 1.f - x;
break;
}
return base + ( y * amp );
}
};
//
inline void getModifierFunc ( SModifierFunction& fill, const core::stringc &string, u32 &pos )
{
if ( string.size() == 0 )
return;
static const c8 * funclist[] =
{
"sin","cos","square", "triangle", "sawtooth","inversesawtooth"
};
fill.func = quake3::isEqual ( string,pos, funclist,6 );
if ( fill.func == -2 )
fill.func = 0;
fill.base = quake3::getAsFloat ( string, pos );
fill.amp = quake3::getAsFloat ( string, pos );
fill.phase = quake3::getAsFloat ( string, pos );
fill.freq = quake3::getAsFloat ( string, pos );
}
struct SVarGroup
{
// simple assoziative array
s32 getIndex( const c8 * name ) const
{
SVariable search;
search.name = name;
return Variable.linear_search ( search );
}
// searches for Variable name and returns is content
// if Variable is not found a reference to an Empty String is returned
const core::stringc &get( const c8 * name ) const
{
s32 index = getIndex ( name );
if ( index < 0 )
return core::irrEmtpyStringc;
return Variable [ index ].content;
}
bool isDefined ( const c8 * name, const c8 * content = 0 ) const
{
for ( u32 i = 0; i != Variable.size (); ++i )
{
if ( 0 == strcmp ( Variable[i].name.c_str(), name ) )
{
if ( 0 == content )
return true;
if ( 0 == strcmp ( Variable[i].content.c_str(), content ) )
return true;
}
}
return false;
}
core::array < SVariable > Variable;
};
struct SVarGroupList: public IUnknown
{
SVarGroupList () {}
virtual ~SVarGroupList () {}
core::array < SVarGroup > VariableGroup;
};
//! A Parsed Shader Holding Variables ordered in Groups
class SShader
{
public:
bool operator < (const SShader &other ) const
{
return name < other.name;
}
const SVarGroup * getGroup ( u32 stage ) const
{
if ( 0 == VarGroup || stage >= VarGroup->VariableGroup.size () )
return 0;
return &VarGroup->VariableGroup [ stage ];
}
// id
s32 id;
// Shader: shader name ( also first variable in first Vargroup )
// Entity: classname ( variable in Group(1) )
core::stringc name;
SVarGroupList *VarGroup; // reference
};
typedef SShader SEntity;
typedef core::array < SEntity > tQ3EntityList;
/*
dump shader like original layout, regardless of internal data holding
no recursive folding..
*/
inline void dumpVarGroup ( core::stringc &dest, const SVarGroup * group, s32 stack )
{
core::stringc buf;
s32 i;
if ( stack > 0 )
{
buf = "";
for ( i = 0; i < stack - 1; ++i )
buf += '\t';
buf += "{\n";
dest.append ( buf );
}
for ( u32 g = 0; g != group->Variable.size(); ++g )
{
buf = "";
for ( i = 0; i < stack; ++i )
buf += '\t';
buf += group->Variable[g].name;
buf += " ";
buf += group->Variable[g].content;
buf += "\n";
dest.append ( buf );
}
if ( stack > 1 )
{
buf = "";
for ( i = 0; i < stack - 1; ++i )
buf += '\t';
buf += "}\n";
dest.append ( buf );
}
}
inline core::stringc & dumpShader ( core::stringc &dest, const SShader * shader )
{
dest = "";
if ( 0 == shader )
return dest;
const SVarGroup * group;
const u32 size = shader->VarGroup->VariableGroup.size ();
for ( u32 i = 0; i != size; ++i )
{
group = &shader->VarGroup->VariableGroup[ i ];
dumpVarGroup ( dest, group, core::clamp ( (s32) i, 0, 2 ) );
}
if ( size <= 1 )
{
dest.append ( "{\n" );
}
dest.append ( "}\n" );
return dest;
}
/*
quake3 doesn't care much about tga & jpg
load one or multiple files stored in name started at startPos to the texture array textures
if texture is not loaded 0 will be added ( to find missing textures easier)
*/
inline void getTextures ( tTexArray &textures ,
const core::stringc &name, u32 &startPos,
io::IFileSystem *fileSystem,
video::IVideoDriver* driver
)
{
static const char * extension[2] =
{
".jpg",
".tga"
};
tStringList stringList;
getAsStringList ( stringList, -1, name, startPos );
textures.clear();
core::stringc loadFile;
for ( u32 i = 0; i!= stringList.size (); ++i )
{
video::ITexture* texture = 0;
for ( u32 g = 0; g != 2 ; ++g )
{
irr::core::cutFilenameExtension ( loadFile, stringList[i] ).append ( extension[g] );
if ( fileSystem->existFile ( loadFile.c_str() ) )
{
texture = driver->getTexture( loadFile.c_str () );
if ( texture )
{
break;
}
}
}
// take 0 Texture
textures.push_back(texture);
}
}
/*!
Manages various Quake3 Shader Styles
*/
class IShaderManager : public irr::IUnknown
{
};
} // end namespace quake3
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,60 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_READ_FILE_H_INCLUDED__
#define __I_READ_FILE_H_INCLUDED__
#include "IUnknown.h"
namespace irr
{
namespace io
{
//! Interface providing read acess to a file.
class IReadFile : public virtual IUnknown
{
public:
virtual ~IReadFile() {};
//! Reads an amount of bytes from the file.
//! \param buffer: Pointer to buffer where to read bytes will be written to.
//! \param sizeToRead: Amount of bytes to read from the file.
//! \return Returns how much bytes were read.
virtual s32 read(void* buffer, u32 sizeToRead) = 0;
//! Changes position in file, returns true if successful.
//! \param finalPos: Destination position in the file.
//! \param relativeMovement: If set to true, the position in the file is
//! changed relative to current position. Otherwise the position is changed
//! from beginning of file.
//! \return Returns true if successful, otherwise false.
virtual bool seek(s32 finalPos, bool relativeMovement = false) = 0;
//! Returns size of file.
//! \return Returns the size of the file in bytes.
virtual s32 getSize() = 0;
//! Returns the current position in the file.
//! \return Returns the current position in the file in bytes.
virtual s32 getPos() = 0;
//! Returns name of file.
//! \return Returns the file name as zero terminated character string.
virtual const c8* getFileName() = 0;
};
//! Internal function, please do not use.
IReadFile* createReadFile(const c8* fileName);
//! Internal function, please do not use.
IReadFile* createLimitReadFile(const c8* fileName, IReadFile* alreadyOpenedFile, s32 areaSize);
//! Internal function, please do not use.
IReadFile* createMemoryReadFile(void* memory, s32 size, const c8* fileName, bool deleteMemoryWhenDropped);
} // end namespace io
} // end namespace irr
#endif

View File

@ -1,151 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_SCENE_COLLISION_MANAGER_H_INCLUDED__
#define __I_SCENE_COLLISION_MANAGER_H_INCLUDED__
#include "IUnknown.h"
#include "vector3d.h"
#include "triangle3d.h"
#include "position2d.h"
#include "line3d.h"
namespace irr
{
namespace scene
{
class ISceneNode;
class ICameraSceneNode;
class ITriangleSelector;
//! The Scene Collision Manager provides methods for performing collision tests and picking on scene nodes.
class ISceneCollisionManager : public virtual IUnknown
{
public:
//! destructor
virtual ~ISceneCollisionManager() {};
//! Finds the collision point of a line and lots of triangles, if there is one.
//! \param ray: Line with witch collisions are tested.
//! \param selector: TriangleSelector containing the triangles. It can
//! be created for example using ISceneManager::createTriangleSelector() or
//! ISceneManager::createTriangleOctTreeSelector().
//! \param outCollisionPoint: If a collision is detected, this will contain the
//! position of the nearest collision.
//! \param outTriangle: If a collision is detected, this will contain the triangle
//! with which the ray collided.
//! \return Returns true if a collision was detected and false if not.
virtual bool getCollisionPoint(const core::line3d<f32>& ray,
ITriangleSelector* selector, core::vector3df& outCollisionPoint,
core::triangle3df& outTriangle) = 0;
//! Collides a moving ellipsoid with a 3d world with gravity and returns
//! the resulting new position of the ellipsoid. This can be used for moving
//! a character in a 3d world: The character will slide at walls and is able
//! to walk up stairs. The method used how to calculate the collision result
//! position is based on the paper "Improved Collision detection and Response"
//! by Kasper Fauerby.
//! \param selector: TriangleSelector containing the triangles of the world.
//! It can be created for example using ISceneManager::createTriangleSelector() or
//! ISceneManager::createTriangleOctTreeSelector().
//! \param ellipsoidPosition: Position of the ellipsoid.
//! \param ellipsoidRadius: Radius of the ellipsoid.
//! \param ellipsoidDirectionAndSpeed: Direction and speed of
//! the movement of the ellipsoid.
//! \param triout: Optional parameter where the last triangle causing a
//! collision is stored, if there is a collision.
//! \param outFalling: Is set to true if the ellipsoid is falling down, caused
//! by gravity.
//! \param slidingSpeed: DOCUMENTATION NEEDED.
//! \param gravityDirectionAndSpeed: Direction and force of gravity.
//! \return Returns the new position of the ellipsoid.
virtual core::vector3df getCollisionResultPosition(
ITriangleSelector* selector,
const core::vector3df &ellipsoidPosition,
const core::vector3df& ellipsoidRadius,
const core::vector3df& ellipsoidDirectionAndSpeed,
core::triangle3df& triout,
bool& outFalling,
f32 slidingSpeed = 0.0005f,
const core::vector3df& gravityDirectionAndSpeed
= core::vector3df(0.0f, 0.0f, 0.0f)) = 0;
//! Returns a 3d ray which would go through the 2d screen coodinates.
//! \param pos: Screen coordinates in pixels.
//! \param camera: Camera from which the ray starts. If null, the
//! active camera is used.
//! \return Returns a ray starting from the position of the camera
//! and ending at a length of the far value of the camera at a position
//! which would be behind the 2d screen coodinates.
virtual core::line3d<f32> getRayFromScreenCoordinates(
core::position2d<s32> pos, ICameraSceneNode* camera = 0) = 0;
//! Calculates 2d screen position from a 3d position.
//! \param pos: 3D position in world space to be transformed into
//! 2d.
//! \param camera: Camera to be used. If null, the currently active
//! camera is used.
//! \return Returns the 2d screen coordinates which a object in the
//! 3d world would have if it would be rendered to the screen. If the
//! 3d position is behind the camera, it is set to (-10000,-10000). In
//! most cases you can ignore this fact, because if you use this method
//! for drawing a decorator over a 3d object, it will be clipped by the
//! screen borders.
virtual core::position2d<s32> getScreenCoordinatesFrom3DPosition(
core::vector3df pos, ICameraSceneNode* camera=0) = 0;
//! Returns the scene node, which is currently visible under the overgiven
//! screencoordinates, viewed from the currently active camera. The collision
//! tests are done using a bounding box for each scene node.
//! \param pos: Position in pixel screen coordinates, under which the returned
//! scene node will be.
//! \param idBitMask: Only scene nodes with an id with bits set like in this mask
//! will be tested. If the BitMask is 0, this feature is disabled.
//! \param bNoDebugObjects: Doesn't take debug objects into account when true. These
// are scene nodes with IsDebugObject() = true.
//! \return Returns the visible scene node under screen coordinates with matching
//! bits in its id. If there is no scene node under this position, 0 is returned.
virtual ISceneNode* getSceneNodeFromScreenCoordinatesBB(core::position2d<s32> pos,
s32 idBitMask=0, bool bNoDebugObjects = false) = 0;
//! Returns the nearest scene node which collides with a 3d ray and
//! which id matches a bitmask. The collision tests are done using a bounding
//! box for each scene node.
//! \param ray: Line with witch collisions are tested.
//! \param idBitMask: Only scene nodes with an id with bits set like in this mask
//! will be tested. If the BitMask is 0, this feature is disabled.
//! \param bNoDebugObjects: Doesn't take debug objects into account when true. These
// are scene nodes with IsDebugObject() = true.
//! \return Returns the scene node nearest to ray.start, which collides with the
//! ray and matches the idBitMask, if the mask is not null. If no scene
//! node is found, 0 is returned.
virtual ISceneNode* getSceneNodeFromRayBB(core::line3d<f32> ray,
s32 idBitMask=0, bool bNoDebugObjects = false) = 0;
//! Returns the scene node, at which the overgiven camera is looking at and
//! which id matches the bitmask. A ray is simply casted from the position
//! of the camera to the view target position, and all scene nodes are tested
//! against this ray. The collision tests are done using a bounding
//! box for each scene node.
//! \param camera: Camera from which the ray is casted.
//! \param idBitMask: Only scene nodes with an id with bits set like in this mask
//! will be tested. If the BitMask is 0, this feature is disabled.
//! \param bNoDebugObjects: Doesn't take debug objects into account when true. These
// are scene nodes with IsDebugObject() = true.
//! \return Returns the scene node nearest to the camera, which collides with the
//! ray and matches the idBitMask, if the mask is not null. If no scene
//! node is found, 0 is returned.
virtual ISceneNode* getSceneNodeFromCameraBB(ICameraSceneNode* camera,
s32 idBitMask=0, bool bNoDebugObjects = false) = 0;
};
} // end namespace scene
} // end namespace irr
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,659 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_SCENE_NODE_H_INCLUDED__
#define __I_SCENE_NODE_H_INCLUDED__
#include "IUnknown.h"
#include "ESceneNodeTypes.h"
#include "ISceneManager.h"
#include "ISceneNodeAnimator.h"
#include "ITriangleSelector.h"
#include "SMaterial.h"
#include "irrString.h"
#include "aabbox3d.h"
#include "matrix4.h"
#include "irrList.h"
#include "IAttributes.h"
#include "IAttributeExchangingObject.h"
namespace irr
{
namespace scene
{
//! Scene node interface.
/** A scene node is a node in the hirachical scene graph. Every scene node may have children,
which are other scene nodes. Children move relative the their parents position. If the parent of a node is not
visible, its children won't be visible too. In this way, it is for example easily possible
to attach a light to a moving car, or to place a walking character on a moving platform
on a moving ship. */
class ISceneNode : public io::IAttributeExchangingObject
{
public:
//! Constructor
ISceneNode( ISceneNode* parent, ISceneManager* mgr, 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))
: RelativeTranslation(position), RelativeRotation(rotation), RelativeScale(scale),
Parent(parent), ID(id), SceneManager(mgr), TriangleSelector(0),
AutomaticCullingState(EAC_BOX), IsVisible(true),
DebugDataVisible(EDS_OFF), IsDebugObject(false)
{
if (Parent)
Parent->addChild(this);
updateAbsolutePosition();
}
//! Destructor
virtual ~ISceneNode()
{
// delete all children
removeAll();
// delete all animators
core::list<ISceneNodeAnimator*>::Iterator ait = Animators.begin();
for (; ait != Animators.end(); ++ait)
(*ait)->drop();
if (TriangleSelector)
TriangleSelector->drop();
}
//! This method is called just before the rendering process of the whole scene.
/** Nodes may register themselves in the render pipeline during this call,
precalculate the geometry which should be renderered, and prevent their
children from being able to register them selfes if they are clipped by simply
not calling their OnRegisterSceneNode-Method.
If you are implementing your own scene node, you should overwrite this method
with an implementtion code looking like this:
\code
if (IsVisible)
SceneManager->registerNodeForRendering(this);
ISceneNode::OnRegisterSceneNode();
\endcode
*/
virtual void OnRegisterSceneNode()
{
if (IsVisible)
{
core::list<ISceneNode*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
(*it)->OnRegisterSceneNode();
}
}
//! OnAnimate() is called just before rendering the whole scene.
//! Nodes may calculate or store animations here, and may do other useful things,
//! dependent on what they are. Also, OnAnimate() should be called for all
//! child scene nodes here. This method will called once per frame, independent
//! of if the scene node is visible or not.
//! \param timeMs: Current time in milli seconds.
virtual void OnAnimate(u32 timeMs)
{
if (IsVisible)
{
// animate this node with all animators
core::list<ISceneNodeAnimator*>::Iterator ait = Animators.begin();
for (; ait != Animators.end(); ++ait)
(*ait)->animateNode(this, timeMs);
// update absolute position
updateAbsolutePosition();
// perform the post render process on all children
core::list<ISceneNode*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
(*it)->OnAnimate(timeMs);
}
}
//! Renders the node.
virtual void render() = 0;
//! Returns the name of the node.
//! \return Returns name as wide character string.
virtual const c8* getName() const
{
return Name.c_str();
}
//! Sets the name of the node.
//! \param name: New name of the scene node.
virtual void setName(const c8* name)
{
Name = name;
}
//! Returns the axis aligned, not transformed bounding box of this node.
//! This means that if this node is a animated 3d character, moving in a room,
//! the bounding box will always be around the origin. To get the box in
//! real world coordinates, just transform it with the matrix you receive with
//! getAbsoluteTransformation() or simply use getTransformedBoundingBox(),
//! which does the same.
virtual const core::aabbox3d<f32>& getBoundingBox() const = 0;
//! Returns the axis aligned, transformed and animated absolute bounding box
//! of this node.
virtual const core::aabbox3d<f32> getTransformedBoundingBox() const
{
core::aabbox3d<f32> box = getBoundingBox();
AbsoluteTransformation.transformBox(box);
return box;
}
//! returns the absolute transformation of the node. Is recalculated every OnAnimate()-call.
const core::matrix4& getAbsoluteTransformation() const
{
return AbsoluteTransformation;
}
//! Returns the relative transformation of the scene node.
//! The relative transformation is stored internally as 3 vectors:
//! translation, rotation and scale. To get the relative transformation
//! matrix, it is calculated from these values.
//! \return Returns the relative transformation matrix.
virtual core::matrix4 getRelativeTransformation() const
{
core::matrix4 mat;
mat.setRotationDegrees(RelativeRotation);
mat.setTranslation(RelativeTranslation);
if (RelativeScale != core::vector3df(1,1,1))
{
core::matrix4 smat;
smat.setScale(RelativeScale);
mat *= smat;
}
return mat;
}
//! Returns true if the node is visible. This is only an option, set by the user and has
//! nothing to do with geometry culling
virtual bool isVisible() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsVisible;
}
//! Sets if the node should be visible or not. All children of this node won't be visible too.
virtual void setVisible(bool isVisible)
{
IsVisible = isVisible;
}
//! Returns the id of the scene node. This id can be used to identify the node.
virtual s32 getID() const
{
return ID;
}
//! sets the id of the scene node. This id can be used to identify the node.
virtual void setID(s32 id)
{
ID = id;
}
//! Adds a child to this scene node. If the scene node already
//! has got a parent, it is removed from there as child.
virtual void addChild(ISceneNode* child)
{
if (child)
{
child->grab();
child->remove(); // remove from old parent
Children.push_back(child);
child->Parent = this;
}
}
//! Removes a child from this scene node.
//! \return Returns true if the child could be removed, and false if not.
virtual bool removeChild(ISceneNode* child)
{
core::list<ISceneNode*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
if ((*it) == child)
{
(*it)->Parent = 0;
(*it)->drop();
Children.erase(it);
return true;
}
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return false;
}
//! Removes all children of this scene node
virtual void removeAll()
{
core::list<ISceneNode*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
{
(*it)->Parent = 0;
(*it)->drop();
}
Children.clear();
}
//! Removes this scene node from the scene, deleting it.
virtual void remove()
{
if (Parent)
Parent->removeChild(this);
}
//! Adds an animator which should animate this node.
virtual void addAnimator(ISceneNodeAnimator* animator)
{
if (animator)
{
Animators.push_back(animator);
animator->grab();
}
}
//! Returns a const reference to the list of all scene node animators.
const core::list<ISceneNodeAnimator*>& getAnimators() const
{
return Animators;
}
//! Removes an animator from this scene node.
virtual void removeAnimator(ISceneNodeAnimator* animator)
{
core::list<ISceneNodeAnimator*>::Iterator it = Animators.begin();
for (; it != Animators.end(); ++it)
if ((*it) == animator)
{
(*it)->drop();
Animators.erase(it);
return;
}
}
//! Removes all animators from this scene node.
virtual void removeAnimators()
{
core::list<ISceneNodeAnimator*>::Iterator it = Animators.begin();
for (; it != Animators.end(); ++it)
(*it)->drop();
Animators.clear();
}
//! Returns the material based on the zero based index i. To get the amount
//! of materials used by this scene node, use getMaterialCount().
//! This function is needed for inserting the node into the scene hirachy on a
//! optimal position for minimizing renderstate changes, but can also be used
//! to directly modify the material of a scene node.
//! \param num: Zero based index. The maximal value is getMaterialCount() - 1.
//! \return Returns the material of that index.
virtual video::SMaterial& getMaterial(u32 num)
{
return *((video::SMaterial*)0);
}
//! Returns amount of materials used by this scene node.
//! \return Returns current count of materials used by this scene node.
virtual u32 getMaterialCount()
{
return 0;
}
//! Sets all material flags at once to a new value. Helpful for
//! example, if you want to be the the whole mesh to be lighted by
//! \param flag: Which flag of all materials to be set.
//! \param newvalue: New value of the flag.
void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
{
for (u32 i=0; i<getMaterialCount(); ++i)
getMaterial(i).setFlag(flag, newvalue);
}
//! Sets the texture of the specified layer in all materials of this
//! scene node to the new texture.
//! \param textureLayer: Layer of texture to be set. Must be a value greater or
//! equal than 0 and smaller than MATERIAL_MAX_TEXTURES.
//! \param texture: Texture to be used.
void setMaterialTexture(u32 textureLayer, video::ITexture* texture)
{
if (textureLayer>= video::MATERIAL_MAX_TEXTURES)
return;
for (u32 i=0; i<getMaterialCount(); ++i)
getMaterial(i).Textures[textureLayer] = texture;
}
//! Sets the material type of all materials s32 this scene node
//! to a new material type.
//! \param newType: New type of material to be set.
void setMaterialType(video::E_MATERIAL_TYPE newType)
{
for (u32 i=0; i<getMaterialCount(); ++i)
getMaterial(i).MaterialType = newType;
}
//! Gets the scale of the scene node.
/** \return Returns the scale of the scene node. */
virtual core::vector3df getScale() const
{
return RelativeScale;
}
//! Sets the scale of the scene node.
/** \param scale: New scale of the node */
virtual void setScale(const core::vector3df& scale)
{
RelativeScale = scale;
}
//! Gets the rotation of the node.
/** Note that this is the relative rotation of the node.
\return Current relative rotation of the scene node. */
virtual const core::vector3df& getRotation() const
{
return RelativeRotation;
}
//! Sets the rotation of the node.
/** This only modifies the relative rotation of the node.
\param rotation: New rotation of the node in degrees. */
virtual void setRotation(const core::vector3df& rotation)
{
RelativeRotation = rotation;
}
//! Gets the position of the node.
/** Note that the position is relative to the parent.
\return Returns the current position of the node relative to the parent. */
virtual const core::vector3df getPosition() const
{
return RelativeTranslation;
}
//! Sets the position of the node.
/** Note that the position is relative to the parent.
\param newpos: New relative postition of the scene node. */
virtual void setPosition(const core::vector3df& newpos)
{
RelativeTranslation = newpos;
}
//! Gets the abolute position of the node.
/** The position is absolute.
\return Returns the current absolute position of the scene node. */
virtual core::vector3df getAbsolutePosition() const
{
return AbsoluteTransformation.getTranslation();
}
//! Enables or disables automatic culling based on the bounding box.
/** Automatic culling is enabled by default. Note that not
all SceneNodes support culling (the billboard scene node for example)
and that some nodes always cull their geometry because it is their
only reason for existance, for example the OctreeSceneNode.
\param enabled: If true, automatic culling is enabled.
If false, it is disabled. */
void setAutomaticCulling( E_CULLING_TYPE state)
{
AutomaticCullingState = state;
}
//! Gets the automatic culling state.
/** \return The node is culled based on its bounding box if this method
returns true, otherwise no culling is performed. */
E_CULLING_TYPE getAutomaticCulling() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return AutomaticCullingState;
}
//! Sets if debug data like bounding boxes should be drawn.
/** Please note that not all scene nodes support this feature. */
virtual void setDebugDataVisible(E_DEBUG_SCENE_TYPE visible)
{
DebugDataVisible = visible;
}
//! Returns if debug data like bounding boxes are drawed.
E_DEBUG_SCENE_TYPE isDebugDataVisible() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return DebugDataVisible;
}
//! Sets if this scene node is a debug object.
/** Debug objects have some special properties, for example they can be easily
excluded from collision detection or from serialization, etc. */
void setIsDebugObject(bool debugObject)
{
IsDebugObject = debugObject;
}
//! Returns if this scene node is a debug object.
/** Debug objects have some special properties, for example they can be easily
excluded from collision detection or from serialization, etc. */
bool isDebugObject()
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsDebugObject;
}
//! Returns a const reference to the list of all children.
const core::list<ISceneNode*>& getChildren() const
{
return Children;
}
//! Changes the parent of the scene node.
virtual void setParent(ISceneNode* newParent)
{
grab();
remove();
Parent = newParent;
if (Parent)
Parent->addChild(this);
drop();
}
//! Returns the triangle selector attached to this scene node.
//! The Selector can be used by the engine for doing collision
//! detection. You can create a TriangleSelector with
//! ISceneManager::createTriangleSelector() or
//! ISceneManager::createOctTreeTriangleSelector and set it with
//! ISceneNode::setTriangleSelector(). If a scene node got no triangle
//! selector, but collision tests should be done with it, a triangle
//! selector is created using the bounding box of the scene node.
//! \return Returns a pointer to the TriangleSelector or NULL, if there
//! is none.
virtual ITriangleSelector* getTriangleSelector() const
{
return TriangleSelector;
}
//! Sets the triangle selector of the scene node. The Selector can be
//! used by the engine for doing collision detection. You can create a
//! TriangleSelector with ISceneManager::createTriangleSelector() or
//! ISceneManager::createOctTreeTriangleSelector(). Some nodes may
//! create their own selector by default, so it would be good to
//! check if there is already a selector in this node by calling
//! ISceneNode::getTriangleSelector().
//! \param selector: New triangle selector for this scene node.
virtual void setTriangleSelector(ITriangleSelector* selector)
{
if (TriangleSelector)
TriangleSelector->drop();
TriangleSelector = selector;
if (TriangleSelector)
TriangleSelector->grab();
}
//! updates the absolute position based on the relative and the parents position
virtual void updateAbsolutePosition()
{
if (Parent )
{
AbsoluteTransformation =
Parent->getAbsoluteTransformation() * getRelativeTransformation();
}
else
AbsoluteTransformation = getRelativeTransformation();
}
//! Returns the parent of this scene node
scene::ISceneNode* getParent() const
{
return Parent;
}
//! Returns type of the scene node
virtual ESCENE_NODE_TYPE getType() const
{
return ESNT_UNKNOWN;
}
//! Writes attributes of the scene node.
//! Implement this to expose the attributes of your scene node for
//! scripting languages, editors, debuggers or xml serialization purposes.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0)
{
out->addString ("Name", Name.c_str());
out->addInt ("Id", ID );
out->addVector3d("Position", RelativeTranslation );
out->addVector3d("Rotation", RelativeRotation );
out->addVector3d("Scale", RelativeScale );
out->addBool ("Visible", IsVisible );
out->addEnum ("AutomaticCulling", AutomaticCullingState, AutomaticCullingNames);
out->addInt ("DebugDataVisible", DebugDataVisible );
out->addBool ("IsDebugObject", IsDebugObject );
}
//! Reads attributes of the scene node.
//! Implement this to set the attributes of your scene node for
//! scripting languages, editors, debuggers or xml deserialization purposes.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
Name = in->getAttributeAsString("Name");
ID = in->getAttributeAsInt("Id");
RelativeTranslation = in->getAttributeAsVector3d("Position");
RelativeRotation = in->getAttributeAsVector3d("Rotation");
RelativeScale = in->getAttributeAsVector3d("Scale");
IsVisible = in->getAttributeAsBool("Visible");
AutomaticCullingState = (scene::E_CULLING_TYPE ) in->getAttributeAsEnumeration("AutomaticCulling", scene::AutomaticCullingNames);
DebugDataVisible = (scene::E_DEBUG_SCENE_TYPE ) in->getAttributeAsInt("DebugDataVisible");
IsDebugObject = in->getAttributeAsBool("IsDebugObject");
updateAbsolutePosition();
}
protected:
//! name of the scene node.
core::stringc Name;
//! absolute transformation of the node.
core::matrix4 AbsoluteTransformation;
//! relative translation of the scene node.
core::vector3df RelativeTranslation;
//! relative rotation of the scene node.
core::vector3df RelativeRotation;
//! relative scale of the scene node.
core::vector3df RelativeScale;
//! Pointer to the parent
ISceneNode* Parent;
//! List of all children of this node
core::list<ISceneNode*> Children;
//! List of all animator nodes
core::list<ISceneNodeAnimator*> Animators;
//! id of the node.
s32 ID;
//! pointer to the scene manager
ISceneManager* SceneManager;
//! pointer to the triangle selector
ITriangleSelector* TriangleSelector;
//! automatic culling
E_CULLING_TYPE AutomaticCullingState;
//! is the node visible?
bool IsVisible;
//! flag if debug data should be drawn, such as Bounding Boxes.
E_DEBUG_SCENE_TYPE DebugDataVisible;
//! is debug object?
bool IsDebugObject;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,52 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_SCENE_NODE_ANIMATOR_H_INCLUDED__
#define __I_SCENE_NODE_ANIMATOR_H_INCLUDED__
#include "IUnknown.h"
#include "vector3d.h"
#include "ESceneNodeAnimatorTypes.h"
#include "IAttributeExchangingObject.h"
namespace irr
{
namespace io
{
class IAttributes;
} // end namespace io
namespace scene
{
class ISceneNode;
//! Animates a scene node. Can animate position, rotation, material, and so on.
/** A scene node animator is able to animate a scene node in a very simple way. It may
change its position, rotation, scale and/or material. There are lots of animators
to choose from. You can create scene node animators with the ISceneManager interface.
*/
class ISceneNodeAnimator : public io::IAttributeExchangingObject
{
public:
//! destructor
virtual ~ISceneNodeAnimator() {}
/// <summary>
/// Animates a scene node.
/// </summary>
/// \param node: Node to animate.
/// \param timeMs: Current time in milli seconds.
virtual void animateNode(ISceneNode* node, u32 timeMs) = 0;
//! Returns type of the scene node animator
virtual ESCENE_NODE_ANIMATOR_TYPE getType()
{
return ESNAT_UNKNOWN;
}
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,93 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_SCENE_NODE_ANIMATOR_COLLISION_RESPONSE_H_INCLUDED__
#define __I_SCENE_NODE_ANIMATOR_COLLISION_RESPONSE_H_INCLUDED__
#include "ISceneNode.h"
namespace irr
{
namespace scene
{
//! Special scene node animator for doing automatic collision detection and response.
/** This scene node animator can be attached to any scene node modifying it in that
way, that it cannot move through walls of the world, is influenced by gravity and
acceleration. This animator is useful for example for first person shooter
games. Attach it for example to a first person shooter camera, and the camera will
behave as the player control in a first person shooter game: The camera stops and
slides at walls, walks up stairs, falls down if there is no floor under it, and so on.
*/
class ISceneNodeAnimatorCollisionResponse : public ISceneNodeAnimator
{
public:
//! destructor
virtual ~ISceneNodeAnimatorCollisionResponse() {}
//! Returns if the attached scene node is falling, which means that
//! there is no blocking wall from the scene node in the direction of
//! the gravity. The implementation of this method is very fast,
//! no collision detection is done when invoking it.
//! \return Returns true if the scene node is falling, false if not.
virtual bool isFalling() = 0;
//! Sets the radius of the ellipsoid with which collision detection and
//! response is done. If you have got a scene node, and you are unsure about
//! how big the radius should be, you could use the following code to determine
//! it:
//! \code
//! core::aabbox<f32> box = yourSceneNode->getBoundingBox();
//! core::vector3df radius = box.MaxEdge - box.getCenter();
//! \endcode
//! \param radius: New radius of the ellipsoid.
virtual void setEllipsoidRadius(const core::vector3df& radius) = 0;
//! Returns the radius of the ellipsoid with wich the collision detection and
//! response is done.
//! \return Radius of the ellipsoid.
virtual core::vector3df getEllipsoidRadius() const = 0;
//! Sets the gravity of the environment. A good example value would be
//! core::vector3df(0,-100.0f,0) for letting gravity affect all object to
//! fall down. For bigger gravity, make increase the length of the vector.
//! You can disable gravity by setting it to core::vector3df(0,0,0);
//! \param gravity: New gravity vector.
virtual void setGravity(const core::vector3df& gravity) = 0;
//! Returns current vector of gravity.
//! \return Returns the gravity vector.
virtual core::vector3df getGravity() const = 0;
//! By default, the ellipsoid for collision detection is created around
//! the center of the scene node, which means that the ellipsoid surrounds
//! it completely. If this is not what you want, you may specify a translation
//! for the ellipsoid.
//! \param translation: Translation of the ellipsoid relative
//! to the position of the scene node.
virtual void setEllipsoidTranslation(const core::vector3df &translation) = 0;
//! Returns the translation of the ellipsoid for collision detection. See
//! ISceneNodeAnimatorCollisionResponse::setEllipsoidTranslation() for
//! more details.
//! \return Returns the tranlation of the ellipsoid relative to the position
//! of the scene node.
virtual core::vector3df getEllipsoidTranslation() const = 0;
//! Sets a triangle selector holding all triangles of the world with which
//! the scene node may collide.
//! \param newWorld: New triangle selector containing triangles to let the
//! scene node collide with.
virtual void setWorld(ITriangleSelector* newWorld) = 0;
//! Returns the current triangle selector containing all triangles for
//! collision detection.
virtual ITriangleSelector* getWorld() const = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,69 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_SCENE_NODE_ANIMATOR_FACTORY_H_INCLUDED__
#define __I_SCENE_NODE_ANIMATOR_FACTORY_H_INCLUDED__
#include "IUnknown.h"
#include "ESceneNodeAnimatorTypes.h"
namespace irr
{
namespace scene
{
class ISceneNode;
class ISceneNodeAnimator;
//! Interface making it possible to dynamicly create scene nodes animators
/** To be able to add custom scene node animators to Irrlicht and to make it possible for the
scene manager to save and load those external animators, simply implement this
interface and register it in you scene manager via ISceneManager::registerSceneNodeAnimatorFactory.
Note: When implementing your own scene node factory, don't call ISceneNodeManager::grab() to
increase the reference counter of the scene node manager. This is not necessary because the
scene node manager will grab() the factory anyway, and otherwise cyclic references will
be created and the scene manager and all its nodes won't get deallocated.
*/
class ISceneNodeAnimatorFactory : public virtual IUnknown
{
public:
//! creates a scene node animator based on its type id
/** \param type: Type of the scene node animator to add.
\param target: Target scene node of the new animator.
\return Returns pointer to the new scene node animator or null if not successful. You need to
drop this pointer after calling this, see IUnknown::drop() for details. */
virtual ISceneNodeAnimator* createSceneNodeAnimator(ESCENE_NODE_ANIMATOR_TYPE type, ISceneNode* target) = 0;
//! creates a scene node animator based on its type name
/** \param typeName: Type of the scene node animator to add.
\param target: Target scene node of the new animator.
\return Returns pointer to the new scene node animator or null if not successful. You need to
drop this pointer after calling this, see IUnknown::drop() for details. */
virtual ISceneNodeAnimator* createSceneNodeAnimator(const c8* typeName, ISceneNode* target) = 0;
//! returns amount of scene node animator types this factory is able to create
virtual s32 getCreatableSceneNodeAnimatorTypeCount() = 0;
//! returns type of a createable scene node animator type
/** \param idx: Index of scene node animator type in this factory. Must be a value between 0 and
getCreatableSceneNodeTypeCount() */
virtual ESCENE_NODE_ANIMATOR_TYPE getCreateableSceneNodeAnimatorType(s32 idx) = 0;
//! returns type name of a createable scene node animator type
/** \param idx: Index of scene node animator type in this factory. Must be a value between 0 and
getCreatableSceneNodeAnimatorTypeCount() */
virtual const c8* getCreateableSceneNodeAnimatorTypeName(s32 idx) = 0;
//! returns type name of a createable scene node animator type
/** \param type: Type of scene node animator.
\return: Returns name of scene node animator type if this factory can create the type, otherwise 0. */
virtual const c8* getCreateableSceneNodeAnimatorTypeName(ESCENE_NODE_ANIMATOR_TYPE type) = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,68 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_SCENE_NODE_FACTORY_H_INCLUDED__
#define __I_SCENE_NODE_FACTORY_H_INCLUDED__
#include "IUnknown.h"
#include "ESceneNodeTypes.h"
namespace irr
{
namespace scene
{
class ISceneNode;
//! Interface making it possible to dynamicly create scene nodes
/** To be able to add custom scene nodes to Irrlicht and to make it possible for the
scene manager to save and load those external scene nodes, simply implement this
interface and register it in you scene manager via ISceneManager::registerSceneNodeFactory.
Note: When implementing your own scene node factory, don't call ISceneNodeManager::grab() to
increase the reference counter of the scene node manager. This is not necessary because the
scene node manager will grab() the factory anyway, and otherwise cyclic references will
be created and the scene manager and all its nodes won't get deallocated.
*/
class ISceneNodeFactory : public virtual IUnknown
{
public:
//! adds a scene node to the scene graph based on its type id
/** \param type: Type of the scene node to add.
\param parent: Parent scene node of the new node, can be null to add the scene node to the root.
\return Returns pointer to the new scene node or null if not successful. */
virtual ISceneNode* addSceneNode(ESCENE_NODE_TYPE type, ISceneNode* parent=0) = 0;
//! adds a scene node to the scene graph based on its type name
/** \param typeName: Type name of the scene node to add.
\param parent: Parent scene node of the new node, can be null to add the scene node to the root.
\return Returns pointer to the new scene node or null if not successful. */
virtual ISceneNode* addSceneNode(const c8* typeName, ISceneNode* parent=0) = 0;
//! returns amount of scene node types this factory is able to create
virtual s32 getCreatableSceneNodeTypeCount() = 0;
//! returns type of a createable scene node type
/** \param idx: Index of scene node type in this factory. Must be a value between 0 and
getCreatableSceneNodeTypeCount() */
virtual ESCENE_NODE_TYPE getCreateableSceneNodeType(s32 idx) = 0;
//! returns type name of a createable scene node type by index
/** \param idx: Index of scene node type in this factory. Must be a value between 0 and
getCreatableSceneNodeTypeCount() */
virtual const c8* getCreateableSceneNodeTypeName(s32 idx) = 0;
//! returns type name of a createable scene node type
/** \param type: Type of scene node.
\return: Returns name of scene node type if this factory can create the type, otherwise 0. */
virtual const c8* getCreateableSceneNodeTypeName(ESCENE_NODE_TYPE type) = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,48 +0,0 @@
// 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
#ifndef __I_SCENE_USER_DATA_SERIALIZER_H_INCLUDED__
#define __I_SCENE_USER_DATA_SERIALIZER_H_INCLUDED__
#include "IUnknown.h"
namespace irr
{
namespace io
{
class IAttributes;
} // end namespace io
namespace scene
{
class ISceneNode;
//! Interface to read and write user data to and from .irr files.
/** This interface is to be imlpemented by the user, to make it possible to read
and write user data when reading or writing .irr files via ISceneManager.
To be used with ISceneManager::loadScene() and ISceneManager::saveScene() */
class ISceneUserDataSerializer
{
public:
virtual ~ISceneUserDataSerializer() {}
//! Called when the scene manager read a scene node while loading a file.
/** The userData pointer contains a list of attributes with userData which
were attached to the scene node in the read scene file.*/
virtual void OnReadUserData(ISceneNode* forSceneNode, io::IAttributes* userData) = 0;
//! Called when the scene manager is writing a scene node to an xml file for example.
/** Implement this method and return a list of attributes containing the user data
you want to be saved together with the scene node. Return 0 if no user data should
be added. Please note that the scene manager will call drop() to the returned pointer
after it no longer needs it, so if you didn't create a new object for the return value
and returning a longer existing IAttributes object, simply call grab() before returning it. */
virtual io::IAttributes* createUserData(ISceneNode* forSceneNode) = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,67 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_SHADER_CONSTANT_SET_CALLBACT_H_INCLUDED__
#define __I_SHADER_CONSTANT_SET_CALLBACT_H_INCLUDED__
#include "IUnknown.h"
namespace irr
{
namespace video
{
class IMaterialRendererServices;
//! Interface making it possible to set constants for gpu programs every frame.
/** Implement this interface in an own class and pass a pointer to it to one of the methods in
IGPUProgrammingServices when creating a shader. The OnSetConstants method will be called
every frame now. */
class IShaderConstantSetCallBack : public virtual IUnknown
{
public:
//! Destructor.
virtual ~IShaderConstantSetCallBack() {}
//! Called by the engine when the vertex and/or pixel shader constants for an material renderer should be set.
/**
Implement the IShaderConstantSetCallBack in an own class and implement your own
OnSetConstants method using the given IMaterialRendererServices interface.
Pass a pointer to this class to one of the methods in IGPUProgrammingServices
when creating a shader. The OnSetConstants method will now be called every time
before geometry is being drawn using your shader material. A sample implementation
would look like this:
\code
virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 userData)
{
video::IVideoDriver* driver = services->getVideoDriver();
// set clip matrix at register 4
core::matrix4 worldViewProj(driver->getTransform(video::ETS_PROJECTION));
worldViewProj *= driver->getTransform(video::ETS_VIEW);
worldViewProj *= driver->getTransform(video::ETS_WORLD);
services->setVertexShaderConstant(&worldViewProj.M[0], 4, 4);
// for high level shading languages, this would be another solution:
//services->setVertexShaderConstant("mWorldViewProj", worldViewProj.M, 16);
// set some light color at register 9
video::SColorf col(0.0f,1.0f,1.0f,0.0f);
services->setVertexShaderConstant(reinterpret_cast<const f32*>(&col), 9, 1);
// for high level shading languages, this would be another solution:
//services->setVertexShaderConstant("myColor", reinterpret_cast<f32*>(&col), 4);
}
\endcode
\param services: Pointer to an interface providing methods to set the constants for the shader.
\param userData: Userdata int which can be specified when creating the shader.
*/
virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData) = 0;
};
} // end namespace video
} // end namespace irr
#endif

View File

@ -1,33 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_SHADOW_VOLUME_SCENE_NODE_H_INCLUDED__
#define __I_SHADOW_VOLUME_SCENE_NODE_H_INCLUDED__
#include "ISceneNode.h"
#include "IMesh.h"
namespace irr
{
namespace scene
{
//! Scene node for rendering a shadow volume into a stencil buffer.
class IShadowVolumeSceneNode : public ISceneNode
{
public:
//! constructor
IShadowVolumeSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id)
: ISceneNode(parent, mgr, id) {}
//! sets the mesh from which the shadow volume should be generated.
virtual void setMeshToRenderFrom(IMesh* mesh) = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,140 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
// The code for the TerrainSceneNode is based on the terrain renderer by Soconne and
// the GeoMipMapSceneNode developed by Spintz. They made their code available for Irrlicht
// and allowed it to be distributed under this licence. I only modified some parts.
// A lot of thanks go to them.
#ifndef __I_TERRAIN_SCENE_NODE_H__
#define __I_TERRAIN_SCENE_NODE_H__
#include "ETerrainElements.h"
#include "ISceneNode.h"
#include "SMeshBufferLightMap.h"
#include "IMesh.h"
#include "irrArray.h"
namespace irr
{
namespace scene
{
//! A scene node for displaying terrain using the geo mip map algorithm.
/** The code for the TerrainSceneNode is based on the Terrain renderer by Soconne and
* the GeoMipMapSceneNode developed by Spintz. They made their code available for Irrlicht
* and allowed it to be distributed under this licence. I only modified some parts.
* A lot of thanks go to them.
*
* This scene node is capable of very quickly loading
* terrains and updating the indices at runtime to enable viewing very large terrains. It uses a
* CLOD ( Continuous Level of Detail ) algorithm which updates the indices for each patch based on
* a LOD ( Level of Detail ) which is determined based on a patch's distance from the camera.
*
* The Patch Size of the terrain must always be a size of ( 2^N+1, i.e. 8+1(9), 16+1(17), etc. ).
* The MaxLOD available is directly dependent on the patch size of the terrain. LOD 0 contains all
* of the indices to draw all the triangles at the max detail for a patch. As each LOD goes up by 1
* the step taken, in generating indices increases by - 2^LOD, so for LOD 1, the step taken is 2, for
* LOD 2, the step taken is 4, LOD 3 - 8, etc. The step can be no larger than the size of the patch,
* so having a LOD of 8, with a patch size of 17, is asking the algoritm to generate indices every
* 2^8 ( 256 ) vertices, which is not possible with a patch size of 17. The maximum LOD for a patch
* size of 17 is 2^4 ( 16 ). So, with a MaxLOD of 5, you'll have LOD 0 ( full detail ), LOD 1 ( every
* 2 vertices ), LOD 2 ( every 4 vertices ), LOD 3 ( every 8 vertices ) and LOD 4 ( every 16 vertices ).
**/
class ITerrainSceneNode : public ISceneNode
{
public:
//! constructor
ITerrainSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
const core::vector3df& position = core::vector3df(0.0f, 0.0f, 0.0f),
const core::vector3df& rotation = core::vector3df(0.0f, 0.0f, 0.0f),
const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f) )
: ISceneNode (parent, mgr, id, position, rotation, scale) {}
//! destructor
virtual ~ITerrainSceneNode() {};
//! \return: Returns the bounding box of the entire terrain.
virtual const core::aabbox3d<f32>& getBoundingBox ( ) const = 0;
//! Returns the bounding box of a patch
virtual const core::aabbox3d<f32>& getBoundingBox (s32 patchX, s32 patchZ) const = 0;
//! Returns the number of indices currently in the meshbuffer for this scene node.
virtual u32 getIndexCount() = 0;
//! Returns pointer to the mesh
virtual IMesh* getMesh() = 0;
//! Gets the meshbuffer data based on a specified level of detail.
/** \param mb: A reference to an SMeshBuffer object
\param LOD: the level of detail you want the indices from. */
virtual void getMeshBufferForLOD(SMeshBufferLightMap& mb, s32 LOD) = 0;
//! Gets the indices for a specified patch at a specified Level of Detail.
/** \param indices: A reference to an array of u32 indices.
\param patchX: Patch x coordinate.
\param patchZ: Patch z coordinate.
\param LOD: The level of detail to get for that patch. If -1, then get
the CurrentLOD. If the CurrentLOD is set to -1, meaning it's not shown,
then it will retrieve the triangles at the highest LOD ( 0 ).
\return: Number if indices put into the buffer. */
virtual s32 getIndicesForPatch(core::array<u32>& indices,
s32 patchX, s32 patchZ, s32 LOD = 0 ) = 0;
//! Populates an array with the CurrentLOD of each patch.
/** \param LODs: A reference to a core::array<s32> to hold the values
\return: Returns the number of elements in the array */
virtual s32 getCurrentLODOfPatches(core::array<s32>& LODs) = 0;
//! Manually sets the LOD of a patch
/** \param patchX: Patch x coordinate.
\param patchZ: Patch z coordinate.
\param LOD: The level of detail to set the patch to. */
virtual void setLODOfPatch( s32 patchX, s32 patchZ, s32 LOD ) = 0;
//! Returns center of terrain.
virtual core::vector3df getTerrainCenter() = 0;
//! Returns height of a point of the terrain.
virtual f32 getHeight( f32 x, f32 y ) = 0;
//! Sets the movement camera threshold.
/** It is used to determine when to recalculate
indices for the scene node. The default value is 10.0f. */
virtual void setCameraMovementDelta(f32 delta) = 0;
//! Sets the rotation camera threshold.
/** It is used to determine when to recalculate
indices for the scene node. The default value is 1.0f. */
virtual void setCameraRotationDelta(f32 delta) = 0;
//! Sets whether or not the node should dynamically update its associated selector when the geomipmap data changes.
/** \param bVal: Boolean value representing whether or not to update selector dynamically. */
virtual void setDynamicSelectorUpdate(bool bVal) = 0;
//! Override the default generation of distance thresholds.
/** For determining the LOD a patch
is rendered at. If any LOD is overridden, then the scene node will no longer apply
scaling factors to these values. If you override these distances, and then apply
a scale to the scene node, it is your responsibility to update the new distances to
work best with your new terrain size. */
virtual bool overrideLODDistance(s32 LOD, f64 newDistance) = 0;
//! Scales the base texture, similar to makePlanarTextureMapping.
/** \param scale: The scaling amount. Values above 1.0 increase the number of time the
texture is drawn on the terrain. Values below 0 will decrease the number of times the
texture is drawn on the terrain. Using negative values will flip the texture, as
well as still scaling it.
\param scale2: If set to 0 (default value), this will set the second texture coordinate set
to the same values as in the first set. If this is another value than zero, it will scale
the second texture coordinate set by this value. */
virtual void scaleTexture(f32 scale = 1.0f, f32 scale2 = 0.0f) = 0;
};
} // end namespace scene
} // end namespace irr
#endif // __IGEOMIPMAPSCENENODE_H__

View File

@ -1,37 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_TEXT_SCENE_NODE_H_INCLUDED__
#define __I_TEXT_SCENE_NODE_H_INCLUDED__
#include "ISceneNode.h"
namespace irr
{
namespace scene
{
//! A scene node for displaying 2d text at a position in three dimensional space
class ITextSceneNode : public ISceneNode
{
public:
//! constructor
ITextSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
const core::vector3df& position = core::vector3df(0,0,0))
: ISceneNode(parent, mgr, id, position) {}
//! sets the text string
virtual void setText(const wchar_t* text) = 0;
//! sets the color of the text
virtual void setTextColor(video::SColor color) = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,173 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_TEXTURE_H_INCLUDED__
#define __I_TEXTURE_H_INCLUDED__
#include "IUnknown.h"
#include "IImage.h"
#include "dimension2d.h"
#include "EDriverTypes.h"
#include "irrString.h"
#include "matrix4.h"
namespace irr
{
namespace video
{
//! Enumeration flags telling the video driver in which format textures
//! should be created.
enum E_TEXTURE_CREATION_FLAG
{
//! Forces the driver to create 16 bit textures always, independent of
//! which format the file on disk has. When choosing this you may loose
//! some color detail, but gain much speed and memory. 16 bit textures
//! can be transferred twice as fast as 32 bit textures and only use
//! half of the space in memory.
//! When using this flag, it does not make sense to use the flags
//! ETCF_ALWAYS_32_BIT, ETCF_OPTIMIZED_FOR_QUALITY,
//! or ETCF_OPTIMIZED_FOR_SPEED at the same time.
ETCF_ALWAYS_16_BIT = 0x00000001,
//! Forces the driver to create 32 bit textures always, independent of
//! which format the file on disk has. Please note that some drivers
//! (like the software device) will ignore this, because they are only
//! able to create and use 16 bit textures.
//! When using this flag, it does not make sense to use the flags
//! ETCF_ALWAYS_16_BIT, ETCF_OPTIMIZED_FOR_QUALITY,
//! or ETCF_OPTIMIZED_FOR_SPEED at the same time.
ETCF_ALWAYS_32_BIT = 0x00000002,
//! Lets the driver decide in which format the textures are created and
//! tries to make the textures look as good as possible.
//! Usually it simply chooses the format in which the texture was stored on disk.
//! When using this flag, it does not make sense to use the flags
//! ETCF_ALWAYS_16_BIT, ETCF_ALWAYS_32_BIT,
//! or ETCF_OPTIMIZED_FOR_SPEED at the same time.
ETCF_OPTIMIZED_FOR_QUALITY = 0x00000004,
//! Lets the driver decide in which format the textures are created and
//! tries to create them maximizing render speed.
//! When using this flag, it does not make sense to use the flags
//! ETCF_ALWAYS_16_BIT, ETCF_ALWAYS_32_BIT, or ETCF_OPTIMIZED_FOR_QUALITY,
//! at the same time.
ETCF_OPTIMIZED_FOR_SPEED = 0x00000008,
//! Automatically creates mip map levels for the textures.
ETCF_CREATE_MIP_MAPS = 0x00000010,
//! This flag is never used, it only forces the compiler to
//! compile these enumeration values to 32 bit.
ETCF_FORCE_32_BIT_DO_NOT_USE = 0x7fffffff
};
//! Helper function, helps to get the desired texture creation format from the flags.
//! Returns either ETCF_ALWAYS_32_BIT, ETCF_ALWAYS_16_BIT, ETCF_OPTIMIZED_FOR_QUALITY,
//! or ETCF_OPTIMIZED_FOR_SPEED.
inline E_TEXTURE_CREATION_FLAG getTextureFormatFromFlags(u32 flags)
{
if (flags & ETCF_OPTIMIZED_FOR_SPEED)
return ETCF_OPTIMIZED_FOR_SPEED;
if (flags & ETCF_ALWAYS_16_BIT)
return ETCF_ALWAYS_16_BIT;
if (flags & ETCF_ALWAYS_32_BIT)
return ETCF_ALWAYS_32_BIT;
if (flags & ETCF_OPTIMIZED_FOR_QUALITY)
return ETCF_OPTIMIZED_FOR_QUALITY;
return ETCF_OPTIMIZED_FOR_SPEED;
}
//! Interface of a Video Driver dependent Texture.
/**
An ITexture is created by an IVideoDriver by using IVideoDriver::addTexture or
IVideoDriver::getTexture. After that, the texture may only be used by this VideoDriver.
As you can imagine, textures of the DirectX and the OpenGL device will, e.g., not be compatible.
An exception is the Software device and the NULL device, their textures are compatible.
If you try to use a texture created by one device with an other device, the device
will refuse to do that and write a warning or an error message to the output buffer.
*/
class ITexture : public virtual IUnknown
{
public:
//! constructor
ITexture(const c8* name) : Name(name)
{
Name.make_lower();
}
//! destructor
virtual ~ITexture() {};
//! Lock function.
/** Locks the Texture and returns a pointer to access the
pixels. After lock() has been called and all operations on the pixels
are done, you must call unlock().
\return Returns a pointer to the pixel data. The format of the pixel can
be determinated by using getColorFormat(). NULL is returned, if
the texture cannot be locked. */
virtual void* lock() = 0;
//! Unlock function. Must be called after a lock() to the texture.
virtual void unlock() = 0;
//! Returns original size of the texture.
/** The texture is usually
scaled, if it was created with an unoptimal size. For example if the size
of the texture file it was loaded from was not a power of two. This returns
the size of the texture, it had before it was scaled. Can be useful
when drawing 2d images on the screen, which should have the exact size
of the original texture. Use ITexture::getSize() if you want to know
the real size it has now stored in the system.
\return Returns the original size of the texture. */
virtual const core::dimension2d<s32>& getOriginalSize() = 0;
//! Returns dimension (=size) of the texture.
/** \return Returns the size of the texture. */
virtual const core::dimension2d<s32>& getSize() = 0;
//! Returns driver type of texture.
/** This is the driver, which created the texture.
This method is used internally by the video devices, to check, if they may
use a texture because textures may be incompatible between different
devices.
\return Returns driver type of texture. */
virtual E_DRIVER_TYPE getDriverType() = 0;
//! Returns the color format of texture.
/** \return Returns the color format of texture. */
virtual ECOLOR_FORMAT getColorFormat() const = 0;
//! Returns pitch of texture (in bytes).
/** The pitch is the amount of bytes
used for a row of pixels in a texture.
\return Returns pitch of texture in bytes. */
virtual u32 getPitch() const = 0;
//! Returns whether the texture has MipMaps
/** \return Returns true if texture has MipMaps, else false. */
virtual bool hasMipMaps() { return false; }
//! Regenerates the mip map levels of the texture.
/** Useful after locking and modifying the texture */
virtual void regenerateMipMapLevels() = 0;
//! Returns name of texture (in most cases this is the filename)
const core::stringc& getName() { return Name; }
protected:
core::stringc Name;
};
} // end namespace video
} // end namespace irr
#endif

View File

@ -1,71 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_TIMER_H_INCLUDED__
#define __I_TIMER_H_INCLUDED__
#include "IUnknown.h"
namespace irr
{
//! Interface for getting and manipulating the virtual time
class ITimer : public virtual IUnknown
{
public:
//! destructor
virtual ~ITimer() {}
//! Returns current real time in milliseconds of the system.
/** This value does not start with 0 when the application starts.
For example in one implementation the value returned could be the
amount of milliseconds which have elapsed since the system was started. */
virtual u32 getRealTime() = 0;
//! Returns current virtual time in milliseconds.
/** This value starts with 0 and can be manipulated using setTime(), stopTimer(),
startTimer(), etc. This value depends on the set speed of the timer if the timer
is stopped, etc. If you need the system time, use getRealTime() */
virtual u32 getTime() = 0;
//! sets current virtual time
virtual void setTime(u32 time) = 0;
//! Stops the virtual timer.
/** The timer is reference counted, which means everything which calls
stop() will also have to call start(), otherwise the timer may not start/stop
corretly again. */
virtual void stop() = 0;
//! Starts the virtual timer.
/** The timer is reference counted, which means everything which calls
stop() will also have to call start(), otherwise the timer may not start/stop
corretly again. */
virtual void start() = 0;
//! Sets the speed of the timer
/** The speed is the factor with which the time is running faster or slower then the
real system time. */
virtual void setSpeed(f32 speed = 1.0f) = 0;
//! Returns current speed of the timer
/** The speed is the factor with which the time is running faster or slower then the
real system time. */
virtual f32 getSpeed() = 0;
//! Returns if the virtual timer is currently stopped
virtual bool isStopped() = 0;
//! Advances the virtual time
/** Makes the virtual timer update the time value based on the real
time. This is called automatically when calling IrrlichtDevice::run(),
but you can call it manually if you don't use this method. */
virtual void tick() = 0;
};
} // end namespace irr
#endif

View File

@ -1,85 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_TRIANGLE_SELECTOR_H_INCLUDED__
#define __I_TRIANGLE_SELECTOR_H_INCLUDED__
#include "IUnknown.h"
#include "triangle3d.h"
#include "aabbox3d.h"
#include "matrix4.h"
#include "line3d.h"
namespace irr
{
namespace scene
{
//! Interface to return triangles with specific properties.
/** Every ISceneNode may have a triangle selector, available with
ISceneNode::getTriangleScelector() or ISceneManager::createTriangleSelector.
This is used for doing collision detection: For example if you know, that a collision may happened in the
area between (1,1,1) and (10,10,10), you can get all triangles of the
scene node in this area with the ITriangleSelector easily and check every triangle
if it collided. */
class ITriangleSelector : public virtual IUnknown
{
public:
//! destructor
virtual ~ITriangleSelector() {};
//! Returns amount of all available triangles in this selector
virtual s32 getTriangleCount() const = 0;
//! Gets all triangles.
//! \param triangles: Array where the resulting triangles will be written to.
//! \param arraySize: Size of the target array.
//! \param outTriangleCount: Amount of triangles which have been written into the
//! array.
//! \param transform: Pointer to matrix for transforming the triangles before.
//! they are returned. Useful for example to scale all triangles down into an
//! ellipsoid space. If this pointer is null, no transformation will be done.
virtual void getTriangles(core::triangle3df* triangles, s32 arraySize,
s32& outTriangleCount, const core::matrix4* transform=0) = 0;
//! Gets all triangles which lie within a specific bounding box.
//! Please note that unoptimized triangle selectors also may return triangles,
//! which are not in the specific box at all.
//! \param triangles: Array where the resulting triangles will be written to.
//! \param arraySize: Size of the target array.
//! \param outTriangleCount: Amount of triangles which have been written into the
//! array.
//! \param box: Only triangles which are in this axis aligned bounding box
//! will be written into the array.
//! \param transform: Pointer to matrix for transforming the triangles before.
//! they are returned. Useful for example to scale all triangles down into an
//! ellipsoid space. If this pointer is null, no transformation will be done.
virtual void getTriangles(core::triangle3df* triangles, s32 arraySize,
s32& outTriangleCount, const core::aabbox3d<f32>& box,
const core::matrix4* transform=0) = 0;
//! Gets all triangles which have or may have contact with a 3d line.
//! Please note that unoptimized triangle selectors also may return triangles,
//! which are not in contact at all with the 3d line.
//! \param triangles: Array where the resulting triangles will be written to.
//! \param arraySize: Size of the target array.
//! \param outTriangleCount: Amount of triangles which have been written into the
//! array.
//! \param line: Only triangles which may be in contact with this 3d line will
//! be written into the array.
//! \param transform: Pointer to matrix for transforming the triangles before.
//! they are returned. Useful for example to scale all triangles down into an
//! ellipsoid space. If this pointer is null, no transformation will be done.
virtual void getTriangles(core::triangle3df* triangles, s32 arraySize,
s32& outTriangleCount, const core::line3d<f32>& line,
const core::matrix4* transform=0) = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,153 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_UNKNOWN_H_INCLUDED__
#define __I_UNKNOWN_H_INCLUDED__
#include "irrTypes.h"
namespace irr
{
//! Base class of most objects of the Irrlicht Engine.
/** This class provides reference counting through the methods grab() and drop().
It also is able to store a debug string for every instance of an object.
Most objects of the Irrlicht
Engine are derived from IUnknown, and so they are reference counted.
When you create an object in the Irrlicht engine, calling a method
which starts with 'create', an object is created, and you get a pointer
to the new object. If you no longer need the object, you have
to call drop(). This will destroy the object, if grab() was not called
in another part of you program, because this part still needs the object.
Note, that you only need to call drop() to the object, if you created it,
and the method had a 'create' in it.
A simple example:
If you want to create a texture, you may want to call an imaginable method
IDriver::createTexture. You call
ITexture* texture = driver->createTexture(dimension2d<s32>(128, 128));
If you no longer need the texture, call texture->drop().
If you want to load a texture, you may want to call imaginable method
IDriver::loadTexture. You do this like
ITexture* texture = driver->loadTexture("example.jpg");
You will not have to drop the pointer to the loaded texture, because
the name of the method does not start with 'create'. The texture
is stored somewhere by the driver.
*/
class IUnknown
{
public:
//! Constructor.
IUnknown()
: ReferenceCounter(1), DebugName(0)
{
}
//! Destructor.
virtual ~IUnknown()
{
}
//! Grabs the object. Increments the reference counter by one.
//! Someone who calls grab() to an object, should later also call
//! drop() to it. If an object never gets as much drop() as grab()
//! calls, it will never be destroyed.
//! The IUnknown class provides a basic reference counting mechanism
//! with its methods grab() and drop(). Most objects of the Irrlicht
//! Engine are derived from IUnknown, and so they are reference counted.
//!
//! When you create an object in the Irrlicht engine, calling a method
//! which starts with 'create', an object is created, and you get a pointer
//! to the new object. If you no longer need the object, you have
//! to call drop(). This will destroy the object, if grab() was not called
//! in another part of you program, because this part still needs the object.
//! Note, that you only need to call drop() to the object, if you created it,
//! and the method had a 'create' in it.
//!
//! A simple example:
//!
//! If you want to create a texture, you may want to call an imaginable method
//! IDriver::createTexture. You call
//! ITexture* texture = driver->createTexture(dimension2d<s32>(128, 128));
//! If you no longer need the texture, call texture->drop().
//! If you want to load a texture, you may want to call imaginable method
//! IDriver::loadTexture. You do this like
//! ITexture* texture = driver->loadTexture("example.jpg");
//! You will not have to drop the pointer to the loaded texture, because
//! the name of the method does not start with 'create'. The texture
//! is stored somewhere by the driver.
void grab() { ++ReferenceCounter; }
//! Drops the object. Decrements the reference counter by one.
//! Returns true, if the object was deleted.
//! The IUnknown class provides a basic reference counting mechanism
//! with its methods grab() and drop(). Most objects of the Irrlicht
//! Engine are derived from IUnknown, and so they are reference counted.
//!
//! When you create an object in the Irrlicht engine, calling a method
//! which starts with 'create', an object is created, and you get a pointer
//! to the new object. If you no longer need the object, you have
//! to call drop(). This will destroy the object, if grab() was not called
//! in another part of you program, because this part still needs the object.
//! Note, that you only need to call drop() to the object, if you created it,
//! and the method had a 'create' in it.
//!
//! A simple example:
//!
//! If you want to create a texture, you may want to call an imaginable method
//! IDriver::createTexture. You call
//! ITexture* texture = driver->createTexture(dimension2d<s32>(128, 128));
//! If you no longer need the texture, call texture->drop().
//! If you want to load a texture, you may want to call imaginable method
//! IDriver::loadTexture. You do this like
//! ITexture* texture = driver->loadTexture("example.jpg");
//! You will not have to drop the pointer to the loaded texture, because
//! the name of the method does not start with 'create'. The texture
//! is stored somewhere by the driver.
bool drop()
{
_IRR_DEBUG_BREAK_IF(ReferenceCounter <= 0) // someone is doing bad reference counting.
--ReferenceCounter;
if (!ReferenceCounter)
{
delete this;
return true;
}
return false;
}
//! Returns the debug name of the object. The Debugname may only be set and
//! changed by the object itself. This method should only be used in Debug mode.
//! \return Returns a string, previously set by setDebugName();
const c8* getDebugName() const
{
return DebugName;
}
protected:
//! Sets the debug name of the object. The Debugname may only be set and
//! changed by the object itself. This method should only be used in Debug mode.
//! \param newName: New debug name to set.
void setDebugName(const c8* newName)
{
DebugName = newName;
}
private:
s32 ReferenceCounter;
const c8* DebugName;
};
} // end namespace irr
#endif

View File

@ -1,863 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __IRR_I_VIDEO_DRIVER_H_INCLUDED__
#define __IRR_I_VIDEO_DRIVER_H_INCLUDED__
#include "rect.h"
#include "SColor.h"
#include "ITexture.h"
#include "irrArray.h"
#include "matrix4.h"
#include "dimension2d.h"
#include "position2d.h"
#include "IReadFile.h"
#include "SMaterial.h"
#include "IImageLoader.h"
#include "IImageWriter.h"
#include "IMeshBuffer.h"
#include "triangle3d.h"
#include "SExposedVideoData.h"
#include "IMaterialRenderer.h"
#include "EDriverTypes.h"
#include "IGPUProgrammingServices.h"
namespace irr
{
namespace io
{
class IAttributes;
} // end namespace io
namespace scene
{
class IMeshBuffer;
} // end namespace scene
namespace video
{
struct S3DVertex;
struct S3DVertex2TCoords;
struct S3DVertexTangents;
struct SLight;
//! enumeration for querying features of the video driver.
enum E_VIDEO_DRIVER_FEATURE
{
//! Is driver able to render to a surface?
EVDF_RENDER_TO_TARGET = 0,
//! Is hardeware transform and lighting supported?
EVDF_HARDWARE_TL,
//! Are multiple textures per material possible?
EVDF_MULTITEXTURE,
//! Is driver able to render with a bilinear filter applied?
EVDF_BILINEAR_FILTER,
//! Can the driver handle mip maps?
EVDF_MIP_MAP,
//! Can the driver update mip maps automatically?
EVDF_MIP_MAP_AUTO_UPDATE,
//! Are stencilbuffers switched on and does the device support stencil buffers?
EVDF_STENCIL_BUFFER,
//! Is Vertex Shader 1.1 supported?
EVDF_VERTEX_SHADER_1_1,
//! Is Vertex Shader 2.0 supported?
EVDF_VERTEX_SHADER_2_0,
//! Is Vertex Shader 3.0 supported?
EVDF_VERTEX_SHADER_3_0,
//! Is Pixel Shader 1.1 supported?
EVDF_PIXEL_SHADER_1_1,
//! Is Pixel Shader 1.2 supported?
EVDF_PIXEL_SHADER_1_2,
//! Is Pixel Shader 1.3 supported?
EVDF_PIXEL_SHADER_1_3,
//! Is Pixel Shader 1.4 supported?
EVDF_PIXEL_SHADER_1_4,
//! Is Pixel Shader 2.0 supported?
EVDF_PIXEL_SHADER_2_0,
//! Is Pixel Shader 3.0 supported?
EVDF_PIXEL_SHADER_3_0,
//! Are ARB vertex programs v1.0 supported?
EVDF_ARB_VERTEX_PROGRAM_1,
//! Are ARB fragment programs v1.0 supported?
EVDF_ARB_FRAGMENT_PROGRAM_1,
//! Is GLSL supported?
EVDF_ARB_GLSL,
//! Is HLSL supported?
EVDF_HLSL,
//! Are non-power-of-two textures supported?
EVDF_TEXTURE_NPOT,
//! Are framebuffer objects supported?
EVDF_FRAMEBUFFER_OBJECT
};
//! enumeration for geometry transformation states
enum E_TRANSFORMATION_STATE
{
//! View transformation
ETS_VIEW = 0,
//! World transformation
ETS_WORLD,
//! Projection transformation
ETS_PROJECTION,
//! Texture transformation
ETS_TEXTURE_0,
//! Texture transformation
ETS_TEXTURE_1,
//! Texture transformation
ETS_TEXTURE_2,
//! Texture transformation
ETS_TEXTURE_3,
//! Not used
ETS_COUNT
};
//! Interface to driver which is able to perform 2d and 3d gfx functions.
/** The IVideoDriver interface is one of the most important interfaces of
the Irrlicht Engine: All rendering and texture manipulating is done with
this interface. You are able to use the Irrlicht Engine by only invoking methods
of this interface if you would like to, although the irr::scene::ISceneManager interface
provides a lot of powerful classes and methods to make the programmers life
easier.
*/
class IVideoDriver : public virtual IUnknown
{
public:
//! destructor
virtual ~IVideoDriver() {}
//! Applications must call this method before performing any rendering.
/** \param backBuffer: Specifies if the back buffer should be cleared, which
means that the screen is filled with a color specified with the parameter color.
If this parameter is false, the back buffer will not be cleared and the color
parameter is ignored.
\param zBuffer: Specifies if the depth or z buffer should be cleared. It is
not nesesarry to do so, if only 2d drawing is used.
\return Returns false if failed. Begin Scene can clear the back- and the z-buffer. */
virtual bool beginScene(bool backBuffer, bool zBuffer, SColor color) = 0;
//! Presents the rendered image on the screen.
/** Applications must call this method after performing any rendering.
\param windowId: Handle of another window, if you want the bitmap to be displayed
on another window. If this is null, everything will be displayed in the default window.
Note: This does not work in fullscreen mode and is not implemented for all devices (only for
D3D8, D3D9, Software1 and Software2, and only for Windows).
\param sourceRect: Pointer to a rectangle defining the source rectangle of the area
to be presented. Set to null to present everything. Note: not implemented in all devices.
\return Returns false if failed and true if succeeded. */
virtual bool endScene( s32 windowId = 0, core::rect<s32>* sourceRect=0 ) = 0;
//! Queries the features of the driver.
/** Returns true if a feature is available
\param feature: A feature to query.
\return Returns true if the feature is available, false if not. */
virtual bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) = 0;
//! Sets the view, world or projection transformation.
/* \param state: Transformation type to be set. Can be view, world or projection.
\param mat: Matrix describing the transformation. */
virtual void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat) = 0;
//! Returns the transformation set by setTransform
virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state) = 0;
//! Sets a material.
/** All 3d drawing functions draw geometry now
using this material.
\param material: Material to be used from now on. */
virtual void setMaterial(const SMaterial& material) = 0;
//! Returns a pointer to a texture.
/** Loads the texture if it is not
already loaded, and generates mipmap levels if wished.
You can influence how the texture is loaded using the setTextureCreationFlag()
method.
The texture can be in BMP, JPG, TGA, PCX, PNG and PSD format.
For loading BMP, TGA, PCX, and PSD files, the engine uses its own methods.
PCX loading is based on some code by Dean P. Macri, who sent
it in for free use by the engine, PGN loading is done using a loader
by rt who allowed it to be used by Irrlicht.
For loading JPG-Files the JPEG LIB 6b, written by
The Independent JPEG Group is used by the engine. For PNG loading,
libPNG is used. Thanx for such great libraries!
\param filename: Filename of the texture to be loaded.
\return Returns a pointer to the texture and NULL if the texture
could not be loaded.
This pointer should not be dropped. See IUnknown::drop() for more information.*/
virtual ITexture* getTexture(const c8* filename) = 0;
//! Returns a pointer to a texture.
/** Loads the texture if it is not
already loaded, and generates mipmap levels if wished.
You can influence how the texture is loaded using the setTextureCreationFlag()
method.
The texture can be in BMP, JPG, TGA, PCX, PNG and PSD format.
For loading BMP, TGA, PCX, and PSD files, the engine uses its own methods.
PCX loading is based on some code by Dean P. Macri, who sent
it in for free use by the engine, PGN loading is done using a loader
by rt who allowed it to be used by Irrlicht.
For loading JPG-Files the JPEG LIB 6b, written by
The Independent JPEG Group is used by the engine. For PNG loading,
libPNG is used. Thanx for such great libraries!
\param file: Pointer to an already opened file.
\return Returns a pointer to the texture and NULL if the texture
could not be loaded.
This pointer should not be dropped. See IUnknown::drop() for more information.*/
virtual ITexture* getTexture(io::IReadFile* file) = 0;
//! Returns a texture by index
/** \param index: Index of the texture, must be smaller than getTextureCount()
Please note that this index would change when adding or removing textures
*/
virtual ITexture* getTextureByIndex(u32 index) = 0;
//! Returns amount of textures currently loaded
virtual s32 getTextureCount() = 0;
//! Creates an empty Texture of specified size.
/** \param size: Size of the texture.
\param name: A name for the texture. Later calls of getTexture() with this name
will return this texture
\param format: Desired color format of the texture. Please note that
the driver may choose to create the texture in another color format.
\return Returns a pointer to the new created Texture.
This pointer should not be dropped. See IUnknown::drop() for more information.
The format of the new texture will be chosen by the driver. */
virtual ITexture* addTexture(const core::dimension2d<s32>& size,
const c8* name, ECOLOR_FORMAT format = ECF_A8R8G8B8) = 0;
//! Creates a texture from a loaded IImage.
/** \param name: A name for the texture. Later calls of getTexture() with this name
will return this texture
\param image: Image from which the texture is created from.
\return Returns a pointer to the new created Texture.
This pointer should not be dropped. See IUnknown::drop() for more information.
The format of the new texture will be chosen by the driver. */
virtual ITexture* addTexture(const c8* name, IImage* image) = 0;
//! Creates a render target texture.
/** \param size: Size of the texture, in pixels. Width and height should
be a power of two (for example 64, 128, 256, 512, ...) and it should not
be bigger than the backbuffer, because it shares the zbuffer with the
screen buffer.
\return Returns a pointer to the created texture or 0 if the texture could not
be created. If you no longer need the image, you should call ITexture::drop().
See IUnknown::drop() for more information. */
virtual ITexture* createRenderTargetTexture(const core::dimension2d<s32>& size) = 0;
//! Removes a texture from the texture cache and deletes it, freeing lot of memory.
/** Please note that after calling this, the pointer to the ITexture
may not be longer valid, if it was not grabbed before by other parts of
the engine for storing it longer. So it would be a good idea to set all
materials which are using this texture to null or another texture first.
\param texture: Texture to delete from the engines cache. */
virtual void removeTexture(ITexture* texture) = 0;
//! Removes all texture from the texture cache and deletes them, freeing lot of memory.
/** Please note that after calling this, the pointer to all ITextures
may not be longer valid, if they were not grabbed before by other parts of
the engine for storing them longer. So it would be a good idea to set all
materials which are using textures to null first. */
virtual void removeAllTextures() = 0;
//! Creates an 1bit alpha channel of the texture based of an color key.
/** This makes the texture transparent at the regions where this color
key can be found when using for example draw2DImage with useAlphachannel
= true.
\param texture: Texture of which its alpha channel is modified.
\param color: Color key color. Every pixel with this color will get transparent
like described above. Please note that the colors of a texture may get
converted when loading it, so the color values may not be exactly the same
in the engine and for example in picture edit programs. To avoid this
problem, you could use the makeColorKeyTexture method, which takes the position
of a pixel instead a color value. */
virtual void makeColorKeyTexture(video::ITexture* texture, video::SColor color) = 0;
//! Creates an 1bit alpha channel of the texture based of an color key position.
/** This makes the texture transparent at the regions where this color
key can be found when using for example draw2DImage with useAlphachannel
= true.
\param texture: Texture of which its alpha channel is modified.
\param colorKeyPixelPos: Position of a pixel with the color key color.
Every pixel with this color will get transparent
like described above. */
virtual void makeColorKeyTexture(video::ITexture* texture,
core::position2d<s32> colorKeyPixelPos) = 0;
//! Creates a normal map from a height map texture.
/** If the target texture
has 32 bit, the height value is stored in the alpha component of the texture as
addition. This value will be used by the video::EMT_PARALLAX_MAP_SOLID
material and similar materials.
\param texture: Texture of which its alpha channel is modified.
\param amplitude: Constant value by which the height information is multiplied.*/
virtual void makeNormalMapTexture(video::ITexture* texture, f32 amplitude=1.0f) = 0;
//! Sets a new render target.
/** This will only work if the driver
supports the EVDF_RENDER_TO_TARGET feature, which can be
queried with queryFeature(). Usually, rendering to textures is done in this
way:
\code
// create render target
ITexture* target = driver->createRenderTargetTexture(core::dimension2d<s32>(128,128));
// ...
driver->setRenderTarget(target); // set render target
// .. draw stuff here
driver->setRenderTarget(0); // set previous render target
Please note that you cannot render 3D or 2D geometry with a render target as texture
on it when you are rendering the scene into this render target at the same time. It is
usually only possible to render into a texture between the IVideoDriver::beginScene() and endScene()
method calls. And please also note that the scene will be rendered upside down into the texture
in some devices (e.g. OpenGL vs. D3D). A simple workaround for this is to flip the
texture coordinates of the geometry where the render target texture is displayed on.
\endcode
\param texture: New render target. Must be a texture created with
IVideoDriver::createRenderTargetTexture(). If set to 0, it sets the previous render
target which was set before the last setRenderTarget() call.
\param clearBackBuffer: Clears the backbuffer of the render target with the color parameter
\param clearZBuffer: Clears the zBuffer of the rendertarget. Note that, because the frame
buffer shares the zbuffer with the rendertarget, its zbuffer will be partially cleared
too with this.
\return Returns true if sucessful and false if not. */
virtual bool setRenderTarget(video::ITexture* texture,
bool clearBackBuffer=true, bool clearZBuffer=true,
SColor color=video::SColor(0,0,0,0)) = 0;
//! Sets a new viewport.
/** Every rendering operation is done into this new area.
\param Rectangle defining the new area of rendering operations. */
virtual void setViewPort(const core::rect<s32>& area) = 0;
//! Gets the area of the current viewport.
/** \return Returns rectangle of the current vieport. */
virtual const core::rect<s32>& getViewPort() const = 0;
//! draws a vertex primitive list
/** Note that there may be at maximum 65536 vertices, because the
index list is an array of 16 bit values each with a maximum value
of 65536. If there are more than 65536 vertices in the list,
results of this operation are not defined.
\param vertices: Pointer to array of vertices.
\param vertexCount: Amount of vertices in the array.
\param indexList: Pointer to array of indizes.
\param triangleCount: amount of Triangles.
\param vType: Vertex type, e.g. EVT_STANDARD for S3DVertex.
\param pType: Primitive type, e.g. EPT_TRIANGLE_FAN for a triangle fan. */
virtual void drawVertexPrimitiveList(const void* vertices, u32 vertexCount, const u16* indexList, u32 triangleCount, E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType) = 0;
//! Draws an indexed triangle list.
/** Note that there may be at maximum 65536 vertices, because the
index list is a array of 16 bit values each with a maximum value
of 65536. If there are more than 65536 vertices in the list,
results of this operation are not defined.
\param vertices: Pointer to array of vertices.
\param vertexCount: Amount of vertices in the array.
\param indexList: Pointer to array of indizes.
\param triangleCount: amount of Triangles. Usually amount of indizes / 3. */
virtual void drawIndexedTriangleList(const S3DVertex* vertices,
u32 vertexCount, const u16* indexList, u32 triangleCount) = 0;
//! Draws an indexed triangle list.
/** Note that there may be at maximum 65536 vertices, because the
index list is a array of 16 bit values each with a maximum value
of 65536. If there are more than 65536 vertices in the list,
results of this operation are not defined.
\param vertices: Pointer to array of vertices.
\param vertexCount: Amount of vertices in the array.
\param indexList: Pointer to array of indizes.
\param triangleCount: amount of Triangles. Usually amount of indizes / 3.*/
virtual void drawIndexedTriangleList(const S3DVertex2TCoords* vertices,
u32 vertexCount, const u16* indexList, u32 triangleCount) = 0;
//! Draws an indexed triangle list.
/** Note that there may be at maximum 65536 vertices, because the
index list is a array of 16 bit values each with a maximum value
of 65536. If there are more than 65536 vertices in the list,
results of this operation are not defined.
\param vertices: Pointer to array of vertices.
\param vertexCount: Amount of vertices in the array.
\param indexList: Pointer to array of indizes.
\param triangleCount: amount of Triangles. Usually amount of indizes / 3. */
virtual void drawIndexedTriangleList(const S3DVertexTangents* vertices,
u32 vertexCount, const u16* indexList, u32 triangleCount) = 0;
//! Draws an indexed triangle fan.
/** Note that there may be at maximum 65536 vertices, because the
index list is a array of 16 bit values each with a maximum value
of 65536. If there are more than 65536 vertices in the list,
results of this operation are not defined.
Please note that some of the implementation code for this method is based on
free code sent in by Mario Gruber, lots of thanks go to him!
\param vertices: Pointer to array of vertices.
\param vertexCount: Amount of vertices in the array.
\param indexList: Pointer to array of indizes.
\param triangleCount: amount of Triangles. Usually amount of indizes - 2. */
virtual void drawIndexedTriangleFan(const S3DVertex* vertices,
u32 vertexCount, const u16* indexList, u32 triangleCount) = 0;
//! Draws an indexed triangle fan.
/** Note that there may be at maximum 65536 vertices, because the
index list is a array of 16 bit values each with a maximum value
of 65536. If there are more than 65536 vertices in the list,
results of this operation are not defined.
Please note that some of the implementation code for this method is based on
free code sent in by Mario Gruber, lots of thanks go to him!
\param vertices: Pointer to array of vertices.
\param vertexCount: Amount of vertices in the array.
\param indexList: Pointer to array of indizes.
\param triangleCount: amount of Triangles. Usually amount of indizes - 2. */
virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices,
u32 vertexCount, const u16* indexList, u32 triangleCount) = 0;
//! Draws a 3d line.
/** For some implementations, this method simply calls drawIndexedTriangles with some
triangles. Note that the line is drawn using the current transformation
matrix and material. So if you need to draw the 3D line independently of the
current transformation, use
\code
driver->setTransform(video::ETS_WORLD, core::matrix4());
\endcode
before drawing the line.
This method was created for making culling debugging easier.
\param start: Start of the 3d line.
\param end: End of the 3d line.
\param color: Color of the line. */
virtual void draw3DLine(const core::vector3df& start,
const core::vector3df& end, SColor color = SColor(255,255,255,255)) = 0;
//! Draws a 3d triangle.
/** This method usually simply calls drawIndexedTriangles with some
triangles. Note that the line is drawn using the current transformation
matrix and material.
This method was created for making collision debugging easier. It works with
all drivers because it does simply a call to drawIndexedTriangleList and
hence is not very fast but it might be useful for further development.
\param triangle: The triangle to draw.
\param color: Color of the line. */
virtual void draw3DTriangle(const core::triangle3df& triangle,
SColor color = SColor(255,255,255,255)) = 0;
//! Draws a 3d axis aligned box.
/** This method usually simply calls drawIndexedTriangles with some
triangles. Note that the line is drawn using the current transformation
matrix and material.
This method was created for making culling debugging easier. It works with
all drivers because it does simply a call to drawIndexedTriangleList and
hence is not very fast but it might be useful for further development.
\param box: The axis aligned box to draw
\param color: Color to use while drawing the box. */
virtual void draw3DBox(const core::aabbox3d<f32> box,
SColor color = SColor(255,255,255,255)) = 0;
//! Simply draws a 2d image without any special effects
/** \param texture: Pointer to texture to use.
\param destPos: upper left 2d destination position where the image will be drawn. */
virtual void draw2DImage(video::ITexture* texture,
const core::position2d<s32>& destPos) = 0;
//! Draws a 2d image using a color
/** (if color is other than
Color(255,255,255,255)) and the alpha channel of the texture if wanted.
\param texture: Texture to be drawn.
\param destPos: Upper left 2d destination position where the image will be drawn.
\param sourceRect: Source rectangle in the image.
\param clipRect: Pointer to rectangle on the screen where the image is clipped to.
This pointer can be NULL. Then the image is not clipped.
\param color: Color with which the image is colored. If the color equals
Color(255,255,255,255), the color is ignored. Note that the alpha component
is used: If alpha is other than 255, the image will be transparent.
\param useAlphaChannelOfTexture: If true, the alpha channel of the texture is
used to draw the image.*/
virtual void draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false) = 0;
//! draws a set of 2d images, using a color and the alpha
/** channel of the texture if desired. The images are drawn
beginning at pos and concatenated in one line. All drawings
are clipped against clipRect (if != 0).
The subtextures are defined by the array of sourceRects
and are chosen by the indices given.
\param texture: Texture to be drawn.
\param pos: Upper left 2d destination position where the image will be drawn.
\param sourceRects: Source rectangles of the image.
\param indices: List of indices which choose the actual rectangle used each time.
\param kerningWidth: Offset to Position on X
\param clipRect: Pointer to rectangle on the screen where the image is clipped to.
This pointer can be 0. Then the image is not clipped.
\param color: Color with which the image is colored.
Note that the alpha component is used: If alpha is other than 255, the image will be transparent.
\param useAlphaChannelOfTexture: If true, the alpha channel of the texture is
used to draw the image. */
virtual void draw2DImage(video::ITexture* texture,
const core::position2d<s32>& pos,
const core::array<core::rect<s32> >& sourceRects,
const core::array<s32>& indices,
s32 kerningWidth,
const core::rect<s32>* clipRect, SColor color,
bool useAlphaChannelOfTexture) = 0;
//! Draws a part of the texture into the rectangle.
/** Suggested and first implemented by zola.
\param texture: the texture to draw from
\param destRect: the rectangle to draw into
\param sourceRect: the rectangle denoting a part of the texture
\param clipRect: clips the destination rectangle (may be 0)
\param colors: array of 4 colors denoting the color values of the corners of the destRect
\param useAlphaChannelOfTexture: true if alpha channel will be blended. */
virtual void draw2DImage(video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
video::SColor* colors=0, bool useAlphaChannelOfTexture=false) = 0;
//!Draws an 2d rectangle.
/** \param color: Color of the rectangle to draw. The alpha component will not
be ignored and specifies how transparent the rectangle will be.
\param pos: Position of the rectangle.
\param clip: Pointer to rectangle against which the rectangle will be clipped.
If the pointer is null, no clipping will be performed. */
virtual void draw2DRectangle(SColor color, const core::rect<s32>& pos,
const core::rect<s32>* clip = 0) = 0;
//!Draws an 2d rectangle with a gradient.
/** \param colorLeftUp: Color of the left upper corner to draw.
The alpha component will not be ignored and specifies how transparent the rectangle will be.
\param colorRightUp: Color of the right upper corner to draw.
The alpha component will not be ignored and specifies how transparent the rectangle will be.
\param colorLeftDown: Color of the left lower corner to draw.
The alpha component will not be ignored and specifies how transparent the rectangle will be.
\param colorRightDown: Color of the right lower corner to draw.
The alpha component will not be ignored and specifies how transparent the rectangle will be.
\param pos: Position of the rectangle.
\param clip: Pointer to rectangle against which the rectangle will be clipped.
If the pointer is null, no clipping will be performed. */
virtual void draw2DRectangle(const core::rect<s32>& pos,
SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown,
const core::rect<s32>* clip = 0) = 0;
//! Draws a 2d line.
/** \param start: Screen coordinates of the start of the line in pixels.
\param end: Screen coordinates of the start of the line in pixels.
\param color: Color of the line to draw. */
virtual void draw2DLine(const core::position2d<s32>& start,
const core::position2d<s32>& end,
SColor color=SColor(255,255,255,255)) = 0;
//! Draws a non filled concyclic regular 2d polyon.
/** This method can be used to draw
circles, but also triangles, tetragons, pentagons, hexagons, heptagons, octagons,
enneagons, decagons, hendecagons, dodecagon, triskaidecagons, etc. I think you'll
got it now. And all this by simply specifying the vertex count. Welcome to the
wonders of geometry.
\param center: Position of center of circle (pixels).
\param radius: Radius of circle in pixels.
\param color: Color of the circle.
\param vertexCount: Amount of vertices of the polygon. Specify 2 to draw a line,
3 to draw a triangle, 4 for a tetragons and a lot (>10) for nearly a circle. */
virtual void draw2DPolygon(core::position2d<s32> center,
f32 radius, video::SColor color=SColor(100,255,255,255), s32 vertexCount=10) = 0;
//! Draws a shadow volume into the stencil buffer.
/** To draw a stencil shadow, do
this: Frist, draw all geometry. Then use this method, to draw the shadow
volume. Then, use IVideoDriver::drawStencilShadow() to visualize the shadow.
Please note that the code for the opengl version of the method is based on
free code sent in by Philipp Dortmann, lots of thanks go to him!
\param triangles: Pointer to array of 3d vectors, specifing the shadow volume.
\param count: Amount of triangles in the array.
\param zfail: If set to true, zfail method is used, otherwise zpass. */
virtual void drawStencilShadowVolume(const core::vector3df* triangles, s32 count, bool zfail=true) = 0;
//! Fills the stencil shadow with color.
/** After the shadow volume has been drawn
into the stencil buffer using IVideoDriver::drawStencilShadowVolume(), use this
to draw the color of the shadow.
Please note that the code for the opengl version of the method is based on
free code sent in by Philipp Dortmann, lots of thanks go to him!
\param clearStencilBuffer: Set this to false, if you want to draw every shadow
with the same color, and only want to call drawStencilShadow() once after all
shadow volumes have been drawn. Set this to true, if you want to paint every
shadow with its own color.
\param leftUpEdge: Color of the shadow in the upper left corner of screen.
\param rightUpEdge: Color of the shadow in the upper right corner of screen.
\param leftDownEdge: Color of the shadow in the lower left corner of screen.
\param rightDownEdge: Color of the shadow in the lower right corner of screen. */
virtual void drawStencilShadow(bool clearStencilBuffer=false,
video::SColor leftUpEdge = video::SColor(255,0,0,0),
video::SColor rightUpEdge = video::SColor(255,0,0,0),
video::SColor leftDownEdge = video::SColor(255,0,0,0),
video::SColor rightDownEdge = video::SColor(255,0,0,0)) = 0;
//! Draws a mesh buffer
/** \param mb: Buffer to draw; */
virtual void drawMeshBuffer( const scene::IMeshBuffer* mb) = 0;
//! Sets the fog mode.
/** These are global values attached to each 3d object
rendered, which has the fog flag enabled in its material.
\param color: Color of the fog
\param linearFog: Set this to true for linear fog, otherwise exponential fog is applied.
\param start: Only used in linear fog mode (linearFog=true). Specifies where fog starts.
\param end: Only used in linear fog mode (linearFog=true). Specifies where fog ends.
\param density: Only used in expotential fog mode (linearFog=false). Must be a value between 0 and 1.
\param pixelFog: Set this to false for vertex fog, and true if you want pixel fog.
\param rangeFog: Set this to true to enable range-based vertex fog. The distance
from the viewer is used to compute the fog, not the z-coordinate. This is
better, but slower. This is only available with D3D and vertex fog. */
virtual void setFog(SColor color=SColor(0,255,255,255), bool linearFog=true, f32 start=50.0f, f32 end=100.0f,
f32 density=0.01f, bool pixelFog=false, bool rangeFog=false) = 0;
//! Returns the size of the screen or render window.
/** \return Size of screen or render window. */
virtual core::dimension2d<s32> getScreenSize() = 0;
//! Returns the size of the current render target, or the screen size if the driver
//! doesnt support render to texture
/** \return Size of render target or screen/window */
virtual core::dimension2d<s32> getCurrentRenderTargetSize() = 0;
//! Returns current frames per second value.
/** \return Returns amount of frames per second drawn. **/
virtual s32 getFPS() = 0;
//! Returns amount of primitives (mostly triangles) which were drawn in the last frame.
/** Together with getFPS() very useful method for statistics.
\return Amount of primitives drawn in the last frame. */
virtual u32 getPrimitiveCountDrawn( u32 param = 0 ) = 0;
//! Deletes all dynamic lights which were previously added with addDynamicLight().
virtual void deleteAllDynamicLights() = 0;
//! Adds a dynamic light.
/** \param light: Data specifing the dynamic light. */
virtual void addDynamicLight(const SLight& light) = 0;
//! Sets the dynamic ambient light color.
/** The default color is
(0,0,0,0) which means it is dark.
\param color: New color of the ambient light. */
virtual void setAmbientLight(const SColorf& color) = 0;
//! Returns the maximal amount of dynamic lights the device can handle
/** \return Maximal amount of dynamic lights. */
virtual u32 getMaximalDynamicLightAmount() = 0;
//! Returns current amount of dynamic lights set
/** \return Current amount of dynamic lights set */
virtual u32 getDynamicLightCount() = 0;
//! Returns light data which was previously set with IVideDriver::addDynamicLight().
/** \param idx: Zero based index of the light. Must be greater than 0 and smaller
than IVideoDriver()::getDynamicLightCount.
\return Light data. */
virtual const SLight& getDynamicLight(u32 idx) = 0;
//! Gets name of this video driver.
/** \return Returns the name of the video driver. Example: In case of the Direct3D8
driver, it would return "Direct3D 8.1". */
virtual const wchar_t* getName() = 0;
//! Adds an external image loader to the engine.
/** This is useful if
the Irrlicht Engine should be able to load textures of currently
unsupported file formats (e.g .gif). The IImageLoader only needs
to be implemented for loading this file format. A pointer to
the implementation can be passed to the engine using this method.
\param loader: Pointer to the external loader created. */
virtual void addExternalImageLoader(IImageLoader* loader) = 0;
//! Adds an external image writer to the engine.
/** This is useful if
the Irrlicht Engine should be able to write textures of currently
unsupported file formats (e.g .gif). The IImageWriter only needs
to be implemented for writing this file format. A pointer to
the implementation can be passed to the engine using this method.
\param writer: Pointer to the external writer created. */
virtual void addExternalImageWriter(IImageWriter* writer) = 0;
//! Returns the maximum amount of primitives
/** (mostly vertices) which
the device is able to render with one drawIndexedTriangleList
call. */
virtual u32 getMaximalPrimitiveCount() = 0;
//! Enables or disables a texture creation flag.
/** This flag defines how
textures should be created. By changing this value, you can influence for example
the speed of rendering a lot. But please note that the video drivers
take this value only as recommendation. It could happen that you
enable the ETCM_ALWAYS_16_BIT mode, but the driver creates 32 bit
textures.
\param flag: Texture creation flag.
\param enbabled: Specifies if the given flag should be enabled or disabled.*/
virtual void setTextureCreationFlag(E_TEXTURE_CREATION_FLAG flag, bool enabled) = 0;
//! Returns if a texture creation flag is enabled or disabled.
/** You can change this value using setTextureCreationMode().
\param flag: Texture creation flag.
\return Returns the current texture creation mode. */
virtual bool getTextureCreationFlag(E_TEXTURE_CREATION_FLAG flag) = 0;
//! Creates a software image from a file.
/** No hardware texture will
be created for this image. This method is useful for example if
you want to read a heightmap for a terrain renderer.
\param filename: Name of the file from which the image is created.
\return Returns the created image.
If you no longer need the image, you should call IImage::drop().
See IUnknown::drop() for more information. */
virtual IImage* createImageFromFile(const c8* filename) = 0;
//! Creates a software image from a file.
/** No hardware texture will
be created for this image. This method is useful for example if
you want to read a heightmap for a terrain renderer.
\param file: File from which the image is created.
\return Returns the created image.
If you no longer need the image, you should call IImage::drop().
See IUnknown::drop() for more information. */
virtual IImage* createImageFromFile(io::IReadFile* file) = 0;
//! Writes the provided image to disk file
/** Requires that there is a suitable image writer
registered for writing the image to disk
\param image: Image to write to disk
\param filename: name of the file to write
\param param: control parameter for the backend ( eq. compression level )
\return Returns true on success */
virtual bool writeImageToFile(IImage* image, const c8* filename, u32 param = 0) = 0;
//! Creates a software image from a byte array.
/** No hardware texture will
be created for this image. This method is useful for example if
you want to read a heightmap for a terrain renderer.
\param format: Desired color format of the texture
\param size: Desired the size of the image
\param data: a byte array with pixelcolor information
\param useForeignMemory: If true, the image will use the data pointer
directly and own it from now on, which means it will also try to delete [] the
data when the image will be destructed.
If false, the memory will by copied internally.
\return Returns the created image.
If you no longer need the image, you should call IImage::drop().
See IUnknown::drop() for more information. */
virtual IImage* createImageFromData(ECOLOR_FORMAT format,
const core::dimension2d<s32>& size, void *data,
bool ownForeignMemory=false,
bool deleteMemory = true) = 0;
//! Only used by the internal engine.
/** Used to notify the driver that
the window was resized. Usually, there is no need to call this method. */
virtual void OnResize(const core::dimension2d<s32>& size) = 0;
//! Adds a new material renderer to the video device.
/** Use this method to extend the VideoDriver with new MaterialTypes. To extend the
engine using this method do the following:
Derive a class from IMaterialRenderer and override the methods you need. For
setting the right renderstates, you can try to get a pointer to the real rendering device
using IVideoDriver::getExposedVideoData(). Add your class with
IVideoDriver::addMaterialRenderer() and if you want an object in the engine to be displayed
with your new material, set the MaterialType member of the SMaterial struct to the
value returned by this method.
If you simply want to create a new material using vertex and/or pixel shaders, it would
be easier to use the video::IGPUProgrammingServices interface which you can get using
the getGPUProgrammingServices() method.
\param name: name for this registered material renderer entry.
\return Returns the number of the
material type which can be set in SMaterial::MaterialType to use the renderer.
-1 is returned if an error occured. (For example if you tried to add
an material renderer to the software renderer or the null device, which do not accept
material renderers.) */
virtual s32 addMaterialRenderer(IMaterialRenderer* renderer, const c8* name = 0) = 0;
//! Returns pointer to material renderer or null if not existing.
/** \param idx: Id of the material renderer. Can be a value of the E_MATERIAL_TYPE enum or a
value which was returned by addMaterialRenderer(). */
virtual IMaterialRenderer* getMaterialRenderer(u32 idx) = 0;
//! Returns amount of currently available material renderers.
virtual u32 getMaterialRendererCount() = 0;
//! Returns name of the material renderer
/** This string can for example be used to test if a specific renderer already has
been registered/created, or use this string to store data about materials: This
returned name will be also used when serializing Materials.
\param idx: Id of the material renderer. Can be a value of the E_MATERIAL_TYPE enum or a
value which was returned by addMaterialRenderer(). */
virtual const c8* getMaterialRendererName(u32 idx) = 0;
//! Sets the name of a material renderer.
/** Will have no effect on built-in material renderers.
\param idx: Id of the material renderer. Can be a value of the E_MATERIAL_TYPE enum or a
value which was returned by addMaterialRenderer(). */
virtual void setMaterialRendererName(s32 idx, const c8* name) = 0;
//! Creates material attributes list from a material, usable for serialization and more.
/** Please note that the videodriver will use the material renderer names from
getMaterialRendererName() to write out the material type name, so they should be set before. */
virtual io::IAttributes* createAttributesFromMaterial(const video::SMaterial& material) = 0;
//! Fills an SMaterial structure from attributes.
/** Please note that for setting material types of the material, the video driver
will need to query the material renderers for their names, so all non built-in materials must have been created before
calling this method. */
virtual void fillMaterialStructureFromAttributes(video::SMaterial& outMaterial, io::IAttributes* attributes) = 0;
//! Returns driver and operating system specific data about the IVideoDriver.
/** This method should only be used if the engine should be extended without having
to modify the source of the engine. */
virtual SExposedVideoData getExposedVideoData() = 0;
//! Returns type of video driver
virtual E_DRIVER_TYPE getDriverType() = 0;
//! Returns pointer to the IGPUProgrammingServices interface.
/** Returns 0 if the
videodriver does not support this. (For example the Software and the NULL device
will always return 0) */
virtual IGPUProgrammingServices* getGPUProgrammingServices() = 0;
//! Clears the ZBuffer.
/** Note that you usually need not to call this method,
This is done automaticly during IVideoDriver::beginScene() or
IVideoDriver::setRenderTarget() if you specify zBuffer=true.
But if you have to render some special things, you can clear the zbuffer
during the rendering process with this method another time. */
virtual void clearZBuffer() = 0;
//! Returns an image created from the last rendered frame.
virtual IImage* createScreenShot() = 0;
};
} // end namespace video
} // end namespace irr
#endif

View File

@ -1,58 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __IRR_I_VIDEO_MODE_LIST_H_INCLUDED__
#define __IRR_I_VIDEO_MODE_LIST_H_INCLUDED__
#include "IUnknown.h"
#include "dimension2d.h"
namespace irr
{
namespace video
{
//! A list of all available video modes.
/** You can get a list via IrrlichtDevice::getVideoModeList(). If you are confused
now, because you think you have to create an Irrlicht Device with a video
mode before being able to get the video mode list, let me tell you that
there is no need to start up an Irrlicht Device with EDT_DIRECT3D8, EDT_OPENGL or
EDT_SOFTWARE: For this (and for lots of other reasons) the null device,
EDT_NULL exists.*/
class IVideoModeList : public virtual IUnknown
{
public:
//! destructor
virtual ~IVideoModeList() {}
//! Gets amount of video modes in the list.
//! \return Returns amount of video modes.
virtual s32 getVideoModeCount() const = 0;
//! Returns the screen size of a video mode in pixels.
//! \param modeNumber: zero based index of the video mode.
//! \return Returns size of screen in pixels of the specified video mode.
virtual core::dimension2d<s32> getVideoModeResolution(s32 modeNumber) const = 0;
//! Returns the pixel depth of a video mode in bits.
//! \param modeNumber: zero based index of the video mode.
//! \return Returns the size of each pixel of the specified video mode in bits.
virtual s32 getVideoModeDepth(s32 modeNumber) const = 0;
//! Returns current desktop screen resolution.
//! \return Returns size of screen in pixels of the current desktop video mode.
virtual core::dimension2d<s32> getDesktopResolution() const = 0;
//! Returns the pixel depth of a video mode in bits.
//! \return Returns the size of each pixel of the current desktop video mode in bits.
virtual s32 getDesktopDepth() const = 0;
};
} // end namespace video
} // end namespace irr
#endif

View File

@ -1,52 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_WRITE_FILE_H_INCLUDED__
#define __I_WRITE_FILE_H_INCLUDED__
#include "IUnknown.h"
namespace irr
{
namespace io
{
//! Interface providing write acess to a file.
class IWriteFile : public virtual IUnknown
{
public:
virtual ~IWriteFile() {};
//! Reads an amount of bytes from the file.
//! \param buffer: Pointer to buffer of bytes to write.
//! \param sizeToWrite: Amount of bytes to wrtie to the file.
//! \return Returns how much bytes were written.
virtual s32 write(const void* buffer, s32 sizeToWrite) = 0;
//! Changes position in file, returns true if successful.
//! \param finalPos: Destination position in the file.
//! \param relativeMovement: If set to true, the position in the file is
//! changed relative to current position. Otherwise the position is changed
//! from begin of file.
//! \return Returns true if successful, otherwise false.
virtual bool seek(s32 finalPos, bool relativeMovement = false) = 0;
//! Returns the current position in the file.
//! \return Returns the current position in the file in bytes.
virtual s32 getPos() = 0;
//! Returns name of file.
//! \return Returns the file name as zero terminated character string.
virtual const c8* getFileName() = 0;
};
//! Internal function, please do not use.
IWriteFile* createWriteFile(const c8* fileName, bool append);
} // end namespace io
} // end namespace irr
#endif

View File

@ -1,31 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_XML_READER_H_INCLUDED__
#define __I_XML_READER_H_INCLUDED__
#include "IUnknown.h"
#include "irrXML.h"
namespace irr
{
namespace io
{
//! A xml reader for wide characters, derived from IUnknown.
//! This XML Parser can read any type of text files from any source where irrlicht
//! can read. Just call IFileSystem::createXMLReader().
//! For more informations on how to use the parser, see IIrrXMLReader
typedef IIrrXMLReader<wchar_t, IUnknown> IXMLReader;
//! A xml reader for ASCII or UTF-8 characters, derived from IUnknown.
//! This XML Parser can read any type of text files from any source where irrlicht
//! can read. Just call IFileSystem::createXMLReaderUTF8().
//! For more informations on how to use the parser, see IIrrXMLReader
typedef IIrrXMLReader<c8, IUnknown> IXMLReaderUTF8;
} // end namespace io
} // end namespace irr
#endif

View File

@ -1,77 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_XML_WRITER_H_INCLUDED__
#define __I_XML_WRITER_H_INCLUDED__
#include "IUnknown.h"
#include "irrArray.h"
#include "irrString.h"
namespace irr
{
namespace io
{
//! Interface providing methods for making it easier to write XML files.
/** This XML Writer only writes UTF-16 xml files, because these are parsed
faster than all other formats by IXMLReader.
*/
class IXMLWriter : public virtual IUnknown
{
public:
//! Destructor
virtual ~IXMLWriter() {};
//! Writes a xml 1.0 header like &lt;?xml version="1.0"?&gt;. This should
//! always be called before writing anything other, because also the
//! text file header for unicode texts is written out with this method.
virtual void writeXMLHeader() = 0;
//! Writes an xml element with maximal 5 attributes like "<foo />" or
//! &lt;foo optAttr="value" /&gt;. The element can be empty or not.
//! \param name: Name of the element
//! \param empty: Specifies if the element should be empty. Like "<foo />". If
//! You set this to false, something like this is written instead: "<foo>".
//! \param attr1Name: 1st attributes name
//! \param attr1Value: 1st attributes value
//! \param attr2Name: 2nd attributes name
//! \param attr2Value: 2nd attributes value
//! \param attr3Name: 3rd attributes name
//! \param attr3Value: 3rd attributes value
//! \param attr4Name: 4th attributes name
//! \param attr4Value: 4th attributes value
//! \param attr5Name: 5th attributes name
//! \param attr5Value: 5th attributes value
virtual void writeElement(const wchar_t* name, bool empty=false,
const wchar_t* attr1Name = 0, const wchar_t* attr1Value = 0,
const wchar_t* attr2Name = 0, const wchar_t* attr2Value = 0,
const wchar_t* attr3Name = 0, const wchar_t* attr3Value = 0,
const wchar_t* attr4Name = 0, const wchar_t* attr4Value = 0,
const wchar_t* attr5Name = 0, const wchar_t* attr5Value = 0) = 0;
//! Writes an xml element with any number of attributes
virtual void writeElement(const wchar_t* name, bool empty,
core::array<core::stringw> &names, core::array<core::stringw> &values) = 0;
//! Writes a comment into the xml file
virtual void writeComment(const wchar_t* comment) = 0;
//! Writes the closing tag for an element. Like "</foo>"
virtual void writeClosingTag(const wchar_t* name) = 0;
//! Writes a text into the file. All occurrences of special characters like
//! & (&amp;), < (&lt;), > (&gt;), and " (&quot;) are automaticly replaced.
virtual void writeText(const wchar_t* text) = 0;
//! Writes a line break
virtual void writeLineBreak() = 0;
};
} // end namespace io
} // end namespace irr
#endif

View File

@ -1,207 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __IRR_COMPILE_CONFIG_H_INCLUDED__
#define __IRR_COMPILE_CONFIG_H_INCLUDED__
//! Irrlicht SDK Version
#define IRRLICHT_SDK_VERSION "1.3"
//! The defines for different operating system are:
//! _XBOX for XBox
//! WIN32 for Windows32
//! WIN64 for Windows64
//! _IRR_WINDOWS_ for all irrlicht supported windows versions
//! OS2 for OS/2
//! MACOSX for Mac OS X
//! LINUX for linux and unix (it is defined here if no other os is defined)
#if defined(WIN32) || defined(WIN64)
#define _IRR_WINDOWS_
#endif
#if !defined(_IRR_WINDOWS_) && !defined(_XBOX) && !defined(OS2) && !defined(MACOSX)
#define LINUX
#endif
#if defined(__sparc__) || defined(__sun__)
#define __BIG_ENDIAN__
#endif
#include <stdio.h> // TODO: Although included elsewhere this is required at least for mingw
//! Define _IRR_COMPILE_WITH_DIRECT3D_8_ and _IRR_COMPILE_WITH_DIRECT3D_9_ to compile
//! the Irrlicht engine with Direct3D8 and/or DIRECT3D9.
/** If you only want to use the software device or opengl this can be useful.
This switch is mostly disabled because people do not get the g++ compiler compile
directX header files, and directX is only available on windows platforms. If you
are using Dev-Cpp, and want to compile this using a DX dev pack, you can define
_IRR_COMPILE_WITH_DX9_DEV_PACK_. So you simply need to add something like this
to the compiler settings: -DIRR_COMPILE_WITH_DX9_DEV_PACK
and this to the linker settings: -ld3dx9 -ld3dx8 **/
#if (defined(_IRR_WINDOWS_) || defined(_XBOX)) && \
(!defined(__GNUC__) || defined(IRR_COMPILE_WITH_DX9_DEV_PACK))
#define _IRR_COMPILE_WITH_DIRECT3D_8_
#define _IRR_COMPILE_WITH_DIRECT3D_9_
#endif
//! Define _IRR_COMPILE_WITH_OPENGL_ to compile the Irrlicht engine with OpenGL.
/** If you do not wish the engine to be compiled with OpengGL, comment this
define out. */
#if !defined(_XBOX)
#define _IRR_COMPILE_WITH_OPENGL_
#endif // ! _XBOX
//! Define _IRR_COMPILE_WITH_SOFTWARE_ to compile the Irrlicht engine with software driver
/** If you do not need the software driver, or want to use Burning's Video instead,
comment this define out */
#define _IRR_COMPILE_WITH_SOFTWARE_
//! Define _IRR_COMPILE_WITH_BURNINGSVIDEO_ to compile the Irrlicht engine with Burning's video driver
/** If you do not need this software driver, you can comment this define out. */
#define _IRR_COMPILE_WITH_BURNINGSVIDEO_
//! Define _IRR_COMPILE_WITH_X11_ to compile the Irrlicht engine with X11 support.
/** If you do not wish the engine to be compiled with X11, comment this
define out. */
#if defined(LINUX)
#define _IRR_COMPILE_WITH_X11_
#endif
//! Define _IRR_OPENGL_USE_EXTPOINTER_ if the OpenGL renderer should use OpenGL extensions via function pointers.
/** On some systems there is no support for the dynamic extension of OpenGL
via function pointers such that this has to be undef'ed. */
#if !defined(MACOSX) && !defined(__sun__)
#define _IRR_OPENGL_USE_EXTPOINTER_
#endif
//! On some Linux systems the XF86 vidmode extension or X11 RandR are missing. Use these flags
//! to remove the dependencies such that Irrlicht will compile on those systems, too.
#if defined(LINUX) && !defined(__sun__)
#define _IRR_LINUX_X11_VIDMODE_
//#define _IRR_LINUX_X11_RANDR_
#endif
//! Define _IRR_COMPILE_WITH_ZLIB_ to enable compiling the engine using zlib.
/** This enables the engine to read from compressed .zip archives. If you
disable this feature, the engine can still read archives, but only uncompressed
ones. */
#define _IRR_COMPILE_WITH_ZLIB_
//! Define _IRR_USE_NON_SYSTEM_ZLIB_ to let irrlicht use the zlib which comes with irrlicht.
/** If this is commented out, Irrlicht will try to compile using the zlib installed in the system.
This is only used when _IRR_COMPILE_WITH_ZLIB_ is defined. */
//#define _IRR_USE_NON_SYSTEM_ZLIB_
//! Define _IRR_COMPILE_WITH_JPEGLIB_ to enable compiling the engine using libjpeg.
/** This enables the engine to read jpeg images. If you comment this out,
the engine will no longer read .jpeg images. */
#define _IRR_COMPILE_WITH_LIBJPEG_
//! Define _IRR_USE_NON_SYSTEM_JPEG_LIB_ to let irrlicht use the jpeglib which comes with irrlicht.
/** If this is commented out, Irrlicht will try to compile using the jpeg lib installed in the system.
This is only used when _IRR_COMPILE_WITH_LIBJPEG_ is defined. */
#define _IRR_USE_NON_SYSTEM_JPEG_LIB_
//! Define _IRR_COMPILE_WITH_LIBPNG_ to enable compiling the engine using libpng.
/** This enables the engine to read png images. If you comment this out,
the engine will no longer read .png images. */
#define _IRR_COMPILE_WITH_LIBPNG_
//! Define _IRR_USE_NON_SYSTEM_LIBPNG_ to let irrlicht use the libpng which comes with irrlicht.
/** If this is commented out, Irrlicht will try to compile using the libpng installed in the system.
This is only used when _IRR_COMPILE_WITH_LIBPNG_ is defined. */
#define _IRR_USE_NON_SYSTEM_LIB_PNG_
//! Define _IRR_D3D_NO_SHADER_DEBUGGING to disable shader debugging in D3D9
/** If _IRR_D3D_NO_SHADER_DEBUGGING is undefined in IrrCompileConfig.h,
it is possible to debug all D3D9 shaders in VisualStudio. All shaders
(which have been generated in memory or read from archives for example) will be emitted
into a temporary file at runtime for this purpose. To debug your shaders, choose
Debug->Direct3D->StartWithDirect3DDebugging in Visual Studio, and for every shader a
file named 'irr_dbg_shader_%%.vsh' or 'irr_dbg_shader_%%.psh' will be created. Drag'n'drop
the file you want to debug into visual studio. That's it. You can now set breakpoints and
watch registers, variables etc. This works with ASM, HLSL, and both with pixel and vertex shaders.
Note that the engine will run in D3D REF for this, which is a lot slower than HAL. */
#define _IRR_D3D_NO_SHADER_DEBUGGING
#define _IRR_STATIC_LIB_
#ifdef _IRR_WINDOWS_
#ifndef _IRR_STATIC_LIB_
#ifdef IRRLICHT_EXPORTS
#define IRRLICHT_API __declspec(dllexport)
#else
#define IRRLICHT_API __declspec(dllimport)
#endif // IRRLICHT_EXPORT
#else
#define IRRLICHT_API
#endif // _IRR_STATIC_LIB_
// Declare the calling convention.
#if defined(_STDCALL_SUPPORTED)
#define IRRCALLCONV __stdcall
#else
#define IRRCALLCONV __cdecl
#endif // STDCALL_SUPPORTED
#else
#define IRRLICHT_API
#define IRRCALLCONV
#endif // _IRR_WINDOWS_
// We need to disable DIRECT3D9 support for Visual Studio 6.0 because
// those $%&$!! disabled support for it since Dec. 2004 and users are complaining
// about linker errors. Comment this out only if you are knowing what you are
// doing. (Which means you have an old DX9 SDK and VisualStudio6).
#ifdef _MSC_VER
#if (_MSC_VER < 1300 && !defined(__GNUC__))
#undef _IRR_COMPILE_WITH_DIRECT3D_9_
#pragma message("Compiling Irrlicht with Visual Studio 6.0, support for DX9 is disabled.")
#endif
#endif
//! Define one of the three setting for Burning's Video Software Rasterizer
/** So if we were marketing guys we could says Irrlicht has 4 Software-Rasterizers.
In a Nutshell:
All Burnings Rasterizers use 32 Bit Backbuffer, 32Bit Texture & 32 Bit Z or WBuffer,
16 Bit/32 Bit can be adjusted on a global flag.
BURNINGVIDEO_RENDERER_BEAUTIFUL
32 Bit + Vertexcolor + Lighting + Per Pixel Perspective Correct + SubPixel/SubTexel Correct +
Bilinear Texturefiltering + WBuffer
BURNINGVIDEO_RENDERER_FAST
32 Bit + Per Pixel Perspective Correct + SubPixel/SubTexel Correct + WBuffer +
Bilinear Dithering TextureFilterung + WBuffer
BURNINGVIDEO_RENDERER_ULTRA_FAST
16Bit + SubPixel/SubTexel Correct + ZBuffer
*/
#define BURNINGVIDEO_RENDERER_BEAUTIFUL
//#define BURNINGVIDEO_RENDERER_FAST
//#define BURNINGVIDEO_RENDERER_ULTRA_FAST
//! Set FPU settings
/** Irrlicht should use approximate float and integer fpu techniques
precision will be lower but speed higher. currently X86 only
*/
#if !defined(MACOSX) && !defined(__sun__)
//#define IRRLICHT_FAST_MATH
#endif
#endif // __IRR_COMPILE_CONFIG_H_INCLUDED__

View File

@ -1,169 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_IRRLICHT_DEVICE_H_INCLUDED__
#define __I_IRRLICHT_DEVICE_H_INCLUDED__
#include "irrTypes.h"
#include "IUnknown.h"
#include "dimension2d.h"
#include "IFileSystem.h"
#include "IVideoDriver.h"
#include "EDriverTypes.h"
#include "IGUIEnvironment.h"
#include "IEventReceiver.h"
#include "ISceneManager.h"
#include "ICursorControl.h"
#include "IVideoModeList.h"
#include "ITimer.h"
#include "ILogger.h"
#include "IOSOperator.h"
namespace irr
{
//! The Irrlicht device. You can create it with createDevice() or createDeviceEx().
/** This is the most important class of the Irrlicht Engine. You can access everything
in the engine if you have a pointer to an instance of this class.
*/
class IrrlichtDevice : public virtual IUnknown
{
public:
//! destructor
virtual ~IrrlichtDevice() {};
//! Runs the device.
/** Also increments the virtual timer by calling ITimer::tick();. You can prevent this
by calling ITimer::stop(); before and ITimer::start() after calling IrrlichtDevice::run().
Returns false if device wants to be deleted. Use it in this way:
\code
while(device->run())
{
// draw everything here
}
\endcode
If you want the device to do nothing if the window is inactive (recommended),
use this slightly enhanced code instead:
\code
while(device->run())
if (device->isWindowActive())
{
// draw everything here
}
\endcode
Note if you are running Irrlicht inside an external, custom created window:
Calling Device->run() will cause Irrlicht to dispatch windows messages internally.
If you are running Irrlicht in your own, custom window, you
you can also simply use your own message loop
using GetMessage, DispatchMessage and whatever and simply don't use this method.
But note that Irrlicht will not be able to fetch user input then. See
irr::SIrrlichtCreationParameters::WindowId for more informations and example code.
*/
virtual bool run() = 0;
//! Cause the device to temporarily pause execution and let other processes to run
// This should bring down processor usage without major performance loss for Irrlicht
virtual void yield() = 0;
//! Pause execution and let other processes to run for a specified amount of time.
/** It may not wait the full given time, as sleep may be interrupted
\param timeMs: Time to sleep for in milisecs.
\param pauseTimer: If true, pauses the device timer while sleeping
*/
virtual void sleep(u32 timeMs, bool pauseTimer=false) = 0;
//! Provides access to the video driver for drawing 3d and 2d geometry.
/** \return Returns a pointer the video driver. */
virtual video::IVideoDriver* getVideoDriver() = 0;
//! Provides access to the virtual file system.
/** \return Returns a pointer to the file system. */
virtual io::IFileSystem* getFileSystem() = 0;
//! Provides access to the 2d user interface environment.
/** \return Returns a pointer to the gui environment. */
virtual gui::IGUIEnvironment* getGUIEnvironment() = 0;
//! \return Returns a pointer to the scene manager.
virtual scene::ISceneManager* getSceneManager() = 0;
//! Provides access to the cursor control.
/** \return Returns a pointer to the mouse cursor control interface. */
virtual gui::ICursorControl* getCursorControl() = 0;
//! Provides access to the logger.
/** \return Returns a pointer to the logger. */
virtual ILogger* getLogger() = 0;
//! Gets a list with all video modes available.
/** If you are confused
now, because you think you have to create an Irrlicht Device with a video
mode before being able to get the video mode list, let me tell you that
there is no need to start up an Irrlicht Device with EDT_DIRECT3D8, EDT_OPENGL or
EDT_SOFTWARE: For this (and for lots of other reasons) the null device,
EDT_NULL exists.
\return Returns a pointer to a list with all video modes supported
by the gfx adapter. */
virtual video::IVideoModeList* getVideoModeList() = 0;
//! Returns the operation system opertator object.
/** It provides methods for
getting operation system specific informations and doing operation system
specific operations. Like for example exchanging data with the clipboard
or reading the operation system version. */
virtual IOSOperator* getOSOperator() = 0;
//! Returns pointer to the timer.
/** \return Returns a pointer to the ITimer object. The system time can be retrieved by it as
well as the virtual time, which also can be manipulated. */
virtual ITimer* getTimer() = 0;
//! Sets the caption of the window.
/** \param text: New text of the window caption. */
virtual void setWindowCaption(const wchar_t* text) = 0;
//! Returns if the window is active.
/** \return Returns true if window is active. If the window is inactive,
nothing need to be drawn. So if you don't want to draw anything when
the window is inactive, create your drawing loop this way:
\code
while(device->run())
if (device->isWindowActive())
{
// draw everything here
}
\endcode */
virtual bool isWindowActive() = 0;
//! Notifies the device that it should close itself.
/** IrrlichtDevice::run() will always return false after closeDevice() was called. */
virtual void closeDevice() = 0;
//! Returns the version of the engine.
/** The returned string
will look like this: "1.2.3" or this: "1.2". */
virtual const c8* getVersion() = 0;
//! Sets a new event receiver to receive events.
virtual void setEventReceiver(IEventReceiver* receiver) = 0;
//! Returns poinhter to the current event receiver. Returns 0 if there is none.
virtual IEventReceiver* getEventReceiver() = 0;
//! Sends a user created event to the engine.
/** Is is usually not necessary to use this. However, if you are using an own
input library for example for doing joystick input, you can use this to post key or mouse input
events to the engine. Internally, this method only delegates the events further to the
scene manager and the GUI environment. */
virtual void postEventFromUser(SEvent event) = 0;
//! Sets if the window should be resizeable in windowed mode.
/** The default is false. This method only works in windowed mode. */
virtual void setResizeAble(bool resize=false) = 0;
};
} // end namespace irr
#endif

View File

@ -1,163 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __IRR_KEY_CODES_H_INCLUDED__
#define __IRR_KEY_CODES_H_INCLUDED__
namespace irr
{
enum EKEY_CODE
{
KEY_LBUTTON = 0x01, // Left mouse button
KEY_RBUTTON = 0x02, // Right mouse button
KEY_CANCEL = 0x03, // Control-break processing
KEY_MBUTTON = 0x04, // Middle mouse button (three-button mouse)
KEY_XBUTTON1 = 0x05, // Windows 2000/XP: X1 mouse button
KEY_XBUTTON2 = 0x06, // Windows 2000/XP: X2 mouse button
KEY_BACK = 0x08, // BACKSPACE key
KEY_TAB = 0x09, // TAB key
KEY_CLEAR = 0x0C, // CLEAR key
KEY_RETURN = 0x0D, // ENTER key
KEY_SHIFT = 0x10, // SHIFT key
KEY_CONTROL = 0x11, // CTRL key
KEY_MENU = 0x12, // ALT key
KEY_PAUSE = 0x13, // PAUSE key
KEY_CAPITAL = 0x14, // CAPS LOCK key
KEY_KANA = 0x15, // IME Kana mode
KEY_HANGUEL = 0x15, // IME Hanguel mode (maintained for compatibility use KEY_HANGUL)
KEY_HANGUL = 0x15, // IME Hangul mode
KEY_JUNJA = 0x17, // IME Junja mode
KEY_FINAL = 0x18, // IME final mode
KEY_HANJA = 0x19, // IME Hanja mode
KEY_KANJI = 0x19, // IME Kanji mode
KEY_ESCAPE = 0x1B, // ESC key
KEY_CONVERT = 0x1C, // IME convert
KEY_NONCONVERT = 0x1D, // IME nonconvert
KEY_ACCEPT = 0x1E, // IME accept
KEY_MODECHANGE = 0x1F, // IME mode change request
KEY_SPACE = 0x20, // SPACEBAR
KEY_PRIOR = 0x21, // PAGE UP key
KEY_NEXT = 0x22, // PAGE DOWN key
KEY_END = 0x23, // END key
KEY_HOME = 0x24, // HOME key
KEY_LEFT = 0x25, // LEFT ARROW key
KEY_UP = 0x26, // UP ARROW key
KEY_RIGHT = 0x27, // RIGHT ARROW key
KEY_DOWN = 0x28, // DOWN ARROW key
KEY_SELECT = 0x29, // SELECT key
KEY_PRINT = 0x2A, // PRINT key
KEY_EXECUT = 0x2B, // EXECUTE key
KEY_SNAPSHOT = 0x2C, // PRINT SCREEN key
KEY_INSERT = 0x2D, // INS key
KEY_DELETE = 0x2E, // DEL key
KEY_HELP = 0x2F, // HELP key
KEY_KEY_0 = 0x30, // 0 key
KEY_KEY_1 = 0x31, // 1 key
KEY_KEY_2 = 0x32, // 2 key
KEY_KEY_3 = 0x33, // 3 key
KEY_KEY_4 = 0x34, // 4 key
KEY_KEY_5 = 0x35, // 5 key
KEY_KEY_6 = 0x36, // 6 key
KEY_KEY_7 = 0x37, // 7 key
KEY_KEY_8 = 0x38, // 8 key
KEY_KEY_9 = 0x39, // 9 key
KEY_KEY_A = 0x41, // A key
KEY_KEY_B = 0x42, // B key
KEY_KEY_C = 0x43, // C key
KEY_KEY_D = 0x44, // D key
KEY_KEY_E = 0x45, // E key
KEY_KEY_F = 0x46, // F key
KEY_KEY_G = 0x47, // G key
KEY_KEY_H = 0x48, // H key
KEY_KEY_I = 0x49, // I key
KEY_KEY_J = 0x4A, // J key
KEY_KEY_K = 0x4B, // K key
KEY_KEY_L = 0x4C, // L key
KEY_KEY_M = 0x4D, // M key
KEY_KEY_N = 0x4E, // N key
KEY_KEY_O = 0x4F, // O key
KEY_KEY_P = 0x50, // P key
KEY_KEY_Q = 0x51, // Q key
KEY_KEY_R = 0x52, // R key
KEY_KEY_S = 0x53, // S key
KEY_KEY_T = 0x54, // T key
KEY_KEY_U = 0x55, // U key
KEY_KEY_V = 0x56, // V key
KEY_KEY_W = 0x57, // W key
KEY_KEY_X = 0x58, // X key
KEY_KEY_Y = 0x59, // Y key
KEY_KEY_Z = 0x5A, // Z key
KEY_LWIN = 0x5B, // Left Windows key (MicrosoftŽ NaturalŽ keyboard)
KEY_RWIN = 0x5C, // Right Windows key (Natural keyboard)
KEY_APPS = 0x5D, //Applications key (Natural keyboard)
KEY_SLEEP = 0x5F, // Computer Sleep key
KEY_NUMPAD0 = 0x60, // Numeric keypad 0 key
KEY_NUMPAD1 = 0x61, // Numeric keypad 1 key
KEY_NUMPAD2 = 0x62, // Numeric keypad 2 key
KEY_NUMPAD3 = 0x63, // Numeric keypad 3 key
KEY_NUMPAD4 = 0x64, // Numeric keypad 4 key
KEY_NUMPAD5 = 0x65, // Numeric keypad 5 key
KEY_NUMPAD6 = 0x66, // Numeric keypad 6 key
KEY_NUMPAD7 = 0x67, // Numeric keypad 7 key
KEY_NUMPAD8 = 0x68, // Numeric keypad 8 key
KEY_NUMPAD9 = 0x69, // Numeric keypad 9 key
KEY_MULTIPLY = 0x6A, // Multiply key
KEY_ADD = 0x6B, // Add key
KEY_SEPARATOR = 0x6C, // Separator key
KEY_SUBTRACT = 0x6D, // Subtract key
KEY_DECIMAL = 0x6E, // Decimal key
KEY_DIVIDE = 0x6F, // Divide key
KEY_F1 = 0x70, // F1 key
KEY_F2 = 0x71, // F2 key
KEY_F3 = 0x72, // F3 key
KEY_F4 = 0x73, // F4 key
KEY_F5 = 0x74, // F5 key
KEY_F6 = 0x75, // F6 key
KEY_F7 = 0x76, // F7 key
KEY_F8 = 0x77, // F8 key
KEY_F9 = 0x78, // F9 key
KEY_F10 = 0x79, // F10 key
KEY_F11 = 0x7A, // F11 key
KEY_F12 = 0x7B, // F12 key
KEY_F13 = 0x7C, // F13 key
KEY_F14 = 0x7D, // F14 key
KEY_F15 = 0x7E, // F15 key
KEY_F16 = 0x7F, // F16 key
KEY_F17 = 0x80, // F17 key
KEY_F18 = 0x81, // F18 key
KEY_F19 = 0x82, // F19 key
KEY_F20 = 0x83, // F20 key
KEY_F21 = 0x84, // F21 key
KEY_F22 = 0x85, // F22 key
KEY_F23 = 0x86, // F23 key
KEY_F24 = 0x87, // F24 key
KEY_NUMLOCK = 0x90, // NUM LOCK key
KEY_SCROLL = 0x91, // SCROLL LOCK key
KEY_LSHIFT = 0xA0, // Left SHIFT key
KEY_RSHIFT = 0xA1, // Right SHIFT key
KEY_LCONTROL = 0xA2, // Left CONTROL key
KEY_RCONTROL = 0xA3, // Right CONTROL key
KEY_LMENU = 0xA4, // Left MENU key
KEY_RMENU = 0xA5, // Right MENU key
KEY_PLUS = 0xBB, // Plus Key (+)
KEY_COMMA = 0xBC, // Comma Key (,)
KEY_MINUS = 0xBD, // Minus Key (-)
KEY_PERIOD = 0xBE, // Period Key (.)
KEY_ATTN = 0xF6, // Attn key
KEY_CRSEL = 0xF7, // CrSel key
KEY_EXSEL = 0xF8, // ExSel key
KEY_EREOF = 0xF9, // Erase EOF key
KEY_PLAY = 0xFA, // Play key
KEY_ZOOM = 0xFB, // Zoom key
KEY_PA1 = 0xFD, // PA1 key
KEY_OEM_CLEAR = 0xFE, // Clear key
KEY_KEY_CODES_COUNT = 0xFF // this is not a key, but the amount of keycodes there are.
};
} // end namespace irr
#endif

View File

@ -1,193 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __S_3D_VERTEX_H_INCLUDED__
#define __S_3D_VERTEX_H_INCLUDED__
#include "vector3d.h"
#include "vector2d.h"
#include "SColor.h"
namespace irr
{
namespace video
{
//! Enumeration for all vertex types there are.
enum E_VERTEX_TYPE
{
//! Standard vertex type used by the Irrlicht engine, video::S3DVertex.
EVT_STANDARD = 0,
//! Vertex with two texture coordinates, video::S3DVertex2TCoords. Usually used
//! for geometry with lightmaps or other special materials.
EVT_2TCOORDS,
//! Vertex with a tangent and binormal vector, video::S3DVertexTangents. Usually
//! used for tangent space normal mapping.
EVT_TANGENTS
};
//! standard vertex used by the Irrlicht engine.
struct S3DVertex
{
//! default constructor
S3DVertex() {};
//! constructor
S3DVertex(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor c, f32 tu, f32 tv)
: Pos(x,y,z), Normal(nx,ny,nz), Color(c), TCoords(tu,tv) {}
//! constructor
S3DVertex(const core::vector3df& pos, const core::vector3df& normal,
SColor color, const core::vector2d<f32>& tcoords)
: Pos(pos), Normal(normal), Color(color), TCoords(tcoords) {}
//! Position
core::vector3df Pos;
//! Normal vector
core::vector3df Normal;
//! Color
SColor Color;
//! Texture coordinates
core::vector2d<f32> TCoords;
bool operator == (const S3DVertex& other) const
{
return (Pos == other.Pos && Normal == other.Normal &&
Color == other.Color && TCoords == other.TCoords);
}
bool operator != (const S3DVertex& other) const
{
return (Pos != other.Pos || Normal != other.Normal ||
Color != other.Color || TCoords != other.TCoords);
}
};
//! Vertex with two texture coordinates.
/** Usually used for geometry with lightmaps
or other special materials.
*/
struct S3DVertex2TCoords
{
//! default constructor
S3DVertex2TCoords() {};
//! constructor with two different texture coords
S3DVertex2TCoords(f32 x, f32 y, f32 z, SColor c, f32 tu, f32 tv, f32 tu2, f32 tv2)
: Pos(x,y,z), Color(c), TCoords(tu,tv), TCoords2(tu2,tv2) {}
//! constructor with two different texture coords
S3DVertex2TCoords(const core::vector3df& pos, SColor color,
const core::vector2d<f32>& tcoords, const core::vector2d<f32>& tcoords2)
: Pos(pos), Color(color), TCoords(tcoords), TCoords2(tcoords2) {}
//! constructor
S3DVertex2TCoords(const core::vector3df& pos, const core::vector3df& normal, const SColor& color,
const core::vector2d<f32>& tcoords, const core::vector2d<f32>& tcoords2)
: Pos(pos), Normal(normal), Color(color), TCoords(tcoords), TCoords2(tcoords2) {}
//! constructor with the same texture coords and normal
S3DVertex2TCoords(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor c, f32 tu, f32 tv)
: Pos(x,y,z), Normal(nx,ny,nz), Color(c), TCoords(tu,tv), TCoords2(tu,tv) {}
//! constructor with the same texture coords and normal
S3DVertex2TCoords(const core::vector3df& pos, const core::vector3df& normal,
SColor color, const core::vector2d<f32>& tcoords)
: Pos(pos), Normal(normal), Color(color), TCoords(tcoords), TCoords2(tcoords) {}
//! Position
core::vector3df Pos;
//! Normal
core::vector3df Normal;
//! Color
SColor Color;
//! First set of texture coordinates
core::vector2d<f32> TCoords;
//! Second set of texture coordinates
core::vector2d<f32> TCoords2;
bool operator == (const S3DVertex2TCoords& other) const
{
return (Pos == other.Pos && Normal == other.Normal &&
Color == other.Color && TCoords == other.TCoords &&
TCoords2 == other.TCoords2);
}
bool operator != (const S3DVertex2TCoords& other) const
{
return (Pos != other.Pos || Normal != other.Normal ||
Color != other.Color || TCoords != other.TCoords ||
TCoords2 != other.TCoords2);
}
};
//! Vertex with a tangent and binormal vector.
/** Usually used for tangent space normal mapping.
*/
struct S3DVertexTangents
{
//! default constructor
S3DVertexTangents() { };
//! constructor
S3DVertexTangents(f32 x, f32 y, f32 z)
: Pos(x,y,z) { }
//! constructor
S3DVertexTangents(const core::vector3df& pos,
const core::vector2df& tcoords, SColor c)
: Pos(pos), Color(c), TCoords(tcoords) { }
//! Position
core::vector3df Pos;
//! Normal vector
core::vector3df Normal;
//! Color
SColor Color;
//! Texture coordinates
core::vector2d<f32> TCoords;
//! Tangent vector along the x-axis of the texture
core::vector3df Tangent;
//! Binormal vector (tangent x normal)
core::vector3df Binormal;
bool operator == (const S3DVertexTangents& other) const
{
return (Pos == other.Pos && Normal == other.Normal &&
Color == other.Color && TCoords == other.TCoords &&
Tangent == other.Tangent && Binormal == other.Binormal);
}
bool operator != (const S3DVertexTangents& other) const
{
return (Pos != other.Pos || Normal != other.Normal ||
Color != other.Color || TCoords != other.TCoords ||
Tangent != other.Tangent || Binormal != other.Binormal);
}
};
} // end namespace video
} // end namespace irr
#endif

View File

@ -1,121 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __S_ANIMATED_MESH_H_INCLUDED__
#define __S_ANIMATED_MESH_H_INCLUDED__
#include "IAnimatedMesh.h"
#include "IMesh.h"
#include "aabbox3d.h"
#include "irrArray.h"
namespace irr
{
namespace scene
{
//! Simple implementation of the IAnimatedMesh interface.
struct SAnimatedMesh : public IAnimatedMesh
{
//! constructor
SAnimatedMesh()
{
#ifdef _DEBUG
setDebugName("SAnimatedMesh");
#endif
Type = EAMT_UNKNOWN;
}
//! destructor
~SAnimatedMesh()
{
// drop meshes
for (u32 i=0; i<Meshes.size(); ++i)
Meshes[i]->drop();
};
//! Gets the frame count of the animated mesh.
//! \return Returns the amount of frames. If the amount is 1, it is a static, non animated mesh.
virtual s32 getFrameCount()
{
return Meshes.size();
}
//! Returns the IMesh interface for a frame.
//! \param frame: Frame number as zero based index. The maximum frame number is
//! getFrameCount() - 1;
//! \param detailLevel: Level of detail. 0 is the lowest,
//! 255 the highest level of detail. Most meshes will ignore the detail level.
//! \param startFrameLoop: start frame
//! \param endFrameLoop: end frame
//! \return Returns the animated mesh based on a detail level.
virtual IMesh* getMesh(s32 frame, s32 detailLevel, s32 startFrameLoop=-1, s32 endFrameLoop=-1)
{
if (Meshes.empty())
return 0;
return Meshes[frame];
}
//! adds a Mesh
void addMesh(IMesh* mesh)
{
if (mesh)
{
mesh->grab();
Meshes.push_back(mesh);
}
}
//! Returns an axis aligned bounding box of the mesh.
//! \return A bounding box of this mesh is returned.
virtual const core::aabbox3d<f32>& getBoundingBox() const
{
return Box;
}
//! set user axis aligned bounding box
virtual void setBoundingBox( const core::aabbox3df& box)
{
Box = box;
}
void recalculateBoundingBox()
{
Box.reset(0,0,0);
if (Meshes.empty())
return;
Box = Meshes[0]->getBoundingBox();
for (u32 i=1; i<Meshes.size(); ++i)
Box.addInternalBox(Meshes[i]->getBoundingBox());
}
//! Returns the type of the animated mesh.
virtual E_ANIMATED_MESH_TYPE getMeshType() const
{
return Type;
}
core::aabbox3d<f32> Box;
core::array<IMesh*> Meshes;
E_ANIMATED_MESH_TYPE Type;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,513 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __COLOR_H_INCLUDED__
#define __COLOR_H_INCLUDED__
#include "irrTypes.h"
#include "irrMath.h"
namespace irr
{
namespace video
{
//! Creates a 16 bit A1R5G5B5 color
inline u16 RGBA16(u32 r, u32 g, u32 b, u32 a)
{
return ((a & 0x80) << 8 |
(r & 0xF8) << 7 |
(g & 0xF8) << 2 |
(b & 0xF8) >> 3);
}
//! Creates a 16 bit A1R5G5B5 color
inline u16 RGB16(u32 r, u32 g, u32 b)
{
return RGBA16(r,g,b,0xFF);
}
//! Creates a 16 bit A1R5G5B5 color, based on 16 bit input values
inline u16 RGB16from16(u16 r, u16 g, u16 b)
{
return (r & 0x1F) << 10 |
(g & 0x1F) << 5 |
(b & 0x1F);
}
//! Converts a 32 bit (X8R8G8B8) color to a 16 A1R5G5B5 color
inline u16 X8R8G8B8toA1R5G5B5(u32 color)
{
return ( 0x8000 |
( color & 0x00F80000) >> 9 |
( color & 0x0000F800) >> 6 |
( color & 0x000000F8) >> 3);
}
//! Converts a 32 bit (A8R8G8B8) color to a 16 A1R5G5B5 color
inline u16 A8R8G8B8toA1R5G5B5(u32 color)
{
return (( color & 0x80000000) >> 16|
( color & 0x00F80000) >> 9 |
( color & 0x0000F800) >> 6 |
( color & 0x000000F8) >> 3);
}
//! Returns A8R8G8B8 Color from A1R5G5B5 color
//! build a nicer 32 Bit Color by extending dest lower bits with source high bits
inline u32 A1R5G5B5toA8R8G8B8(u32 color)
{
return ( (( -( (s32) color & 0x00008000 ) >> (s32) 31 ) & 0xFF000000 ) |
(( color & 0x00007C00 ) << 9) | (( color & 0x00007000 ) << 4) |
(( color & 0x000003E0 ) << 6) | (( color & 0x00000380 ) << 1) |
(( color & 0x0000001F ) << 3) | (( color & 0x0000001C ) >> 2)
);
}
//! Returns A8R8G8B8 Color from R5G6B5 color
inline u32 R5G6B5toA8R8G8B8(u16 color)
{
return 0xFF000000 |
((color & 0xF800) << 8)|
((color & 0x07E0) << 5)|
((color & 0x001F) << 3);
}
//! Returns A1R5G5B5 Color from R5G6B5 color
inline u16 R5G6B5toA1R5G5B5(u16 color)
{
return 0x8000 | (((color & 0xFFC0) >> 1) | (color & 0x1F));
}
//! Returns R5G6B5 Color from A1R5G5B5 color
inline u16 A1R5G5B5toR5G6B5(u16 color)
{
return (((color & 0x7FE0) << 1) | (color & 0x1F));
}
//! Returns the alpha component from A1R5G5B5 color
inline u32 getAlpha(u16 color)
{
return ((color >> 15)&0x1);
}
//! Returns the red component from A1R5G5B5 color.
//! Shift left by 3 to get 8 bit value.
inline u32 getRed(u16 color)
{
return ((color >> 10)&0x1F);
}
//! Returns the green component from A1R5G5B5 color
//! Shift left by 3 to get 8 bit value.
inline u32 getGreen(u16 color)
{
return ((color >> 5)&0x1F);
}
//! Returns the blue component from A1R5G5B5 color
//! Shift left by 3 to get 8 bit value.
inline u32 getBlue(u16 color)
{
return (color & 0x1F);
}
//! Returns the red component from A1R5G5B5 color.
//! Shift left by 3 to get 8 bit value.
inline s32 getRedSigned(u16 color)
{
return ((color >> 10)&0x1F);
}
//! Returns the green component from A1R5G5B5 color
//! Shift left by 3 to get 8 bit value.
inline s32 getGreenSigned(u16 color)
{
return ((color >> 5)&0x1F);
}
//! Returns the blue component from A1R5G5B5 color
//! Shift left by 3 to get 8 bit value.
inline s32 getBlueSigned(u16 color)
{
return (color & 0x1F);
}
//! Returns the average from a 16 bit A1R5G5B5 color
inline s32 getAverage(s16 color)
{
return ((getRed(color)<<3) + (getGreen(color)<<3) + (getBlue(color)<<3)) / 3;
}
//! Class representing a 32 bit ARGB color.
/** The color values for alpha, red, green, and blue are
stored in a single s32. So all four values may be between 0 and 255.
This class is used by most parts of the Irrlicht Engine
to specify a color. Another way is using the class Colorf, which
stores the color values in 4 floats.
*/
class SColor
{
public:
//! Constructor of the Color. Does nothing. The color value
//! is not initialized to save time.
inline SColor() {}
//! Constructs the color from 4 values representing the alpha, red, green and
//! blue components of the color. Must be values between 0 and 255.
inline SColor (u32 a, u32 r, u32 g, u32 b)
: color(((a & 0xff)<<24) | ((r & 0xff)<<16) | ((g & 0xff)<<8) | (b & 0xff)) {}
//! Constructs the color from a 32 bit value. Could be another color.
inline SColor(u32 clr)
: color(clr) {}
//! Returns the alpha component of the color. The alpha component
//! defines how transparent a color should be.
//! 0 means not transparent (opaque), 255 means fully transparent.
inline u32 getAlpha() const { return color>>24; }
//! Returns the red component of the color.
//! \return Returns a value between 0 and 255, specifying how red the color is.
//! 0 means no red, 255 means full red.
inline u32 getRed() const { return (color>>16) & 0xff; }
//! Returns the green component of the color.
//! \return Returns a value between 0 and 255, specifying how green the color is.
//! 0 means no green, 255 means full green.
inline u32 getGreen() const { return (color>>8) & 0xff; }
//! Returns the blue component of the color.
//! \return Returns a value between 0 and 255, specifying how blue the color is.
//! 0 means no blue, 255 means full blue.
inline u32 getBlue() const { return color & 0xff; }
//! Returns the luminance of the color.
inline f32 getLuminance() const
{
return 0.3f*getRed() + 0.59f*getGreen() + 0.11f*getBlue();
}
//! Returns the average intensity of the color.
inline u32 getAverage() const
{
return ( getRed() + getGreen() + getBlue() ) / 3;
}
//! Sets the alpha component of the Color. The alpha component
//! defines how transparent a color should be.
//! \param a: Has to be a value between 0 and 255.
//! 0 means not transparent (opaque), 255 means fully transparent.
inline void setAlpha(u32 a) { color = ((a & 0xff)<<24) | (color & 0x00ffffff); }
//! Sets the red component of the Color.
//! \param r: Has to be a value between 0 and 255.
//! 0 means no red (=black), 255 means full red.
inline void setRed(u32 r) { color = ((r & 0xff)<<16) | (color & 0xff00ffff); }
//! Sets the green component of the Color.
//! \param g: Has to be a value between 0 and 255.
//! 0 means no green (=black), 255 means full green.
inline void setGreen(u32 g) { color = ((g & 0xff)<<8) | (color & 0xffff00ff); }
//! Sets the blue component of the Color.
//! \param b: Has to be a value between 0 and 255.
//! 0 means no blue (=black), 255 means full blue.
inline void setBlue(u32 b) { color = (b & 0xff) | (color & 0xffffff00); }
//! Calculates a 16 bit A1R5G5B5 value of this color.
//! \return Returns the 16 bit A1R5G5B5 value of this color.
inline u16 toA1R5G5B5() const { return A8R8G8B8toA1R5G5B5(color); };
//! Converts color to OpenGL color format,
//! from ARGB to RGBA in 4 byte components for endian aware
//! passing to OpenGL
//! \param dest: address where the 4x8 bit OpenGL color is stored.
inline void toOpenGLColor(u8* dest) const
{
*dest = getRed();
*++dest = getGreen();
*++dest = getBlue();
*++dest = getAlpha();
};
//! Sets all four components of the color at once.
//! Constructs the color from 4 values representing the alpha, red, green and
//! blue components of the color. Must be values between 0 and 255.
//! \param a: Alpha component of the color.
//! The alpha component defines how transparent a color should be.
//! Has to be a value between 0 and 255.
//! 0 means not transparent (opaque), 255 means fully transparent.
//! \param r: Sets the red component of the Color.
//! Has to be a value between 0 and 255.
//! 0 means no red (=black), 255 means full red.
//! \param g: Sets the green component of the Color.
//! Has to be a value between 0 and 255.
//! 0 means no green (=black), 255 means full green.
//! \param b: Sets the blue component of the Color.
//! Has to be a value between 0 and 255.
//! 0 means no blue (=black), 255 means full blue.
inline void set(u32 a, u32 r, u32 g, u32 b) { color = (((a & 0xff)<<24) | ((r & 0xff)<<16) | ((g & 0xff)<<8) | (b & 0xff)); }
inline void set(u32 col) { color = col; }
//! Compares the color to another color.
//! \return Returns true if the colors are the same, and false if not.
inline bool operator==(const SColor& other) const { return other.color == color; }
//! Compares the color to another color.
//! \return Returns true if the colors are different, and false if they are the same.
inline bool operator!=(const SColor& other) const { return other.color != color; }
//! Interpolates the color with a f32 value to another color
//! \param other: Other color
//! \param d: value between 0.0f and 1.0f
//! \return Returns interpolated color.
inline SColor getInterpolated(const SColor &other, f32 d) const
{
const f32 inv = 1.0f - d;
return SColor((u32)(other.getAlpha()*inv + getAlpha()*d),
(u32)(other.getRed()*inv + getRed()*d),
(u32)(other.getGreen()*inv + getGreen()*d),
(u32)(other.getBlue()*inv + getBlue()*d));
}
//! Returns interpolated color. ( quadratic )
/** \param other0: other vector to interpolate between
\param other1: other vector to interpolate between
\param factor: value between 0.0f and 1.0f. */
inline SColor getInterpolated_quadratic(const SColor& v2, const SColor& v3, const f32 d) const
{
// this*(1-d)*(1-d) + 2 * v2 * (1-d) + v3 * d * d;
const f32 inv = 1.f - d;
const f32 mul0 = inv * inv;
const f32 mul1 = 2.f * d * inv;
const f32 mul2 = d * d;
return SColor ( core::clamp ( core::floor32 ( getAlpha() * mul0 + v2.getAlpha() * mul1 + v3.getAlpha() * mul2 ), 0, 255 ),
core::clamp ( core::floor32 ( getRed() * mul0 + v2.getRed() * mul1 + v3.getRed() * mul2 ), 0, 255 ),
core::clamp ( core::floor32 ( getGreen() * mul0 + v2.getGreen() * mul1 + v3.getGreen() * mul2 ), 0, 255 ),
core::clamp ( core::floor32 ( getBlue() * mul0 + v2.getBlue() * mul1 + v3.getBlue() * mul2 ), 0, 255 )
);
}
//! color in A8R8G8B8 Format
u32 color;
};
//! Class representing a color with four floats.
/** The color values for red, green, blue
and alpha are each stored in a 32 bit floating point variable.
So all four values may be between 0.0f and 1.0f.
This class is rarely used by the Irrlicht Engine
to specify a color. Another, faster way is using the class Color, which
stores the color values in a single 32 bit integer.
*/
class SColorf
{
public:
//! Constructs a color. All values are initialised with 0.0f, resulting
//! in a black color.
SColorf() : r(0.0f), g(0.0f), b(0.0f), a(0.0f) {};
//! Constructs a color from three color values: red, green and blue.
//! \param r: Red color component. Should be a value between 0.0f meaning
//! no red (=black) and 1.0f, meaning full red.
//! \param g: Green color component. Should be a value between 0.0f meaning
//! no green (=black) and 1.0f, meaning full green.
//! \param b: Blue color component. Should be a value between 0.0f meaning
//! no blue (=black) and 1.0f, meaning full blue.
SColorf(f32 r, f32 g, f32 b) : r(r), g(g), b(b), a(1.0f) {};
//! Constructs a color from four color values: alpha, red, green and blue.
//! \param a: Alpha color component of the color.
//! The alpha component defines how transparent a color should be.
//! Has to be a value between 0.0f and 1.0f,
//! 0.0f means not transparent (opaque), 1.0f means fully transparent.
//! \param r: Red color component. Should be a value between 0.0f meaning
//! no red (=black) and 1.0f, meaning full red.
//! \param g: Green color component. Should be a value between 0.0f meaning
//! no green (=black) and 1.0f, meaning full green.
//! \param b: Blue color component. Should be a value between 0.0f meaning
//! no blue (=black) and 1.0f, meaning full blue.
SColorf(f32 r, f32 g, f32 b, f32 a) : r(r), g(g), b(b), a(a) {};
//! Constructs a color from 32 bit Color.
//! \param c: 32 bit color value from which this Colorf class is
//! constructed from.
SColorf(SColor c) { const f32 inv = 1.0f / 255.0f; r = c.getRed() * inv; g = c.getGreen() * inv; b = c.getBlue() * inv; a = c.getAlpha() * inv; };
//! Converts this color to a SColor without floats.
SColor toSColor() const
{
return SColor((s32)(a*255.0f), (s32)(r*255.0f), (s32)(g*255.0f), (s32)(b*255.0f));
}
//! red color component
f32 r;
//! green color component
f32 g;
//! blue component
f32 b;
//! alpha color component
f32 a;
//! Sets three color components to new values at once.
//! \param rr: Red color component. Should be a value between 0.0f meaning
//! no red (=black) and 1.0f, meaning full red.
//! \param gg: Green color component. Should be a value between 0.0f meaning
//! no green (=black) and 1.0f, meaning full green.
//! \param bb: Blue color component. Should be a value between 0.0f meaning
//! no blue (=black) and 1.0f, meaning full blue.
void set(f32 rr, f32 gg, f32 bb) {r = rr; g =gg; b = bb; };
//! Sets all four color components to new values at once.
//! \param a: Alpha component.
//! \param rr: Red color component. Should be a value between 0.0f meaning
//! no red (=black) and 1.0f, meaning full red.
//! \param gg: Green color component. Should be a value between 0.0f meaning
//! no green (=black) and 1.0f, meaning full green.
//! \param bb: Blue color component. Should be a value between 0.0f meaning
//! no blue (=black) and 1.0f, meaning full blue.
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
//! \param other: Other color
//! \param d: value between 0.0f and 1.0f
//! \return Returns interpolated color.
inline SColorf getInterpolated(const SColorf &other, f32 d) const
{
const f32 inv = 1.0f - d;
return SColorf(other.r*inv + r*d,
other.g*inv + g*d, other.b*inv + b*d, other.a*inv + a*d);
}
//! Returns interpolated color. ( quadratic )
/** \param other0: other vector to interpolate between
\param other1: other vector to interpolate between
\param factor: value between 0.0f and 1.0f. */
inline SColorf getInterpolated_quadratic(const SColorf& v2, const SColorf& v3, const f32 d) const
{
// this*(1-d)*(1-d) + 2 * v2 * (1-d) + v3 * d * d;
const f32 inv = 1.f - d;
const f32 mul0 = inv * inv;
const f32 mul1 = 2.f * d * inv;
const f32 mul2 = d * d;
return SColorf ( r * mul0 + v2.r * mul1 + v3.r * mul2,
g * mul0 + v2.g * mul1 + v3.g * mul2,
g * mul0 + v2.b * mul1 + v3.b * mul2,
a * mul0 + v2.a * mul1 + v3.a * mul2
);
}
//! Sets a color component by index. R=0, G=1, B=2, A=3
inline void setColorComponentValue(s32 index, f32 value)
{
switch(index)
{
case 0: r = value; break;
case 1: g = value; break;
case 2: b = value; break;
case 3: a = value; break;
}
}
};
//! Class representing a color in HSV format
/** The color values for hue, saturation, value
are stored in a 32 bit floating point variable.
*/
class SColorHSL
{
public:
SColorHSL ( f32 h = 0.f, f32 s = 0.f, f32 l = 0.f )
: Hue ( h ), Saturation ( s ), Luminance ( l ) {}
void setfromRGB ( const SColor &color );
void settoRGB ( SColor &color ) const;
f32 Hue;
f32 Saturation;
f32 Luminance;
private:
inline u32 toRGB1(f32 rm1, f32 rm2, f32 rh) const;
};
inline void SColorHSL::settoRGB ( SColor &color ) const
{
if ( Saturation == 0.0f) // grey
{
u8 c = (u8) ( Luminance * 255.0 );
color.setRed ( c );
color.setGreen ( c );
color.setBlue ( c );
return;
}
f32 rm1, rm2;
if ( Luminance <= 0.5f )
{
rm2 = Luminance + Luminance * Saturation;
}
else
{
rm2 = Luminance + Saturation - Luminance * Saturation;
}
rm1 = 2.0f * Luminance - rm2;
color.setRed ( toRGB1(rm1, rm2, Hue + (120.0f * core::DEGTORAD )) );
color.setGreen ( toRGB1(rm1, rm2, Hue) );
color.setBlue ( toRGB1(rm1, rm2, Hue - (120.0f * core::DEGTORAD) ) );
}
inline u32 SColorHSL::toRGB1(f32 rm1, f32 rm2, f32 rh) const
{
while ( rh > 2.f * core::PI )
rh -= 2.f * core::PI;
while ( rh < 0.f )
rh += 2.f * core::PI;
if (rh < 60.0f * core::DEGTORAD ) rm1 = rm1 + (rm2 - rm1) * rh / (60.0f * core::DEGTORAD);
else if (rh < 180.0f * core::DEGTORAD ) rm1 = rm2;
else if (rh < 240.0f * core::DEGTORAD ) rm1 = rm1 + (rm2 - rm1) * ( ( 240.0f * core::DEGTORAD ) - rh) / (60.0f * core::DEGTORAD);
return (u32) (rm1 * 255.f);
}
} // end namespace video
} // end namespace irr
#endif

View File

@ -1,86 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __S_EXPOSED_VIDEO_DATA_H_INCLUDED__
#define __S_EXPOSED_VIDEO_DATA_H_INCLUDED__
// forward declarations for internal pointers
struct IDirect3D9;
struct IDirect3DDevice9;
struct IDirect3D8;
struct IDirect3DDevice8;
namespace irr
{
namespace video
{
//! structure for holding data describing a driver and operating system specific data.
/** This data can be retrived by IVideoDriver::getExposedVideoData(). Use this with caution.
This only should be used to make it possible to extend the engine easily without
modification of its source. Note that this structure does not contain any valid data, if
you are using the software or the null device.
*/
struct SExposedVideoData
{
union
{
struct
{
//! Pointer to the IDirect3D9 interface
IDirect3D9* D3D9;
//! Pointer to the IDirect3D9 interface
IDirect3DDevice9* D3DDev9;
//! Window handle. Get with for example
//! HWND h = reinterpret_cast<HWND>(exposedData.D3D9.HWnd)
s32 HWnd;
} D3D9;
struct
{
//! Pointer to the IDirect3D8 interface
IDirect3D8* D3D8;
//! Pointer to the IDirect3D8 interface
IDirect3DDevice8* D3DDev8;
//! Window handle. Get with for example with:
//! HWND h = reinterpret_cast<HWND>(exposedData.D3D8.HWnd)
s32 HWnd;
} D3D8;
struct
{
//! Private GDI Device Context. Get if for example with:
//! HDC h = reinterpret_cast<HDC>(exposedData.OpenGLWin32.HDc)
s32 HDc;
//! Permanent Rendering Context. Get if for example with:
//! HGLRC h = reinterpret_cast<HGLRC>(exposedData.OpenGLWin32.HRc)
s32 HRc;
//! Window handle. Get with for example with:
//! HWND h = reinterpret_cast<HWND>(exposedData.OpenGLWin32.HWnd)
s32 HWnd;
} OpenGLWin32;
struct
{
// XWindow handle
u32 Window;
} OpenGLLinux;
};
};
} // end namespace video
} // end namespace irr
#endif

View File

@ -1,140 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_IRRLICHT_CREATION_PARAMETERS_H_INCLUDED__
#define __I_IRRLICHT_CREATION_PARAMETERS_H_INCLUDED__
namespace irr
{
//! Structure for holding advanced Irrlicht Device creation parameters.
/** This structure is only used in the createDeviceEx() function. */
struct SIrrlichtCreationParameters
{
//! Constructs a SIrrlichtCreationParameters structure with default values.
SIrrlichtCreationParameters()
{
DriverType = video::EDT_BURNINGSVIDEO;
WindowSize = core::dimension2d<s32>(800, 600);
Bits = 16;
Fullscreen = false;
Stencilbuffer = false;
Vsync = false;
AntiAlias = false;
HighPrecisionFPU = false;
EventReceiver = 0;
WindowId = 0;
SDK_version_do_not_use = IRRLICHT_SDK_VERSION;
}
//! Type of the device.
/** This can currently be video::EDT_NULL,
video::EDT_SOFTWARE, video::EDT_DIRECT3D8, video::EDT_DIRECT3D9 and video::EDT_OPENGL.
Default: Software. */
video::E_DRIVER_TYPE DriverType;
//! Size of the window or the video mode in fullscreen mode. Default: 800x600
core::dimension2d<s32> WindowSize;
//! Bits per pixel in fullscreen mode. Ignored if windowed mode. Default: 16.
u32 Bits;
//! Should be set to true if the device should run in fullscreen.
/** Otherwise the device runs in windowed mode. Default: false. */
bool Fullscreen;
//! Specifies if the stencil buffer should be enabled.
/** Set this to true,
if you want the engine be able to draw stencil buffer shadows. Note that not all
devices are able to use the stencil buffer. If they don't no shadows will be drawn.
Default: false. */
bool Stencilbuffer;
//! Specifies vertical syncronisation.
/** If set to true, the driver will wait for the vertical retrace period, otherwise not.
Default: false */
bool Vsync;
//! Specifies if the device should use fullscreen anti aliasing
/** Makes sharp/pixelated edges softer, but requires more performance. Also, 2D
elements might look blurred with this switched on. The resulting rendering quality
also depends on the hardware and driver you are using, your program might look
different on different hardware with this. So if you are writing a
game/application with antiAlias switched on, it would be a good idea to make it
possible to switch this option off again by the user.
This is only supported in D3D9 and D3D8. In D3D9, both sample types are supported,
D3DMULTISAMPLE_X_SAMPLES and D3DMULTISAMPLE_NONMASKABLE. Default value: false */
bool AntiAlias;
//! Specifies if the device should use high precision FPU setting
/** This is only relevant for DirectX Devices, which switch to low FPU precision
by default for performance reasons. However, this may lead to problems with the
other computations of the application. In this case setting this flag to true
should help - on the expense of performance loss, though.
Default value: false */
bool HighPrecisionFPU;
//! A user created event receiver.
IEventReceiver* EventReceiver;
//! Window Id.
/** If this is set to a value other than 0, the Irrlicht Engine will be created in
an already existing window. For windows, set this to the HWND of the window you want.
The windowSize and FullScreen options will be ignored when using the WindowId parameter.
Default this is set to 0.
To make Irrlicht run inside the custom window, you still will have to draw Irrlicht
on your own. You can use this loop, as usual:
\code
while (device->run())
{
driver->beginScene(true, true, 0);
smgr->drawAll();
driver->endScene();
}
\endcode
Instead of this, you can also simply use your own message loop
using GetMessage, DispatchMessage and whatever. Calling
IrrlichtDevice::run() will cause Irrlicht to dispatch messages internally too.
You need not call Device->run() if you want to do your own message
dispatching loop, but Irrlicht will not be able to fetch
user input then and you have to do it on your own using the window
messages, DirectInput, or whatever. Also, you'll have to increment the Irrlicht timer.
An alternative, own message dispatching loop without device->run() would
look like this:
\code
MSG msg;
while (true)
{
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
if (msg.message == WM_QUIT)
break;
}
// increase virtual timer time
device->getTimer()->tick();
// draw engine picture
driver->beginScene(true, true, 0);
smgr->drawAll();
driver->endScene();
}
\endcode
However, there is no need to draw the picture this often. Just do it how you like.
*/
s32 WindowId;
//! Don't use or change this parameter.
/** Always set it to IRRLICHT_SDK_VERSION, which is done by default.
This is needed for sdk version checks. */
const c8* SDK_version_do_not_use;
};
} // end namespace irr
#endif

View File

@ -1,37 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __S_KEY_MAP_H_INCLUDED__
#define __S_KEY_MAP_H_INCLUDED__
#include "Keycodes.h"
namespace irr
{
//! enumeration for key actions. Used for example in the FPS Camera.
enum EKEY_ACTION
{
EKA_MOVE_FORWARD = 0,
EKA_MOVE_BACKWARD,
EKA_STRAFE_LEFT,
EKA_STRAFE_RIGHT,
EKA_JUMP_UP,
EKA_COUNT,
//! This value is not used. It only forces this enumeration to compile in 32 bit.
EKA_FORCE_32BIT = 0x7fffffff
};
//! Struct storing which key belongs to which action.
struct SKeyMap
{
EKEY_ACTION Action;
EKEY_CODE KeyCode;
};
} // end namespace irr
#endif

Some files were not shown because too many files have changed in this diff Show More