2009-01-14 04:37:51 -08:00
|
|
|
// Copyright (C) 2002-2009 Nikolaus Gebhardt
|
2007-05-20 11:03:49 -07:00
|
|
|
// 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 GeoMipMapSceneNode
|
2008-02-27 06:07:27 -08:00
|
|
|
// developed by Spintz. He made it available for Irrlicht and allowed it to be
|
|
|
|
// distributed under this licence. I only modified some parts. A lot of thanks go to him.
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
#ifndef __C_TERRAIN_SCENE_NODE_H__
|
|
|
|
#define __C_TERRAIN_SCENE_NODE_H__
|
|
|
|
|
|
|
|
#include "ITerrainSceneNode.h"
|
|
|
|
#include "SMesh.h"
|
2008-08-27 21:00:22 -07:00
|
|
|
#include "CDynamicMeshBuffer.h"
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
namespace irr
|
|
|
|
{
|
|
|
|
namespace io
|
|
|
|
{
|
|
|
|
class IFileSystem;
|
2008-03-04 16:02:00 -08:00
|
|
|
class IReadFile;
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
namespace scene
|
|
|
|
{
|
2008-03-04 16:02:00 -08:00
|
|
|
class ITextSceneNode;
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
//! A scene node for displaying terrain using the geo mip map algorithm.
|
|
|
|
class CTerrainSceneNode : public ITerrainSceneNode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
//! constructor
|
|
|
|
//! \param parent: The node which this node is a child of. Making this node a child of another node, or
|
|
|
|
//! making it a parent of another node is yet untested and most likely does not work properly.
|
|
|
|
//! \param mgr: Pointer to the scene manager.
|
|
|
|
//! \param id: The id of the node
|
|
|
|
//! \param maxLOD: The maximum LOD ( Level of Detail ) for the node.
|
|
|
|
//! \param patchSize: An E_GEOMIPMAP_PATCH_SIZE enumeration defining the size of each patch of the terrain.
|
|
|
|
//! \param position: The absolute position of this node.
|
|
|
|
//! \param rotation: The absolute rotation of this node. ( NOT YET IMPLEMENTED )
|
|
|
|
//! \param scale: The scale factor for the terrain. If you're using a heightmap of size 128x128 and would like
|
|
|
|
//! your terrain to be 12800x12800 in game units, then use a scale factor of ( core::vector ( 100.0f, 100.0f, 100.0f ).
|
|
|
|
//! If you use a Y scaling factor of 0.0f, then your terrain will be flat.
|
2008-02-27 06:07:27 -08:00
|
|
|
CTerrainSceneNode(ISceneNode* parent, ISceneManager* mgr, io::IFileSystem* fs, s32 id,
|
2007-05-20 11:03:49 -07:00
|
|
|
s32 maxLOD = 4, E_TERRAIN_PATCH_SIZE patchSize = ETPS_17,
|
|
|
|
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));
|
|
|
|
|
2007-09-17 09:09:50 -07:00
|
|
|
virtual ~CTerrainSceneNode();
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Initializes the terrain data. Loads the vertices from the heightMapFile.
|
2008-02-27 06:07:27 -08:00
|
|
|
virtual bool loadHeightMap(io::IReadFile* file,
|
2007-05-20 11:03:49 -07:00
|
|
|
video::SColor vertexColor = video::SColor ( 255, 255, 255, 255 ), s32 smoothFactor = 0 );
|
|
|
|
|
|
|
|
//! Initializes the terrain data. Loads the vertices from the heightMapFile.
|
|
|
|
virtual bool loadHeightMapRAW(io::IReadFile* file, s32 bitsPerPixel = 16,
|
2008-12-03 14:26:53 -08:00
|
|
|
bool signedData=true, bool floatVals=false, s32 width=0, video::SColor vertexColor = video::SColor ( 255, 255, 255, 255 ), s32 smoothFactor = 0 );
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Returns the material based on the zero based index i. This scene node only uses
|
|
|
|
//! 1 material.
|
|
|
|
//! \param i: Zero based index i. UNUSED, left in for virtual purposes.
|
|
|
|
//! \return Returns the single material this scene node uses.
|
2008-02-27 06:07:27 -08:00
|
|
|
virtual video::SMaterial& getMaterial ( u32 i )
|
|
|
|
{
|
2007-05-20 11:03:49 -07:00
|
|
|
return Mesh.getMeshBuffer(i)->getMaterial();
|
|
|
|
}
|
|
|
|
|
|
|
|
//! Returns amount of materials used by this scene node ( always 1 )
|
|
|
|
//! \return Returns current count of materials used by this scene node ( always 1 )
|
2007-09-16 16:41:55 -07:00
|
|
|
virtual u32 getMaterialCount() const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2008-02-27 06:07:27 -08:00
|
|
|
return Mesh.getMeshBufferCount();
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
2008-02-27 06:07:27 -08:00
|
|
|
//! Gets the last scaling factor applied to the scene node. This value only represents the
|
|
|
|
//! last scaling factor presented to the node. For instance, if you make create the node
|
|
|
|
//! with a scale factor of ( 1.0f, 1.0f, 1.0f ) then call setScale ( 50.0f, 5.0f, 50.0f ),
|
|
|
|
//! then make another call to setScale with the values ( 2.0f, 2.0f, 2.0f ), this will return
|
2007-05-20 11:03:49 -07:00
|
|
|
//! core::vector3df ( 2.0f, 2.0f, 2.0f ), although the total scaling of the scene node is
|
|
|
|
//! core::vector3df ( 100.0f, 10.0f, 100.0f ).
|
|
|
|
//! \return Returns the last scaling factor passed to the scene node.
|
2008-02-12 15:43:19 -08:00
|
|
|
virtual const core::vector3df& getScale() const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2008-02-27 06:07:27 -08:00
|
|
|
return TerrainData.Scale;
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//! Scales the scene nodes vertices by the vector specified.
|
|
|
|
//! \param scale: Scaling factor to apply to the node.
|
|
|
|
virtual void setScale(const core::vector3df& scale);
|
|
|
|
|
|
|
|
//! Gets the last rotation factor applied to the scene node.
|
|
|
|
//! \return Returns the last rotation factor applied to the scene node.
|
2008-02-27 06:07:27 -08:00
|
|
|
virtual const core::vector3df& getRotation() const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return TerrainData.Rotation;
|
|
|
|
}
|
|
|
|
|
|
|
|
//! Rotates 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);
|
|
|
|
|
2007-12-23 09:04:40 -08:00
|
|
|
//! Sets the pivot point for rotation of this node.
|
2007-05-20 11:03:49 -07:00
|
|
|
//! NOTE: The default for the RotationPivot will be the center of the individual tile.
|
|
|
|
virtual void setRotationPivot( const core::vector3df& pivot );
|
|
|
|
|
2008-02-27 06:07:27 -08:00
|
|
|
//! Gets the last positioning vector applied to the scene node.
|
2007-05-20 11:03:49 -07:00
|
|
|
//! \return Returns the last position vector applied to the scene node.
|
2008-02-12 15:43:19 -08:00
|
|
|
virtual const core::vector3df& getPosition() const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return TerrainData.Position;
|
|
|
|
}
|
|
|
|
|
|
|
|
//! Moves the scene nodes vertices by the vector specified.
|
|
|
|
//! \param newpos: Vector specifying how much to move each vertex of the scene node.
|
|
|
|
virtual void setPosition(const core::vector3df& newpos);
|
|
|
|
|
|
|
|
//! Updates the scene nodes indices if the camera has moved or rotated by a certain
|
2008-02-27 06:07:27 -08:00
|
|
|
//! threshold, which can be changed using the SetCameraMovementDeltaThreshold and
|
2007-05-20 11:03:49 -07:00
|
|
|
//! SetCameraRotationDeltaThreshold functions. This also determines if a given patch
|
|
|
|
//! for the scene node is within the view frustum and if it's not the indices are not
|
|
|
|
//! generated for that patch.
|
|
|
|
virtual void OnRegisterSceneNode();
|
|
|
|
|
|
|
|
//! Render the scene node
|
|
|
|
virtual void render();
|
|
|
|
|
|
|
|
//! Return the bounding box of the entire terrain.
|
|
|
|
virtual const core::aabbox3d<f32>& getBoundingBox() const;
|
|
|
|
|
|
|
|
//! Return the bounding box of a patch
|
|
|
|
virtual const core::aabbox3d<f32>& getBoundingBox(s32 patchX, s32 patchZ) const;
|
|
|
|
|
|
|
|
//! Return the number of indices currently used to draw the scene node.
|
2007-09-17 09:09:50 -07:00
|
|
|
virtual u32 getIndexCount() const { return IndicesToRender; }
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Returns the mesh
|
2008-08-06 07:45:22 -07:00
|
|
|
virtual IMesh* getMesh() { return &Mesh; }
|
|
|
|
|
|
|
|
//! Returns a pointer to the buffer used by the terrain (most users will not need this)
|
|
|
|
virtual IMeshBuffer* getRenderBuffer() { return RenderBuffer; }
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Gets the meshbuffer data based on a specified Level of Detail.
|
2008-12-08 09:06:34 -08:00
|
|
|
//! \param mb: A reference to an IDynamicMeshBuffer object
|
2007-05-20 11:03:49 -07:00
|
|
|
//! \param LOD: The Level Of Detail you want the indices from.
|
2008-12-08 09:06:34 -08:00
|
|
|
virtual void getMeshBufferForLOD(IDynamicMeshBuffer& mb, s32 LOD=0) const;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2008-02-27 06:07:27 -08:00
|
|
|
//! Gets the indices for a specified patch at a specified Level of Detail.
|
2007-05-20 11:03:49 -07:00
|
|
|
//! \param indices: A reference to an array of u32 indices.
|
|
|
|
//! \param patchX: Patch x coordinate.
|
|
|
|
//! \param patchZ: Patch z coordinate.
|
2008-02-27 06:07:27 -08:00
|
|
|
//! \param LOD: The level of detail to get for that patch. If -1, then get
|
2007-05-20 11:03:49 -07:00
|
|
|
//! the CurrentLOD. If the CurrentLOD is set to -1, meaning it's not shown,
|
2008-12-08 09:06:34 -08:00
|
|
|
//! then it will retrieve the triangles at the highest LOD (0).
|
2007-12-23 09:04:40 -08:00
|
|
|
//! \return: Number of indices put into the buffer.
|
2007-05-20 11:03:49 -07:00
|
|
|
virtual s32 getIndicesForPatch(core::array<u32>& indices,
|
2008-12-08 09:06:34 -08:00
|
|
|
s32 patchX, s32 patchZ, s32 LOD=0);
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! 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
|
2007-09-17 09:09:50 -07:00
|
|
|
virtual s32 getCurrentLODOfPatches(core::array<s32>& LODs) const;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! 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.
|
2008-12-08 09:06:34 -08:00
|
|
|
virtual void setLODOfPatch(s32 patchX, s32 patchZ, s32 LOD=0);
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Returns center of terrain.
|
2007-09-17 09:09:50 -07:00
|
|
|
virtual const core::vector3df& getTerrainCenter() const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return TerrainData.Center;
|
|
|
|
}
|
|
|
|
|
|
|
|
//! Returns center of terrain.
|
2007-09-17 09:09:50 -07:00
|
|
|
virtual f32 getHeight( f32 x, f32 y ) const;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Sets the movement camera threshold which is used to determine when to recalculate
|
|
|
|
//! indices for the scene node. The default value is 10.0f.
|
2008-02-27 06:07:27 -08:00
|
|
|
virtual void setCameraMovementDelta(f32 delta)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
CameraMovementDelta = delta;
|
|
|
|
}
|
|
|
|
|
|
|
|
//! Sets the rotation camera threshold which is used to determine when to recalculate
|
|
|
|
//! indices for the scene node. The default value is 1.0f.
|
|
|
|
virtual void setCameraRotationDelta(f32 delta)
|
|
|
|
{
|
|
|
|
CameraRotationDelta = delta;
|
|
|
|
}
|
|
|
|
|
2008-11-14 16:42:45 -08:00
|
|
|
//! Sets whether or not the node should dynamically update it its associated selector when
|
2007-05-20 11:03:49 -07:00
|
|
|
//! the geomipmap data changes.
|
|
|
|
//! param bVal: Boolean value representing whether or not to update selector dynamically.
|
|
|
|
//! NOTE: Temporarily disabled while working out issues with DynamicSelectorUpdate
|
|
|
|
virtual void setDynamicSelectorUpdate(bool bVal ) { DynamicSelectorUpdate = false; }
|
|
|
|
|
|
|
|
//! Override the default generation of distance thresholds for determining the LOD a patch
|
2007-12-23 09:04:40 -08:00
|
|
|
//! is rendered at. If any LOD is overridden, then the scene node will no longer apply
|
2008-11-20 15:50:43 -08:00
|
|
|
//! scaling factors to these values. If you override these distances and then apply
|
2007-05-20 11:03:49 -07:00
|
|
|
//! 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 );
|
|
|
|
|
2007-07-03 09:04:33 -07:00
|
|
|
//! Scales the two textures
|
|
|
|
virtual void scaleTexture(f32 scale = 1.0f, f32 scale2 = 0.0f);
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Returns type of the scene node
|
2007-07-03 09:04:33 -07:00
|
|
|
virtual ESCENE_NODE_TYPE getType() const {return ESNT_TERRAIN;}
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Writes attributes of the scene node.
|
2007-07-03 09:04:33 -07:00
|
|
|
virtual void serializeAttributes(io::IAttributes* out,
|
2007-09-14 15:25:59 -07:00
|
|
|
io::SAttributeReadWriteOptions* options=0) const;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Reads attributes of the scene node.
|
2007-07-03 09:04:33 -07:00
|
|
|
virtual void deserializeAttributes(io::IAttributes* in,
|
|
|
|
io::SAttributeReadWriteOptions* options=0);
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Creates a clone of this scene node and its children.
|
2007-07-03 09:04:33 -07:00
|
|
|
virtual ISceneNode* clone(ISceneNode* newParent,
|
|
|
|
ISceneManager* newManager);
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
friend class CTerrainTriangleSelector;
|
|
|
|
|
|
|
|
struct SPatch
|
|
|
|
{
|
|
|
|
SPatch()
|
2007-12-23 09:04:40 -08:00
|
|
|
: CurrentLOD(-1), Top(0), Bottom(0), Right(0), Left(0)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 CurrentLOD;
|
|
|
|
core::aabbox3df BoundingBox;
|
|
|
|
core::vector3df Center;
|
|
|
|
SPatch* Top;
|
|
|
|
SPatch* Bottom;
|
|
|
|
SPatch* Right;
|
|
|
|
SPatch* Left;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct STerrainData
|
|
|
|
{
|
|
|
|
STerrainData()
|
|
|
|
: Size(0), PatchSize(0), CalcPatchSize(0),
|
|
|
|
PatchCount(0), MaxLOD(0),
|
|
|
|
BoundingBox(core::aabbox3df( 99999.9f, 99999.9f, 99999.9f, -99999.9f, -99999.9f, -99999.9f)),
|
2008-11-20 15:50:43 -08:00
|
|
|
Patches(0)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
STerrainData(s32 patchSize, s32 maxLOD, const core::vector3df& position, const core::vector3df& rotation, const core::vector3df& scale)
|
|
|
|
: Size(0), Position(position), Rotation(rotation), Scale(scale),
|
|
|
|
PatchSize(patchSize), CalcPatchSize(patchSize-1),
|
|
|
|
PatchCount(0), MaxLOD(maxLOD),
|
|
|
|
BoundingBox(core::aabbox3df( 99999.9f, 99999.9f, 99999.9f, -99999.9f, -99999.9f, -99999.9f)),
|
2008-11-20 15:50:43 -08:00
|
|
|
Patches(0)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 Size;
|
|
|
|
core::vector3df Position;
|
|
|
|
core::vector3df Rotation;
|
|
|
|
core::vector3df RotationPivot;
|
|
|
|
core::vector3df Scale;
|
|
|
|
core::vector3df Center;
|
|
|
|
s32 PatchSize;
|
|
|
|
s32 CalcPatchSize;
|
|
|
|
s32 PatchCount;
|
|
|
|
s32 MaxLOD;
|
|
|
|
core::aabbox3df BoundingBox;
|
2008-11-20 15:50:43 -08:00
|
|
|
core::array<f64> LODDistanceThreshold;
|
2007-05-20 11:03:49 -07:00
|
|
|
SPatch* Patches;
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual void preRenderLODCalculations();
|
|
|
|
virtual void preRenderIndicesCalculations();
|
|
|
|
|
|
|
|
//! get indices when generating index data for patches at varying levels of detail.
|
2007-12-23 09:04:40 -08:00
|
|
|
u32 getIndex(const s32 PatchX, const s32 PatchZ, const s32 PatchIndex, u32 vX, u32 vZ) const;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2008-01-06 14:56:36 -08:00
|
|
|
//! smooth the terrain
|
2008-08-27 21:00:22 -07:00
|
|
|
void smoothTerrain(CDynamicMeshBuffer* mb, s32 smoothFactor);
|
2008-01-06 14:56:36 -08:00
|
|
|
|
2008-02-27 06:07:27 -08:00
|
|
|
//! calculate smooth normals
|
2008-08-27 21:00:22 -07:00
|
|
|
void calculateNormals(CDynamicMeshBuffer* mb);
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! create patches, stuff that needs to only be done once for patches goes here.
|
|
|
|
void createPatches();
|
|
|
|
|
|
|
|
//! calculate the internal STerrainData structure
|
|
|
|
void calculatePatchData();
|
|
|
|
|
|
|
|
//! calculate or recalculate the distance thresholds
|
|
|
|
void calculateDistanceThresholds(bool scalechanged = false);
|
|
|
|
|
|
|
|
//! sets the CurrentLOD of all patches to the specified LOD
|
|
|
|
void setCurrentLODOfPatches(s32 i);
|
|
|
|
|
|
|
|
//! sets the CurrentLOD of TerrainData patches to the LODs specified in the array
|
2007-12-23 09:04:40 -08:00
|
|
|
void setCurrentLODOfPatches(const core::array<s32>& lodarray);
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Apply transformation changes( scale, position, rotation )
|
|
|
|
void applyTransformation();
|
|
|
|
|
|
|
|
STerrainData TerrainData;
|
|
|
|
SMesh Mesh;
|
2008-08-27 21:00:22 -07:00
|
|
|
|
|
|
|
CDynamicMeshBuffer *RenderBuffer;
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
u32 VerticesToRender;
|
|
|
|
u32 IndicesToRender;
|
|
|
|
|
|
|
|
bool DynamicSelectorUpdate;
|
|
|
|
bool OverrideDistanceThreshold;
|
|
|
|
bool UseDefaultRotationPivot;
|
|
|
|
bool ForceRecalculation;
|
|
|
|
|
|
|
|
core::vector3df OldCameraPosition;
|
|
|
|
core::vector3df OldCameraRotation;
|
2008-12-29 11:40:48 -08:00
|
|
|
core::vector3df OldCameraUp;
|
2008-10-16 22:11:14 -07:00
|
|
|
f32 OldCameraFOV;
|
2007-05-20 11:03:49 -07:00
|
|
|
f32 CameraMovementDelta;
|
|
|
|
f32 CameraRotationDelta;
|
2008-10-16 22:11:14 -07:00
|
|
|
f32 CameraFOVDelta;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
// needed for (de)serialization
|
|
|
|
f32 TCoordScale1;
|
|
|
|
f32 TCoordScale2;
|
Changes in version 1.6, TA
- FileSystem 2.0 SUPER MASTER MAJOR API CHANGE !!!
The FileSystem is know build internally like for e.q the texture-, and the meshloaders.
There exists a known list of ArchiveLoader, which know how to produce a Archive.
The Loaders and the Archive can be attached/detached on runtime.
The FileNames are now stored as core::string<c16>. where c16 is toggled between char/wchar
with the #define flag _IRR_WCHAR_FILESYSTEM, to supported unicode backends (default:off)
I replaced all (const c8* filename) to string references.
Basically the FileSystem is divided into two regions. Native and Virtual.
Native means using the backend OS.
Virtual means only use currently attach IArchives.
Browsing
each FileSystem has it's own workdirectory and it's own methods to
- create a FileTree
- add/remove files & directory ( to be done )
Hint: store a savegame in a zip archive...
basic browsing for all archives is implemented.
Example 21. Quake3Explorer shows this
TODO:
- a file filter should be implemented.
- The IArchive should have a function to create a filetree
for now CFileList is used.
Class Hiarchy:
IArchiveLoader: is able to produce a IFileArchive
- ZipLoader
- PakLoader
- MountPointReader ( formaly known as CUnzipReader )
IFileArchive:
-ZipArchive
-PakArchive
-MountPoint (known as FolderFile)
IFileSystem
- addArchiveLoader
- changed implementation of isALoadableFileExtension in all loaders
to have consistent behavior
- added a parameter to IFileList * createFileList
setFileListSystem
allows to query files in any of the game archives
standard behavior listtype = SYSTEM ( default)
- CLimitReadFile
added multiple file random-access support.
solved problems with mixed compressed & uncompressed files in a zip
TODO:
- Big Big Testing!!
- Linux Version ( minor )
- remove all double loader interfaces where only the filename differs
(IReadFile/const char *filename). This blows up the the interface
- many loaders use their own private filesearching
we should rework this
- there are a lot of helper function ( getAbsolutePath, getFileDir )
which should be adapted to the virtual filesystem
- IrrlichtDevice
added:
virtual bool setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness, f32 contrast ) = 0;
virtual bool getGammaRamp( f32 &red, f32 &green, f32 &blue ) = 0;
and calculating methods to DeviceStub.
implemented in Win32, TODO: other Devices
- irrlicht.h
changed exported irrlicht.dll routines createDevice, createDeviceEx, IdentityMatrix
to extern "C" name mangling.
for easier dynamically loading the irrlicht library and different versions
- ParticleSystem
removed the private (old?,wrong?) interface from the ParticleEffectors
to match the parent class irr::io::IAttributeExchangingObject::deserializeAttributes
TODO:
please test if the serialization works!
- Generic
- vector3d<T>& normalize()
#if 0
f32 length = (f32)(X*X + Y*Y + Z*Z);
if (core::equals(length, 0.f))
return *this;
length = core::reciprocal_squareroot ( (f32)length );
#else
const T length = core::reciprocal_squareroot ( (X*X + Y*Y + Z*Z) );
#endif
Weak checking on zero?!?! just to avoid a sqrt?. mhm, maybe not;-)
added reciprocal_squareroot for f64
- dimension2d
added operator dimension2d<T>& operator=(const dimension2d<U>& other)
to cast between different types
- vector2d
bugfix:
vector2d<T>& operator+=(const dimension2d<T>& other) { X += other.Width; Y += other.Width; return *this; }
to
vector2d<T>& operator+=(const dimension2d<T>& other) { X += other.Width; Y += other.Height; return *this; }
- C3DMeshLoader renamed chunks const u16 to a enum
removing "variable declared but never used warning"
- added a global const identity Material
changed all references *((video::SMaterial*)0) to point to IdentityMaterial
removed warning: "a NULL reference is not allowed"
- modified IRRLICHT_MATH to not support reciprocal stuff
but to use faster float-to-int conversion.
gcc troubles may they are. i'm using intel-compiler..;-)
- core::matrix4
USE_MATRIX_TEST
i tried to optimize the identity-check ( in means of performance)
i didn't succeed so well, so i made a define for the matrix isIdentity -check
for now it's sometimes faster to always calculate versus identity-check
but if there are a lot of scenenodes/ particles one can profit from the
fast_inverse matrix, when no scaling is used. further approvement could
be done on inverse for just tranlastion! ( many static scenenodes are not rotated,
they are just placed somewhere in the world)
one thing to take in account is that sizeof(matrix) is 64 byte and
with the additional bool/u32 makes it 66 byte which is not really cache-friendly..
- added buildRotateFromTo
Builds a matrix that rotates from one vector to another
- irr::array. changed allocating routine in push_back
okt, 2008. it's only allowed to alloc one element, if
default constructor has to be called.
removes existing crashes. ( MD3 Mesh ) and possible others ones.
A new list template should be made.
one with constructor/destructor calls ( safe_array ) and
one without. like the array since the beginning of irrlicht.
currently the array/string is extremly slow..
also a hint for the user has to be done, so that a struct T of
array<T> must have a copy constructor of type T ( const T&other ).
i needed hours to track that down...
added a new method setAllocStrategy,
safe ( used + 1 ), double ( used * 2 + 1)
better default strategies will be implemented
- removed binary_search_const
i added it quite a long time ago, but it doesnt make real sense
a call to a sort method should happen always. i just wanted to safe
a few cycles..
- added binary_search_multi
searches for a multi-set ( more than 1 entry in the sorted array)
returns start and end-index
- changed some identity matrix settings to use core::IdentityMatrix
- added deletePathFromFilename to generic string functions in coreutil.h and
removed from CZipReader and CPakReader
- s32 deserializeAttributes used instead of virtual void deserializeAttributes in
ParticleSystem ( wrong virtual was used)
- strings & Locale
- started to add locale support
- added verify to string
- added some helper functions
- XBOX
i have access to a XBOX development machine now. I started to compile
for the XBOX. Question: Who did the previous implementation?. There
is no XBOX-Device inhere. maybe it's forbidden because of using the offical
Microsoft XDK. I will implement a native or sdl device based on opendk.
irrlicht compiles without errors on the xbox but can't be used.
TODO:
- native XBOX Device
- Windows Mobile
reworked a little. added the mobile example to the windows solution for
cross development.
added maximal 128x128 texture size for windows mobile ( memory issues )
- Collision Speed Up
The Collision Speed Up greatly improves with many small static child-nodes
- added COctTreeTriangleSelector::getTriangles for 3dline from user Piraaate
- modified createOctTreeTriangleSelector and createTriangleSelector
to allow node == 0, to be added to a meta selector
- CSceneNodeAnimatorCollisionResponse has the same problem as CSceneNodeAnimatorFPS
on first update:
Problem. you start setting the map. (setWorld). First update cames 4000 ms later.
The Animator applies the missing force... big problem...
changed to react on first update like camera.
- add Variable FirstUpdate. if set to true ( on all changes )
then position, lasttime, and falling are initialized
-added #define OCTTREE_USE_HARDWARE in Octree.h
if defined octtree uses internally a derived scene::MeshBuffer which has
the possibility to use the Hardware Vertex Buffer for static vertices and
dirty indices;-)
if defined OCTTREE_USE_HARDWARE octree uses internally a derived scene::CMeshBuffer
so it's not just a replacement inside the octree. It also in the OctTreeSceneNode.
#if defined (OCTTREE_USE_HARDWARE)
driver->drawMeshBuffer ( &LightMapMeshes[i] );
#else
driver->drawIndexedTriangleList( &LightMapMeshes[i].Vertices[0], LightMapMeshes[i].Vertices.size(),
d[i].Indices, d[i].CurrentSize / 3);
#endif
#define OCTTREE_PARENTTEST is also used. It's skip testing on fully outside and takes everything on fully inside
- virtual void ISceneNode::updateAbsolutePosition()
- changed
inline CMatrix4<T> CMatrix4<T>::operator*(const CMatrix4<T>& m2) const
all two matrices have to be checked by isIdentity()
to let the isIdentity work always
-changed inline bool CMatrix4<T>::isIdentity() const
on full identityCheck->
to look first on Translation, because this is the most challenging element
which will likely not to be identity..
- virtual core::matrix4 getRelativeTransformation() const
Hiarchy on Identity-Check
1) ->getRelativeTransform -> 9 floating point checks to be passed as Identity
2) ->isIdentity () -> 16 floating point checks to be passed as Identity
- inline void CMatrix4<T>::transformBoxEx(core::aabbox3d<f32>& box) const
added isIdentity() check
- changed CSceneNodeAnimatorCollisionResponse
- added CSceneNodeAnimatorCollisionResponse::setGravity
needed to set the differents Forces for the Animator. for eq. water..
- added CSceneNodeAnimatorCollisionResponse::setAnimateTarget
- added CSceneNodeAnimatorCollisionResponse::getAnimateTarget
- changed CSceneNodeAnimatorCollisionResponse::animateNode to react on FirstUpdate
- changad Gravity to
- TODO: set Gravity to Physically frame independent values..
current response uses an frame depdended acceleration vector.
~9.81 m/s^2 was achieved at around 50 fps with a setting of -0.03
may effect existing application..
- SceneNodes
- CSkyDomeSceneNode
moved radius ( default 1000 ) to constructor
added Normals
added DebugInfo
added Material.ZBuffer, added SceneMaanager
- CVolumeLightSceneNode:
changed default blending OneTextureBlendgl_src_color gl_src_alpha to
EMT_TRANSPARENT_ADD_COLOR ( gl_src_color gl_one )
which gives the same effect on non-transparent-materials.
Following the unspoken guide-line, lowest effect as default
- added LensFlareSceneNode (from forum user gammaray, modified to work )
showing in example special fx
- changed SceneNode Skydome f64 to f32,
- AnimatedMesh
-Debug Data:
mesh normals didn't rotate with the scenenode fixed ( matrix-multiplication order)
- Camera SceneNode setPosition
Camera now finally allow to change position and target and updates all
effected animators..
a call to OnAnimate ( ) lastime < time or OnAnimate ( 0 ) will reset the
camera and fr. the collision animator to a new position
- Device:
added the current mousebutton state to the Mouse Event
so i need to get the current mouse state from the OS
-a dded to CIrrDeviceWin32
TODO:
- Linux and SDL Device
- GUI
- CGUIFont:
- added virtual void setInvisibleCharacters( const wchar_t *s ) = 0;
define which characters should not be drawn ( send to driver) by the font.
for example " " would not draw any space which is usually blank in most fonts
and saves rendering of ususally full blank alpha-sprites.
This saves a lot of rendering...
default:
setInvisibleCharacters ( L" " );
- added MultiLine rendering
should avoid to us CStaticText breaking text in future
- CGUIListBox
- changed Scrollbar LargeStepSize to ItemHeight
which easy enables to scroll line by line
- CGUIScrollBar
bug:
Create a Window and inside a listbox with a scrollbar or
a windowed irrlicht application
Click & hold Scrollbar Slider. move outside it's region.
Release Mouse. Go Back to Scrollbar.. it's moving always...
it's generally missing the event PRESSED_MOVED, which
leads to problem when an element is dragging, has a focus, or position loose
and gets focus back again. ( think of a drunken mouse sliding left&right during tracking )
so added the mouse Input Buttonstates on every mouse event
IrrDeviceWin32:
added event.MouseInput.ButtonStates = wParam & ( MK_LBUTTON | MK_RBUTTON | MK_MBUTTON );
TODO:
Linux & SDL
so now i can do this
case irr::EMIE_MOUSE_MOVED:
if ( !event.MouseInput.isLeftPressed () )
{
Dragging = false;
}
- bug:
Scrollbar notifyListBox notify when the scrollbar is clicked.
- changed timed event in draw to OnPostRender
Why the hell is a gui element firing a timed event
in a draw routine!!!!!. This should be corrected for all gui-elements.
- added GUI Image List from Reinhard Ostermeier, modified to work
added GUI Tree View from Reinhard Ostermeier, modified to work
shown in the Quake3MapShader Example
TODO: Spritebanks
- FileOpenDialog
changed the static text for the filename to an edit box.
- changed the interface for addEditBox to match with addStaticText
- changed the interface for addSpinBox to match with addEditBox
- added MouseWheel to Spinbox
- changed CGUITable CLICK_AREA from 3 to 12 to enable clicking on the visible marker
- CGUISpritebank
removed some crashes with empty Sprite banks
- IGUIScrollBar
added SetMin before min was always 0
changed ScrollWheel Direction on horizontal to move right on wheel up, left on wheel down
- IComboBox
-added ItemData
- removed IsVisbile check in IGUIElement::draw
- Image Loaders
- added TGA file type 2 ( grayscale uncompressed )
- added TGA file type (1) 8 Bit indexed color uncompressed
ColorConverter:
- added convert_B8G8R8toA8R8G8B8
- added convert_B8G8R8A8toA8R8G8B8
- Media Files
- added missing shaders and textures to map-20kdm2.
Taken from free implementation
- ball.wav. adjusted DC-Offset, amplified to -4dB, trim cross-zero
- impact.wav clip-restoration, trim cross-zero
- added gun.md2, gun.pcx to media-files
copyright issues!. i don't know from where this file came from...
i hope this is not from original quake2..
- added new irrlicht logo irrlicht3.png
i've taken the new layout. i should ask niko to use it.
- added Skydome picture to media files (skydome2.jpg) half/sphere
- OctTree
-added
#define OCTTREE_PARENTTEST ( default: disabled )
used to leave-out children test if the parent passed a complete frustum.
plus: leaves out children test
minus: all edges have to be checked
- added MesBuffer Hardware Hint Vertex to octtree
- CQuake3ShaderSceneNode:
- removed function releaseMesh
Shader doesn't copy the original mesh anymore ( saving memory )
so therefore this (for others often misleading ) function was removed
- changed constructor to take a (shared) destination meshbuffer for rendering
reducing vertex-memory to a half
- don't copy the original vertices anymore
- added deformvertexes autosprite
- added deformvertexes move
- added support for RTCW and Raven BSPs ( qmap2 )
- added polygonoffset (TODO: not perfect)
- added added nomipmaps
- added rgbgen const
- added alphagen
- added MesBuffer Hardware Hint Vertex/Index to Quake3: static geometry, dynamic indices
- added Quake3Explorer examples
- added wave noise
- added tcmod transform
- added whiteimage
- added collision to Quake3Explorer
- renamed SMD3QuaterionTag* to SMD3QuaternionTag* ( typo )
- updated quake3:blendfunc
- added crouch to Quake3Explorer
(modifying the ellipsiodRadius of the camera animator )
added crouch to CSceneNodeAnimatorCameraFPS
still problems with stand up and collision
- Quake3MapLoader
modified memory allocation for faster loading
- Quake3LoadParam
added Parameter to the Mesh-Loader
- added
The still existing missing caulking of curved surfaces.
using round in the coordinates doesn't solve the problem.
but for the demo bsp mesh it solves the problem... (luck)
so for now it's switchable.
TJUNCTION_SOLVER_ROUND
default:off
- BurningVideo
- pushed BurningsVideo to 0.40
- added blendfunc gl_one_minus_dst_alpha gl_one
- added blendfunc gl_dst_color gl_zero
- added blendfunc gl_dst_color src_alpha
- modified AlphaChannel_Ref renderer to support alpha test lessequal
- addded 32 Bit Index Buffer
- added sourceRect/destRect check to 2D-Blitter ( slower, but resolves crash )
- added setTextureCreationFlag video::ETCF_ALLOW_NON_POWER_2
Burning checks this flag and when set, it bypasses the power2 size check,
which is necessary on 3D but can be avoided on 2D.
used on fonts automatically.
- added Support for Destination Alpha
- OpenGL
- Fixed a bug in COpenGLExtensenionHandler where a glint was downcasted to u8!!!!!!
MaxTextureSize=static_cast<u32>(num);
- TODO: COpenGLMaterialRenderer_ONETEXTURE_BLEND to work as expected
- Direct3D8
- compile and links again
- added 32 Bit Index Buffer
- D3DSAMP_MIPMAPLODBIAS doesnt compile!. it is d3d9 i think.
- compile for XBOX
- Direc3D9
- fixed crash on RTT Textures DepthBuffer freed twice.
added deleteAllTextures to destuctor
- NullDriver
- removeallTextures. added setMaterial ( SMaterial() ) to clean pointers for freed textures
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2147 dfc29bdd-3216-0410-991c-e03cc46cb475
2009-01-27 07:53:53 -08:00
|
|
|
core::string<c16> HeightmapFile;
|
2007-05-20 11:03:49 -07:00
|
|
|
io::IFileSystem* FileSystem;
|
|
|
|
};
|
|
|
|
|
2007-09-17 09:09:50 -07:00
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
} // end namespace scene
|
|
|
|
} // end namespace irr
|
|
|
|
|
|
|
|
#endif // __C_TERRAIN_SCENE_NODE_H__
|
|
|
|
|
2008-08-27 21:00:22 -07:00
|
|
|
|