mirror of
https://github.com/minetest/irrlicht.git
synced 2025-07-05 17:50:24 +02:00
Merging r6337 through r6363 from trunk to ogl-es branch
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6379 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
@ -102,6 +102,26 @@ namespace scene
|
||||
}
|
||||
}
|
||||
|
||||
//! Append the vertices and indices to the current buffer
|
||||
/** Only works for compatible vertex types.
|
||||
\param vertices Pointer to a vertex array.
|
||||
\param numVertices Number of vertices in the array.
|
||||
\param indices Pointer to index array.
|
||||
\param numIndices Number of indices in array. */
|
||||
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) IRR_OVERRIDE
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
//! Append the meshbuffer to the current buffer
|
||||
/** Only works for compatible vertex types
|
||||
\param other Buffer to append to this one. */
|
||||
virtual void append(const IMeshBuffer* const other) IRR_OVERRIDE
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
||||
//! Describe what kind of primitive geometry is used by the meshbuffer
|
||||
virtual void setPrimitiveType(E_PRIMITIVE_TYPE type) IRR_OVERRIDE
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ namespace scene
|
||||
|
||||
class CIndexBuffer : public IIndexBuffer
|
||||
{
|
||||
|
||||
// Virtual function wrapper around irr::core::array
|
||||
class IIndexList
|
||||
{
|
||||
public:
|
||||
@ -22,14 +22,15 @@ namespace scene
|
||||
|
||||
virtual u32 stride() const =0;
|
||||
virtual u32 size() const =0;
|
||||
virtual void push_back(const u32 &element) =0;
|
||||
virtual void push_back(u32 value) =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 void reallocate(u32 new_size, bool canShrink=true) =0;
|
||||
virtual u32 allocated_size() const =0;
|
||||
virtual void* pointer() =0;
|
||||
virtual const void* const_pointer() const =0;
|
||||
virtual video::E_INDEX_TYPE getType() const =0;
|
||||
};
|
||||
|
||||
@ -43,10 +44,9 @@ namespace scene
|
||||
|
||||
virtual u32 size() const IRR_OVERRIDE {return Indices.size();}
|
||||
|
||||
virtual void push_back(const u32 &element) IRR_OVERRIDE
|
||||
virtual void push_back(u32 value) IRR_OVERRIDE
|
||||
{
|
||||
// push const ref due to compiler problem with gcc 4.6, big endian
|
||||
Indices.push_back((const T&)element);
|
||||
Indices.push_back((T)value);
|
||||
}
|
||||
|
||||
virtual u32 operator [](u32 index) const IRR_OVERRIDE
|
||||
@ -66,9 +66,9 @@ namespace scene
|
||||
Indices.set_used(usedNow);
|
||||
}
|
||||
|
||||
virtual void reallocate(u32 new_size) IRR_OVERRIDE
|
||||
virtual void reallocate(u32 new_size, bool canShrink) IRR_OVERRIDE
|
||||
{
|
||||
Indices.reallocate(new_size);
|
||||
Indices.reallocate(new_size, canShrink);
|
||||
}
|
||||
|
||||
virtual u32 allocated_size() const IRR_OVERRIDE
|
||||
@ -76,7 +76,8 @@ namespace scene
|
||||
return Indices.allocated_size();
|
||||
}
|
||||
|
||||
virtual void* pointer() IRR_OVERRIDE {return Indices.pointer();}
|
||||
virtual void* pointer() IRR_OVERRIDE { return Indices.pointer(); }
|
||||
virtual const void* const_pointer() const IRR_OVERRIDE { return Indices.const_pointer(); }
|
||||
|
||||
virtual video::E_INDEX_TYPE getType() const IRR_OVERRIDE
|
||||
{
|
||||
@ -109,12 +110,14 @@ namespace scene
|
||||
delete Indices;
|
||||
}
|
||||
|
||||
//virtual void setType(video::E_INDEX_TYPE IndexType);
|
||||
virtual void setType(video::E_INDEX_TYPE IndexType) IRR_OVERRIDE
|
||||
virtual void setType(video::E_INDEX_TYPE indexType) IRR_OVERRIDE
|
||||
{
|
||||
if ( Indices && Indices->getType() == indexType )
|
||||
return;
|
||||
|
||||
IIndexList *NewIndices=0;
|
||||
|
||||
switch (IndexType)
|
||||
switch (indexType)
|
||||
{
|
||||
case video::EIT_16BIT:
|
||||
{
|
||||
@ -142,6 +145,7 @@ namespace scene
|
||||
}
|
||||
|
||||
virtual void* getData() IRR_OVERRIDE {return Indices->pointer();}
|
||||
virtual const void* getData() const IRR_OVERRIDE { return Indices->const_pointer(); }
|
||||
|
||||
virtual video::E_INDEX_TYPE getType() const IRR_OVERRIDE {return Indices->getType();}
|
||||
|
||||
@ -152,9 +156,9 @@ namespace scene
|
||||
return Indices->size();
|
||||
}
|
||||
|
||||
virtual void push_back(const u32 &element) IRR_OVERRIDE
|
||||
virtual void push_back(u32 value) IRR_OVERRIDE
|
||||
{
|
||||
Indices->push_back(element);
|
||||
Indices->push_back(value);
|
||||
}
|
||||
|
||||
virtual u32 operator [](u32 index) const IRR_OVERRIDE
|
||||
@ -177,9 +181,9 @@ namespace scene
|
||||
Indices->set_used(usedNow);
|
||||
}
|
||||
|
||||
virtual void reallocate(u32 new_size) IRR_OVERRIDE
|
||||
virtual void reallocate(u32 new_size, bool canShrink=true) IRR_OVERRIDE
|
||||
{
|
||||
Indices->reallocate(new_size);
|
||||
Indices->reallocate(new_size, canShrink);
|
||||
}
|
||||
|
||||
virtual u32 allocated_size() const IRR_OVERRIDE
|
||||
@ -187,11 +191,6 @@ namespace scene
|
||||
return Indices->allocated_size();
|
||||
}
|
||||
|
||||
virtual void* pointer() IRR_OVERRIDE
|
||||
{
|
||||
return Indices->pointer();
|
||||
}
|
||||
|
||||
//! get the current hardware mapping hint
|
||||
virtual E_HARDWARE_MAPPING getHardwareMappingHint() const IRR_OVERRIDE
|
||||
{
|
||||
|
@ -25,12 +25,20 @@ namespace scene
|
||||
virtual u32 size() const =0;
|
||||
|
||||
virtual void push_back (const video::S3DVertex &element) =0;
|
||||
virtual void push_back(const video::S3DVertex2TCoords &element) =0;
|
||||
virtual void push_back(const video::S3DVertexTangents &element) =0;
|
||||
virtual void setValue(u32 index, const video::S3DVertex &value) =0;
|
||||
virtual void setValue(u32 index, const video::S3DVertex2TCoords &value) =0;
|
||||
virtual void setValue(u32 index, const video::S3DVertexTangents &value) =0;
|
||||
|
||||
virtual video::S3DVertex& operator [](u32 index) = 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, bool canShrink=true) =0;
|
||||
virtual u32 allocated_size() const =0;
|
||||
virtual video::S3DVertex* pointer() =0;
|
||||
virtual void* pointer() =0;
|
||||
virtual const void* const_pointer() const =0;
|
||||
virtual video::E_VERTEX_TYPE getType() const =0;
|
||||
};
|
||||
|
||||
@ -45,7 +53,21 @@ namespace scene
|
||||
virtual u32 size() const IRR_OVERRIDE {return Vertices.size();}
|
||||
|
||||
virtual void push_back (const video::S3DVertex &element) IRR_OVERRIDE
|
||||
{Vertices.push_back((T&)element);}
|
||||
{Vertices.push_back(element);}
|
||||
virtual void push_back(const video::S3DVertex2TCoords &element) IRR_OVERRIDE
|
||||
{Vertices.push_back(element);}
|
||||
virtual void push_back(const video::S3DVertexTangents &element) IRR_OVERRIDE
|
||||
{Vertices.push_back(element);}
|
||||
|
||||
virtual void setValue(u32 index, const video::S3DVertex &value) IRR_OVERRIDE
|
||||
{Vertices[index] = value;}
|
||||
virtual void setValue(u32 index, const video::S3DVertex2TCoords &value) IRR_OVERRIDE
|
||||
{Vertices[index] = value;}
|
||||
virtual void setValue(u32 index, const video::S3DVertexTangents &value) IRR_OVERRIDE
|
||||
{Vertices[index] = value;}
|
||||
|
||||
virtual video::S3DVertex& operator [](u32 index) IRR_OVERRIDE
|
||||
{return (video::S3DVertex&)Vertices[index];}
|
||||
|
||||
virtual video::S3DVertex& operator [](const u32 index) const IRR_OVERRIDE
|
||||
{return (video::S3DVertex&)Vertices[index];}
|
||||
@ -56,15 +78,16 @@ namespace scene
|
||||
virtual void set_used(u32 usedNow) IRR_OVERRIDE
|
||||
{Vertices.set_used(usedNow);}
|
||||
|
||||
virtual void reallocate(u32 new_size) IRR_OVERRIDE
|
||||
{Vertices.reallocate(new_size);}
|
||||
virtual void reallocate(u32 new_size, bool canShrink) IRR_OVERRIDE
|
||||
{Vertices.reallocate(new_size, canShrink);}
|
||||
|
||||
virtual u32 allocated_size() const IRR_OVERRIDE
|
||||
{
|
||||
return Vertices.allocated_size();
|
||||
}
|
||||
|
||||
virtual video::S3DVertex* pointer() IRR_OVERRIDE {return Vertices.pointer();}
|
||||
virtual void* pointer() IRR_OVERRIDE {return Vertices.pointer();}
|
||||
virtual const void* const_pointer() const IRR_OVERRIDE {return Vertices.const_pointer();}
|
||||
|
||||
virtual video::E_VERTEX_TYPE getType() const IRR_OVERRIDE {return T::getType();}
|
||||
};
|
||||
@ -94,9 +117,11 @@ namespace scene
|
||||
delete Vertices;
|
||||
}
|
||||
|
||||
|
||||
virtual void setType(video::E_VERTEX_TYPE vertexType) IRR_OVERRIDE
|
||||
{
|
||||
if ( Vertices && Vertices->getType() == vertexType )
|
||||
return;
|
||||
|
||||
IVertexList *NewVertices=0;
|
||||
|
||||
switch (vertexType)
|
||||
@ -121,8 +146,27 @@ namespace scene
|
||||
{
|
||||
NewVertices->reallocate( Vertices->size() );
|
||||
|
||||
for(u32 n=0;n<Vertices->size();++n)
|
||||
NewVertices->push_back((*Vertices)[n]);
|
||||
switch (Vertices->getType()) // old type
|
||||
{
|
||||
case video::EVT_STANDARD:
|
||||
{
|
||||
for(u32 n=0;n<Vertices->size();++n)
|
||||
NewVertices->push_back((*Vertices)[n]);
|
||||
break;
|
||||
}
|
||||
case video::EVT_2TCOORDS:
|
||||
{
|
||||
for(u32 n=0;n<Vertices->size();++n)
|
||||
NewVertices->push_back((video::S3DVertex2TCoords&)(*Vertices)[n]);
|
||||
break;
|
||||
}
|
||||
case video::EVT_TANGENTS:
|
||||
{
|
||||
for(u32 n=0;n<Vertices->size();++n)
|
||||
NewVertices->push_back((video::S3DVertexTangents&)(*Vertices)[n]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
delete Vertices;
|
||||
}
|
||||
@ -131,6 +175,7 @@ namespace scene
|
||||
}
|
||||
|
||||
virtual void* getData() IRR_OVERRIDE {return Vertices->pointer();}
|
||||
virtual const void* getData() const IRR_OVERRIDE {return Vertices->const_pointer();}
|
||||
|
||||
virtual video::E_VERTEX_TYPE getType() const IRR_OVERRIDE {return Vertices->getType();}
|
||||
|
||||
@ -146,6 +191,36 @@ namespace scene
|
||||
Vertices->push_back(element);
|
||||
}
|
||||
|
||||
virtual void push_back(const video::S3DVertex2TCoords &element) IRR_OVERRIDE
|
||||
{
|
||||
Vertices->push_back(element);
|
||||
}
|
||||
|
||||
virtual void push_back(const video::S3DVertexTangents &element) IRR_OVERRIDE
|
||||
{
|
||||
Vertices->push_back(element);
|
||||
}
|
||||
|
||||
virtual void setValue(u32 index, const video::S3DVertex &value) IRR_OVERRIDE
|
||||
{
|
||||
Vertices->setValue(index, value);
|
||||
}
|
||||
|
||||
virtual void setValue(u32 index, const video::S3DVertex2TCoords &value) IRR_OVERRIDE
|
||||
{
|
||||
Vertices->setValue(index, value);
|
||||
}
|
||||
|
||||
virtual void setValue(u32 index, const video::S3DVertexTangents &value) IRR_OVERRIDE
|
||||
{
|
||||
Vertices->setValue(index, value);
|
||||
}
|
||||
|
||||
virtual video::S3DVertex& operator [](u32 index) IRR_OVERRIDE
|
||||
{
|
||||
return (*Vertices)[index];
|
||||
}
|
||||
|
||||
virtual video::S3DVertex& operator [](const u32 index) const IRR_OVERRIDE
|
||||
{
|
||||
return (*Vertices)[index];
|
||||
@ -161,9 +236,9 @@ namespace scene
|
||||
Vertices->set_used(usedNow);
|
||||
}
|
||||
|
||||
virtual void reallocate(u32 new_size) IRR_OVERRIDE
|
||||
virtual void reallocate(u32 new_size, bool canShrink=true) IRR_OVERRIDE
|
||||
{
|
||||
Vertices->reallocate(new_size);
|
||||
Vertices->reallocate(new_size, canShrink);
|
||||
}
|
||||
|
||||
virtual u32 allocated_size() const IRR_OVERRIDE
|
||||
@ -171,11 +246,6 @@ namespace scene
|
||||
return Vertices->allocated_size();
|
||||
}
|
||||
|
||||
virtual video::S3DVertex* pointer() IRR_OVERRIDE
|
||||
{
|
||||
return Vertices->pointer();
|
||||
}
|
||||
|
||||
//! get the current hardware mapping hint
|
||||
virtual E_HARDWARE_MAPPING getHardwareMappingHint() const IRR_OVERRIDE
|
||||
{
|
||||
|
@ -151,17 +151,6 @@ namespace scene
|
||||
/** Basically its an alternate way to describe a transformation. */
|
||||
struct SMD3QuaternionTag
|
||||
{
|
||||
virtual ~SMD3QuaternionTag()
|
||||
{
|
||||
position.X = 0.f;
|
||||
}
|
||||
|
||||
// construct copy constructor
|
||||
SMD3QuaternionTag( const SMD3QuaternionTag & copyMe )
|
||||
{
|
||||
*this = copyMe;
|
||||
}
|
||||
|
||||
// construct for searching
|
||||
SMD3QuaternionTag( const core::stringc& name )
|
||||
: Name ( name ) {}
|
||||
@ -181,14 +170,6 @@ namespace scene
|
||||
return Name == other.Name;
|
||||
}
|
||||
|
||||
SMD3QuaternionTag & operator=( const SMD3QuaternionTag & copyMe )
|
||||
{
|
||||
Name = copyMe.Name;
|
||||
position = copyMe.position;
|
||||
rotation = copyMe.rotation;
|
||||
return *this;
|
||||
}
|
||||
|
||||
core::stringc Name;
|
||||
core::vector3df position;
|
||||
core::quaternion rotation;
|
||||
@ -202,14 +183,6 @@ namespace scene
|
||||
Container.setAllocStrategy(core::ALLOC_STRATEGY_SAFE);
|
||||
}
|
||||
|
||||
// construct copy constructor
|
||||
SMD3QuaternionTagList(const SMD3QuaternionTagList& copyMe)
|
||||
{
|
||||
*this = copyMe;
|
||||
}
|
||||
|
||||
virtual ~SMD3QuaternionTagList() {}
|
||||
|
||||
SMD3QuaternionTag* get(const core::stringc& name)
|
||||
{
|
||||
SMD3QuaternionTag search ( name );
|
||||
@ -250,12 +223,6 @@ namespace scene
|
||||
Container.push_back(other);
|
||||
}
|
||||
|
||||
SMD3QuaternionTagList& operator = (const SMD3QuaternionTagList & copyMe)
|
||||
{
|
||||
Container = copyMe.Container;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
core::array < SMD3QuaternionTag > Container;
|
||||
};
|
||||
|
@ -24,46 +24,13 @@ namespace scene
|
||||
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() IRR_OVERRIDE =0;
|
||||
|
||||
//! Get the material of this meshbuffer
|
||||
/** \return Material of this buffer. */
|
||||
virtual const video::SMaterial& getMaterial() const IRR_OVERRIDE =0;
|
||||
// ------------------- Old interface ------------------- //
|
||||
// That stuff could also be in CDynamicMeshBuffer
|
||||
// I suppose it was put here to show that the information
|
||||
// is now basically handled by the vertex/index buffers instead
|
||||
// of the meshbuffer itself.
|
||||
|
||||
//! Get the axis aligned bounding box of this meshbuffer.
|
||||
/** \return Axis aligned bounding box of this buffer. */
|
||||
virtual const core::aabbox3df& getBoundingBox() const IRR_OVERRIDE =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) IRR_OVERRIDE =0;
|
||||
|
||||
//! Recalculates the bounding box. Should be called if the mesh changed.
|
||||
virtual void recalculateBoundingBox() IRR_OVERRIDE =0;
|
||||
|
||||
//! Append the vertices and indices to the current buffer
|
||||
/** Only works for compatible vertex types.
|
||||
\param vertices Pointer to a vertex array.
|
||||
\param numVertices Number of vertices in the array.
|
||||
\param indices Pointer to index array.
|
||||
\param numIndices Number of indices in array. */
|
||||
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) IRR_OVERRIDE
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//! Append the meshbuffer to the current buffer
|
||||
/** Only works for compatible vertex types
|
||||
\param other Buffer to append to this one. */
|
||||
virtual void append(const IMeshBuffer* const other) IRR_OVERRIDE
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// ------------------- To be removed? ------------------- //
|
||||
|
||||
//! get the current hardware mapping hint
|
||||
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const IRR_OVERRIDE
|
||||
@ -105,7 +72,6 @@ namespace scene
|
||||
return getIndexBuffer().getChangedID();
|
||||
}
|
||||
|
||||
// ------------------- Old interface ------------------- //
|
||||
|
||||
//! Get type of vertex data which is stored in this meshbuffer.
|
||||
/** \return Vertex type of this buffer. */
|
||||
|
@ -20,23 +20,43 @@ namespace scene
|
||||
{
|
||||
public:
|
||||
|
||||
//! Pointer to first element
|
||||
virtual void* getData() =0;
|
||||
|
||||
//! Const pointer to first element
|
||||
virtual const void* getData() const =0;
|
||||
|
||||
//! Same as getData(), just closer to core::array interface
|
||||
void* pointer() { return getData(); }
|
||||
|
||||
virtual video::E_INDEX_TYPE getType() const =0;
|
||||
|
||||
//! Change between 16 and 32 bit indices.
|
||||
/** This copies all indices to a new buffer of corresponding type.
|
||||
Be careful - going from 32 to 16 bit will only work correctly
|
||||
if none of your indices is larger than 16 bit. */
|
||||
virtual void setType(video::E_INDEX_TYPE IndexType) =0;
|
||||
|
||||
//! Number of bytes per element
|
||||
virtual u32 stride() const =0;
|
||||
|
||||
//! Number of elements
|
||||
virtual u32 size() const =0;
|
||||
virtual void push_back (const u32 &element) =0;
|
||||
|
||||
//! Add value to end. Note that for 16 bit index types values shouldn't be larger than u16
|
||||
virtual void push_back(u32 value) =0;
|
||||
|
||||
//! Set value at index. Note that for 16 bit index types values shouldn't be larger than u16
|
||||
/** Buffer must be already large enough. This is basically the non const version of operator [] */
|
||||
virtual void setValue(u32 index, u32 value) =0;
|
||||
|
||||
//! Access element value at given index
|
||||
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* pointer() =0;
|
||||
virtual void set_used(u32 usedNow) =0;
|
||||
virtual void reallocate(u32 new_size, bool canShrink=true) =0;
|
||||
virtual u32 allocated_size() const=0;
|
||||
|
||||
//! get the current hardware mapping hint
|
||||
virtual E_HARDWARE_MAPPING getHardwareMappingHint() const =0;
|
||||
|
@ -120,14 +120,16 @@ namespace scene
|
||||
virtual core::vector2df& getTCoords(u32 i) = 0;
|
||||
|
||||
//! Append the vertices and indices to the current buffer
|
||||
/** Only works for compatible vertex types.
|
||||
/** Only works for compatible vertex types
|
||||
and not implemented for most buffers for now.
|
||||
\param vertices Pointer to a vertex array.
|
||||
\param numVertices Number of vertices in the array.
|
||||
\param indices Pointer to index array.
|
||||
\param numIndices Number of indices in array. */
|
||||
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) = 0;
|
||||
|
||||
//! Append the meshbuffer to the current buffer
|
||||
//! Not supported right now by any meshbuffer
|
||||
//! In theory: Append the meshbuffer to the current buffer
|
||||
/** Only works for compatible vertex types
|
||||
\param other Buffer to append to this one. */
|
||||
virtual void append(const IMeshBuffer* const other) = 0;
|
||||
|
@ -30,7 +30,7 @@ class IMeshLoader : public virtual IReferenceCounted
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
IMeshLoader() : TextureLoader(0), PreferredIndexType(video::EIT_16BIT) {}
|
||||
IMeshLoader() : TextureLoader(0), IndexTypeHint(EITH_OPTIMAL) {}
|
||||
|
||||
//! Destructor
|
||||
virtual ~IMeshLoader()
|
||||
@ -79,30 +79,47 @@ public:
|
||||
return TextureLoader;
|
||||
}
|
||||
|
||||
enum E_INDEX_TYPE_HINT
|
||||
{
|
||||
//! Prefer to use 16-bit index buffers even if it breaks the mesh
|
||||
//! The default (and only option) before Irrlicht 1.9
|
||||
EITH_16BIT,
|
||||
|
||||
//! Allow using 32-bit index buffers
|
||||
EITH_32BIT,
|
||||
|
||||
//! Allow 32-bit, but copy back to 16-bit when 32 is not needed.
|
||||
//! So tiny overhead (sometimes extra allocation+copying) on loading,
|
||||
//! but meshes are later more optimal.
|
||||
//! Default since Irrlicht 1.9
|
||||
EITH_OPTIMAL
|
||||
};
|
||||
|
||||
|
||||
//! Give loader a hint if you would prefer 16 or 32 bit meshbuffers.
|
||||
/**
|
||||
Generally Irrlicht works with 16-bit meshbuffers so far.
|
||||
Rendering 32-bit meshbuffers works, other functions like
|
||||
Before Irrlicht 1.9 Irrlicht worked mostly with 16-bit meshbuffers.
|
||||
Rendering 32-bit meshbuffers works, but some functions like
|
||||
mesh-writing and mesh manipulation might not work yet.
|
||||
NOTE: Most loaders will ignore this hint so far, but hopefully
|
||||
will care about it in the future.
|
||||
*/
|
||||
void setPreferredIndexType(irr::video::E_INDEX_TYPE typeHint)
|
||||
void setIndexTypeHint(E_INDEX_TYPE_HINT typeHint)
|
||||
{
|
||||
PreferredIndexType = typeHint;
|
||||
IndexTypeHint = typeHint;
|
||||
}
|
||||
|
||||
//! Return current preference user has for the index-size of meshbuffers
|
||||
//! Return current preference user has for the index type of meshbuffers
|
||||
/** Note that this is _not_ necessarily the type used by the meshloader */
|
||||
irr::video::E_INDEX_TYPE getPreferredIndexType() const
|
||||
E_INDEX_TYPE_HINT getIndexTypeHint() const
|
||||
{
|
||||
return PreferredIndexType;
|
||||
return IndexTypeHint;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
IMeshTextureLoader* TextureLoader;
|
||||
irr::video::E_INDEX_TYPE PreferredIndexType;
|
||||
E_INDEX_TYPE_HINT IndexTypeHint;
|
||||
};
|
||||
|
||||
|
||||
|
@ -637,8 +637,6 @@ namespace quake3
|
||||
{
|
||||
IShader ()
|
||||
: ID ( 0 ), VarGroup ( 0 ) {}
|
||||
virtual ~IShader () {}
|
||||
|
||||
|
||||
bool operator == (const IShader &other ) const
|
||||
{
|
||||
|
@ -21,6 +21,12 @@ namespace scene
|
||||
//! Pointer to first element of vertex data
|
||||
virtual void* getData() =0;
|
||||
|
||||
//! Const pointer to first element
|
||||
virtual const void* getData() const =0;
|
||||
|
||||
//! Same as getData.
|
||||
virtual void* pointer() { return getData(); }
|
||||
|
||||
virtual video::E_VERTEX_TYPE getType() const =0;
|
||||
virtual void setType(video::E_VERTEX_TYPE vertexType) =0;
|
||||
|
||||
@ -30,16 +36,28 @@ namespace scene
|
||||
//! Number of elements
|
||||
virtual u32 size() const =0;
|
||||
|
||||
//! Add vertex to end. Note that depending on vertex type this will be one of the types derived from video::S3DVertex.
|
||||
//! Add vertex to end.
|
||||
//* Note that if you pass another type than the currently used vertex type then information can be lost */
|
||||
virtual void push_back(const video::S3DVertex &element) =0;
|
||||
virtual void push_back(const video::S3DVertex2TCoords &element) =0;
|
||||
virtual void push_back(const video::S3DVertexTangents &element) =0;
|
||||
|
||||
//! Set value at index. Buffer must be already large enough that element exists.
|
||||
//* Note that if you pass another type than the currently used vertex type then information can be lost */
|
||||
virtual void setValue(u32 index, const video::S3DVertex &value) =0;
|
||||
virtual void setValue(u32 index, const video::S3DVertex2TCoords &value) =0;
|
||||
virtual void setValue(u32 index, const video::S3DVertexTangents &value) =0;
|
||||
|
||||
//! Direct access to elements. Risky to use!
|
||||
/** The reference _must_ be cast to the correct type before use. It's only video::S3DVertex if getType is EVT_STANDARD.
|
||||
otherwise cast it first to a reference type derived from S3DVertex like S3DVertex2TCoords& or S3DVertexTangents&. */
|
||||
virtual video::S3DVertex& operator [](u32 index) = 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;
|
||||
|
||||
//! Same as getData() - not sure why we got 2, should probably deprecate (and we don't always have video::S3DVertex*, so just confusing)
|
||||
virtual video::S3DVertex* pointer() =0;
|
||||
virtual void set_used(u32 usedNow) =0;
|
||||
virtual void reallocate(u32 new_size, bool canShrink=true) =0;
|
||||
virtual u32 allocated_size() const =0;
|
||||
|
||||
//! get the current hardware mapping hint
|
||||
virtual E_HARDWARE_MAPPING getHardwareMappingHint() const =0;
|
||||
|
@ -44,7 +44,7 @@ const char* const sBuiltInVertexTypeNames[] =
|
||||
struct S3DVertex
|
||||
{
|
||||
//! default constructor
|
||||
S3DVertex() {}
|
||||
S3DVertex() : Color(0xffffffff) {}
|
||||
|
||||
//! constructor
|
||||
S3DVertex(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor c, f32 tu, f32 tv)
|
||||
@ -142,7 +142,7 @@ struct S3DVertex2TCoords : public S3DVertex
|
||||
: S3DVertex(pos, normal, color, tcoords), TCoords2(tcoords) {}
|
||||
|
||||
//! constructor from S3DVertex
|
||||
S3DVertex2TCoords(S3DVertex& o) : S3DVertex(o) {}
|
||||
S3DVertex2TCoords(const S3DVertex& o) : S3DVertex(o) {}
|
||||
|
||||
//! Second set of texture coordinates
|
||||
core::vector2d<f32> TCoords2;
|
||||
@ -214,6 +214,9 @@ struct S3DVertexTangents : public S3DVertex
|
||||
const core::vector3df& binormal=core::vector3df())
|
||||
: S3DVertex(pos, normal, c, tcoords), Tangent(tangent), Binormal(binormal) { }
|
||||
|
||||
//! constructor from S3DVertex
|
||||
S3DVertexTangents(const S3DVertex& o) : S3DVertex(o) {}
|
||||
|
||||
//! Tangent vector along the x-axis of the texture
|
||||
core::vector3df Tangent;
|
||||
|
||||
|
@ -289,9 +289,8 @@ namespace video
|
||||
|
||||
We (mostly) avoid dynamic memory in SMaterial, so the extra memory
|
||||
will still be allocated. But by lowering MATERIAL_MAX_TEXTURES_USED the
|
||||
material comparisons and assignments can be faster. Also several other
|
||||
places in the engine can be faster when reducing this value to the limit
|
||||
you need.
|
||||
material comparisons can be faster. Also several other places in the
|
||||
engine can be faster when reducing this value to the limit you need.
|
||||
|
||||
NOTE: This should only be changed once and before any call to createDevice.
|
||||
NOTE: Do not set it below 1 or above the value of _IRR_MATERIAL_MAX_TEXTURES_.
|
||||
@ -318,63 +317,6 @@ namespace video
|
||||
FogEnable(false), NormalizeNormals(false), UseMipMaps(true)
|
||||
{ }
|
||||
|
||||
//! Copy constructor
|
||||
/** \param other Material to copy from. */
|
||||
SMaterial(const SMaterial& other)
|
||||
{
|
||||
// These pointers are checked during assignment
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
|
||||
TextureLayer[i].TextureMatrix = 0;
|
||||
*this = other;
|
||||
}
|
||||
|
||||
//! Assignment operator
|
||||
/** \param other Material to copy from. */
|
||||
SMaterial& operator=(const SMaterial& other)
|
||||
{
|
||||
// Check for self-assignment!
|
||||
if (this == &other)
|
||||
return *this;
|
||||
|
||||
MaterialType = other.MaterialType;
|
||||
|
||||
AmbientColor = other.AmbientColor;
|
||||
DiffuseColor = other.DiffuseColor;
|
||||
EmissiveColor = other.EmissiveColor;
|
||||
SpecularColor = other.SpecularColor;
|
||||
Shininess = other.Shininess;
|
||||
MaterialTypeParam = other.MaterialTypeParam;
|
||||
MaterialTypeParam2 = other.MaterialTypeParam2;
|
||||
Thickness = other.Thickness;
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
|
||||
{
|
||||
TextureLayer[i] = other.TextureLayer[i];
|
||||
}
|
||||
|
||||
Wireframe = other.Wireframe;
|
||||
PointCloud = other.PointCloud;
|
||||
GouraudShading = other.GouraudShading;
|
||||
Lighting = other.Lighting;
|
||||
ZWriteEnable = other.ZWriteEnable;
|
||||
BackfaceCulling = other.BackfaceCulling;
|
||||
FrontfaceCulling = other.FrontfaceCulling;
|
||||
FogEnable = other.FogEnable;
|
||||
NormalizeNormals = other.NormalizeNormals;
|
||||
ZBuffer = other.ZBuffer;
|
||||
AntiAliasing = other.AntiAliasing;
|
||||
ColorMask = other.ColorMask;
|
||||
ColorMaterial = other.ColorMaterial;
|
||||
BlendOperation = other.BlendOperation;
|
||||
BlendFactor = other.BlendFactor;
|
||||
PolygonOffsetFactor = other.PolygonOffsetFactor;
|
||||
PolygonOffsetDirection = other.PolygonOffsetDirection;
|
||||
PolygonOffsetDepthBias = other.PolygonOffsetDepthBias;
|
||||
PolygonOffsetSlopeScale = other.PolygonOffsetSlopeScale;
|
||||
UseMipMaps = other.UseMipMaps;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Texture layer array.
|
||||
SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES];
|
||||
|
||||
|
@ -140,9 +140,6 @@ class map
|
||||
reset();
|
||||
}
|
||||
|
||||
// Copy constructor
|
||||
Iterator(const Iterator& src) : Root(src.Root), Cur(src.Cur) {}
|
||||
|
||||
void reset(bool atLowest=true)
|
||||
{
|
||||
if (atLowest)
|
||||
@ -161,13 +158,6 @@ class map
|
||||
return Cur;
|
||||
}
|
||||
|
||||
Iterator& operator=(const Iterator& src)
|
||||
{
|
||||
Root = src.Root;
|
||||
Cur = src.Cur;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
void operator++(int)
|
||||
{
|
||||
inc();
|
||||
@ -287,8 +277,7 @@ class map
|
||||
reset();
|
||||
}
|
||||
|
||||
// Copy constructor
|
||||
ConstIterator(const ConstIterator& src) : Root(src.Root), Cur(src.Cur) {}
|
||||
// Constructor(Iterator)
|
||||
ConstIterator(const Iterator& src) : Root(src.Root), Cur(src.Cur) {}
|
||||
|
||||
void reset(bool atLowest=true)
|
||||
@ -309,13 +298,6 @@ class map
|
||||
return Cur;
|
||||
}
|
||||
|
||||
ConstIterator& operator=(const ConstIterator& src)
|
||||
{
|
||||
Root = src.Root;
|
||||
Cur = src.Cur;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
void operator++(int)
|
||||
{
|
||||
inc();
|
||||
|
@ -27,8 +27,6 @@ public:
|
||||
vector2d(T nx, T ny) : X(nx), Y(ny) {}
|
||||
//! Constructor with the same value for both members
|
||||
explicit vector2d(T n) : X(n), Y(n) {}
|
||||
//! Copy constructor
|
||||
vector2d(const vector2d<T>& other) : X(other.X), Y(other.Y) {}
|
||||
|
||||
vector2d(const dimension2d<T>& other) : X(other.Width), Y(other.Height) {}
|
||||
|
||||
@ -36,8 +34,6 @@ public:
|
||||
|
||||
vector2d<T> operator-() const { return vector2d<T>(-X, -Y); }
|
||||
|
||||
vector2d<T>& operator=(const vector2d<T>& other) { X = other.X; Y = other.Y; return *this; }
|
||||
|
||||
vector2d<T>& operator=(const dimension2d<T>& other) { X = other.Width; Y = other.Height; return *this; }
|
||||
|
||||
vector2d<T> operator+(const vector2d<T>& other) const { return vector2d<T>(X + other.X, Y + other.Y); }
|
||||
|
@ -28,15 +28,11 @@ namespace core
|
||||
vector3d(T nx, T ny, T nz) : X(nx), Y(ny), Z(nz) {}
|
||||
//! Constructor with the same value for all elements
|
||||
explicit vector3d(T n) : X(n), Y(n), Z(n) {}
|
||||
//! Copy constructor
|
||||
vector3d(const vector3d<T>& other) : X(other.X), Y(other.Y), Z(other.Z) {}
|
||||
|
||||
// operators
|
||||
|
||||
vector3d<T> operator-() const { return vector3d<T>(-X, -Y, -Z); }
|
||||
|
||||
vector3d<T>& operator=(const vector3d<T>& other) { X = other.X; Y = other.Y; Z = other.Z; return *this; }
|
||||
|
||||
vector3d<T> operator+(const vector3d<T>& other) const { return vector3d<T>(X + other.X, Y + other.Y, Z + other.Z); }
|
||||
vector3d<T>& operator+=(const vector3d<T>& other) { X+=other.X; Y+=other.Y; Z+=other.Z; return *this; }
|
||||
vector3d<T> operator+(const T val) const { return vector3d<T>(X + val, Y + val, Z + val); }
|
||||
|
Reference in New Issue
Block a user