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". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_DYNAMIC_MESHBUFFER_H_INCLUDED__ #ifndef __C_DYNAMIC_MESHBUFFER_H_INCLUDED__
#define __C_DYNAMIC_MESHBUFFER_H_INCLUDED__ #define __C_DYNAMIC_MESHBUFFER_H_INCLUDED__
#include "IDynamicMeshBuffer.h" #include "IDynamicMeshBuffer.h"
#include "CVertexBuffer.h" #include "CVertexBuffer.h"
#include "CIndexBuffer.h" #include "CIndexBuffer.h"
namespace irr namespace irr
{ {
namespace scene namespace scene
{ {
class CDynamicMeshBuffer: public IDynamicMeshBuffer
class CDynamicMeshBuffer: public IDynamicMeshBuffer {
{ public:
//! constructor
IVertexBuffer *VertexBuffer; CDynamicMeshBuffer(video::E_VERTEX_TYPE vertexType, video::E_INDEX_TYPE indexType)
IIndexBuffer *IndexBuffer; {
VertexBuffer=new CVertexBuffer(vertexType);
IndexBuffer=new CIndexBuffer(indexType);
public: }
//! destructor
CDynamicMeshBuffer(video::E_VERTEX_TYPE vertexType, video::E_INDEX_TYPE indexType) ~CDynamicMeshBuffer()
{ {
VertexBuffer=new CVertexBuffer(vertexType); if (VertexBuffer)
IndexBuffer=new CIndexBuffer(indexType); VertexBuffer->drop();
if (IndexBuffer)
} IndexBuffer->drop();
}
~CDynamicMeshBuffer()
{ virtual IVertexBuffer &getVertexBuffer() const
if (VertexBuffer) VertexBuffer->drop(); {
if (IndexBuffer) IndexBuffer->drop(); return *VertexBuffer;
} }
virtual IIndexBuffer &getIndexBuffer() const
virtual IVertexBuffer &getVertexBuffer() const {
{ return *IndexBuffer;
return *VertexBuffer; }
}
virtual IIndexBuffer &getIndexBuffer() const virtual void setVertexBuffer(IVertexBuffer *newVertexBuffer)
{ {
return *IndexBuffer; if (newVertexBuffer)
} newVertexBuffer->grab();
if (VertexBuffer)
virtual void setVertexBuffer(IVertexBuffer *newVertexBuffer) VertexBuffer->drop();
{
if (newVertexBuffer) newVertexBuffer->grab(); VertexBuffer=newVertexBuffer;
if (VertexBuffer) VertexBuffer->drop(); }
VertexBuffer=newVertexBuffer; virtual void setIndexBuffer(IIndexBuffer *newIndexBuffer)
} {
if (newIndexBuffer)
virtual void setIndexBuffer(IIndexBuffer *newIndexBuffer) newIndexBuffer->grab();
{ if (IndexBuffer)
if (newIndexBuffer) newIndexBuffer->grab(); IndexBuffer->drop();
if (IndexBuffer) IndexBuffer->drop();
IndexBuffer=newIndexBuffer;
IndexBuffer=newIndexBuffer; }
}
//! Get Material of this buffer.
virtual const video::SMaterial& getMaterial() const
//! Get Material of this buffer. {
virtual const video::SMaterial& getMaterial() const return Material;
{ }
return Material;
} //! Get Material of this buffer.
virtual video::SMaterial& getMaterial()
//! Get Material of this buffer. {
virtual video::SMaterial& getMaterial() return Material;
{ }
return Material;
} //! Get bounding box
virtual const core::aabbox3d<f32>& getBoundingBox() const
//! Get bounding box {
virtual const core::aabbox3d<f32>& getBoundingBox() const return BoundingBox;
{ }
return BoundingBox;
} //! Set bounding box
virtual void setBoundingBox( const core::aabbox3df& box)
//! Set bounding box {
virtual void setBoundingBox( const core::aabbox3df& box) BoundingBox = box;
{ }
BoundingBox = box;
} //! Recalculate bounding box
virtual void recalculateBoundingBox()
//! Recalculate bounding box {
virtual void recalculateBoundingBox() if (!getVertexBuffer().size())
{ BoundingBox.reset(0,0,0);
else
if (!getVertexBuffer().size()) {
BoundingBox.reset(0,0,0); BoundingBox.reset(getVertexBuffer()[0].Pos);
else for (u32 i=1; i<getVertexBuffer().size(); ++i)
{ BoundingBox.addInternalPoint(getVertexBuffer()[i].Pos);
BoundingBox.reset(getVertexBuffer()[0].Pos); }
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;
video::SMaterial Material; };
core::aabbox3d<f32> BoundingBox;
};
} // end namespace scene } // end namespace scene
......
// Copyright (C) 2002-2008 Nikolaus Gebhardt // Copyright (C) 2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_INDEX_BUFFER_H_INCLUDED__ #ifndef __C_INDEX_BUFFER_H_INCLUDED__
#define __C_INDEX_BUFFER_H_INCLUDED__ #define __C_INDEX_BUFFER_H_INCLUDED__
#include "IIndexBuffer.h" #include "IIndexBuffer.h"
namespace irr namespace irr
{ {
namespace scene namespace scene
{ {
class CIndexBuffer : public IIndexBuffer
class CIndexBuffer : public IIndexBuffer {
{
class IIndexList
class IIndexList {
{ public:
public: virtual u32 stride() const =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 void push_back (const u32 &element) =0; virtual u32 operator [](u32 index) const =0;
virtual const u32 operator [](u32 index) const=0; virtual u32 getLast() =0;
virtual const u32 getLast() =0; virtual void setValue(u32 index, u32 value) =0;
virtual void setValue(u32 index, u32 value) =0; virtual void set_used(u32 usedNow) =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 u32 allocated_size() const=0; virtual void* pointer() =0;
virtual void* pointer() =0; virtual video::E_INDEX_TYPE getType() =0;
virtual video::E_INDEX_TYPE getType()=0; };
};
template <class T>
template <class T> class CSpecificIndexList : public IIndexList
class CSpecificIndexList : public IIndexList {
{ public:
public: core::array<T> Indices;
core::array<T> Indices;
virtual u32 stride() const {return sizeof(T);}
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)
{
virtual void push_back (const u32 &element) Indices.push_back((T&)element);
{Indices.push_back((T&)element);} }
virtual const u32 operator [](u32 index) const virtual u32 operator [](u32 index) const
{return (u32) (Indices[index]);} {
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)
{ virtual void setValue(u32 index, u32 value)
Indices[index]=(T)value; {
} Indices[index]=(T)value;
}
virtual void set_used(u32 usedNow) virtual void set_used(u32 usedNow)
{Indices.set_used(usedNow);} {
Indices.set_used(usedNow);
virtual void reallocate(u32 new_size) }
{Indices.reallocate(new_size);}
virtual void reallocate(u32 new_size)
virtual u32 allocated_size() const {
{ Indices.reallocate(new_size);
return Indices.allocated_size(); }
}
virtual u32 allocated_size() const
virtual void* pointer() {return Indices.pointer();} {
return Indices.allocated_size();
virtual video::E_INDEX_TYPE getType() }
{
if (sizeof(T)==sizeof(u16)) return video::EIT_16BIT; virtual void* pointer() {return Indices.pointer();}
return video::EIT_32BIT;
} virtual video::E_INDEX_TYPE getType()
}; {
if (sizeof(T)==sizeof(u16))
public: return video::EIT_16BIT;
IIndexList *Indices; return video::EIT_32BIT;
}
CIndexBuffer(video::E_INDEX_TYPE IndexType) :Indices(0), MappingHint(EHM_NEVER), ChangedID(1) };
{
setType(IndexType); public:
} IIndexList *Indices;
~CIndexBuffer() CIndexBuffer(video::E_INDEX_TYPE IndexType) :Indices(0), MappingHint(EHM_NEVER), ChangedID(1)
{ {
if (Indices) setType(IndexType);
delete Indices; }
}
~CIndexBuffer()
//virtual void setType(video::E_INDEX_TYPE IndexType); {
virtual void setType(video::E_INDEX_TYPE IndexType) delete Indices;
{ }
IIndexList *NewIndices=0; //virtual void setType(video::E_INDEX_TYPE IndexType);
virtual void setType(video::E_INDEX_TYPE IndexType)
switch (IndexType) {
{ IIndexList *NewIndices=0;
case video::EIT_16BIT:
{ switch (IndexType)
NewIndices=new CSpecificIndexList<u16>; {
break; case video::EIT_16BIT:
} {
case video::EIT_32BIT: NewIndices=new CSpecificIndexList<u16>;
{ break;
NewIndices=new CSpecificIndexList<u32>; }
break; case video::EIT_32BIT:
} {
} NewIndices=new CSpecificIndexList<u32>;
break;
if (Indices) }
{ }
NewIndices->reallocate( Indices->size() );
if (Indices)
for(u32 n=0;n<Indices->size();++n) {
NewIndices->push_back((*Indices)[n]); NewIndices->reallocate( Indices->size() );
delete Indices; for(u32 n=0;n<Indices->size();++n)
} NewIndices->push_back((*Indices)[n]);
Indices=NewIndices; delete Indices;
} }
Indices=NewIndices;
}
virtual void* getData() {return Indices->pointer();}
virtual video::E_INDEX_TYPE getType(){return Indices->getType();} virtual void* getData() {return Indices->pointer();}
virtual u32 stride() const {return Indices->stride();} virtual video::E_INDEX_TYPE getType(){return Indices->getType();}
virtual u32 size() const virtual u32 stride() const {return Indices->stride();}
{
return Indices->size(); virtual u32 size() const
} {
return Indices->size();
virtual void push_back (const u32 &element) }
{
Indices->push_back(element); virtual void push_back(const u32 &element)
} {
Indices->push_back(element);
virtual const u32 operator [](u32 index) const }
{
return (*Indices)[index]; virtual const u32 operator [](u32 index) const
} {
return (*Indices)[index];
virtual const u32 getLast() }
{
return Indices->getLast(); virtual const u32 getLast()
} {
return Indices->getLast();
virtual void setValue(u32 index, u32 value) }
{
Indices->setValue(index, value); virtual void setValue(u32 index, u32 value)
} {
Indices->setValue(index, value);
}
virtual void set_used(u32 usedNow)
{ virtual void set_used(u32 usedNow)
Indices->set_used(usedNow); {
} Indices->set_used(usedNow);
}
virtual void reallocate(u32 new_size)
{ virtual void reallocate(u32 new_size)
Indices->reallocate(new_size); {
} Indices->reallocate(new_size);
}
virtual u32 allocated_size() const
{ virtual u32 allocated_size() const
return Indices->allocated_size(); {
} return Indices->allocated_size();
}
virtual void* pointer()
{ virtual void* pointer()
return Indices->pointer(); {
} return Indices->pointer();
}
//! get the current hardware mapping hint
virtual const E_HARDWARE_MAPPING getHardwareMappingHint() const //! get the current hardware mapping hint
{ virtual const E_HARDWARE_MAPPING getHardwareMappingHint() const
return MappingHint; {
} return MappingHint;
}
//! set the hardware mapping hint, for driver
virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint ) //! set the hardware mapping hint, for driver
{ virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint )
MappingHint=NewMappingHint; {
} MappingHint=NewMappingHint;
}
//! flags the mesh as changed, reloads hardware buffers
virtual void setDirty() //! flags the mesh as changed, reloads hardware buffers
{ virtual void setDirty()
++ChangedID; {
} ++ChangedID;
}
//! Get the currently used ID for identification of changes.
/** This shouldn't be used for anything outside the VideoDriver. */ //! Get the currently used ID for identification of changes.
virtual const u32 getChangedID() const {return ChangedID;} /** This shouldn't be used for anything outside the VideoDriver. */
virtual const u32 getChangedID() const {return ChangedID;}
E_HARDWARE_MAPPING MappingHint;
u32 ChangedID; E_HARDWARE_MAPPING MappingHint;
}; u32 ChangedID;
};
} // end namespace scene } // end namespace scene
} // end namespace irr } // end namespace irr
......
// Copyright (C) 2002-2008 Nikolaus Gebhardt // Copyright (C) 2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_VERTEX_BUFFER_H_INCLUDED__ #ifndef __C_VERTEX_BUFFER_H_INCLUDED__
#define __C_VERTEX_BUFFER_H_INCLUDED__ #define __C_VERTEX_BUFFER_H_INCLUDED__
#include "IVertexBuffer.h" #include "IVertexBuffer.h"
namespace irr namespace irr
{ {
namespace scene namespace scene
{ {
class CVertexBuffer : public IVertexBuffer
class CVertexBuffer : public IVertexBuffer {
{
class IVertexList
{
public:
class IVertexList virtual u32 stride() const =0;
{
public: virtual u32 size() const =0;
virtual u32 stride() const =0;
virtual void push_back (const video::S3DVertex &element) =0;
virtual u32 size() const=0; virtual video::S3DVertex& operator [](const u32 index) const =0;
virtual void push_back (const video::S3DVertex &element) =0; virtual video::S3DVertex& getLast() =0;
virtual video::S3DVertex& operator [](const u32 index) const=0; virtual void set_used(u32 usedNow) =0;
virtual video::S3DVertex& getLast() =0; virtual void reallocate(u32 new_size) =0;
virtual void set_used(u32 usedNow) =0; virtual u32 allocated_size() const =0;
virtual void reallocate(u32 new_size)=0; virtual video::S3DVertex* pointer() =0;
virtual u32 allocated_size() const =0; virtual video::E_VERTEX_TYPE getType() =0;
virtual video::S3DVertex* pointer() =0; };
virtual video::E_VERTEX_TYPE getType()=0;
}; template <class T>
class CSpecificVertexList : public IVertexList
template <class T> {
class CSpecificVertexList : public IVertexList public:
{ core::array<T> Vertices;
public:
core::array<T> Vertices; virtual u32 stride() const {return sizeof(T);}
virtual u32 stride() const {return sizeof(T);} virtual u32 size() const {return Vertices.size();}
virtual u32 size() const virtual void push_back (const video::S3DVertex &element)
{return Vertices.size();} {Vertices.push_back((T&)element);}
virtual void push_back (const video::S3DVertex &element) virtual video::S3DVertex& operator [](const u32 index) const
{Vertices.push_back((T&)element);} {return (video::S3DVertex&)Vertices[index];}
virtual video::S3DVertex& operator [](const u32 index) const virtual video::S3DVertex& getLast()
{return (video::S3DVertex&)Vertices[index];} {return (video::S3DVertex&)Vertices.getLast();}
virtual video::S3DVertex& getLast() virtual void set_used(u32 usedNow)
{return (video::S3DVertex&)Vertices.getLast();} {Vertices.set_used(usedNow);}
virtual void set_used(u32 usedNow) virtual void reallocate(u32 new_size)
{Vertices.set_used(usedNow);} {Vertices.reallocate(new_size);}
virtual void reallocate(u32 new_size) virtual u32 allocated_size() const
{Vertices.reallocate(new_size);} {
return Vertices.allocated_size();
virtual u32 allocated_size() const }
{
return Vertices.allocated_size(); virtual video::S3DVertex* pointer() {return Vertices.pointer();}
}
virtual video::E_VERTEX_TYPE getType(){return T().getType();}
virtual video::S3DVertex* pointer() {return Vertices.pointer();} };
virtual video::E_VERTEX_TYPE getType(){return T().getType();} public:
}; IVertexList *Vertices;
public: CVertexBuffer(video::E_VERTEX_TYPE vertexType) :Vertices(0), MappingHint(EHM_NEVER), ChangedID(1)
IVertexList *Vertices; {
setType(vertexType);
CVertexBuffer(video::E_VERTEX_TYPE vertexType) :Vertices(0), MappingHint(EHM_NEVER), ChangedID(1) }
{
setType(vertexType); ~CVertexBuffer()
} {
delete Vertices;
~CVertexBuffer() }
{
if (Vertices) //virtual void setType(video::E_VERTEX_TYPE vertexType);
delete Vertices;
} virtual void setType(video::E_VERTEX_TYPE vertexType)
{
IVertexList *NewVertices=0;
//virtual void setType(video::E_VERTEX_TYPE vertexType);
switch (vertexType)
virtual void setType(video::E_VERTEX_TYPE vertexType) {
{ case video::EVT_STANDARD:
{
IVertexList *NewVertices=0; NewVertices=new CSpecificVertexList<video::S3DVertex>;
break;
switch (vertexType) }
{ case video::EVT_2TCOORDS:
case video::EVT_STANDARD: {
{ NewVertices=new CSpecificVertexList<video::S3DVertex2TCoords>;
NewVertices=new CSpecificVertexList<video::S3DVertex>; break;
break; }
} case video::EVT_TANGENTS:
case video::EVT_2TCOORDS: {
{ NewVertices=new CSpecificVertexList<video::S3DVertexTangents>;
NewVertices=new CSpecificVertexList<video::S3DVertex2TCoords>; break;
break; }
} }
case video::EVT_TANGENTS: if (Vertices)
{ {
NewVertices=new CSpecificVertexList<video::S3DVertexTangents>; NewVertices->reallocate( Vertices->size() );
break;
} for(u32 n=0;n<Vertices->size();++n)
} NewVertices->push_back((*Vertices)[n]);
if (Vertices)
{ delete Vertices;
NewVertices->reallocate( Vertices->size() ); }
for(u32 n=0;n<Vertices->size();++n) Vertices=NewVertices;
NewVertices->push_back((*Vertices)[n]); }
delete Vertices; virtual void* getData() {return Vertices->pointer();}
}
virtual video::E_VERTEX_TYPE getType(){return Vertices->getType();}
Vertices=NewVertices;
virtual u32 stride() const {return Vertices->stride();}
}
virtual u32 size() const
{
return Vertices->size();
virtual void* getData() {return Vertices->pointer();} }
virtual video::E_VERTEX_TYPE getType(){return Vertices->getType();}
virtual void push_back (const video::S3DVertex &element)
virtual u32 stride() const {return Vertices->stride();} {
Vertices->push_back(element);
virtual u32 size() const }
{
return Vertices->size(); virtual video::S3DVertex& operator [](const u32 index) const
} {
return (*Vertices)[index];
virtual void push_back (const video::S3DVertex &element) }
{
Vertices->push_back(element); virtual video::S3DVertex& getLast()
} {
return Vertices->getLast();
virtual video::S3DVertex& operator [](const u32 index) const }
{
return (*Vertices)[index]; virtual void set_used(u32 usedNow)
} {
Vertices->set_used(usedNow);
virtual video::S3DVertex& getLast() }
{
return Vertices->getLast(); virtual void reallocate(u32 new_size)
} {
Vertices->reallocate(new_size);
virtual void set_used(u32 usedNow) }
{
Vertices->set_used(usedNow); virtual u32 allocated_size() const
} {
return Vertices->allocated_size();
virtual void reallocate(u32 new_size) }
{
Vertices->reallocate(new_size); virtual video::S3DVertex* pointer()
} {
return Vertices->pointer();
virtual u32 allocated_size() const }
{
return Vertices->allocated_size(); //! get the current hardware mapping hint
} virtual const E_HARDWARE_MAPPING getHardwareMappingHint() const
{
virtual video::S3DVertex* pointer() return MappingHint;
{ }
return Vertices->pointer();
} //! set the hardware mapping hint, for driver
virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint )
//! get the current hardware mapping hint {
virtual const E_HARDWARE_MAPPING getHardwareMappingHint() const MappingHint=NewMappingHint;
{ }
return MappingHint;
} //! flags the mesh as changed, reloads hardware buffers
virtual void setDirty()
//! set the hardware mapping hint, for driver {
virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint ) ++ChangedID;
{ }
MappingHint=NewMappingHint;
} //! Get the currently used ID for identification of changes.
/** This shouldn't be used for anything outside the VideoDriver. */
//! flags the mesh as changed, reloads hardware buffers virtual const u32 getChangedID() const {return ChangedID;}
virtual void setDirty()
{ E_HARDWARE_MAPPING MappingHint;
++ChangedID; u32 ChangedID;
} };
//! Get the currently used ID for identification of changes.
/** This shouldn't be used for anything outside the VideoDriver. */
virtual const u32 getChangedID() const {return ChangedID;}
E_HARDWARE_MAPPING MappingHint;
u32 ChangedID;
};
} // end namespace scene } // end namespace scene
} // end namespace irr } // end namespace irr
......
This diff is collapsed.
// Copyright (C) 2002-2008 Nikolaus Gebhardt // Copyright (C) 2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_INDEX_BUFFER_H_INCLUDED__ #ifndef __I_INDEX_BUFFER_H_INCLUDED__
#define __I_INDEX_BUFFER_H_INCLUDED__ #define __I_INDEX_BUFFER_H_INCLUDED__
#include "IReferenceCounted.h" #include "IReferenceCounted.h"
#include "irrArray.h" #include "irrArray.h"
#include "SVertexIndex.h" #include "SVertexIndex.h"
namespace irr namespace irr
{ {
namespace video namespace video
{ {
} }
namespace scene namespace scene
{ {
class IIndexBuffer : public virtual IReferenceCounted class IIndexBuffer : public virtual IReferenceCounted
{ {
public: public:
virtual void* getData()=0; virtual void* getData() =0;
virtual video::E_INDEX_TYPE getType() =0; virtual video::E_INDEX_TYPE getType() =0;
virtual void setType(video::E_INDEX_TYPE IndexType) =0; virtual void setType(video::E_INDEX_TYPE IndexType) =0;
virtual u32 stride() const =0;
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 u32 size() const=0; virtual const u32 getLast() =0;
virtual void push_back (const u32 &element) =0; virtual void setValue(u32 index, u32 value) =0;
virtual const u32 operator [](u32 index) const=0; virtual void set_used(u32 usedNow) =0;
virtual const u32 getLast() =0; virtual void reallocate(u32 new_size) =0;
virtual void setValue(u32 index, u32 value) =0; virtual u32 allocated_size() const=0;
virtual void set_used(u32 usedNow) =0;
virtual void reallocate(u32 new_size)=0; virtual void* pointer() =0;
virtual u32 allocated_size() const=0;
virtual void* pointer() =0;
//! get the current hardware mapping hint //! 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 //! 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 //! 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. //! Get the currently used ID for identification of changes.
/** This shouldn't be used for anything outside the VideoDriver. */ /** This shouldn't be used for anything outside the VideoDriver. */
virtual const u32 getChangedID() const = 0; virtual const u32 getChangedID() const = 0;
}; };
} // end namespace scene } // end namespace scene
} // end namespace irr } // end namespace irr
......
// Copyright (C) 2002-2008 Nikolaus Gebhardt // Copyright (C) 2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_VERTEX_BUFFER_H_INCLUDED__ #ifndef __I_VERTEX_BUFFER_H_INCLUDED__
#define __I_VERTEX_BUFFER_H_INCLUDED__ #define __I_VERTEX_BUFFER_H_INCLUDED__
#include "IReferenceCounted.h" #include "IReferenceCounted.h"
#include "irrArray.h" #include "irrArray.h"
#include "S3DVertex.h" #include "S3DVertex.h"
namespace irr namespace irr
{ {
...@@ -19,37 +16,34 @@ namespace scene ...@@ -19,37 +16,34 @@ namespace scene
class IVertexBuffer : public virtual IReferenceCounted class IVertexBuffer : public virtual IReferenceCounted
{ {
public: public:
virtual void* getData() =0;
virtual void* getData()=0; virtual video::E_VERTEX_TYPE getType() =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 stride() const =0; virtual u32 size() const =0;
virtual u32 size() const=0; virtual void push_back(const video::S3DVertex &element) =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 video::S3DVertex& getLast() =0; virtual void set_used(u32 usedNow) =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 u32 allocated_size() const=0; virtual video::S3DVertex* pointer() =0;
virtual video::S3DVertex* pointer() =0;
//! get the current hardware mapping hint //! 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 //! 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 //! 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. //! Get the currently used ID for identification of changes.
/** This shouldn't be used for anything outside the VideoDriver. */ /** This shouldn't be used for anything outside the VideoDriver. */
virtual const u32 getChangedID() const = 0; virtual const u32 getChangedID() const = 0;
};
};
} // end namespace scene } // end namespace scene
} // end namespace irr } // end namespace irr
......
// Copyright (C) 2002-2008 Nikolaus Gebhardt // Copyright (C) 2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
...@@ -12,69 +12,64 @@ namespace irr ...@@ -12,69 +12,64 @@ namespace irr
{ {
namespace video namespace video
{ {
enum E_INDEX_TYPE enum E_INDEX_TYPE
{ {
EIT_16BIT = 0, EIT_16BIT = 0,
EIT_32BIT EIT_32BIT
}; };
/*
/* //! vertex index used by the Irrlicht engine.
//! vertex index used by the Irrlicht engine. template <class T>
template <class T> struct SSpecificVertexIndex
struct SSpecificVertexIndex {
{ T Index;
T Index;
//! default constructor
SSpecificVertexIndex() {}
//! default constructor
SSpecificVertexIndex() {} //! constructor
SSpecificVertexIndex(u32 _index) :Index(_index) {}
//! constructor
SSpecificVertexIndex(u32 _index) :Index(_index) {} bool operator==(const SSpecificVertexIndex& other) const
{
return (Index == other.Index);
bool operator==(const SSpecificVertexIndex& other) const }
{
return (Index == other.Index); bool operator!=(const SSpecificVertexIndex& other) const
} {
return (Index != other.Index);
bool operator!=(const SSpecificVertexIndex& other) const }
{
return (Index != other.Index); bool operator<(const SSpecificVertexIndex& other) const
} {
return (Index < other.Index);
bool operator<(const SSpecificVertexIndex& other) const }
{
return (Index < other.Index); SSpecificVertexIndex operator+(const u32& other) const
} {
return SSpecificVertexIndex(Index + other);
}
SSpecificVertexIndex operator+(const u32& other) const operator const u32() const
{ {
return SSpecificVertexIndex(Index + other); return (const u32)Index;
} }
operator const u32() const E_INDEX_TYPE getType() const
{ {
return (const u32)Index; if (sizeof(T)==sizeof(u16))
} return video::EIT_16BIT;
return video::EIT_32BIT;
E_INDEX_TYPE getType() const }
{
if (sizeof(T)==sizeof(u16)) return video::EIT_16BIT; };
return video::EIT_32BIT;
} //typedef SSpecificVertexIndex<u16> SVertexIndex;
}; typedef u32 SVertexIndex;
*/
//typedef SSpecificVertexIndex<u16> SVertexIndex;
typedef u32 SVertexIndex;
*/
} // end namespace video } // end namespace video
......
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