Commit bcdb4977 authored by hybrid's avatar hybrid

Fixed whitespace and line endings.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1446 dfc29bdd-3216-0410-991c-e03cc46cb475
parent bea9e087
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
......@@ -15,35 +15,30 @@ namespace irr
namespace scene
{
class CDynamicMeshBuffer: public IDynamicMeshBuffer
{
IVertexBuffer *VertexBuffer;
IIndexBuffer *IndexBuffer;
public:
//! constructor
CDynamicMeshBuffer(video::E_VERTEX_TYPE vertexType, video::E_INDEX_TYPE indexType)
{
VertexBuffer=new CVertexBuffer(vertexType);
IndexBuffer=new CIndexBuffer(indexType);
}
//! destructor
~CDynamicMeshBuffer()
{
if (VertexBuffer) VertexBuffer->drop();
if (IndexBuffer) IndexBuffer->drop();
if (VertexBuffer)
VertexBuffer->drop();
if (IndexBuffer)
IndexBuffer->drop();
}
virtual IVertexBuffer &getVertexBuffer() const
{
return *VertexBuffer;
}
virtual IIndexBuffer &getIndexBuffer() const
{
return *IndexBuffer;
......@@ -51,21 +46,24 @@ namespace scene
virtual void setVertexBuffer(IVertexBuffer *newVertexBuffer)
{
if (newVertexBuffer) newVertexBuffer->grab();
if (VertexBuffer) VertexBuffer->drop();
if (newVertexBuffer)
newVertexBuffer->grab();
if (VertexBuffer)
VertexBuffer->drop();
VertexBuffer=newVertexBuffer;
}
virtual void setIndexBuffer(IIndexBuffer *newIndexBuffer)
{
if (newIndexBuffer) newIndexBuffer->grab();
if (IndexBuffer) IndexBuffer->drop();
if (newIndexBuffer)
newIndexBuffer->grab();
if (IndexBuffer)
IndexBuffer->drop();
IndexBuffer=newIndexBuffer;
}
//! Get Material of this buffer.
virtual const video::SMaterial& getMaterial() const
{
......@@ -93,7 +91,6 @@ namespace scene
//! Recalculate bounding box
virtual void recalculateBoundingBox()
{
if (!getVertexBuffer().size())
BoundingBox.reset(0,0,0);
else
......@@ -102,17 +99,16 @@ namespace scene
for (u32 i=1; i<getVertexBuffer().size(); ++i)
BoundingBox.addInternalPoint(getVertexBuffer()[i].Pos);
}
}
video::SMaterial Material;
core::aabbox3d<f32> BoundingBox;
private:
IVertexBuffer *VertexBuffer;
IIndexBuffer *IndexBuffer;
};
} // end namespace scene
} // end namespace irr
......
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
......@@ -7,15 +7,11 @@
#include "IIndexBuffer.h"
namespace irr
{
namespace scene
{
class CIndexBuffer : public IIndexBuffer
{
......@@ -23,16 +19,16 @@ namespace scene
{
public:
virtual u32 stride() const =0;
virtual u32 size() const=0;
virtual void push_back (const u32 &element) =0;
virtual const u32 operator [](u32 index) const=0;
virtual const u32 getLast() =0;
virtual u32 size() const =0;
virtual void push_back(const u32 &element) =0;
virtual u32 operator [](u32 index) const =0;
virtual u32 getLast() =0;
virtual void setValue(u32 index, u32 value) =0;
virtual void set_used(u32 usedNow) =0;
virtual void reallocate(u32 new_size)=0;
virtual u32 allocated_size() const=0;
virtual void reallocate(u32 new_size) =0;
virtual u32 allocated_size() const =0;
virtual void* pointer() =0;
virtual video::E_INDEX_TYPE getType()=0;
virtual video::E_INDEX_TYPE getType() =0;
};
template <class T>
......@@ -43,29 +39,34 @@ namespace scene
virtual u32 stride() const {return sizeof(T);}
virtual u32 size() const
{return Indices.size();}
virtual u32 size() const {return Indices.size();}
virtual void push_back (const u32 &element)
{Indices.push_back((T&)element);}
virtual void push_back(const u32 &element)
{
Indices.push_back((T&)element);
}
virtual const u32 operator [](u32 index) const
{return (u32) (Indices[index]);}
virtual u32 operator [](u32 index) const
{
return (u32)(Indices[index]);
}
virtual const u32 getLast()
{return (u32)Indices.getLast();}
virtual u32 getLast() {return (u32)Indices.getLast();}
virtual void setValue(u32 index, u32 value)
{
Indices[index]=(T)value;
}
virtual void set_used(u32 usedNow)
{Indices.set_used(usedNow);}
{
Indices.set_used(usedNow);
}
virtual void reallocate(u32 new_size)
{Indices.reallocate(new_size);}
{
Indices.reallocate(new_size);
}
virtual u32 allocated_size() const
{
......@@ -76,7 +77,8 @@ namespace scene
virtual video::E_INDEX_TYPE getType()
{
if (sizeof(T)==sizeof(u16)) return video::EIT_16BIT;
if (sizeof(T)==sizeof(u16))
return video::EIT_16BIT;
return video::EIT_32BIT;
}
};
......@@ -91,14 +93,12 @@ namespace scene
~CIndexBuffer()
{
if (Indices)
delete Indices;
}
//virtual void setType(video::E_INDEX_TYPE IndexType);
virtual void setType(video::E_INDEX_TYPE IndexType)
{
IIndexList *NewIndices=0;
switch (IndexType)
......@@ -128,9 +128,8 @@ namespace scene
Indices=NewIndices;
}
virtual void* getData() {return Indices->pointer();}
virtual video::E_INDEX_TYPE getType(){return Indices->getType();}
virtual u32 stride() const {return Indices->stride();}
......@@ -140,7 +139,7 @@ namespace scene
return Indices->size();
}
virtual void push_back (const u32 &element)
virtual void push_back(const u32 &element)
{
Indices->push_back(element);
}
......@@ -160,7 +159,6 @@ namespace scene
Indices->setValue(index, value);
}
virtual void set_used(u32 usedNow)
{
Indices->set_used(usedNow);
......@@ -208,11 +206,6 @@ namespace scene
};
} // end namespace scene
} // end namespace irr
......
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
......@@ -7,32 +7,29 @@
#include "IVertexBuffer.h"
namespace irr
{
namespace scene
{
class CVertexBuffer : public IVertexBuffer
{
class IVertexList
{
public:
virtual u32 stride() const =0;
virtual u32 size() const=0;
virtual u32 size() const =0;
virtual void push_back (const video::S3DVertex &element) =0;
virtual video::S3DVertex& operator [](const u32 index) const=0;
virtual video::S3DVertex& operator [](const u32 index) const =0;
virtual video::S3DVertex& getLast() =0;
virtual void set_used(u32 usedNow) =0;
virtual void reallocate(u32 new_size)=0;
virtual void reallocate(u32 new_size) =0;
virtual u32 allocated_size() const =0;
virtual video::S3DVertex* pointer() =0;
virtual video::E_VERTEX_TYPE getType()=0;
virtual video::E_VERTEX_TYPE getType() =0;
};
template <class T>
......@@ -43,8 +40,7 @@ namespace scene
virtual u32 stride() const {return sizeof(T);}
virtual u32 size() const
{return Vertices.size();}
virtual u32 size() const {return Vertices.size();}
virtual void push_back (const video::S3DVertex &element)
{Vertices.push_back((T&)element);}
......@@ -81,16 +77,13 @@ namespace scene
~CVertexBuffer()
{
if (Vertices)
delete Vertices;
}
//virtual void setType(video::E_VERTEX_TYPE vertexType);
virtual void setType(video::E_VERTEX_TYPE vertexType)
{
IVertexList *NewVertices=0;
switch (vertexType)
......@@ -122,12 +115,10 @@ namespace scene
}
Vertices=NewVertices;
}
virtual void* getData() {return Vertices->pointer();}
virtual video::E_VERTEX_TYPE getType(){return Vertices->getType();}
virtual u32 stride() const {return Vertices->stride();}
......@@ -196,11 +187,9 @@ namespace scene
E_HARDWARE_MAPPING MappingHint;
u32 ChangedID;
};
} // end namespace scene
} // end namespace irr
......
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
......@@ -6,8 +6,6 @@
#define __I_DYNAMIC_MESH_BUFFER_H_INCLUDED__
#include "IMeshBuffer.h"
#include "IVertexBuffer.h"
#include "IIndexBuffer.h"
......@@ -20,37 +18,31 @@ namespace scene
class IDynamicMeshBuffer : public IMeshBuffer
{
public:
virtual IVertexBuffer &getVertexBuffer() const =0;
virtual IIndexBuffer &getIndexBuffer() const =0;
virtual void setVertexBuffer(IVertexBuffer *vertexBuffer) =0;
virtual void setIndexBuffer(IIndexBuffer *indexBuffer) =0;
//! Get the material of this meshbuffer
/** \return Material of this buffer. */
virtual video::SMaterial& getMaterial() = 0;
virtual video::SMaterial& getMaterial() =0;
//! Get the material of this meshbuffer
/** \return Material of this buffer. */
virtual const video::SMaterial& getMaterial() const = 0;
virtual const video::SMaterial& getMaterial() const =0;
//! Get the axis aligned bounding box of this meshbuffer.
/** \return Axis aligned bounding box of this buffer. */
virtual const core::aabbox3df& getBoundingBox() const = 0;
virtual const core::aabbox3df& getBoundingBox() const =0;
//! Set axis aligned bounding box
/** \param box User defined axis aligned bounding box to use
for this buffer. */
virtual void setBoundingBox(const core::aabbox3df& box) = 0;
virtual void setBoundingBox(const core::aabbox3df& box) =0;
//! Recalculates the bounding box. Should be called if the mesh changed.
virtual void recalculateBoundingBox() = 0;
virtual void recalculateBoundingBox() =0;
//! Append the vertices and indices to the current buffer
/** Only works for compatible vertex types.
......@@ -71,10 +63,8 @@ namespace scene
}
// ------------------- To be removed? ------------------- //
//! get the current hardware mapping hint
virtual const E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const
{
......@@ -115,8 +105,6 @@ namespace scene
return getIndexBuffer().getChangedID();
}
// ------------------- Old interface ------------------- //
//! Get type of vertex data which is stored in this meshbuffer.
......@@ -188,11 +176,13 @@ namespace scene
{
return getVertexBuffer()[i].Pos;
}
//! returns normal of vertex i
virtual const core::vector3df& getNormal(u32 i) const
{
return getVertexBuffer()[i].Normal;
}
//! returns normal of vertex i
virtual core::vector3df& getNormal(u32 i)
{
......@@ -201,7 +191,6 @@ namespace scene
};
} // end namespace scene
} // end namespace irr
......
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
......@@ -25,35 +25,29 @@ namespace scene
{
public:
virtual void* getData()=0;
virtual void* getData() =0;
virtual video::E_INDEX_TYPE getType() =0;
virtual void setType(video::E_INDEX_TYPE IndexType) =0;
virtual u32 stride() const =0;
virtual u32 size() const=0;
virtual u32 size() const =0;
virtual void push_back (const u32 &element) =0;
virtual const u32 operator [](u32 index) const=0;
virtual const u32 operator [](u32 index) const =0;
virtual const u32 getLast() =0;
virtual void setValue(u32 index, u32 value) =0;
virtual void set_used(u32 usedNow) =0;
virtual void reallocate(u32 new_size)=0;
virtual void reallocate(u32 new_size) =0;
virtual u32 allocated_size() const=0;
virtual void* pointer() =0;
//! get the current hardware mapping hint
virtual const E_HARDWARE_MAPPING getHardwareMappingHint() const = 0;
virtual const E_HARDWARE_MAPPING getHardwareMappingHint() const =0;
//! set the hardware mapping hint, for driver
virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint ) = 0;
virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint ) =0;
//! flags the meshbuffer as changed, reloads hardware buffers
virtual void setDirty() = 0;
......@@ -64,7 +58,6 @@ namespace scene
};
} // end namespace scene
} // end namespace irr
......
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
......@@ -9,9 +9,6 @@
#include "irrArray.h"
#include "S3DVertex.h"
namespace irr
{
namespace scene
......@@ -20,37 +17,34 @@ namespace scene
class IVertexBuffer : public virtual IReferenceCounted
{
public:
virtual void* getData()=0;
virtual void* getData() =0;
virtual video::E_VERTEX_TYPE getType() =0;
virtual void setType(video::E_VERTEX_TYPE vertexType)=0;
virtual void setType(video::E_VERTEX_TYPE vertexType) =0;
virtual u32 stride() const =0;
virtual u32 size() const=0;
virtual void push_back (const video::S3DVertex &element) =0;
virtual video::S3DVertex& operator [](const u32 index) const=0;
virtual u32 size() const =0;
virtual void push_back(const video::S3DVertex &element) =0;
virtual video::S3DVertex& operator [](const u32 index) const =0;
virtual video::S3DVertex& getLast() =0;
virtual void set_used(u32 usedNow) =0;
virtual void reallocate(u32 new_size)=0;
virtual u32 allocated_size() const=0;
virtual void reallocate(u32 new_size) =0;
virtual u32 allocated_size() const =0;
virtual video::S3DVertex* pointer() =0;
//! get the current hardware mapping hint
virtual const E_HARDWARE_MAPPING getHardwareMappingHint() const = 0;
virtual const E_HARDWARE_MAPPING getHardwareMappingHint() const =0;
//! set the hardware mapping hint, for driver
virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint ) = 0;
virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint ) =0;
//! flags the meshbuffer as changed, reloads hardware buffers
virtual void setDirty() = 0;
virtual void setDirty() =0;
//! Get the currently used ID for identification of changes.
/** This shouldn't be used for anything outside the VideoDriver. */
virtual const u32 getChangedID() const = 0;
};
} // end namespace scene
} // end namespace irr
......
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
......@@ -19,7 +19,6 @@ enum E_INDEX_TYPE
};
/*
//! vertex index used by the Irrlicht engine.
template <class T>
......@@ -27,14 +26,12 @@ struct SSpecificVertexIndex
{
T Index;
//! default constructor
SSpecificVertexIndex() {}
//! constructor
SSpecificVertexIndex(u32 _index) :Index(_index) {}
bool operator==(const SSpecificVertexIndex& other) const
{
return (Index == other.Index);
......@@ -50,8 +47,6 @@ struct SSpecificVertexIndex
return (Index < other.Index);
}
SSpecificVertexIndex operator+(const u32& other) const
{
return SSpecificVertexIndex(Index + other);
......@@ -64,7 +59,8 @@ struct SSpecificVertexIndex
E_INDEX_TYPE getType() const
{
if (sizeof(T)==sizeof(u16)) return video::EIT_16BIT;
if (sizeof(T)==sizeof(u16))
return video::EIT_16BIT;
return video::EIT_32BIT;
}
......@@ -72,7 +68,6 @@ struct SSpecificVertexIndex
//typedef SSpecificVertexIndex<u16> SVertexIndex;
typedef u32 SVertexIndex;
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment