Renamed AttributeUsage and AttributeType
... to VertexComponent and ComponentType. -Renderer: Renamed IsVertexAttributeSupported static method to IsComponentTypeSupported -VertexDeclaration: Added IsTypeSupported static method Renamed [Disable|Enable|Get]Attribute to [Disable|Enable|Get]Component Removed GetAttributeSize static method -VertexMapper: Renamed GetAttributePtr method to GetComponentPtr Former-commit-id: 7115856e1d389610c35b26f63af5d93a5ad5c690
This commit is contained in:
@@ -15,54 +15,6 @@ enum nzAnimationType
|
||||
nzAnimationType_Max = nzAnimationType_Static
|
||||
};
|
||||
|
||||
enum nzAttributeType
|
||||
{
|
||||
nzAttributeType_Color,
|
||||
nzAttributeType_Double1,
|
||||
nzAttributeType_Double2,
|
||||
nzAttributeType_Double3,
|
||||
nzAttributeType_Double4,
|
||||
nzAttributeType_Float1,
|
||||
nzAttributeType_Float2,
|
||||
nzAttributeType_Float3,
|
||||
nzAttributeType_Float4,
|
||||
nzAttributeType_Int1,
|
||||
nzAttributeType_Int2,
|
||||
nzAttributeType_Int3,
|
||||
nzAttributeType_Int4,
|
||||
|
||||
nzAttributeType_Max = nzAttributeType_Int4
|
||||
};
|
||||
|
||||
enum nzAttributeUsage
|
||||
{
|
||||
nzAttributeUsage_Unused = -1,
|
||||
|
||||
nzAttributeUsage_InstanceData0,
|
||||
nzAttributeUsage_InstanceData1,
|
||||
nzAttributeUsage_InstanceData2,
|
||||
nzAttributeUsage_InstanceData3,
|
||||
nzAttributeUsage_InstanceData4,
|
||||
nzAttributeUsage_InstanceData5,
|
||||
nzAttributeUsage_Normal,
|
||||
nzAttributeUsage_Position,
|
||||
nzAttributeUsage_Tangent,
|
||||
nzAttributeUsage_TexCoord,
|
||||
nzAttributeUsage_Userdata0,
|
||||
nzAttributeUsage_Userdata1,
|
||||
nzAttributeUsage_Userdata2,
|
||||
nzAttributeUsage_Userdata3,
|
||||
nzAttributeUsage_Userdata4,
|
||||
nzAttributeUsage_Userdata5,
|
||||
|
||||
nzAttributeUsage_FirstInstanceData = nzAttributeUsage_InstanceData0,
|
||||
nzAttributeUsage_FirstVertexData = nzAttributeUsage_Normal,
|
||||
nzAttributeUsage_LastInstanceData = nzAttributeUsage_InstanceData5,
|
||||
nzAttributeUsage_LastVertexData = nzAttributeUsage_Userdata5,
|
||||
|
||||
nzAttributeUsage_Max = nzAttributeUsage_Userdata5
|
||||
};
|
||||
|
||||
enum nzBufferAccess
|
||||
{
|
||||
nzBufferAccess_DiscardAndWrite,
|
||||
@@ -98,6 +50,25 @@ enum nzBufferUsage
|
||||
nzBufferUsage_Max = nzBufferUsage_Static
|
||||
};
|
||||
|
||||
enum nzComponentType
|
||||
{
|
||||
nzComponentType_Color,
|
||||
nzComponentType_Double1,
|
||||
nzComponentType_Double2,
|
||||
nzComponentType_Double3,
|
||||
nzComponentType_Double4,
|
||||
nzComponentType_Float1,
|
||||
nzComponentType_Float2,
|
||||
nzComponentType_Float3,
|
||||
nzComponentType_Float4,
|
||||
nzComponentType_Int1,
|
||||
nzComponentType_Int2,
|
||||
nzComponentType_Int3,
|
||||
nzComponentType_Int4,
|
||||
|
||||
nzComponentType_Max = nzComponentType_Int4
|
||||
};
|
||||
|
||||
enum nzCubemapFace
|
||||
{
|
||||
// Cette énumération est prévue pour remplacer l'argument "z" des méthodes de NzImage contenant un cubemap
|
||||
@@ -245,6 +216,35 @@ enum nzPrimitiveMode
|
||||
nzPrimitiveMode_Max = nzPrimitiveMode_TriangleFan
|
||||
};
|
||||
|
||||
enum nzVertexComponent
|
||||
{
|
||||
nzVertexComponent_Unused = -1,
|
||||
|
||||
nzVertexComponent_InstanceData0,
|
||||
nzVertexComponent_InstanceData1,
|
||||
nzVertexComponent_InstanceData2,
|
||||
nzVertexComponent_InstanceData3,
|
||||
nzVertexComponent_InstanceData4,
|
||||
nzVertexComponent_InstanceData5,
|
||||
nzVertexComponent_Normal,
|
||||
nzVertexComponent_Position,
|
||||
nzVertexComponent_Tangent,
|
||||
nzVertexComponent_TexCoord,
|
||||
nzVertexComponent_Userdata0,
|
||||
nzVertexComponent_Userdata1,
|
||||
nzVertexComponent_Userdata2,
|
||||
nzVertexComponent_Userdata3,
|
||||
nzVertexComponent_Userdata4,
|
||||
nzVertexComponent_Userdata5,
|
||||
|
||||
nzVertexComponent_FirstInstanceData = nzVertexComponent_InstanceData0,
|
||||
nzVertexComponent_FirstVertexData = nzVertexComponent_Normal,
|
||||
nzVertexComponent_LastInstanceData = nzVertexComponent_InstanceData5,
|
||||
nzVertexComponent_LastVertexData = nzVertexComponent_Userdata5,
|
||||
|
||||
nzVertexComponent_Max = nzVertexComponent_Userdata5
|
||||
};
|
||||
|
||||
enum nzVertexLayout
|
||||
{
|
||||
// Déclarations destinées au rendu
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Initializer.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
|
||||
class NAZARA_API NzUtility
|
||||
{
|
||||
@@ -22,6 +23,9 @@ class NAZARA_API NzUtility
|
||||
|
||||
static void Uninitialize();
|
||||
|
||||
static unsigned int ComponentCount[nzComponentType_Max+1];
|
||||
static std::size_t ComponentStride[nzComponentType_Max+1];
|
||||
|
||||
private:
|
||||
static unsigned int s_moduleReferenceCounter;
|
||||
};
|
||||
|
||||
@@ -28,10 +28,10 @@ class NAZARA_API NzVertexDeclaration : public NzResource
|
||||
NzVertexDeclaration(NzVertexDeclaration& declaration);
|
||||
~NzVertexDeclaration();
|
||||
|
||||
void DisableAttribute(nzAttributeUsage usage);
|
||||
void EnableAttribute(nzAttributeUsage usage, nzAttributeType type, unsigned int offset);
|
||||
void DisableComponent(nzVertexComponent component);
|
||||
void EnableComponent(nzVertexComponent component, nzComponentType type, unsigned int offset);
|
||||
|
||||
void GetAttribute(nzAttributeUsage usage, bool* enabled, nzAttributeType* type, unsigned int* offset) const;
|
||||
void GetComponent(nzVertexComponent component, bool* enabled, nzComponentType* type, unsigned int* offset) const;
|
||||
unsigned int GetStride() const;
|
||||
|
||||
void SetStride(unsigned int stride);
|
||||
@@ -39,15 +39,15 @@ class NAZARA_API NzVertexDeclaration : public NzResource
|
||||
NzVertexDeclaration& operator=(const NzVertexDeclaration& declaration);
|
||||
|
||||
static NzVertexDeclaration* Get(nzVertexLayout layout);
|
||||
static unsigned int GetAttributeSize(nzAttributeType type);
|
||||
static bool IsTypeSupported(nzComponentType type);
|
||||
|
||||
private:
|
||||
static bool Initialize();
|
||||
static void Uninitialize();
|
||||
|
||||
struct Attribute
|
||||
struct Component
|
||||
{
|
||||
nzAttributeType type;
|
||||
nzComponentType type;
|
||||
bool enabled = false;
|
||||
unsigned int offset;
|
||||
|
||||
@@ -60,7 +60,7 @@ class NAZARA_API NzVertexDeclaration : public NzResource
|
||||
*/
|
||||
};
|
||||
|
||||
Attribute m_attributes[nzAttributeUsage_Max+1];
|
||||
Component m_components[nzVertexComponent_Max+1];
|
||||
unsigned int m_stride;
|
||||
|
||||
static NzVertexDeclaration s_declarations[nzVertexLayout_Max+1];
|
||||
|
||||
@@ -24,7 +24,7 @@ class NAZARA_API NzVertexMapper
|
||||
NzVertexMapper(NzSubMesh* subMesh);
|
||||
~NzVertexMapper();
|
||||
|
||||
template<typename T> NzSparsePtr<T> GetAttributePtr(nzAttributeUsage attribute);
|
||||
template<typename T> NzSparsePtr<T> GetComponentPtr(nzVertexComponent component);
|
||||
unsigned int GetVertexCount() const;
|
||||
|
||||
void Unmap();
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
|
||||
template <typename T>
|
||||
NzSparsePtr<T> NzVertexMapper::GetAttributePtr(nzAttributeUsage attribute)
|
||||
NzSparsePtr<T> NzVertexMapper::GetComponentPtr(nzVertexComponent component)
|
||||
{
|
||||
bool enabled;
|
||||
nzAttributeType type;
|
||||
nzComponentType type;
|
||||
unsigned int offset;
|
||||
m_declaration->GetAttribute(attribute, &enabled, &type, &offset);
|
||||
m_declaration->GetComponent(component, &enabled, &type, &offset);
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
@@ -19,7 +19,7 @@ NzSparsePtr<T> NzVertexMapper::GetAttributePtr(nzAttributeUsage attribute)
|
||||
}
|
||||
else
|
||||
{
|
||||
NazaraError("Attribute 0x" + NzString::Number(attribute, 16) + " is not enabled");
|
||||
NazaraError("Attribute 0x" + NzString::Number(component, 16) + " is not enabled");
|
||||
return NzSparsePtr<T>();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user