prefer using int/uint instead of always using int32_t/uint32_t/etc
I believe this was originally based on an overreaction on my part from several years ago where I found some code I wrote did not work correctly on 64-bit systems because I wasn't taking into account different type sizes. Use of int32_t, uint32_t, int16_t, uint16_t, etc should only be used where the byte size of the variable is very important. For general number variable usage, this is less important. e.g. using int or uint for screen coordinates is fine. Using int16/uint16 for screen coordinates also works, but is maybe a bit overkill and more to type for little-to-no benefit.
This commit is contained in:
parent
863d01fce9
commit
ac3f30e3db
|
@ -25,7 +25,7 @@ public:
|
|||
SpriteFont* GetFont() const { return m_standardFont; }
|
||||
SpriteFont* GetUIFont() const { return m_uiFont; }
|
||||
const stl::string& GetUIFontFilename() const { return m_uiFontFilename; }
|
||||
uint8_t GetUIFontSize() const { return m_uiFontSize; }
|
||||
uint GetUIFontSize() const { return m_uiFontSize; }
|
||||
|
||||
private:
|
||||
ContentManager *m_contentManager;
|
||||
|
@ -36,7 +36,7 @@ private:
|
|||
SpriteFont *m_standardFont;
|
||||
SpriteFont *m_uiFont;
|
||||
stl::string m_uiFontFilename;
|
||||
uint8_t m_uiFontSize;
|
||||
uint m_uiFontSize;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -68,8 +68,8 @@ void RenderContext::OnResize()
|
|||
|
||||
void RenderContext::CalculateScreenScale()
|
||||
{
|
||||
uint16_t width = m_graphicsDevice->GetViewContext()->GetViewportWidth();
|
||||
uint16_t height = m_graphicsDevice->GetViewContext()->GetViewportHeight();
|
||||
uint width = m_graphicsDevice->GetViewContext()->GetViewportWidth();
|
||||
uint height = m_graphicsDevice->GetViewContext()->GetViewportHeight();
|
||||
|
||||
// TODO: these values may need adjusting
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
SkeletalMeshRenderer* GetSkeletalMeshRenderer() const { return m_skeletalMeshRenderer; }
|
||||
StaticMeshRenderer* GetStaticMeshRenderer() const { return m_staticMeshRenderer; }
|
||||
|
||||
uint32_t GetScreenScale() const { return m_screenScale; }
|
||||
uint GetScreenScale() const { return m_screenScale; }
|
||||
|
||||
private:
|
||||
void CalculateScreenScale();
|
||||
|
@ -45,7 +45,7 @@ private:
|
|||
SkeletalMeshRenderer *m_skeletalMeshRenderer;
|
||||
StaticMeshRenderer *m_staticMeshRenderer;
|
||||
|
||||
uint32_t m_screenScale;
|
||||
uint m_screenScale;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,8 +20,8 @@ DimEffect::~DimEffect()
|
|||
|
||||
void DimEffect::OnRender(RenderContext *renderContext)
|
||||
{
|
||||
uint16_t width = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportWidth();
|
||||
uint16_t height = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportHeight();
|
||||
uint width = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportWidth();
|
||||
uint height = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportHeight();
|
||||
|
||||
m_color.a = m_alpha;
|
||||
renderContext->GetSpriteBatch()->Render(
|
||||
|
|
|
@ -41,8 +41,8 @@ private:
|
|||
void Remove(EffectListItor itor);
|
||||
|
||||
EffectList m_effects;
|
||||
uint32_t m_numLocalEffects;
|
||||
uint32_t m_numGlobalEffects;
|
||||
uint m_numLocalEffects;
|
||||
uint m_numGlobalEffects;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
|
|
|
@ -25,8 +25,8 @@ FadeEffect::~FadeEffect()
|
|||
|
||||
void FadeEffect::OnRender(RenderContext *renderContext)
|
||||
{
|
||||
uint16_t width = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportWidth();
|
||||
uint16_t height = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportHeight();
|
||||
uint width = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportWidth();
|
||||
uint height = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportHeight();
|
||||
|
||||
m_color.a = m_alpha;
|
||||
renderContext->GetSpriteBatch()->Render(
|
||||
|
|
|
@ -25,8 +25,8 @@ FlashEffect::~FlashEffect()
|
|||
|
||||
void FlashEffect::OnRender(RenderContext *renderContext)
|
||||
{
|
||||
uint16_t width = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportWidth();
|
||||
uint16_t height = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportHeight();
|
||||
uint width = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportWidth();
|
||||
uint height = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportHeight();
|
||||
|
||||
m_color.a = m_alpha;
|
||||
renderContext->GetSpriteBatch()->Render(
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
void Remove(Entity *entity);
|
||||
void RemoveAll();
|
||||
BOOL IsValid(const Entity *entity) const;
|
||||
uint32_t GetNumEntities() const { return m_entities.size(); }
|
||||
uint GetNumEntities() const { return m_entities.size(); }
|
||||
|
||||
template<class T> T* AddComponent(Entity *entity);
|
||||
template<class T> T* GetComponent(const Entity *entity) const;
|
||||
|
|
|
@ -175,7 +175,7 @@ BOOL EventManager::ProcessQueue()
|
|||
EventListenerMap::const_iterator wildcardItor = m_registry.find(EVENT_TYPE_WILDCARD);
|
||||
|
||||
// swap active queues and empty the new queue
|
||||
int queueToProcess = m_activeQueue;
|
||||
uint queueToProcess = m_activeQueue;
|
||||
m_activeQueue = (m_activeQueue + 1) % NUM_EVENT_QUEUES;
|
||||
m_queues[m_activeQueue].clear();
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ private:
|
|||
EventTypeSet m_typeList;
|
||||
EventListenerMap m_registry;
|
||||
EventQueue m_queues[NUM_EVENT_QUEUES];
|
||||
int m_activeQueue;
|
||||
uint m_activeQueue;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "../../math/matrix4x4.h"
|
||||
#include <stl/string.h>
|
||||
|
||||
const int32_t NO_JOINT = -1;
|
||||
const int NO_JOINT = -1;
|
||||
|
||||
struct Joint
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ struct Joint
|
|||
|
||||
stl::string name;
|
||||
Joint *parent;
|
||||
int32_t parentIndex;
|
||||
int parentIndex;
|
||||
Matrix4x4 relative;
|
||||
Matrix4x4 absolute;
|
||||
JointKeyFrame *frames;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
struct JointVertexMapping
|
||||
{
|
||||
int32_t jointIndex;
|
||||
int jointIndex;
|
||||
float weight;
|
||||
};
|
||||
|
||||
|
|
|
@ -4,18 +4,18 @@
|
|||
|
||||
#include "../../math/vector3.h"
|
||||
|
||||
Keyframe::Keyframe(uint32_t numVertices)
|
||||
Keyframe::Keyframe(uint numVertices)
|
||||
{
|
||||
AllocateMemory(numVertices);
|
||||
}
|
||||
|
||||
Keyframe::Keyframe(const stl::string &name, uint32_t numVertices)
|
||||
Keyframe::Keyframe(const stl::string &name, uint numVertices)
|
||||
{
|
||||
m_name = name;
|
||||
AllocateMemory(numVertices);
|
||||
}
|
||||
|
||||
void Keyframe::AllocateMemory(uint32_t numVertices)
|
||||
void Keyframe::AllocateMemory(uint numVertices)
|
||||
{
|
||||
m_numVertices = numVertices;
|
||||
m_vertices = new Vector3[m_numVertices];
|
||||
|
|
|
@ -16,14 +16,14 @@ public:
|
|||
* Creates a new keyframe.
|
||||
* @param numVertices the number of vertices in this keyframe
|
||||
*/
|
||||
Keyframe(uint32_t numVertices);
|
||||
Keyframe(uint numVertices);
|
||||
|
||||
/**
|
||||
* Creates a new keyframe.
|
||||
* @param name the unique name for this keyframe
|
||||
* @param numVertices the number of vertices in this keyframe
|
||||
*/
|
||||
Keyframe(const stl::string &name, uint32_t numVertices);
|
||||
Keyframe(const stl::string &name, uint numVertices);
|
||||
|
||||
virtual ~Keyframe();
|
||||
|
||||
|
@ -35,7 +35,7 @@ public:
|
|||
/**
|
||||
* @return the number of vertices in this keyframe
|
||||
*/
|
||||
uint32_t GetNumVertices() const { return m_numVertices; }
|
||||
uint GetNumVertices() const { return m_numVertices; }
|
||||
|
||||
/**
|
||||
* @return pointer to the vertices in this keyframe
|
||||
|
@ -48,10 +48,10 @@ public:
|
|||
Vector3* GetNormals() { return m_normals; }
|
||||
|
||||
private:
|
||||
void AllocateMemory(uint32_t numVertices);
|
||||
void AllocateMemory(uint numVertices);
|
||||
|
||||
stl::string m_name;
|
||||
uint32_t m_numVertices;
|
||||
uint m_numVertices;
|
||||
Vector3 *m_vertices;
|
||||
Vector3 *m_normals;
|
||||
};
|
||||
|
|
|
@ -16,10 +16,10 @@ KeyframeMesh::KeyframeMesh(const KeyframeMeshFile *file)
|
|||
m_numFrames = file->GetNumFrames();
|
||||
m_frames = new Keyframe*[m_numFrames];
|
||||
ASSERT(m_frames != NULL);
|
||||
for (uint32_t i = 0; i < m_numFrames; ++i)
|
||||
for (uint i = 0; i < m_numFrames; ++i)
|
||||
{
|
||||
Keyframe *srcFrame = file->GetFrames()[i];
|
||||
uint32_t numVertices = srcFrame->GetNumVertices();
|
||||
uint numVertices = srcFrame->GetNumVertices();
|
||||
|
||||
Keyframe *frame = new Keyframe(srcFrame->GetName(), numVertices);
|
||||
ASSERT(frame != NULL);
|
||||
|
@ -66,7 +66,7 @@ KeyframeMesh::KeyframeMesh(const KeyframeMeshFile *file)
|
|||
|
||||
KeyframeMesh::~KeyframeMesh()
|
||||
{
|
||||
for (uint32_t i = 0; i < m_numFrames; ++i)
|
||||
for (uint i = 0; i < m_numFrames; ++i)
|
||||
SAFE_DELETE(m_frames[i]);
|
||||
SAFE_DELETE_ARRAY(m_frames);
|
||||
SAFE_DELETE_ARRAY(m_texCoords);
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
/**
|
||||
* @return the total number of keyframes contained in this mesh
|
||||
*/
|
||||
uint32_t GetNumFrames() const { return m_numFrames; }
|
||||
uint GetNumFrames() const { return m_numFrames; }
|
||||
|
||||
/**
|
||||
* @return pointer to the mesh's keyframes
|
||||
|
@ -43,7 +43,7 @@ public:
|
|||
/**
|
||||
* @return the total number of texture coordinates contained in this mesh
|
||||
*/
|
||||
uint32_t GetNumTexCoords() const { return m_numTexCoords; }
|
||||
uint GetNumTexCoords() const { return m_numTexCoords; }
|
||||
|
||||
/**
|
||||
* @return pointer to the mesh's texture coordinates
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
/**
|
||||
* @return the total number of triangles contained in this mesh
|
||||
*/
|
||||
uint32_t GetNumTriangles() const { return m_numTriangles; }
|
||||
uint GetNumTriangles() const { return m_numTriangles; }
|
||||
|
||||
/**
|
||||
* @return pointer to the mesh's triangles
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
/**
|
||||
* @return the number of vertices per keyframe in this mesh
|
||||
*/
|
||||
uint32_t GetNumVerticesPerFrame() const { return m_numVerticesPerFrame; }
|
||||
uint GetNumVerticesPerFrame() const { return m_numVerticesPerFrame; }
|
||||
|
||||
/**
|
||||
* Retrieves an animation sequence.
|
||||
|
@ -83,14 +83,14 @@ public:
|
|||
VertexBuffer* GetVertices() const { return m_vertices; }
|
||||
|
||||
private:
|
||||
uint32_t m_numFrames;
|
||||
uint m_numFrames;
|
||||
Keyframe **m_frames;
|
||||
uint32_t m_numTexCoords;
|
||||
uint m_numTexCoords;
|
||||
Vector2 *m_texCoords;
|
||||
uint32_t m_numTriangles;
|
||||
uint m_numTriangles;
|
||||
KeyframeMeshTriangle *m_triangles;
|
||||
AnimationList m_animations;
|
||||
uint32_t m_numVerticesPerFrame;
|
||||
uint m_numVerticesPerFrame;
|
||||
VertexBuffer *m_vertices;
|
||||
};
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ KeyframeMeshFile::KeyframeMeshFile(File *file)
|
|||
|
||||
KeyframeMeshFile::~KeyframeMeshFile()
|
||||
{
|
||||
for (uint32_t i = 0; i < m_numFrames; ++i)
|
||||
for (uint i = 0; i < m_numFrames; ++i)
|
||||
SAFE_DELETE(m_frames[i]);
|
||||
SAFE_DELETE_ARRAY(m_frames);
|
||||
SAFE_DELETE_ARRAY(m_texCoords);
|
||||
|
@ -48,10 +48,10 @@ void KeyframeMeshFile::Load()
|
|||
// keyframes
|
||||
file->Seek(keyframesDesc->start, FILESEEK_BEGINNING);
|
||||
m_numFrames = file->ReadInt();
|
||||
uint32_t numVertices = file->ReadInt();
|
||||
uint numVertices = file->ReadInt();
|
||||
m_frames = new Keyframe*[m_numFrames];
|
||||
ASSERT(m_frames != NULL);
|
||||
for (uint32_t i = 0; i < m_numFrames; ++i)
|
||||
for (uint i = 0; i < m_numFrames; ++i)
|
||||
{
|
||||
Keyframe *frame = new Keyframe(numVertices);
|
||||
ASSERT(frame != NULL);
|
||||
|
@ -59,7 +59,7 @@ void KeyframeMeshFile::Load()
|
|||
Vector3 *normals = frame->GetNormals();
|
||||
|
||||
// vertices
|
||||
for (uint32_t j = 0; j < numVertices; ++j)
|
||||
for (uint j = 0; j < numVertices; ++j)
|
||||
{
|
||||
vertices[j].x = file->ReadFloat();
|
||||
vertices[j].y = file->ReadFloat();
|
||||
|
@ -67,7 +67,7 @@ void KeyframeMeshFile::Load()
|
|||
}
|
||||
|
||||
// normals
|
||||
for (uint32_t j = 0; j < numVertices; ++j)
|
||||
for (uint j = 0; j < numVertices; ++j)
|
||||
{
|
||||
normals[j].x = file->ReadFloat();
|
||||
normals[j].y = file->ReadFloat();
|
||||
|
@ -82,7 +82,7 @@ void KeyframeMeshFile::Load()
|
|||
m_numTexCoords = file->ReadInt();
|
||||
m_texCoords = new Vector2[m_numTexCoords];
|
||||
ASSERT(m_texCoords != NULL);
|
||||
for (uint32_t i = 0; i < m_numTexCoords; ++i)
|
||||
for (uint i = 0; i < m_numTexCoords; ++i)
|
||||
{
|
||||
m_texCoords[i].x = file->ReadFloat();
|
||||
m_texCoords[i].y = file->ReadFloat();
|
||||
|
@ -93,7 +93,7 @@ void KeyframeMeshFile::Load()
|
|||
m_numTriangles = file->ReadInt();
|
||||
m_triangles = new KeyframeMeshTriangle[m_numTriangles];
|
||||
ASSERT(m_triangles != NULL);
|
||||
for (uint32_t i = 0; i < m_numTriangles; ++i)
|
||||
for (uint i = 0; i < m_numTriangles; ++i)
|
||||
{
|
||||
m_triangles[i].vertices[0] = file->ReadInt();
|
||||
m_triangles[i].vertices[1] = file->ReadInt();
|
||||
|
@ -111,8 +111,8 @@ void KeyframeMeshFile::Load()
|
|||
if (animationsDesc != NULL)
|
||||
{
|
||||
file->Seek(animationsDesc->start, FILESEEK_BEGINNING);
|
||||
uint32_t numAnimations = file->ReadInt();
|
||||
for (uint32_t i = 0; i < numAnimations; ++i)
|
||||
uint numAnimations = file->ReadInt();
|
||||
for (uint i = 0; i < numAnimations; ++i)
|
||||
{
|
||||
AnimationSequence sequence;
|
||||
stl::string name;
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
/**
|
||||
* @return the total number of keyframes this mesh contains
|
||||
*/
|
||||
uint32_t GetNumFrames() const { return m_numFrames; }
|
||||
uint GetNumFrames() const { return m_numFrames; }
|
||||
|
||||
/**
|
||||
* @return pointer to the mesh's keyframes
|
||||
|
@ -39,7 +39,7 @@ public:
|
|||
/**
|
||||
* @return the total number of texture coordinates this mesh contains
|
||||
*/
|
||||
uint32_t GetNumTexCoords() const { return m_numTexCoords; }
|
||||
uint GetNumTexCoords() const { return m_numTexCoords; }
|
||||
|
||||
/**
|
||||
* @return pointer to the mesh's texture coordinates
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
/**
|
||||
* @return the total number of triangles this mesh contains
|
||||
*/
|
||||
uint32_t GetNumTriangles() const { return m_numTriangles; }
|
||||
uint GetNumTriangles() const { return m_numTriangles; }
|
||||
|
||||
/**
|
||||
* @return pointer to the mesh's triangles
|
||||
|
@ -64,19 +64,19 @@ public:
|
|||
/**
|
||||
* @return the number of vertices each keyframe contains
|
||||
*/
|
||||
uint32_t GetNumVerticesPerFrame() const { return m_numVerticesPerFrame; }
|
||||
uint GetNumVerticesPerFrame() const { return m_numVerticesPerFrame; }
|
||||
|
||||
private:
|
||||
void Load();
|
||||
|
||||
uint32_t m_numFrames;
|
||||
uint m_numFrames;
|
||||
Keyframe **m_frames;
|
||||
uint32_t m_numTexCoords;
|
||||
uint m_numTexCoords;
|
||||
Vector2 *m_texCoords;
|
||||
uint32_t m_numTriangles;
|
||||
uint m_numTriangles;
|
||||
KeyframeMeshTriangle *m_triangles;
|
||||
AnimationList m_animations;
|
||||
uint32_t m_numVerticesPerFrame;
|
||||
uint m_numVerticesPerFrame;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -71,7 +71,7 @@ void KeyframeMeshInstance::OnUpdate(float delta)
|
|||
}
|
||||
}
|
||||
|
||||
void KeyframeMeshInstance::SetSequence(uint32_t startFrame, uint32_t endFrame, BOOL loop)
|
||||
void KeyframeMeshInstance::SetSequence(uint startFrame, uint endFrame, BOOL loop)
|
||||
{
|
||||
m_currentSequenceName.clear();
|
||||
m_currentSequenceStart = startFrame;
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
* @param loop TRUE to loop the sequence, FALSE to stop when done
|
||||
* and leave the current frame as the end frame
|
||||
*/
|
||||
void SetSequence(uint32_t startFrame, uint32_t endFrame, BOOL loop);
|
||||
void SetSequence(uint startFrame, uint endFrame, BOOL loop);
|
||||
|
||||
/**
|
||||
* Sets the current animation sequence.
|
||||
|
@ -57,12 +57,12 @@ public:
|
|||
/**
|
||||
* @return the current frame
|
||||
*/
|
||||
uint32_t GetCurrentFrame() const { return m_thisFrame; }
|
||||
uint GetCurrentFrame() const { return m_thisFrame; }
|
||||
|
||||
/**
|
||||
* @return the next frame
|
||||
*/
|
||||
uint32_t GetNextFrame() const { return m_nextFrame; }
|
||||
uint GetNextFrame() const { return m_nextFrame; }
|
||||
|
||||
/**
|
||||
* @return the current interpolation amount between the current frame
|
||||
|
@ -97,11 +97,11 @@ private:
|
|||
Texture *m_texture;
|
||||
RenderState *m_renderState;
|
||||
stl::string m_currentSequenceName;
|
||||
uint32_t m_currentSequenceStart;
|
||||
uint32_t m_currentSequenceEnd;
|
||||
uint m_currentSequenceStart;
|
||||
uint m_currentSequenceEnd;
|
||||
BOOL m_currentSequenceLoop;
|
||||
uint32_t m_thisFrame;
|
||||
uint32_t m_nextFrame;
|
||||
uint m_thisFrame;
|
||||
uint m_nextFrame;
|
||||
float m_interpolation;
|
||||
BOOL m_isRunningTempSequence;
|
||||
stl::string m_oldSequenceName;
|
||||
|
|
|
@ -28,14 +28,14 @@ void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshIn
|
|||
Render(graphicsDevice, instance->GetMesh(), instance->GetTexture(), instance->GetCurrentFrame(), instance->GetNextFrame(), instance->GetInterpolation(), shader);
|
||||
}
|
||||
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint32_t frame, VertexLerpShader *shader)
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint frame, VertexLerpShader *shader)
|
||||
{
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
instance->GetRenderState()->Apply();
|
||||
Render(graphicsDevice, instance->GetMesh(), instance->GetTexture(), frame, shader);
|
||||
}
|
||||
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint32_t startFrame, uint32_t endFrame, float interpolation, VertexLerpShader *shader)
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint startFrame, uint endFrame, float interpolation, VertexLerpShader *shader)
|
||||
{
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
instance->GetRenderState()->Apply();
|
||||
|
@ -48,7 +48,7 @@ void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *
|
|||
Render(graphicsDevice, mesh, texture, 0, shader);
|
||||
}
|
||||
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint32_t frame, VertexLerpShader *shader)
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint frame, VertexLerpShader *shader)
|
||||
{
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
SetFrameVertices(mesh, frame);
|
||||
|
@ -63,7 +63,7 @@ void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *
|
|||
graphicsDevice->UnbindVertexBuffer();
|
||||
}
|
||||
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint32_t startFrame, uint32_t endFrame, float interpolation, VertexLerpShader *shader)
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint startFrame, uint endFrame, float interpolation, VertexLerpShader *shader)
|
||||
{
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
SetFrameVertices(mesh, startFrame, endFrame);
|
||||
|
@ -78,14 +78,14 @@ void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *
|
|||
graphicsDevice->UnbindVertexBuffer();
|
||||
}
|
||||
|
||||
void KeyframeMeshRenderer::SetFrameVertices(KeyframeMesh *mesh, uint32_t frame)
|
||||
void KeyframeMeshRenderer::SetFrameVertices(KeyframeMesh *mesh, uint frame)
|
||||
{
|
||||
int pos;
|
||||
uint pos;
|
||||
Keyframe *keyframe = mesh->GetFrames()[frame];
|
||||
KeyframeMeshTriangle *triangle;
|
||||
VertexBuffer *vertices = mesh->GetVertices();
|
||||
|
||||
for (uint32_t i = 0; i < mesh->GetNumTriangles(); ++i)
|
||||
for (uint i = 0; i < mesh->GetNumTriangles(); ++i)
|
||||
{
|
||||
pos = i * 3;
|
||||
triangle = &mesh->GetTriangles()[i];
|
||||
|
@ -110,15 +110,15 @@ void KeyframeMeshRenderer::SetFrameVertices(KeyframeMesh *mesh, uint32_t frame)
|
|||
}
|
||||
}
|
||||
|
||||
void KeyframeMeshRenderer::SetFrameVertices(KeyframeMesh *mesh, uint32_t startFrame, uint32_t endFrame)
|
||||
void KeyframeMeshRenderer::SetFrameVertices(KeyframeMesh *mesh, uint startFrame, uint endFrame)
|
||||
{
|
||||
uint32_t pos;
|
||||
uint pos;
|
||||
Keyframe *frame1 = mesh->GetFrames()[startFrame];
|
||||
Keyframe *frame2 = mesh->GetFrames()[endFrame];
|
||||
KeyframeMeshTriangle *triangle;
|
||||
VertexBuffer *vertices = mesh->GetVertices();
|
||||
|
||||
for (uint32_t i = 0; i < mesh->GetNumTriangles(); ++i)
|
||||
for (uint i = 0; i < mesh->GetNumTriangles(); ++i)
|
||||
{
|
||||
pos = i * 3;
|
||||
triangle = &mesh->GetTriangles()[i];
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
* @param instance the keyframe mesh instance to render
|
||||
* @param frame render this frame instead of the instance's current frame
|
||||
*/
|
||||
void Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint32_t frame, VertexLerpShader *shader);
|
||||
void Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint frame, VertexLerpShader *shader);
|
||||
|
||||
/**
|
||||
* Renders an instance of a keyframe mesh.
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
* @param interpolation the amount to interpolate between the start frame
|
||||
* and end frame
|
||||
*/
|
||||
void Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint32_t startFrame, uint32_t endFrame, float interpolation, VertexLerpShader *shader);
|
||||
void Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint startFrame, uint endFrame, float interpolation, VertexLerpShader *shader);
|
||||
|
||||
/**
|
||||
* Renders a keyframe mesh using the first frame.
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
* @param texture the texture to render the mesh with, or NULL for no texture
|
||||
* @param frame the keyframe to render
|
||||
*/
|
||||
void Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint32_t frame, VertexLerpShader *shader);
|
||||
void Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint frame, VertexLerpShader *shader);
|
||||
|
||||
/**
|
||||
* Renders a keyframe mesh.
|
||||
|
@ -78,11 +78,11 @@ public:
|
|||
* @param interpolation the amount to interpolate by between the start
|
||||
* and end frame
|
||||
*/
|
||||
void Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint32_t startFrame, uint32_t endFrame, float interpolation, VertexLerpShader *shader);
|
||||
void Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint startFrame, uint endFrame, float interpolation, VertexLerpShader *shader);
|
||||
|
||||
private:
|
||||
void SetFrameVertices(KeyframeMesh *mesh, uint32_t frame);
|
||||
void SetFrameVertices(KeyframeMesh *mesh, uint32_t startFrame, uint32_t endFrame);
|
||||
void SetFrameVertices(KeyframeMesh *mesh, uint frame);
|
||||
void SetFrameVertices(KeyframeMesh *mesh, uint startFrame, uint endFrame);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
*/
|
||||
struct KeyframeMeshTriangle
|
||||
{
|
||||
uint32_t vertices[3];
|
||||
uint32_t textureCoords[3];
|
||||
uint vertices[3];
|
||||
uint textureCoords[3];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -38,12 +38,12 @@ SkeletalMesh::~SkeletalMesh()
|
|||
m_animations.clear();
|
||||
}
|
||||
|
||||
int32_t SkeletalMesh::GetIndexOfSubset(const stl::string &name) const
|
||||
int SkeletalMesh::GetIndexOfSubset(const stl::string &name) const
|
||||
{
|
||||
for (uint32_t i = 0; i < m_numSubsets; ++i)
|
||||
for (uint i = 0; i < m_numSubsets; ++i)
|
||||
{
|
||||
if (m_subsets[i].GetName() == name)
|
||||
return (int32_t)i;
|
||||
return (int)i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
@ -51,19 +51,19 @@ int32_t SkeletalMesh::GetIndexOfSubset(const stl::string &name) const
|
|||
|
||||
Joint* SkeletalMesh::GetJoint(const stl::string &name) const
|
||||
{
|
||||
int32_t jointIndex = GetIndexOfJoint(name);
|
||||
int jointIndex = GetIndexOfJoint(name);
|
||||
if (jointIndex == NO_JOINT)
|
||||
return NULL;
|
||||
else
|
||||
return &m_joints[jointIndex];
|
||||
}
|
||||
|
||||
int32_t SkeletalMesh::GetIndexOfJoint(const stl::string &name) const
|
||||
int SkeletalMesh::GetIndexOfJoint(const stl::string &name) const
|
||||
{
|
||||
for (uint32_t i = 0; i < m_numJoints; ++i)
|
||||
for (uint i = 0; i < m_numJoints; ++i)
|
||||
{
|
||||
if (m_joints[i].name == name)
|
||||
return (int32_t)i;
|
||||
return (int)i;
|
||||
}
|
||||
|
||||
return NO_JOINT;
|
||||
|
@ -89,18 +89,18 @@ void SkeletalMesh::FindAndSetRootJointIndex()
|
|||
return;
|
||||
}
|
||||
|
||||
uint32_t numJointsTried = 0;
|
||||
int32_t rootIndex = NO_JOINT;
|
||||
uint numJointsTried = 0;
|
||||
int rootIndex = NO_JOINT;
|
||||
while (numJointsTried < m_numJoints && rootIndex == NO_JOINT)
|
||||
{
|
||||
int32_t parentlessJoint = NO_JOINT;
|
||||
int parentlessJoint = NO_JOINT;
|
||||
|
||||
// try the next joint without any parents
|
||||
for (uint32_t i = numJointsTried; i < m_numJoints; ++i)
|
||||
for (uint i = numJointsTried; i < m_numJoints; ++i)
|
||||
{
|
||||
if (m_joints[i].parent == NULL)
|
||||
{
|
||||
parentlessJoint = (int32_t)i;
|
||||
parentlessJoint = (int)i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -114,9 +114,9 @@ void SkeletalMesh::FindAndSetRootJointIndex()
|
|||
|
||||
// ensure it has child joints
|
||||
BOOL hasChildJoints = FALSE;
|
||||
for (uint32_t i = 0; i < m_numJoints; ++i)
|
||||
for (uint i = 0; i < m_numJoints; ++i)
|
||||
{
|
||||
int32_t parentIndex = m_joints[i].parentIndex;
|
||||
int parentIndex = m_joints[i].parentIndex;
|
||||
if (parentIndex == parentlessJoint)
|
||||
{
|
||||
hasChildJoints = TRUE;
|
||||
|
|
|
@ -23,18 +23,18 @@ public:
|
|||
|
||||
virtual ~SkeletalMesh();
|
||||
|
||||
uint32_t GetNumVertices() const { return m_numVertices; }
|
||||
uint GetNumVertices() const { return m_numVertices; }
|
||||
Vector3* GetVertices() const { return m_vertices; }
|
||||
JointVertexMapping* GetJointMappings() const { return m_jointMappings; }
|
||||
uint32_t GetNumSubsets() const { return m_numSubsets; }
|
||||
uint GetNumSubsets() const { return m_numSubsets; }
|
||||
SkeletalMeshSubset* GetSubsets() const { return m_subsets; }
|
||||
int32_t GetIndexOfSubset(const stl::string &name) const;
|
||||
uint32_t GetNumJoints() const { return m_numJoints; }
|
||||
int GetIndexOfSubset(const stl::string &name) const;
|
||||
uint GetNumJoints() const { return m_numJoints; }
|
||||
Joint* GetJoints() const { return m_joints; }
|
||||
Joint* GetJoint(const stl::string &name) const;
|
||||
int32_t GetIndexOfJoint(const stl::string &name) const;
|
||||
int32_t GetRootJointIndex() const { return m_rootJointIndex; }
|
||||
uint32_t GetNumFrames() const { return m_numFrames; }
|
||||
int GetIndexOfJoint(const stl::string &name) const;
|
||||
int GetRootJointIndex() const { return m_rootJointIndex; }
|
||||
uint GetNumFrames() const { return m_numFrames; }
|
||||
const AnimationSequence* GetAnimation(const stl::string &name) const;
|
||||
VertexBuffer* GetVertexBuffer() const { return m_vertexBuffer; }
|
||||
|
||||
|
@ -42,15 +42,15 @@ private:
|
|||
SkeletalMesh();
|
||||
void FindAndSetRootJointIndex();
|
||||
|
||||
uint32_t m_numVertices;
|
||||
uint m_numVertices;
|
||||
Vector3 *m_vertices;
|
||||
JointVertexMapping *m_jointMappings;
|
||||
uint32_t m_numSubsets;
|
||||
uint m_numSubsets;
|
||||
SkeletalMeshSubset *m_subsets;
|
||||
uint32_t m_numJoints;
|
||||
uint m_numJoints;
|
||||
Joint *m_joints;
|
||||
int32_t m_rootJointIndex;
|
||||
uint32_t m_numFrames;
|
||||
int m_rootJointIndex;
|
||||
uint m_numFrames;
|
||||
AnimationList m_animations;
|
||||
VertexBuffer *m_vertexBuffer;
|
||||
};
|
||||
|
|
|
@ -65,7 +65,7 @@ void SkeletalMeshAnimationInstance::OnUpdate(float delta)
|
|||
}
|
||||
}
|
||||
|
||||
void SkeletalMeshAnimationInstance::SetSequence(uint32_t startFrame, uint32_t endFrame, BOOL loop)
|
||||
void SkeletalMeshAnimationInstance::SetSequence(uint startFrame, uint endFrame, BOOL loop)
|
||||
{
|
||||
m_currentSequenceName.clear();
|
||||
m_currentSequenceStart = startFrame;
|
||||
|
|
|
@ -14,23 +14,23 @@ public:
|
|||
virtual ~SkeletalMeshAnimationInstance();
|
||||
|
||||
void OnUpdate(float delta);
|
||||
void SetSequence(uint32_t startFrame, uint32_t endFrame, BOOL loop);
|
||||
void SetSequence(uint startFrame, uint endFrame, BOOL loop);
|
||||
void SetSequence(const stl::string &name, BOOL loop);
|
||||
void RunSequenceOnce(const stl::string &name);
|
||||
|
||||
uint32_t GetCurrentFrame() const { return m_thisFrame; }
|
||||
uint32_t GetNextFrame() const { return m_nextFrame; }
|
||||
uint GetCurrentFrame() const { return m_thisFrame; }
|
||||
uint GetNextFrame() const { return m_nextFrame; }
|
||||
float GetInterpolation() const { return m_interpolation; }
|
||||
|
||||
private:
|
||||
void RecoverFromTempSequence();
|
||||
|
||||
stl::string m_currentSequenceName;
|
||||
uint32_t m_currentSequenceStart;
|
||||
uint32_t m_currentSequenceEnd;
|
||||
uint m_currentSequenceStart;
|
||||
uint m_currentSequenceEnd;
|
||||
BOOL m_currentSequenceLoop;
|
||||
uint32_t m_thisFrame;
|
||||
uint32_t m_nextFrame;
|
||||
uint m_thisFrame;
|
||||
uint m_nextFrame;
|
||||
float m_interpolation;
|
||||
BOOL m_isRunningTempSequence;
|
||||
stl::string m_oldSequenceName;
|
||||
|
|
|
@ -69,7 +69,7 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh()
|
|||
|
||||
// read vertices
|
||||
mesh->m_vertices = new Vector3[mesh->m_numVertices];
|
||||
for (uint32_t i = 0; i < mesh->m_numVertices; ++i)
|
||||
for (uint i = 0; i < mesh->m_numVertices; ++i)
|
||||
{
|
||||
mesh->m_vertices[i].x = file->ReadFloat();
|
||||
mesh->m_vertices[i].y = file->ReadFloat();
|
||||
|
@ -81,9 +81,9 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh()
|
|||
if (hasNormals)
|
||||
{
|
||||
file->Seek(normalsDesc->start, FILESEEK_BEGINNING);
|
||||
uint32_t numNormals = file->ReadUnsignedInt();
|
||||
uint numNormals = file->ReadUnsignedInt();
|
||||
ASSERT(numNormals == mesh->m_numVertices);
|
||||
for (uint32_t i = 0; i < numNormals; ++i)
|
||||
for (uint i = 0; i < numNormals; ++i)
|
||||
{
|
||||
Vector3 normal;
|
||||
normal.x = file->ReadFloat();
|
||||
|
@ -97,9 +97,9 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh()
|
|||
if (hasTexCoords)
|
||||
{
|
||||
file->Seek(texCoordsDesc->start, FILESEEK_BEGINNING);
|
||||
uint32_t numTexCoords = file->ReadUnsignedInt();
|
||||
uint numTexCoords = file->ReadUnsignedInt();
|
||||
ASSERT(numTexCoords == mesh->m_numVertices);
|
||||
for (uint32_t i = 0; i < numTexCoords; ++i)
|
||||
for (uint i = 0; i < numTexCoords; ++i)
|
||||
{
|
||||
Vector2 texCoord;
|
||||
texCoord.x = file->ReadFloat();
|
||||
|
@ -112,12 +112,12 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh()
|
|||
file->Seek(groupsDesc->start, FILESEEK_BEGINNING);
|
||||
mesh->m_numSubsets = file->ReadUnsignedInt();
|
||||
mesh->m_subsets = new SkeletalMeshSubset[mesh->m_numSubsets];
|
||||
for (uint32_t i = 0; i < mesh->m_numSubsets; ++i)
|
||||
for (uint i = 0; i < mesh->m_numSubsets; ++i)
|
||||
{
|
||||
stl::string name;
|
||||
stl::string texture;
|
||||
BOOL alpha;
|
||||
uint32_t numTriangles;
|
||||
uint numTriangles;
|
||||
|
||||
file->ReadString(name);
|
||||
file->ReadString(texture);
|
||||
|
@ -130,20 +130,20 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh()
|
|||
|
||||
// triangles
|
||||
file->Seek(trianglesDesc->start, FILESEEK_BEGINNING);
|
||||
uint32_t numTriangles = file->ReadUnsignedInt();
|
||||
for (uint32_t i = 0; i < numTriangles; ++i)
|
||||
uint numTriangles = file->ReadUnsignedInt();
|
||||
for (uint i = 0; i < numTriangles; ++i)
|
||||
{
|
||||
uint32_t v1 = file->ReadUnsignedInt();
|
||||
uint32_t v2 = file->ReadUnsignedInt();
|
||||
uint32_t v3 = file->ReadUnsignedInt();
|
||||
uint32_t subsetIndex = file->ReadUnsignedInt();
|
||||
uint v1 = file->ReadUnsignedInt();
|
||||
uint v2 = file->ReadUnsignedInt();
|
||||
uint v3 = file->ReadUnsignedInt();
|
||||
uint subsetIndex = file->ReadUnsignedInt();
|
||||
|
||||
SkeletalMeshSubset *subset = &mesh->m_subsets[subsetIndex];
|
||||
subset->GetIndices()->SetCurrent((uint16_t)v1);
|
||||
subset->GetIndices()->SetCurrent((ushort)v1);
|
||||
subset->GetIndices()->MoveNext();
|
||||
subset->GetIndices()->SetCurrent((uint16_t)v2);
|
||||
subset->GetIndices()->SetCurrent((ushort)v2);
|
||||
subset->GetIndices()->MoveNext();
|
||||
subset->GetIndices()->SetCurrent((uint16_t)v3);
|
||||
subset->GetIndices()->SetCurrent((ushort)v3);
|
||||
subset->GetIndices()->MoveNext();
|
||||
}
|
||||
|
||||
|
@ -151,10 +151,10 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh()
|
|||
file->Seek(jointsDesc->start, FILESEEK_BEGINNING);
|
||||
mesh->m_numJoints = file->ReadUnsignedInt();
|
||||
mesh->m_joints = new Joint[mesh->m_numJoints];
|
||||
for (uint32_t i = 0; i < mesh->m_numJoints; ++i)
|
||||
for (uint i = 0; i < mesh->m_numJoints; ++i)
|
||||
{
|
||||
file->ReadString(mesh->m_joints[i].name);
|
||||
int32_t parentIndex = file->ReadInt();
|
||||
int parentIndex = file->ReadInt();
|
||||
mesh->m_joints[i].parentIndex = parentIndex;
|
||||
if (parentIndex >= 0)
|
||||
mesh->m_joints[i].parent = &mesh->m_joints[parentIndex];
|
||||
|
@ -175,7 +175,7 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh()
|
|||
}
|
||||
|
||||
// build absolute transformation matrices for all the joints we just loaded
|
||||
for (uint32_t i = 0; i < mesh->m_numJoints; ++i)
|
||||
for (uint i = 0; i < mesh->m_numJoints; ++i)
|
||||
{
|
||||
Joint *joint = &mesh->m_joints[i];
|
||||
if (joint->parent != NULL)
|
||||
|
@ -190,17 +190,17 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh()
|
|||
// set up inverse absolute transforms for each joint in preparation
|
||||
// for transforming all the vertices
|
||||
Matrix4x4 *inverseJointTransforms = new Matrix4x4[mesh->m_numJoints];
|
||||
for (uint32_t i = 0; i < mesh->m_numJoints; ++i)
|
||||
for (uint i = 0; i < mesh->m_numJoints; ++i)
|
||||
inverseJointTransforms[i] = Matrix4x4::Inverse(mesh->m_joints[i].absolute);
|
||||
|
||||
// joint-to-vertex mappings
|
||||
file->Seek(jointsToVerticesDesc->start, FILESEEK_BEGINNING);
|
||||
uint32_t numMappings = file->ReadUnsignedInt();
|
||||
uint numMappings = file->ReadUnsignedInt();
|
||||
ASSERT(numMappings == mesh->m_numVertices);
|
||||
mesh->m_jointMappings = new JointVertexMapping[numMappings];
|
||||
for (uint32_t i = 0; i < numMappings; ++i)
|
||||
for (uint i = 0; i < numMappings; ++i)
|
||||
{
|
||||
uint32_t jointIndex = file->ReadUnsignedInt();
|
||||
uint jointIndex = file->ReadUnsignedInt();
|
||||
mesh->m_jointMappings[i].jointIndex = jointIndex;
|
||||
mesh->m_jointMappings[i].weight = file->ReadFloat();
|
||||
|
||||
|
@ -228,12 +228,12 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh()
|
|||
mesh->m_numFrames = file->ReadUnsignedInt();
|
||||
|
||||
// allocate memory for the frames for each joint
|
||||
for (uint32_t i = 0; i < mesh->m_numJoints; ++i)
|
||||
for (uint i = 0; i < mesh->m_numJoints; ++i)
|
||||
mesh->m_joints[i].frames = new JointKeyFrame[mesh->m_numFrames];
|
||||
|
||||
for (uint32_t i = 0; i < mesh->m_numFrames; ++i)
|
||||
for (uint i = 0; i < mesh->m_numFrames; ++i)
|
||||
{
|
||||
for (uint32_t j = 0; j < mesh->m_numJoints; ++j)
|
||||
for (uint j = 0; j < mesh->m_numJoints; ++j)
|
||||
{
|
||||
mesh->m_joints[j].frames[i].position.x = file->ReadFloat();
|
||||
mesh->m_joints[j].frames[i].position.y = file->ReadFloat();
|
||||
|
@ -251,8 +251,8 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh()
|
|||
if (animationsDesc != NULL)
|
||||
{
|
||||
file->Seek(animationsDesc->start, FILESEEK_BEGINNING);
|
||||
int32_t numAnimations = file->ReadInt();
|
||||
for (int32_t i = 0; i < numAnimations; ++i)
|
||||
int numAnimations = file->ReadInt();
|
||||
for (int i = 0; i < numAnimations; ++i)
|
||||
{
|
||||
AnimationSequence sequence;
|
||||
stl::string name;
|
||||
|
|
|
@ -22,7 +22,7 @@ SkeletalMeshInstance::SkeletalMeshInstance(SkeletalMesh *mesh)
|
|||
m_enabledSubsets = new BOOL[m_numSubsets];
|
||||
m_textures = new Texture*[m_numSubsets];
|
||||
|
||||
for (uint32_t i = 0; i < m_numSubsets; ++i)
|
||||
for (uint i = 0; i < m_numSubsets; ++i)
|
||||
{
|
||||
m_enabledSubsets[i] = TRUE;
|
||||
m_textures[i] = NULL;
|
||||
|
@ -58,7 +58,7 @@ void SkeletalMeshInstance::OnUpdate(float delta)
|
|||
|
||||
const Matrix4x4* SkeletalMeshInstance::GetJointTransformation(const stl::string &jointName) const
|
||||
{
|
||||
int32_t jointIndex = GetMesh()->GetIndexOfJoint(jointName);
|
||||
int jointIndex = GetMesh()->GetIndexOfJoint(jointName);
|
||||
if (jointIndex == NO_JOINT)
|
||||
return NULL;
|
||||
else
|
||||
|
@ -78,11 +78,11 @@ void SkeletalMeshInstance::ClearFixedRootJointTransformation()
|
|||
m_rootJointHasFixedTransform = FALSE;
|
||||
}
|
||||
|
||||
void SkeletalMeshInstance::CalculateJointTransformations(uint32_t frame)
|
||||
void SkeletalMeshInstance::CalculateJointTransformations(uint frame)
|
||||
{
|
||||
int32_t rootJointIndex = GetMesh()->GetRootJointIndex();
|
||||
int rootJointIndex = GetMesh()->GetRootJointIndex();
|
||||
|
||||
for (uint32_t i = 0; i < m_numJoints; ++i)
|
||||
for (uint i = 0; i < m_numJoints; ++i)
|
||||
{
|
||||
if (!(m_rootJointHasFixedTransform && i == rootJointIndex))
|
||||
{
|
||||
|
@ -115,11 +115,11 @@ void SkeletalMeshInstance::CalculateJointTransformations(uint32_t frame)
|
|||
}
|
||||
}
|
||||
|
||||
void SkeletalMeshInstance::CalculateJointTransformations(uint32_t startFrame, uint32_t endFrame, float interpolation)
|
||||
void SkeletalMeshInstance::CalculateJointTransformations(uint startFrame, uint endFrame, float interpolation)
|
||||
{
|
||||
int32_t rootJointIndex = GetMesh()->GetRootJointIndex();
|
||||
int rootJointIndex = GetMesh()->GetRootJointIndex();
|
||||
|
||||
for (uint32_t i = 0; i < m_numJoints; ++i)
|
||||
for (uint i = 0; i < m_numJoints; ++i)
|
||||
{
|
||||
if (!(m_rootJointHasFixedTransform && i == rootJointIndex))
|
||||
{
|
||||
|
@ -155,7 +155,7 @@ void SkeletalMeshInstance::CalculateJointTransformations(uint32_t startFrame, ui
|
|||
}
|
||||
}
|
||||
|
||||
void SkeletalMeshInstance::BreakDownJointTransformationMatrix(uint32_t jointMatrixIndex)
|
||||
void SkeletalMeshInstance::BreakDownJointTransformationMatrix(uint jointMatrixIndex)
|
||||
{
|
||||
const Matrix4x4 *jointMatrix = &m_jointTransformations[jointMatrixIndex];
|
||||
|
||||
|
@ -165,7 +165,7 @@ void SkeletalMeshInstance::BreakDownJointTransformationMatrix(uint32_t jointMatr
|
|||
|
||||
void SkeletalMeshInstance::EnableSubset(const stl::string &subset, BOOL enable)
|
||||
{
|
||||
int32_t index = m_mesh->GetIndexOfSubset(subset);
|
||||
int index = m_mesh->GetIndexOfSubset(subset);
|
||||
ASSERT(index != -1);
|
||||
if (index == -1)
|
||||
return;
|
||||
|
@ -173,7 +173,7 @@ void SkeletalMeshInstance::EnableSubset(const stl::string &subset, BOOL enable)
|
|||
m_enabledSubsets[index] = enable;
|
||||
}
|
||||
|
||||
void SkeletalMeshInstance::SetTexture(uint32_t index, Texture *texture)
|
||||
void SkeletalMeshInstance::SetTexture(uint index, Texture *texture)
|
||||
{
|
||||
ASSERT(index < m_numSubsets);
|
||||
m_textures[index] = texture;
|
||||
|
@ -181,7 +181,7 @@ void SkeletalMeshInstance::SetTexture(uint32_t index, Texture *texture)
|
|||
|
||||
void SkeletalMeshInstance::SetTexture(const stl::string &subset, Texture *texture)
|
||||
{
|
||||
int32_t index = m_mesh->GetIndexOfSubset(subset);
|
||||
int index = m_mesh->GetIndexOfSubset(subset);
|
||||
ASSERT(index != -1);
|
||||
if (index == -1)
|
||||
return;
|
||||
|
|
|
@ -19,19 +19,19 @@ public:
|
|||
virtual ~SkeletalMeshInstance();
|
||||
|
||||
virtual void OnUpdate(float delta);
|
||||
void CalculateJointTransformations(uint32_t frame);
|
||||
void CalculateJointTransformations(uint32_t startFrame, uint32_t endFrame, float interpolation);
|
||||
void CalculateJointTransformations(uint frame);
|
||||
void CalculateJointTransformations(uint startFrame, uint endFrame, float interpolation);
|
||||
|
||||
uint32_t GetNumSubsets() const { return m_numSubsets; }
|
||||
BOOL IsSubsetEnabled(uint32_t index) const { return m_enabledSubsets[index]; }
|
||||
uint GetNumSubsets() const { return m_numSubsets; }
|
||||
BOOL IsSubsetEnabled(uint index) const { return m_enabledSubsets[index]; }
|
||||
void EnableSubset(const stl::string &subset, BOOL enable);
|
||||
void EnableSubset(uint32_t index, BOOL enable) { m_enabledSubsets[index] = enable; }
|
||||
void EnableSubset(uint index, BOOL enable) { m_enabledSubsets[index] = enable; }
|
||||
|
||||
Texture** GetTextures() const { return m_textures; }
|
||||
void SetTexture(uint32_t index, Texture *texture);
|
||||
void SetTexture(uint index, Texture *texture);
|
||||
void SetTexture(const stl::string &subset, Texture *texture);
|
||||
|
||||
uint32_t GetNumJoints() const { return m_numJoints; }
|
||||
uint GetNumJoints() const { return m_numJoints; }
|
||||
Matrix4x4* GetJointTransformations() const { return m_jointTransformations; }
|
||||
Vector3* GetJointPositions() const { return m_jointPositions; }
|
||||
Quaternion* GetJointRotations() const { return m_jointRotations; }
|
||||
|
@ -49,10 +49,10 @@ public:
|
|||
SkeletalMesh* GetMesh() const { return m_mesh; }
|
||||
|
||||
private:
|
||||
void BreakDownJointTransformationMatrix(uint32_t jointMatrixIndex);
|
||||
void BreakDownJointTransformationMatrix(uint jointMatrixIndex);
|
||||
|
||||
SkeletalMesh *m_mesh;
|
||||
uint32_t m_numSubsets;
|
||||
uint m_numSubsets;
|
||||
BOOL *m_enabledSubsets;
|
||||
Texture **m_textures;
|
||||
RenderState *m_renderState;
|
||||
|
@ -60,7 +60,7 @@ private:
|
|||
BlendState *m_alphaBlendState;
|
||||
BOOL m_renderAllSubsetsAlphaBlended;
|
||||
|
||||
uint32_t m_numJoints;
|
||||
uint m_numJoints;
|
||||
Matrix4x4 *m_jointTransformations;
|
||||
Vector3 *m_jointPositions;
|
||||
Quaternion *m_jointRotations;
|
||||
|
|
|
@ -26,7 +26,7 @@ void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshIn
|
|||
Render(graphicsDevice, instance, 0, shader);
|
||||
}
|
||||
|
||||
void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint32_t frame, VertexSkinningShader *shader)
|
||||
void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint frame, VertexSkinningShader *shader)
|
||||
{
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
instance->CalculateJointTransformations(frame);
|
||||
|
@ -35,7 +35,7 @@ void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshIn
|
|||
RenderAllSubsets(graphicsDevice, instance, shader);
|
||||
}
|
||||
|
||||
void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint32_t startFrame, uint32_t endFrame, float interpolation, VertexSkinningShader *shader)
|
||||
void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint startFrame, uint endFrame, float interpolation, VertexSkinningShader *shader)
|
||||
{
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
instance->CalculateJointTransformations(startFrame, endFrame, interpolation);
|
||||
|
@ -68,7 +68,7 @@ void SkeletalMeshRenderer::RenderAllSubsets(GraphicsDevice *graphicsDevice, Skel
|
|||
{
|
||||
// render only non-alpha subsets first
|
||||
instance->GetBlendState()->Apply();
|
||||
for (uint32_t i = 0; i < instance->GetMesh()->GetNumSubsets(); ++i)
|
||||
for (uint i = 0; i < instance->GetMesh()->GetNumSubsets(); ++i)
|
||||
{
|
||||
if (!instance->IsSubsetEnabled(i))
|
||||
continue;
|
||||
|
@ -86,7 +86,7 @@ void SkeletalMeshRenderer::RenderAllSubsets(GraphicsDevice *graphicsDevice, Skel
|
|||
if (hasAlphaSubsets)
|
||||
{
|
||||
instance->GetAlphaBlendState()->Apply();
|
||||
for (uint32_t i = 0; i < instance->GetMesh()->GetNumSubsets(); ++i)
|
||||
for (uint i = 0; i < instance->GetMesh()->GetNumSubsets(); ++i)
|
||||
{
|
||||
if (!instance->IsSubsetEnabled(i))
|
||||
continue;
|
||||
|
|
|
@ -19,8 +19,8 @@ public:
|
|||
virtual ~SkeletalMeshRenderer();
|
||||
|
||||
void Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, VertexSkinningShader *shader);
|
||||
void Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint32_t frame, VertexSkinningShader *shader);
|
||||
void Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint32_t startFrame, uint32_t endFrame, float interpolation, VertexSkinningShader *shader);
|
||||
void Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint frame, VertexSkinningShader *shader);
|
||||
void Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint startFrame, uint endFrame, float interpolation, VertexSkinningShader *shader);
|
||||
void Render(GraphicsDevice *graphicsDevice, SkeletalMeshAnimationInstance *instance, VertexSkinningShader *shader);
|
||||
|
||||
private:
|
||||
|
|
|
@ -16,7 +16,7 @@ SkeletalMeshSubset::~SkeletalMeshSubset()
|
|||
SAFE_DELETE(m_indices);
|
||||
}
|
||||
|
||||
void SkeletalMeshSubset::Create(const stl::string &name, uint32_t numTriangles, BOOL alpha)
|
||||
void SkeletalMeshSubset::Create(const stl::string &name, uint numTriangles, BOOL alpha)
|
||||
{
|
||||
ASSERT(m_indices == NULL);
|
||||
ASSERT(numTriangles > 0);
|
||||
|
|
|
@ -12,7 +12,7 @@ public:
|
|||
SkeletalMeshSubset();
|
||||
virtual ~SkeletalMeshSubset();
|
||||
|
||||
void Create(const stl::string &name, uint32_t numTriangles, BOOL alpha);
|
||||
void Create(const stl::string &name, uint numTriangles, BOOL alpha);
|
||||
|
||||
const stl::string& GetName() const { return m_name; }
|
||||
IndexBuffer* GetIndices() const { return m_indices; }
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
struct SkeletalMeshTriangle
|
||||
{
|
||||
int32_t vertices[3];
|
||||
int32_t subMeshIndex;
|
||||
int vertices[3];
|
||||
int subMeshIndex;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
struct ChunkDescriptor
|
||||
{
|
||||
uint32_t start;
|
||||
uint32_t length;
|
||||
uint start;
|
||||
uint length;
|
||||
};
|
||||
|
||||
typedef stl::map<stl::string, ChunkDescriptor> ChunkMap;
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
#include "../../math/vector3.h"
|
||||
#include "../../math/vector2.h"
|
||||
|
||||
StaticMesh::StaticMesh(uint32_t numSubsets, StaticMeshSubset **subsets)
|
||||
: Content()
|
||||
StaticMesh::StaticMesh(uint numSubsets, StaticMeshSubset **subsets)
|
||||
{
|
||||
ASSERT(numSubsets > 0);
|
||||
ASSERT(subsets != NULL);
|
||||
|
@ -25,7 +24,6 @@ StaticMesh::StaticMesh(uint32_t numSubsets, StaticMeshSubset **subsets)
|
|||
}
|
||||
|
||||
StaticMesh::StaticMesh(const StaticMeshFile *file, ContentManager *contentManager)
|
||||
: Content()
|
||||
{
|
||||
m_numSubsets = 0;
|
||||
CreateSubsets(file, contentManager);
|
||||
|
@ -33,7 +31,7 @@ StaticMesh::StaticMesh(const StaticMeshFile *file, ContentManager *contentManage
|
|||
|
||||
StaticMesh::~StaticMesh()
|
||||
{
|
||||
for (uint32_t i = 0; i < m_numSubsets; ++i)
|
||||
for (uint i = 0; i < m_numSubsets; ++i)
|
||||
SAFE_DELETE(m_subsets[i]);
|
||||
SAFE_DELETE_ARRAY(m_subsets);
|
||||
}
|
||||
|
@ -51,7 +49,7 @@ void StaticMesh::CreateSubsets(const StaticMeshFile *file, ContentManager *conte
|
|||
Vector3 *normals = file->GetNormals();
|
||||
Vector2 *texCoords = file->GetTexCoords();
|
||||
|
||||
for (uint32_t i = 0; i < m_numSubsets; ++i)
|
||||
for (uint i = 0; i < m_numSubsets; ++i)
|
||||
{
|
||||
StaticMeshFileSubMesh *subMesh = &subMeshes[i];
|
||||
StaticMeshFileMaterial *material = &materials[subMesh->material];
|
||||
|
@ -63,12 +61,12 @@ void StaticMesh::CreateSubsets(const StaticMeshFile *file, ContentManager *conte
|
|||
ASSERT(subset != NULL);
|
||||
|
||||
// add the triangles to the subset
|
||||
uint32_t n = 0;
|
||||
for (uint32_t j = 0; j < file->GetNumTriangles(); ++j)
|
||||
uint n = 0;
|
||||
for (uint j = 0; j < file->GetNumTriangles(); ++j)
|
||||
{
|
||||
if (triangles[j].subMeshIndex == i)
|
||||
{
|
||||
uint32_t pos = n * 3;
|
||||
uint pos = n * 3;
|
||||
|
||||
subset->GetVertices()->SetPosition3(pos, vertices[triangles[j].vertices[0]]);
|
||||
subset->GetVertices()->SetPosition3(pos + 1, vertices[triangles[j].vertices[1]]);
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
* @param numSubsets the number of subsets being provided
|
||||
* @param subsets mesh subsets that this static mesh is to be made up of
|
||||
*/
|
||||
StaticMesh(uint32_t numSubsets, StaticMeshSubset **subsets);
|
||||
StaticMesh(uint numSubsets, StaticMeshSubset **subsets);
|
||||
|
||||
/**
|
||||
* Creates a static mesh object.
|
||||
|
@ -37,19 +37,19 @@ public:
|
|||
/**
|
||||
* @return the number of subsets that make up this mesh
|
||||
*/
|
||||
uint32_t GetNumSubsets() const { return m_numSubsets; }
|
||||
uint GetNumSubsets() const { return m_numSubsets; }
|
||||
|
||||
/**
|
||||
* Gets the specified subset contained in this mesh.
|
||||
* @param index the subset to get
|
||||
* @return the mesh subset
|
||||
*/
|
||||
StaticMeshSubset* GetSubset(uint32_t index) const { return m_subsets[index]; }
|
||||
StaticMeshSubset* GetSubset(uint index) const { return m_subsets[index]; }
|
||||
|
||||
private:
|
||||
void CreateSubsets(const StaticMeshFile *file, ContentManager *contentManager);
|
||||
|
||||
uint32_t m_numSubsets;
|
||||
uint m_numSubsets;
|
||||
StaticMeshSubset **m_subsets;
|
||||
};
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ StaticMeshBuilder::~StaticMeshBuilder()
|
|||
// BuildMesh() will handle passing off the subset objects to a mesh object
|
||||
// if it is called. if it's not called, this will free up the memory since
|
||||
// it was never passed off anywhere else in that case
|
||||
for (uint32_t i = 0; i < m_subsets.size(); ++i)
|
||||
for (uint i = 0; i < m_subsets.size(); ++i)
|
||||
SAFE_DELETE(m_subsets[i]);
|
||||
m_subsets.clear();
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ void StaticMeshBuilder::Reset()
|
|||
m_transform = IDENTITY_MATRIX;
|
||||
}
|
||||
|
||||
uint32_t StaticMeshBuilder::AddSubset(uint32_t numTriangles, Texture *texture)
|
||||
uint StaticMeshBuilder::AddSubset(uint numTriangles, Texture *texture)
|
||||
{
|
||||
ASSERT(numTriangles > 0);
|
||||
StaticMeshSubset *subset = new StaticMeshSubset(numTriangles, texture);
|
||||
|
@ -43,8 +43,8 @@ uint32_t StaticMeshBuilder::AddSubset(uint32_t numTriangles, Texture *texture)
|
|||
}
|
||||
|
||||
void StaticMeshBuilder::SetTriangle(
|
||||
uint32_t subsetIndex,
|
||||
uint32_t triangle,
|
||||
uint subsetIndex,
|
||||
uint triangle,
|
||||
const Vector3 &v1, const Vector3 &v2, const Vector3 &v3,
|
||||
const Vector3 &n1, const Vector3 &n2, const Vector3 &n3,
|
||||
const Vector2 &t1, const Vector2 &t2, const Vector2 &t3
|
||||
|
@ -56,7 +56,7 @@ void StaticMeshBuilder::SetTriangle(
|
|||
ASSERT(subset != NULL);
|
||||
|
||||
VertexBuffer *vertices = subset->GetVertices();
|
||||
uint32_t bufferIndex = triangle * 3;
|
||||
uint bufferIndex = triangle * 3;
|
||||
|
||||
ASSERT((bufferIndex + 3) <= vertices->GetNumElements());
|
||||
|
||||
|
@ -69,8 +69,8 @@ void StaticMeshBuilder::SetTriangle(
|
|||
}
|
||||
|
||||
void StaticMeshBuilder::SetTriangle(
|
||||
uint32_t subsetIndex,
|
||||
uint32_t triangle,
|
||||
uint subsetIndex,
|
||||
uint triangle,
|
||||
const Vector3 &v1, const Vector3 &v2, const Vector3 &v3,
|
||||
const Vector2 &t1, const Vector2 &t2, const Vector2 &t3
|
||||
)
|
||||
|
@ -81,7 +81,7 @@ void StaticMeshBuilder::SetTriangle(
|
|||
ASSERT(subset != NULL);
|
||||
|
||||
VertexBuffer *vertices = subset->GetVertices();
|
||||
uint32_t bufferIndex = triangle * 3;
|
||||
uint bufferIndex = triangle * 3;
|
||||
|
||||
ASSERT((bufferIndex + 3) <= vertices->GetNumElements());
|
||||
|
||||
|
@ -93,8 +93,8 @@ void StaticMeshBuilder::SetTriangle(
|
|||
}
|
||||
|
||||
void StaticMeshBuilder::SetQuad(
|
||||
uint32_t subsetIndex,
|
||||
uint32_t firstTriangle,
|
||||
uint subsetIndex,
|
||||
uint firstTriangle,
|
||||
const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector3 &v4,
|
||||
const Vector3 &n1, const Vector3 &n2, const Vector3 &n3, const Vector3 &n4,
|
||||
const Vector2 &t1, const Vector2 &t2, const Vector2 &t3, const Vector2 &t4
|
||||
|
@ -106,7 +106,7 @@ void StaticMeshBuilder::SetQuad(
|
|||
ASSERT(subset != NULL);
|
||||
|
||||
VertexBuffer *vertices = subset->GetVertices();
|
||||
uint32_t bufferIndex = firstTriangle * 3;
|
||||
uint bufferIndex = firstTriangle * 3;
|
||||
|
||||
ASSERT((bufferIndex + 6) <= vertices->GetNumElements());
|
||||
|
||||
|
@ -125,8 +125,8 @@ void StaticMeshBuilder::SetQuad(
|
|||
}
|
||||
|
||||
void StaticMeshBuilder::SetQuad(
|
||||
uint32_t subsetIndex,
|
||||
uint32_t firstTriangle,
|
||||
uint subsetIndex,
|
||||
uint firstTriangle,
|
||||
const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector3 &v4,
|
||||
const Vector2 &t1, const Vector2 &t2, const Vector2 &t3, const Vector2 &t4
|
||||
)
|
||||
|
@ -137,7 +137,7 @@ void StaticMeshBuilder::SetQuad(
|
|||
ASSERT(subset != NULL);
|
||||
|
||||
VertexBuffer *vertices = subset->GetVertices();
|
||||
uint32_t bufferIndex = firstTriangle * 3;
|
||||
uint bufferIndex = firstTriangle * 3;
|
||||
|
||||
ASSERT((bufferIndex + 6) <= vertices->GetNumElements());
|
||||
|
||||
|
@ -154,8 +154,8 @@ void StaticMeshBuilder::SetQuad(
|
|||
}
|
||||
|
||||
void StaticMeshBuilder::SetBox(
|
||||
uint32_t subsetIndex,
|
||||
uint32_t firstTriangle,
|
||||
uint subsetIndex,
|
||||
uint firstTriangle,
|
||||
const Vector3 ¢er, float width, float height, float depth
|
||||
)
|
||||
{
|
||||
|
@ -174,8 +174,8 @@ void StaticMeshBuilder::SetBox(
|
|||
}
|
||||
|
||||
void StaticMeshBuilder::SetBox(
|
||||
uint32_t subsetIndex,
|
||||
uint32_t firstTriangle,
|
||||
uint subsetIndex,
|
||||
uint firstTriangle,
|
||||
const Vector3 &min, const Vector3 &max
|
||||
)
|
||||
{
|
||||
|
@ -232,7 +232,7 @@ void StaticMeshBuilder::GenerateNormals()
|
|||
{
|
||||
ASSERT(m_subsets.size() > 0);
|
||||
|
||||
for (uint32_t i = 0; i < m_subsets.size(); ++i)
|
||||
for (uint i = 0; i < m_subsets.size(); ++i)
|
||||
{
|
||||
StaticMeshSubset *subset = m_subsets[i];
|
||||
ASSERT(subset != NULL);
|
||||
|
@ -241,11 +241,11 @@ void StaticMeshBuilder::GenerateNormals()
|
|||
ASSERT(buffer->GetNumElements() % 3 == 0);
|
||||
|
||||
// initialize all normals
|
||||
for (uint32_t n = 0; n < buffer->GetNumElements(); ++n)
|
||||
for (uint n = 0; n < buffer->GetNumElements(); ++n)
|
||||
buffer->SetNormal(n, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
// calculate the normal for each triangle and add it to the normals for each individual vertex
|
||||
for (uint32_t v = 0; v < buffer->GetNumElements() / 3; ++v)
|
||||
for (uint v = 0; v < buffer->GetNumElements() / 3; ++v)
|
||||
{
|
||||
// calculate the triangle normal
|
||||
// they should have been added in CCW order (which StaticMeshBuilder does...)
|
||||
|
@ -264,7 +264,7 @@ void StaticMeshBuilder::GenerateNormals()
|
|||
}
|
||||
|
||||
// all the vertex normals will be way too long, need to normalize all of them now
|
||||
for (uint32_t n = 0; n < buffer->GetNumElements(); ++n)
|
||||
for (uint n = 0; n < buffer->GetNumElements(); ++n)
|
||||
{
|
||||
Vector3 normal = buffer->GetNormal(n);
|
||||
buffer->SetNormal(n, Vector3::Normalize(normal));
|
||||
|
@ -279,7 +279,7 @@ StaticMesh* StaticMeshBuilder::BuildMesh()
|
|||
// convert the mesh vector to an array so it can be passed into the mesh object
|
||||
StaticMeshSubset **subsets = new StaticMeshSubset*[m_subsets.size()];
|
||||
ASSERT(subsets != NULL);
|
||||
for (uint32_t i = 0; i < m_subsets.size(); ++i)
|
||||
for (uint i = 0; i < m_subsets.size(); ++i)
|
||||
subsets[i] = m_subsets[i];
|
||||
|
||||
StaticMesh *mesh = new StaticMesh(m_subsets.size(), subsets);
|
||||
|
@ -295,7 +295,7 @@ StaticMesh* StaticMeshBuilder::BuildMesh()
|
|||
|
||||
void StaticMeshBuilder::SetTriangleInternal(
|
||||
VertexBuffer *buffer,
|
||||
uint32_t bufferIndex,
|
||||
uint bufferIndex,
|
||||
const Vector3 &v1, const Vector3 &v2, const Vector3 &v3,
|
||||
const Vector3 &n1, const Vector3 &n2, const Vector3 &n3,
|
||||
const Vector2 &t1, const Vector2 &t2, const Vector2 &t3
|
||||
|
@ -316,7 +316,7 @@ void StaticMeshBuilder::SetTriangleInternal(
|
|||
|
||||
void StaticMeshBuilder::SetTriangleInternal(
|
||||
VertexBuffer *buffer,
|
||||
uint32_t bufferIndex,
|
||||
uint bufferIndex,
|
||||
const Vector3 &v1, const Vector3 &v2, const Vector3 &v3,
|
||||
const Vector2 &t1, const Vector2 &t2, const Vector2 &t3
|
||||
)
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
* @param texture the texture to be applied to this subset, or NULL to use
|
||||
* no texture with it
|
||||
*/
|
||||
uint32_t AddSubset(uint32_t numTriangles, Texture *texture);
|
||||
uint AddSubset(uint numTriangles, Texture *texture);
|
||||
|
||||
/**
|
||||
* Sets a triangle on the specified subset.
|
||||
|
@ -55,8 +55,8 @@ public:
|
|||
* @param triangle the index of the triangle to set in the subset
|
||||
*/
|
||||
void SetTriangle(
|
||||
uint32_t subsetIndex,
|
||||
uint32_t triangle,
|
||||
uint subsetIndex,
|
||||
uint triangle,
|
||||
const Vector3 &v1, const Vector3 &v2, const Vector3 &v3,
|
||||
const Vector3 &n1, const Vector3 &n2, const Vector3 &n3,
|
||||
const Vector2 &t1, const Vector2 &t2, const Vector2 &t3
|
||||
|
@ -68,8 +68,8 @@ public:
|
|||
* @param triangle the index of the triangle to set in the subset
|
||||
*/
|
||||
void SetTriangle(
|
||||
uint32_t subsetIndex,
|
||||
uint32_t triangle,
|
||||
uint subsetIndex,
|
||||
uint triangle,
|
||||
const Vector3 &v1, const Vector3 &v2, const Vector3 &v3,
|
||||
const Vector2 &t1, const Vector2 &t2, const Vector2 &t3
|
||||
);
|
||||
|
@ -82,8 +82,8 @@ public:
|
|||
* the quad's vertices will be set in
|
||||
*/
|
||||
void SetQuad(
|
||||
uint32_t subsetIndex,
|
||||
uint32_t firstTriangle,
|
||||
uint subsetIndex,
|
||||
uint firstTriangle,
|
||||
const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector3 &v4,
|
||||
const Vector3 &n1, const Vector3 &n2, const Vector3 &n3, const Vector3 &n4,
|
||||
const Vector2 &t1, const Vector2 &t2, const Vector2 &t3, const Vector2 &t4
|
||||
|
@ -97,8 +97,8 @@ public:
|
|||
* the quad's vertices will be set in
|
||||
*/
|
||||
void SetQuad(
|
||||
uint32_t subsetIndex,
|
||||
uint32_t firstTriangle,
|
||||
uint subsetIndex,
|
||||
uint firstTriangle,
|
||||
const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector3 &v4,
|
||||
const Vector2 &t1, const Vector2 &t2, const Vector2 &t3, const Vector2 &t4
|
||||
);
|
||||
|
@ -111,8 +111,8 @@ public:
|
|||
* the box's vertices will be set in
|
||||
*/
|
||||
void SetBox(
|
||||
uint32_t subsetIndex,
|
||||
uint32_t firstTriangle,
|
||||
uint subsetIndex,
|
||||
uint firstTriangle,
|
||||
const Vector3 ¢er, float width, float height, float depth
|
||||
);
|
||||
|
||||
|
@ -124,8 +124,8 @@ public:
|
|||
* the box's vertices will be set in
|
||||
*/
|
||||
void SetBox(
|
||||
uint32_t subsetIndex,
|
||||
uint32_t firstTriangle,
|
||||
uint subsetIndex,
|
||||
uint firstTriangle,
|
||||
const Vector3 &min, const Vector3 &max
|
||||
);
|
||||
|
||||
|
@ -146,14 +146,14 @@ public:
|
|||
private:
|
||||
void SetTriangleInternal(
|
||||
VertexBuffer *buffer,
|
||||
uint32_t bufferIndex,
|
||||
uint bufferIndex,
|
||||
const Vector3 &v1, const Vector3 &v2, const Vector3 &v3,
|
||||
const Vector3 &n1, const Vector3 &n2, const Vector3 &n3,
|
||||
const Vector2 &t1, const Vector2 &t2, const Vector2 &t3
|
||||
);
|
||||
void SetTriangleInternal(
|
||||
VertexBuffer *buffer,
|
||||
uint32_t bufferIndex,
|
||||
uint bufferIndex,
|
||||
const Vector3 &v1, const Vector3 &v2, const Vector3 &v3,
|
||||
const Vector2 &t1, const Vector2 &t2, const Vector2 &t3
|
||||
);
|
||||
|
|
|
@ -55,7 +55,7 @@ void StaticMeshFile::Load()
|
|||
m_numVertices = file->ReadUnsignedInt();
|
||||
m_vertices = new Vector3[m_numVertices];
|
||||
ASSERT(m_vertices != NULL);
|
||||
for (uint32_t i = 0; i < m_numVertices; ++i)
|
||||
for (uint i = 0; i < m_numVertices; ++i)
|
||||
{
|
||||
m_vertices[i].x = file->ReadFloat();
|
||||
m_vertices[i].y = file->ReadFloat();
|
||||
|
@ -69,7 +69,7 @@ void StaticMeshFile::Load()
|
|||
m_numNormals = file->ReadUnsignedInt();
|
||||
m_normals = new Vector3[m_numNormals];
|
||||
ASSERT(m_normals != NULL);
|
||||
for (uint32_t i = 0; i < m_numNormals; ++i)
|
||||
for (uint i = 0; i < m_numNormals; ++i)
|
||||
{
|
||||
m_normals[i].x = file->ReadFloat();
|
||||
m_normals[i].y = file->ReadFloat();
|
||||
|
@ -84,7 +84,7 @@ void StaticMeshFile::Load()
|
|||
m_numTexCoords = file->ReadUnsignedInt();
|
||||
m_texCoords = new Vector2[m_numTexCoords];
|
||||
ASSERT(m_texCoords != NULL);
|
||||
for (uint32_t i = 0; i < m_numTexCoords; ++i)
|
||||
for (uint i = 0; i < m_numTexCoords; ++i)
|
||||
{
|
||||
m_texCoords[i].x = file->ReadFloat();
|
||||
m_texCoords[i].y = file->ReadFloat();
|
||||
|
@ -96,7 +96,7 @@ void StaticMeshFile::Load()
|
|||
m_numMaterials = file->ReadUnsignedInt();
|
||||
m_materials = new StaticMeshFileMaterial[m_numMaterials];
|
||||
ASSERT(m_materials != NULL);
|
||||
for (uint32_t i = 0; i < m_numMaterials; ++i)
|
||||
for (uint i = 0; i < m_numMaterials; ++i)
|
||||
{
|
||||
StaticMeshFileMaterial *material = &m_materials[i];
|
||||
|
||||
|
@ -112,7 +112,7 @@ void StaticMeshFile::Load()
|
|||
m_numTriangles = file->ReadUnsignedInt();
|
||||
m_triangles = new StaticMeshTriangle[m_numTriangles];
|
||||
ASSERT(m_triangles != NULL);
|
||||
for (uint32_t i = 0; i < m_numTriangles; ++i)
|
||||
for (uint i = 0; i < m_numTriangles; ++i)
|
||||
{
|
||||
m_triangles[i].vertices[0] = file->ReadUnsignedInt();
|
||||
m_triangles[i].vertices[1] = file->ReadUnsignedInt();
|
||||
|
@ -126,7 +126,7 @@ void StaticMeshFile::Load()
|
|||
m_numSubMeshes = file->ReadUnsignedInt();
|
||||
m_subMeshes = new StaticMeshFileSubMesh[m_numSubMeshes];
|
||||
ASSERT(m_subMeshes != NULL);
|
||||
for (uint32_t i = 0; i < m_numSubMeshes; ++i)
|
||||
for (uint i = 0; i < m_numSubMeshes; ++i)
|
||||
{
|
||||
StaticMeshFileSubMesh *subMesh = &m_subMeshes[i];
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ struct StaticMeshFileMaterial
|
|||
struct StaticMeshFileSubMesh
|
||||
{
|
||||
stl::string name;
|
||||
uint32_t material;
|
||||
uint32_t numTriangles;
|
||||
uint material;
|
||||
uint numTriangles;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
/**
|
||||
* @return the total number of vertices this mesh contains
|
||||
*/
|
||||
uint32_t GetNumVertices() const { return m_numVertices; }
|
||||
uint GetNumVertices() const { return m_numVertices; }
|
||||
|
||||
/**
|
||||
* @return pointer to the mesh's vertex data
|
||||
|
@ -59,7 +59,7 @@ public:
|
|||
/**
|
||||
* @return the total number of normals this mesh contains
|
||||
*/
|
||||
uint32_t GetNumNormals() const { return m_numNormals; }
|
||||
uint GetNumNormals() const { return m_numNormals; }
|
||||
|
||||
/**
|
||||
* @return pointer to the mesh's normal data, or NULL if none exist
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
/**
|
||||
* @return the total number of texture coordinates this mesh contains
|
||||
*/
|
||||
uint32_t GetNumTexCoords() const { return m_numTexCoords; }
|
||||
uint GetNumTexCoords() const { return m_numTexCoords; }
|
||||
|
||||
/**
|
||||
* @return pointer to the mesh's texture coordinates, or NULL if none exist
|
||||
|
@ -79,7 +79,7 @@ public:
|
|||
/**
|
||||
* @return the total number of materials that this mesh contains
|
||||
*/
|
||||
uint32_t GetNumMaterials() const { return m_numMaterials; }
|
||||
uint GetNumMaterials() const { return m_numMaterials; }
|
||||
|
||||
/**
|
||||
* @return pointer to the mesh's materials
|
||||
|
@ -89,7 +89,7 @@ public:
|
|||
/**
|
||||
* @return the total number of triangles that this mesh contains
|
||||
*/
|
||||
uint32_t GetNumTriangles() const { return m_numTriangles; }
|
||||
uint GetNumTriangles() const { return m_numTriangles; }
|
||||
|
||||
/**
|
||||
* @return pointer to the mesh's triangles
|
||||
|
@ -99,7 +99,7 @@ public:
|
|||
/**
|
||||
* @return the total number of sub-meshes (subsets) this mesh contains
|
||||
*/
|
||||
uint32_t GetNumSubMeshes() const { return m_numSubMeshes; }
|
||||
uint GetNumSubMeshes() const { return m_numSubMeshes; }
|
||||
|
||||
/**
|
||||
* @return pointer to the mesh's sub-meshes (subsets)
|
||||
|
@ -109,17 +109,17 @@ public:
|
|||
private:
|
||||
void Load();
|
||||
|
||||
uint32_t m_numVertices;
|
||||
uint m_numVertices;
|
||||
Vector3 *m_vertices;
|
||||
uint32_t m_numNormals;
|
||||
uint m_numNormals;
|
||||
Vector3 *m_normals;
|
||||
uint32_t m_numTexCoords;
|
||||
uint m_numTexCoords;
|
||||
Vector2 *m_texCoords;
|
||||
uint32_t m_numMaterials;
|
||||
uint m_numMaterials;
|
||||
StaticMeshFileMaterial *m_materials;
|
||||
uint32_t m_numTriangles;
|
||||
uint m_numTriangles;
|
||||
StaticMeshTriangle *m_triangles;
|
||||
uint32_t m_numSubMeshes;
|
||||
uint m_numSubMeshes;
|
||||
StaticMeshFileSubMesh *m_subMeshes;
|
||||
};
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ StaticMeshInstance::StaticMeshInstance(StaticMesh *mesh)
|
|||
m_textures = new Texture*[m_mesh->GetNumSubsets()];
|
||||
ASSERT(m_textures != NULL);
|
||||
|
||||
for (uint32_t i = 0; i < m_mesh->GetNumSubsets(); ++i)
|
||||
for (uint i = 0; i < m_mesh->GetNumSubsets(); ++i)
|
||||
ResetTexture(i);
|
||||
}
|
||||
}
|
||||
|
@ -32,13 +32,13 @@ StaticMeshInstance::~StaticMeshInstance()
|
|||
SAFE_DELETE(m_renderState);
|
||||
}
|
||||
|
||||
void StaticMeshInstance::SetTexture(uint32_t index, Texture *texture)
|
||||
void StaticMeshInstance::SetTexture(uint index, Texture *texture)
|
||||
{
|
||||
|
||||
m_textures[index] = texture;
|
||||
}
|
||||
|
||||
void StaticMeshInstance::ResetTexture(uint32_t index)
|
||||
void StaticMeshInstance::ResetTexture(uint index)
|
||||
{
|
||||
m_textures[index] = m_mesh->GetSubset(index)->GetTexture();
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
* @return the number of textures/materials that the mesh this instance
|
||||
* is for contains
|
||||
*/
|
||||
uint32_t GetNumTextures() const { return m_mesh->GetNumSubsets(); }
|
||||
uint GetNumTextures() const { return m_mesh->GetNumSubsets(); }
|
||||
|
||||
/**
|
||||
* Gets the texture for the specified subset/material.
|
||||
|
@ -45,21 +45,21 @@ public:
|
|||
* texture for
|
||||
* @return the texture, or NULL if one is not set
|
||||
*/
|
||||
Texture* GetTexture(uint32_t index) const { return m_textures[index]; }
|
||||
Texture* GetTexture(uint index) const { return m_textures[index]; }
|
||||
|
||||
/**
|
||||
* Sets a new texture for the specified subset/material.
|
||||
* @param index the index of the subset/material to change the texture for
|
||||
* @param texture the new texture to set, or NULL to set no texture
|
||||
*/
|
||||
void SetTexture(uint32_t index, Texture *texture);
|
||||
void SetTexture(uint index, Texture *texture);
|
||||
|
||||
/**
|
||||
* Resets the texture for the specified subset/material back to the mesh's
|
||||
* original texture.
|
||||
* @param index the index of the subset/material to reset the texture for
|
||||
*/
|
||||
void ResetTexture(uint32_t index);
|
||||
void ResetTexture(uint index);
|
||||
|
||||
private:
|
||||
StaticMesh *m_mesh;
|
||||
|
|
|
@ -28,13 +28,13 @@ void StaticMeshRenderer::Render(GraphicsDevice *graphicsDevice, StaticMeshInstan
|
|||
|
||||
void StaticMeshRenderer::RenderAllSubsets(GraphicsDevice *graphicsDevice, StaticMeshInstance *instance)
|
||||
{
|
||||
for (uint32_t i = 0; i < instance->GetMesh()->GetNumSubsets(); ++i)
|
||||
for (uint i = 0; i < instance->GetMesh()->GetNumSubsets(); ++i)
|
||||
RenderSubset(graphicsDevice, instance->GetMesh()->GetSubset(i), instance->GetTexture(i));
|
||||
}
|
||||
|
||||
void StaticMeshRenderer::RenderAllSubsetsTextureless(GraphicsDevice *graphicsDevice, StaticMeshInstance *instance)
|
||||
{
|
||||
for (uint32_t i = 0; i < instance->GetMesh()->GetNumSubsets(); ++i)
|
||||
for (uint i = 0; i < instance->GetMesh()->GetNumSubsets(); ++i)
|
||||
RenderTexturelessSubset(graphicsDevice, instance->GetMesh()->GetSubset(i));
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "../../graphics/texture.h"
|
||||
#include "../../graphics/vertexbuffer.h"
|
||||
|
||||
StaticMeshSubset::StaticMeshSubset(uint32_t numTriangles, Texture *texture)
|
||||
StaticMeshSubset::StaticMeshSubset(uint numTriangles, Texture *texture)
|
||||
{
|
||||
VERTEX_ATTRIBS attribs[] = {
|
||||
VERTEX_POS_3D,
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
* @param numTriangles the number of triangles this subset will contain
|
||||
* @param texture the texture to be applied to this subset
|
||||
*/
|
||||
StaticMeshSubset(uint32_t numTriangles, Texture *texture);
|
||||
StaticMeshSubset(uint numTriangles, Texture *texture);
|
||||
|
||||
virtual ~StaticMeshSubset();
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
*/
|
||||
struct StaticMeshTriangle
|
||||
{
|
||||
uint32_t vertices[3];
|
||||
uint32_t subMeshIndex;
|
||||
uint vertices[3];
|
||||
uint subMeshIndex;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
#include "input/mouse.h"
|
||||
#include "input/touchscreen.h"
|
||||
|
||||
const uint32_t DEFAULT_UPDATE_FREQUENCY = 60;
|
||||
const uint32_t DEFAULT_MAX_FRAMESKIP = 10;
|
||||
const uint DEFAULT_UPDATE_FREQUENCY = 60;
|
||||
const uint DEFAULT_MAX_FRAMESKIP = 10;
|
||||
|
||||
BaseGameApp::BaseGameApp()
|
||||
{
|
||||
|
@ -108,15 +108,15 @@ void BaseGameApp::Loop()
|
|||
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "Main loop started.\n");
|
||||
|
||||
uint32_t numUpdatesThisFrame;
|
||||
uint32_t numLoops = 0;
|
||||
uint32_t timeElapsed = 0;
|
||||
uint numUpdatesThisFrame;
|
||||
uint numLoops = 0;
|
||||
uint timeElapsed = 0;
|
||||
|
||||
uint32_t updateTime = 0;
|
||||
uint32_t renderTime = 0;
|
||||
uint updateTime = 0;
|
||||
uint renderTime = 0;
|
||||
|
||||
m_nextUpdateAt = GetTicks();
|
||||
uint32_t currentTime = GetTicks();
|
||||
uint currentTime = GetTicks();
|
||||
|
||||
while (!m_stop)
|
||||
{
|
||||
|
@ -131,8 +131,8 @@ void BaseGameApp::Loop()
|
|||
}
|
||||
else
|
||||
{
|
||||
uint32_t newTime = GetTicks();
|
||||
uint32_t frameTime = newTime - currentTime;
|
||||
uint newTime = GetTicks();
|
||||
uint frameTime = newTime - currentTime;
|
||||
currentTime = newTime;
|
||||
timeElapsed += frameTime;
|
||||
|
||||
|
@ -168,7 +168,7 @@ void BaseGameApp::Loop()
|
|||
if (numUpdatesThisFrame > 0)
|
||||
m_isRunningSlowly = TRUE;
|
||||
|
||||
uint32_t before = GetTicks();
|
||||
uint before = GetTicks();
|
||||
OnUpdate(m_fixedUpdateInterval);
|
||||
updateTime += GetTicks() - before;
|
||||
|
||||
|
@ -183,7 +183,7 @@ void BaseGameApp::Loop()
|
|||
|
||||
if (m_isDirty && m_window->IsActive() && m_window->HasGLContext())
|
||||
{
|
||||
uint32_t before = GetTicks();
|
||||
uint before = GetTicks();
|
||||
OnRender();
|
||||
m_window->Flip();
|
||||
renderTime += GetTicks() - before;
|
||||
|
@ -283,7 +283,7 @@ void BaseGameApp::OnUpdate(float delta)
|
|||
InternalUpdate();
|
||||
}
|
||||
|
||||
void BaseGameApp::SetUpdateFrequency(uint32_t targetFrequency)
|
||||
void BaseGameApp::SetUpdateFrequency(uint targetFrequency)
|
||||
{
|
||||
m_targetUpdatesPerSecond = targetFrequency;
|
||||
m_ticksPerUpdate = 1000 / m_targetUpdatesPerSecond;
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
* @return the number of frames that were rendered and updated during the last second
|
||||
* (this number includes skipped renders/updates in it's count)
|
||||
*/
|
||||
uint32_t GetFPS() const { return m_fps; }
|
||||
uint GetFPS() const { return m_fps; }
|
||||
|
||||
/**
|
||||
* @return average time in seconds that each frame took during the last second
|
||||
|
@ -80,22 +80,22 @@ public:
|
|||
/**
|
||||
* @return total time in milliseconds that rendering took during the last second
|
||||
*/
|
||||
uint32_t GetRenderTime() const { return m_renderTime; }
|
||||
uint GetRenderTime() const { return m_renderTime; }
|
||||
|
||||
/**
|
||||
* @return total time in milliseconds that updating game logic took during the last second
|
||||
*/
|
||||
uint32_t GetUpdateTime() const { return m_updateTime; }
|
||||
uint GetUpdateTime() const { return m_updateTime; }
|
||||
|
||||
/**
|
||||
* @return the number of frames rendered during the last second
|
||||
*/
|
||||
uint32_t GetRendersPerSecond() const { return m_rendersPerSecond; }
|
||||
uint GetRendersPerSecond() const { return m_rendersPerSecond; }
|
||||
|
||||
/**
|
||||
* @return the number of game logic updates during the last second
|
||||
*/
|
||||
uint32_t GetUpdatesPerSecond() const { return m_updatesPerSecond; }
|
||||
uint GetUpdatesPerSecond() const { return m_updatesPerSecond; }
|
||||
|
||||
/**
|
||||
* @return TRUE if the main loop is running behind
|
||||
|
@ -107,13 +107,13 @@ public:
|
|||
* Sets the desired frames per second to run the main loop at.
|
||||
* @param targetFrequency the number of frames to run the main loop at
|
||||
*/
|
||||
void SetUpdateFrequency(uint32_t targetFrequency);
|
||||
void SetUpdateFrequency(uint targetFrequency);
|
||||
|
||||
/**
|
||||
* Sets the maximum number of frames to skip rendering per loop if the main loop is running slowly.
|
||||
* @param frameSkip the maximum number of frames to skip rendering per loop
|
||||
*/
|
||||
void SetMaxFrameSkip(uint32_t frameSkip) { m_maxFrameSkip = frameSkip; }
|
||||
void SetMaxFrameSkip(uint frameSkip) { m_maxFrameSkip = frameSkip; }
|
||||
|
||||
/**
|
||||
* Resets the time checking that determines if the main loop is running slowly.
|
||||
|
@ -128,7 +128,7 @@ public:
|
|||
*/
|
||||
void Invalidate() { m_isDirty = TRUE; }
|
||||
|
||||
unsigned int GetTicks() const { return m_system->GetTicks(); }
|
||||
uint GetTicks() const { return m_system->GetTicks(); }
|
||||
|
||||
/**
|
||||
* @return TRUE if the app currently is active and has input focus
|
||||
|
@ -214,20 +214,20 @@ private:
|
|||
BOOL m_stop;
|
||||
BOOL m_isPaused;
|
||||
|
||||
uint32_t m_fps;
|
||||
uint m_fps;
|
||||
float m_frameTime;
|
||||
uint32_t m_numRenders;
|
||||
uint32_t m_rendersPerSecond;
|
||||
uint32_t m_numUpdates;
|
||||
uint32_t m_updatesPerSecond;
|
||||
uint32_t m_renderTime;
|
||||
uint32_t m_updateTime;
|
||||
uint m_numRenders;
|
||||
uint m_rendersPerSecond;
|
||||
uint m_numUpdates;
|
||||
uint m_updatesPerSecond;
|
||||
uint m_renderTime;
|
||||
uint m_updateTime;
|
||||
|
||||
uint32_t m_targetUpdatesPerSecond;
|
||||
uint32_t m_ticksPerUpdate;
|
||||
uint32_t m_maxFrameSkip;
|
||||
uint m_targetUpdatesPerSecond;
|
||||
uint m_ticksPerUpdate;
|
||||
uint m_maxFrameSkip;
|
||||
float m_fixedUpdateInterval;
|
||||
uint32_t m_nextUpdateAt;
|
||||
uint m_nextUpdateAt;
|
||||
BOOL m_isRunningSlowly;
|
||||
|
||||
BOOL m_isDirty;
|
||||
|
|
|
@ -100,7 +100,7 @@ inline void ToggleBit(T1 bit, T2 &bitfield)
|
|||
* Seeds the system random number generator
|
||||
* @param seed the value to seed the random number generator with
|
||||
*/
|
||||
void SeedRnd(int32_t seed);
|
||||
void SeedRnd(int seed);
|
||||
|
||||
/**
|
||||
* Returns a random integer.
|
||||
|
@ -108,7 +108,7 @@ void SeedRnd(int32_t seed);
|
|||
* @param high the high end of the range to generate a random integer within
|
||||
* @return the generated random integer
|
||||
*/
|
||||
int32_t Rnd(int32_t low, int32_t high);
|
||||
int Rnd(int low, int high);
|
||||
|
||||
float Rnd(float low, float high);
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
/**
|
||||
* @return the number of references currently being held for this content
|
||||
*/
|
||||
uint32_t GetNumReferences() const { return m_referenceCount; }
|
||||
uint GetNumReferences() const { return m_referenceCount; }
|
||||
|
||||
private:
|
||||
/**
|
||||
|
@ -55,7 +55,7 @@ private:
|
|||
|
||||
BOOL m_wasLoadedByContentLoader;
|
||||
BOOL m_isReferenceCounted;
|
||||
uint32_t m_referenceCount;
|
||||
uint m_referenceCount;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -150,8 +150,8 @@ void ContentLoaderMapStoreBase<T>::Free(ContentStoreItor &itor, BOOL force, BOOL
|
|||
// if this is being forced, we need to manually decrease the Content's
|
||||
// internal reference counter (or the destructor will have a fit).
|
||||
// I suppose this is probably kind of "hack-ish"...
|
||||
uint32_t numToRelease = itor->second.content->GetNumReferences();
|
||||
for (uint32_t i = 0; i < numToRelease; ++i)
|
||||
uint numToRelease = itor->second.content->GetNumReferences();
|
||||
for (uint i = 0; i < numToRelease; ++i)
|
||||
ContentLoaderBase::ReleaseReference(itor->second.content);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ void SpriteFontLoader::OnNewContext()
|
|||
if (font->GetTexture() == NULL)
|
||||
{
|
||||
stl::string filename;
|
||||
uint8_t size = 0;
|
||||
uint size = 0;
|
||||
|
||||
DecomposeFilename(itor->first, filename, size);
|
||||
|
||||
|
@ -77,7 +77,7 @@ void SpriteFontLoader::OnLostContext()
|
|||
SpriteFont* SpriteFontLoader::LoadContent(const stl::string &file, const ContentParam *params)
|
||||
{
|
||||
stl::string filename;
|
||||
uint8_t size = 0;
|
||||
uint size = 0;
|
||||
|
||||
DecomposeFilename(file, filename, size);
|
||||
|
||||
|
@ -105,7 +105,7 @@ stl::string SpriteFontLoader::ProcessFilename(const stl::string &filename, const
|
|||
return buffer;
|
||||
}
|
||||
|
||||
void SpriteFontLoader::DecomposeFilename(const stl::string &filename, stl::string &outFilename, uint8_t &outSize) const
|
||||
void SpriteFontLoader::DecomposeFilename(const stl::string &filename, stl::string &outFilename, uint &outSize) const
|
||||
{
|
||||
ASSERT(filename.length() > 0);
|
||||
|
||||
|
@ -114,10 +114,10 @@ void SpriteFontLoader::DecomposeFilename(const stl::string &filename, stl::strin
|
|||
|
||||
// break it up into filename and font size
|
||||
outFilename = filename.substr(0, startOfSize);
|
||||
outSize = (uint8_t)atoi(filename.substr(startOfSize + 1).c_str());
|
||||
outSize = (uint)atoi(filename.substr(startOfSize + 1).c_str());
|
||||
}
|
||||
|
||||
SpriteFont* SpriteFontLoader::Load(File *file, uint8_t size, SpriteFont *existing) const
|
||||
SpriteFont* SpriteFontLoader::Load(File *file, uint size, SpriteFont *existing) const
|
||||
{
|
||||
LOG_INFO(LOGCAT_ASSETS, "%s: loading \"%s:%d\"\n", GetLoggingTag(), file->GetFilename().c_str(), size);
|
||||
|
||||
|
@ -271,7 +271,7 @@ void SpriteFontLoader::FreeContent(SpriteFont *content)
|
|||
SAFE_DELETE(content);
|
||||
}
|
||||
|
||||
BOOL SpriteFontLoader::GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uint8_t size, SpriteFontGlyphMetrics *metrics) const
|
||||
BOOL SpriteFontLoader::GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uint size, SpriteFontGlyphMetrics *metrics) const
|
||||
{
|
||||
ASSERT(metrics != NULL);
|
||||
|
||||
|
|
|
@ -77,10 +77,10 @@ protected:
|
|||
void FreeContent(SpriteFont *content);
|
||||
|
||||
private:
|
||||
void DecomposeFilename(const stl::string &filename, stl::string &outFilename, uint8_t &outSize) const;
|
||||
SpriteFont* Load(File *file, uint8_t size, SpriteFont *existing) const;
|
||||
void DecomposeFilename(const stl::string &filename, stl::string &outFilename, uint &outSize) const;
|
||||
SpriteFont* Load(File *file, uint size, SpriteFont *existing) const;
|
||||
|
||||
BOOL GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uint8_t size, SpriteFontGlyphMetrics *glyphMetrics) const;
|
||||
BOOL GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uint size, SpriteFontGlyphMetrics *glyphMetrics) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
struct SpriteFontParam : public ContentParam
|
||||
{
|
||||
uint8_t size;
|
||||
uint size;
|
||||
|
||||
SpriteFontParam(uint8_t size)
|
||||
SpriteFontParam(uint size)
|
||||
{
|
||||
this->size = size;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "log.h"
|
||||
#include "util/msgbox.h"
|
||||
|
||||
const int32_t DEBUG_ASSERT_BUFFER_SIZE = 2048;
|
||||
const int DEBUG_ASSERT_BUFFER_SIZE = 2048;
|
||||
|
||||
void DebugInit()
|
||||
{
|
||||
|
|
|
@ -56,7 +56,7 @@ const stl::string& GetAppPath()
|
|||
}
|
||||
g_appPath = path + "/";
|
||||
#elif __APPLE__
|
||||
uint32_t size = MAXPATHLEN;
|
||||
unsigned int size = MAXPATHLEN;
|
||||
char *pathBuffer = new char[size];
|
||||
int result = _NSGetExecutablePath(pathBuffer, &size);
|
||||
if (result == -1)
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
void SeedRnd(int32_t seed)
|
||||
void SeedRnd(int seed)
|
||||
{
|
||||
srand(seed);
|
||||
}
|
||||
|
||||
int32_t Rnd(int32_t low, int32_t high)
|
||||
int Rnd(int low, int high)
|
||||
{
|
||||
return rand() % ((high - low) + 1) + low;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
* @param height the new window height
|
||||
* @return TRUE if successful, FALSE if not
|
||||
*/
|
||||
virtual BOOL Resize(uint16_t width, uint16_t height) = 0;
|
||||
virtual BOOL Resize(uint width, uint height) = 0;
|
||||
|
||||
/**
|
||||
* Toggles between fullscreen and windowed mode.
|
||||
|
@ -57,12 +57,12 @@ public:
|
|||
/**
|
||||
* @return the current width of the window's client area
|
||||
*/
|
||||
virtual uint16_t GetWidth() const = 0;
|
||||
virtual uint GetWidth() const = 0;
|
||||
|
||||
/**
|
||||
* @return the current height of the window's client area
|
||||
*/
|
||||
virtual uint16_t GetHeight() const = 0;
|
||||
virtual uint GetHeight() const = 0;
|
||||
|
||||
/**
|
||||
* @return the current dimensions of the window's client area
|
||||
|
@ -72,7 +72,7 @@ public:
|
|||
/**
|
||||
* @return the bits per pixel display format of the window's graphics context
|
||||
*/
|
||||
virtual uint8_t GetBPP() const = 0;
|
||||
virtual uint GetBPP() const = 0;
|
||||
|
||||
/**
|
||||
* @return TRUE if the current window is windowed, FALSE if fullscreen
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "../math/matrix4x4.h"
|
||||
#include "../math/vector3.h"
|
||||
|
||||
const uint32_t VERTICES_PER_SPRITE = 6;
|
||||
const uint VERTICES_PER_SPRITE = 6;
|
||||
|
||||
const size_t PRINTF_BUFFER_SIZE = 8096;
|
||||
char __billboardSpriteBatch_PrintfBuffer[PRINTF_BUFFER_SIZE + 1];
|
||||
|
@ -132,7 +132,7 @@ void BillboardSpriteBatch::Render(const Texture *texture, const Vector3 &positio
|
|||
AddSprite(type, texture, position, width, height, 0, 0, texture->GetWidth(), texture->GetHeight(), color);
|
||||
}
|
||||
|
||||
void BillboardSpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, float x, float y, float z, float width, float height, BILLBOARDSPRITE_TYPE type, const Color &color)
|
||||
void BillboardSpriteBatch::Render(const TextureAtlas *atlas, uint index, float x, float y, float z, float width, float height, BILLBOARDSPRITE_TYPE type, const Color &color)
|
||||
{
|
||||
const RectF *texCoords = &atlas->GetTile(index).texCoords;
|
||||
const Texture *texture = atlas->GetTexture();
|
||||
|
@ -140,7 +140,7 @@ void BillboardSpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, flo
|
|||
AddSprite(type, texture, Vector3(x, y, z), width, height, texCoords->left, texCoords->top, texCoords->right, texCoords->bottom, color);
|
||||
}
|
||||
|
||||
void BillboardSpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, const Vector3 &position, float width, float height, BILLBOARDSPRITE_TYPE type, const Color &color)
|
||||
void BillboardSpriteBatch::Render(const TextureAtlas *atlas, uint index, const Vector3 &position, float width, float height, BILLBOARDSPRITE_TYPE type, const Color &color)
|
||||
{
|
||||
const RectF *texCoords = &atlas->GetTile(index).texCoords;
|
||||
const Texture *texture = atlas->GetTexture();
|
||||
|
@ -157,8 +157,8 @@ void BillboardSpriteBatch::Render(const SpriteFont *font, const Vector3 &positio
|
|||
{
|
||||
size_t textLength = strlen(text);
|
||||
|
||||
uint16_t textWidth = 0;
|
||||
uint16_t textHeight = 0;
|
||||
uint textWidth = 0;
|
||||
uint textHeight = 0;
|
||||
font->MeasureString(&textWidth, &textHeight, text);
|
||||
|
||||
// the x,y,z coordinate specified is used as the position to center the
|
||||
|
@ -222,7 +222,7 @@ void BillboardSpriteBatch::Printf(const SpriteFont *font, const Vector3 &positio
|
|||
Render(font, position, type, color, pixelScale, __billboardSpriteBatch_PrintfBuffer);
|
||||
}
|
||||
|
||||
void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Texture *texture, const Vector3 &position, float width, float height, uint16_t sourceLeft, uint16_t sourceTop, uint16_t sourceRight, uint16_t sourceBottom, const Color &color)
|
||||
void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Texture *texture, const Vector3 &position, float width, float height, uint sourceLeft, uint sourceTop, uint sourceRight, uint sourceBottom, const Color &color)
|
||||
{
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
Matrix4x4 transform = GetTransformFor(type, position);
|
||||
|
@ -242,13 +242,13 @@ void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Texture *t
|
|||
AddSprite(type, transform, texture, ZERO_VECTOR, width, height, texCoordLeft, texCoordTop, texCoordRight, texCoordBottom, color);
|
||||
}
|
||||
|
||||
void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Matrix4x4 &transform, const Texture *texture, const Vector3 &offset, float width, float height, uint16_t sourceLeft, uint16_t sourceTop, uint16_t sourceRight, uint16_t sourceBottom, const Color &color)
|
||||
void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Matrix4x4 &transform, const Texture *texture, const Vector3 &offset, float width, float height, uint sourceLeft, uint sourceTop, uint sourceRight, uint sourceBottom, const Color &color)
|
||||
{
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
|
||||
uint16_t sourceWidth = sourceRight - sourceLeft;
|
||||
uint sourceWidth = sourceRight - sourceLeft;
|
||||
ASSERT(sourceWidth > 0);
|
||||
uint16_t sourceHeight = sourceBottom - sourceTop;
|
||||
uint sourceHeight = sourceBottom - sourceTop;
|
||||
ASSERT(sourceHeight > 0);
|
||||
float texLeft = sourceLeft / (float)sourceWidth;
|
||||
float texTop = sourceTop / (float)sourceHeight;
|
||||
|
@ -268,9 +268,9 @@ void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Matrix4x4
|
|||
++m_currentSpritePointer;
|
||||
}
|
||||
|
||||
void BillboardSpriteBatch::SetSpriteInfo(uint32_t spriteIndex, BILLBOARDSPRITE_TYPE type, const Matrix4x4 &transform, const Texture *texture, const Vector3 &offset, float width, float height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color)
|
||||
void BillboardSpriteBatch::SetSpriteInfo(uint spriteIndex, BILLBOARDSPRITE_TYPE type, const Matrix4x4 &transform, const Texture *texture, const Vector3 &offset, float width, float height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color)
|
||||
{
|
||||
uint32_t base = spriteIndex * VERTICES_PER_SPRITE;
|
||||
uint base = spriteIndex * VERTICES_PER_SPRITE;
|
||||
|
||||
float halfWidth = width / 2.0f;
|
||||
float halfHeight = height / 2.0f;
|
||||
|
@ -343,10 +343,10 @@ void BillboardSpriteBatch::RenderQueue()
|
|||
m_graphicsDevice->BindVertexBuffer(m_vertices);
|
||||
|
||||
const Texture *currentTexture = NULL;
|
||||
uint32_t startOffset = 0;
|
||||
uint32_t stopOffset = 0;
|
||||
uint startOffset = 0;
|
||||
uint stopOffset = 0;
|
||||
|
||||
for (uint32_t i = 0; i < m_currentSpritePointer; ++i)
|
||||
for (uint i = 0; i < m_currentSpritePointer; ++i)
|
||||
{
|
||||
if (currentTexture != m_textures[i])
|
||||
{
|
||||
|
@ -369,11 +369,11 @@ void BillboardSpriteBatch::RenderQueue()
|
|||
m_graphicsDevice->UnbindVertexBuffer();
|
||||
}
|
||||
|
||||
void BillboardSpriteBatch::RenderQueueRange(const Texture *texture, uint32_t firstSprite, uint32_t lastSprite)
|
||||
void BillboardSpriteBatch::RenderQueueRange(const Texture *texture, uint firstSprite, uint lastSprite)
|
||||
{
|
||||
const int TRIANGLES_PER_SPRITE = 2;
|
||||
uint32_t vertexOffset = firstSprite * VERTICES_PER_SPRITE;
|
||||
uint32_t numTriangles = (lastSprite - firstSprite) * TRIANGLES_PER_SPRITE;
|
||||
uint vertexOffset = firstSprite * VERTICES_PER_SPRITE;
|
||||
uint numTriangles = (lastSprite - firstSprite) * TRIANGLES_PER_SPRITE;
|
||||
|
||||
m_graphicsDevice->BindTexture(texture);
|
||||
m_shader->SetTextureHasAlphaOnly(texture->GetFormat() == TEXTURE_FORMAT_ALPHA);
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
* @param type the type of billboard to render this texture as
|
||||
* @param color color to tint the texture with
|
||||
*/
|
||||
void Render(const TextureAtlas *atlas, uint32_t index, float x, float y, float z, float width, float height, BILLBOARDSPRITE_TYPE type = BILLBOARDSPRITE_SPHERICAL, const Color &color = COLOR_WHITE);
|
||||
void Render(const TextureAtlas *atlas, uint index, float x, float y, float z, float width, float height, BILLBOARDSPRITE_TYPE type = BILLBOARDSPRITE_SPHERICAL, const Color &color = COLOR_WHITE);
|
||||
|
||||
/**
|
||||
* Renders a texture atlas sub-texture / tile as a billboard. The billboard
|
||||
|
@ -118,7 +118,7 @@ public:
|
|||
* @param type the type of billboard to render this texture as
|
||||
* @param color color to tint the texture with
|
||||
*/
|
||||
void Render(const TextureAtlas *atlas, uint32_t index, const Vector3 &position, float width, float height, BILLBOARDSPRITE_TYPE type = BILLBOARDSPRITE_SPHERICAL, const Color &color = COLOR_WHITE);
|
||||
void Render(const TextureAtlas *atlas, uint index, const Vector3 &position, float width, float height, BILLBOARDSPRITE_TYPE type = BILLBOARDSPRITE_SPHERICAL, const Color &color = COLOR_WHITE);
|
||||
|
||||
/**
|
||||
* Renders text as series of billboards. The text will be centered on
|
||||
|
@ -183,20 +183,20 @@ public:
|
|||
void End();
|
||||
|
||||
private:
|
||||
void Initialize(GraphicsDevice *graphicsDevice, uint16_t maxSprites);
|
||||
void Initialize(GraphicsDevice *graphicsDevice, uint maxSprites);
|
||||
void InternalBegin(const RenderState *renderState, const BlendState *blendState, SpriteShader *shader);
|
||||
void AddSprite(BILLBOARDSPRITE_TYPE type, const Texture *texture, const Vector3 &position, float width, float height, uint16_t sourceLeft, uint16_t sourceTop, uint16_t sourceRight, uint16_t sourceBottom, const Color &color);
|
||||
void AddSprite(BILLBOARDSPRITE_TYPE type, const Texture *texture, const Vector3 &position, float width, float height, uint sourceLeft, uint sourceTop, uint sourceRight, uint sourceBottom, const Color &color);
|
||||
void AddSprite(BILLBOARDSPRITE_TYPE type, const Texture *texture, const Vector3 &position, float width, float height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color);
|
||||
void AddSprite(BILLBOARDSPRITE_TYPE type, const Matrix4x4 &transform, const Texture *texture, const Vector3 &offset, float width, float height, uint16_t sourceLeft, uint16_t sourceTop, uint16_t sourceRight, uint16_t sourceBottom, const Color &color);
|
||||
void AddSprite(BILLBOARDSPRITE_TYPE type, const Matrix4x4 &transform, const Texture *texture, const Vector3 &offset, float width, float height, uint sourceLeft, uint sourceTop, uint sourceRight, uint sourceBottom, const Color &color);
|
||||
void AddSprite(BILLBOARDSPRITE_TYPE type, const Matrix4x4 &transform, const Texture *texture, const Vector3 &offset, float width, float height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color);
|
||||
void SetSpriteInfo(uint32_t spriteIndex, BILLBOARDSPRITE_TYPE type, const Matrix4x4 &transform, const Texture *texture, const Vector3 &offset, float width, float height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color);
|
||||
void SetSpriteInfo(uint spriteIndex, BILLBOARDSPRITE_TYPE type, const Matrix4x4 &transform, const Texture *texture, const Vector3 &offset, float width, float height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color);
|
||||
void RenderQueue();
|
||||
void RenderQueueRange(const Texture *texture, uint32_t firstSprite, uint32_t lastSprite);
|
||||
void RenderQueueRange(const Texture *texture, uint firstSprite, uint lastSprite);
|
||||
|
||||
Matrix4x4 GetTransformFor(BILLBOARDSPRITE_TYPE type, const Vector3 &position) const;
|
||||
void CheckForNewSpriteSpace();
|
||||
|
||||
uint32_t m_currentSpriteCapacity;
|
||||
uint m_currentSpriteCapacity;
|
||||
GraphicsDevice *m_graphicsDevice;
|
||||
SpriteShader *m_shader;
|
||||
RenderState *m_renderState;
|
||||
|
@ -207,7 +207,7 @@ private:
|
|||
BlendState m_overrideBlendState;
|
||||
VertexBuffer *m_vertices;
|
||||
stl::vector<const Texture*> m_textures;
|
||||
uint32_t m_currentSpritePointer;
|
||||
uint m_currentSpritePointer;
|
||||
|
||||
Vector3 m_cameraPosition;
|
||||
Vector3 m_cameraForward;
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
/**
|
||||
* @return the number of elements contained in this buffer object
|
||||
*/
|
||||
virtual uint32_t GetNumElements() const = 0;
|
||||
virtual uint GetNumElements() const = 0;
|
||||
|
||||
/**
|
||||
* @return the size in bytes of each element of data in this buffer object
|
||||
|
@ -81,7 +81,7 @@ public:
|
|||
/**
|
||||
* @return the OpenGL buffer object ID for this buffer
|
||||
*/
|
||||
uint32_t GetBufferId() const { return m_bufferId; }
|
||||
uint GetBufferId() const { return m_bufferId; }
|
||||
|
||||
void OnNewContext();
|
||||
void OnLostContext();
|
||||
|
@ -124,7 +124,7 @@ private:
|
|||
|
||||
BUFFEROBJECT_TYPE m_type;
|
||||
BUFFEROBJECT_USAGE m_usage;
|
||||
uint32_t m_bufferId;
|
||||
uint m_bufferId;
|
||||
BOOL m_isDirty;
|
||||
size_t m_sizeInBytes;
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "texture.h"
|
||||
#include "../math/rect.h"
|
||||
|
||||
CustomTextureAtlas::CustomTextureAtlas(uint16_t textureWidth, uint16_t textureHeight, float texCoordEdgeOffset)
|
||||
CustomTextureAtlas::CustomTextureAtlas(uint textureWidth, uint textureHeight, float texCoordEdgeOffset)
|
||||
: TextureAtlas(textureWidth, textureHeight, texCoordEdgeOffset)
|
||||
{
|
||||
}
|
||||
|
@ -19,12 +19,12 @@ CustomTextureAtlas::~CustomTextureAtlas()
|
|||
{
|
||||
}
|
||||
|
||||
uint32_t CustomTextureAtlas::Add(const Rect &position)
|
||||
uint CustomTextureAtlas::Add(const Rect &position)
|
||||
{
|
||||
return Add(position.left, position.top, position.right, position.bottom);
|
||||
}
|
||||
|
||||
uint32_t CustomTextureAtlas::Add(uint16_t left, uint16_t top, uint16_t right, uint16_t bottom)
|
||||
uint CustomTextureAtlas::Add(uint left, uint top, uint right, uint bottom)
|
||||
{
|
||||
ASSERT(right <= GetWidth());
|
||||
ASSERT(bottom <= GetHeight());
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
* help alleviate "texture bleeding"
|
||||
* issues while rendering
|
||||
*/
|
||||
CustomTextureAtlas(uint16_t textureWidth, uint16_t textureHeight, float texCoordEdgeOffset = TEXCOORD_EDGE_BLEED_OFFSET);
|
||||
CustomTextureAtlas(uint textureWidth, uint textureHeight, float texCoordEdgeOffset = TEXCOORD_EDGE_BLEED_OFFSET);
|
||||
|
||||
/**
|
||||
* Creates a texture atlas object with the specified properties.
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
* @param position the pixel coordinates of the sub-texture / tile
|
||||
* @return the index of the new definition
|
||||
*/
|
||||
uint32_t Add(const Rect &position);
|
||||
uint Add(const Rect &position);
|
||||
|
||||
/**
|
||||
* Adds a new definition for a sub-texture / tile.
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
* @param bottom bottom Y coordinate of the sub-texture / tile
|
||||
* @return the index of the new definition
|
||||
*/
|
||||
uint32_t Add(uint16_t left, uint16_t top, uint16_t right, uint16_t bottom);
|
||||
uint Add(uint left, uint top, uint right, uint bottom);
|
||||
|
||||
/**
|
||||
* Clears all sub-texture / tile definitions.
|
||||
|
|
|
@ -39,7 +39,7 @@ BOOL Framebuffer::Initialize(GraphicsDevice *graphicsDevice)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL Framebuffer::Initialize(GraphicsDevice *graphicsDevice, uint16_t fixedWidth, uint16_t fixedHeight)
|
||||
BOOL Framebuffer::Initialize(GraphicsDevice *graphicsDevice, uint fixedWidth, uint fixedHeight)
|
||||
{
|
||||
ASSERT(fixedWidth != 0);
|
||||
ASSERT(fixedHeight != 0);
|
||||
|
@ -173,8 +173,8 @@ BOOL Framebuffer::AttachTexture(FRAMEBUFFER_DATA_TYPE type)
|
|||
if (attachmentType == 0)
|
||||
return FALSE;
|
||||
|
||||
uint16_t width = 0;
|
||||
uint16_t height = 0;
|
||||
uint width = 0;
|
||||
uint height = 0;
|
||||
GetDimensionsForAttachment(width, height);
|
||||
|
||||
Texture *attach = new Texture();
|
||||
|
@ -212,8 +212,8 @@ BOOL Framebuffer::ReCreateAndAttach(FramebufferTextureMap::iterator &itor, BOOL
|
|||
if (attachmentType == 0)
|
||||
return FALSE;
|
||||
|
||||
uint16_t width = 0;
|
||||
uint16_t height = 0;
|
||||
uint width = 0;
|
||||
uint height = 0;
|
||||
GetDimensionsForAttachment(width, height);
|
||||
|
||||
TEXTURE_FORMAT existingFormat = existing->GetFormat();
|
||||
|
@ -268,8 +268,8 @@ BOOL Framebuffer::AttachRenderbuffer(FRAMEBUFFER_DATA_TYPE type)
|
|||
if (attachmentType == 0)
|
||||
return FALSE;
|
||||
|
||||
uint16_t width = 0;
|
||||
uint16_t height = 0;
|
||||
uint width = 0;
|
||||
uint height = 0;
|
||||
GetDimensionsForAttachment(width, height);
|
||||
|
||||
Renderbuffer *attach = new Renderbuffer();
|
||||
|
@ -308,8 +308,8 @@ BOOL Framebuffer::ReCreateAndAttach(FramebufferRenderbufferMap::iterator &itor,
|
|||
if (attachmentType == 0)
|
||||
return FALSE;
|
||||
|
||||
uint16_t width = 0;
|
||||
uint16_t height = 0;
|
||||
uint width = 0;
|
||||
uint height = 0;
|
||||
GetDimensionsForAttachment(width, height);
|
||||
|
||||
FRAMEBUFFER_DATA_TYPE existingType = existing->GetType();
|
||||
|
@ -604,7 +604,7 @@ BOOL Framebuffer::RemoveRenderbuffer(Renderbuffer *renderbuffer)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void Framebuffer::GetDimensionsForAttachment(uint16_t &width, uint16_t &height) const
|
||||
void Framebuffer::GetDimensionsForAttachment(uint &width, uint &height) const
|
||||
{
|
||||
if (IsUsingFixedDimensions())
|
||||
{
|
||||
|
|
|
@ -25,9 +25,9 @@ public:
|
|||
void Release();
|
||||
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice);
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, uint16_t fixedWidth, uint16_t fixedHeight);
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, uint fixedWidth, uint fixedHeight);
|
||||
|
||||
uint32_t GetFramebufferName() const { return m_framebufferName; }
|
||||
uint GetFramebufferName() const { return m_framebufferName; }
|
||||
BOOL IsInvalidated() const { return m_framebufferName == 0; }
|
||||
BOOL IsUsingFixedDimensions() const { return (m_fixedWidth != 0 && m_fixedHeight != 0); }
|
||||
|
||||
|
@ -57,11 +57,11 @@ private:
|
|||
BOOL RemoveTexture(Texture *texture);
|
||||
BOOL RemoveRenderbuffer(Renderbuffer *renderbuffer);
|
||||
|
||||
void GetDimensionsForAttachment(uint16_t &width, uint16_t &height) const;
|
||||
void GetDimensionsForAttachment(uint &width, uint &height) const;
|
||||
|
||||
uint32_t m_framebufferName;
|
||||
uint16_t m_fixedWidth;
|
||||
uint16_t m_fixedHeight;
|
||||
uint m_framebufferName;
|
||||
uint m_fixedWidth;
|
||||
uint m_fixedHeight;
|
||||
ViewContext *m_viewContext;
|
||||
FramebufferRenderbufferMap m_renderbuffers;
|
||||
FramebufferTextureMap m_textures;
|
||||
|
|
|
@ -57,7 +57,7 @@ void GeometryDebugRenderer::Render(const BoundingBox &box, const Color &color)
|
|||
ASSERT(m_begunRendering == TRUE);
|
||||
ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 24));
|
||||
|
||||
uint32_t i = m_currentVertex;
|
||||
uint i = m_currentVertex;
|
||||
|
||||
// removed lines which are duplicated by more then one face
|
||||
// left and right faces don't need to be drawn at all (entirely duplicated lines)
|
||||
|
@ -103,7 +103,7 @@ void GeometryDebugRenderer::Render(const BoundingBox &box, const Color &color)
|
|||
m_vertices->SetPosition3(i++, box.min.x, box.min.y, box.min.z);
|
||||
|
||||
// fill in all the colours
|
||||
for (uint32_t j = m_currentVertex; j < i; ++j)
|
||||
for (uint j = m_currentVertex; j < i; ++j)
|
||||
m_vertices->SetColor(j, color);
|
||||
|
||||
m_currentVertex = i;
|
||||
|
@ -120,7 +120,7 @@ void GeometryDebugRenderer::Render(const BoundingSphere &sphere, const Color &co
|
|||
ASSERT(m_begunRendering == TRUE);
|
||||
ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 615));
|
||||
|
||||
uint32_t p = m_currentVertex;
|
||||
uint p = m_currentVertex;
|
||||
|
||||
float ax, ay, az;
|
||||
float bx, by, bz;
|
||||
|
@ -170,7 +170,7 @@ void GeometryDebugRenderer::Render(const BoundingSphere &sphere, const Color &co
|
|||
}
|
||||
|
||||
// fill in all the colours
|
||||
for (uint32_t i = m_currentVertex; i < p; ++i)
|
||||
for (uint i = m_currentVertex; i < p; ++i)
|
||||
m_vertices->SetColor(i, color);
|
||||
|
||||
m_currentVertex = p;
|
||||
|
|
|
@ -124,7 +124,7 @@ private:
|
|||
Color m_color1;
|
||||
Color m_color2;
|
||||
VertexBuffer *m_vertices;
|
||||
uint32_t m_currentVertex;
|
||||
uint m_currentVertex;
|
||||
|
||||
BOOL m_begunRendering;
|
||||
};
|
||||
|
|
|
@ -238,7 +238,7 @@ void GraphicsDevice::OnNewContext()
|
|||
|
||||
UnbindVertexBuffer();
|
||||
UnbindIndexBuffer();
|
||||
for (uint32_t i = 0; i < MAX_BOUND_TEXTURES; ++i)
|
||||
for (uint i = 0; i < MAX_BOUND_TEXTURES; ++i)
|
||||
UnbindTexture(i);
|
||||
UnbindShader();
|
||||
UnbindRenderbuffer();
|
||||
|
@ -313,7 +313,7 @@ Texture* GraphicsDevice::GetSolidColorTexture(const Color &color)
|
|||
return m_solidColorTextures->Get(color);
|
||||
}
|
||||
|
||||
void GraphicsDevice::BindTexture(const Texture *texture, uint32_t unit)
|
||||
void GraphicsDevice::BindTexture(const Texture *texture, uint unit)
|
||||
{
|
||||
ASSERT(unit < MAX_BOUND_TEXTURES);
|
||||
ASSERT(texture != NULL);
|
||||
|
@ -326,13 +326,13 @@ void GraphicsDevice::BindTexture(const Texture *texture, uint32_t unit)
|
|||
m_boundTextures[unit] = texture;
|
||||
}
|
||||
|
||||
void GraphicsDevice::BindSolidColorTexture(const Color &color, uint32_t unit)
|
||||
void GraphicsDevice::BindSolidColorTexture(const Color &color, uint unit)
|
||||
{
|
||||
Texture *texture = m_solidColorTextures->Get(color);
|
||||
BindTexture(texture, unit);
|
||||
}
|
||||
|
||||
void GraphicsDevice::UnbindTexture(uint32_t unit)
|
||||
void GraphicsDevice::UnbindTexture(uint unit)
|
||||
{
|
||||
ASSERT(unit < MAX_BOUND_TEXTURES);
|
||||
GL_CALL(glActiveTexture(GL_TEXTURE0 + unit));
|
||||
|
@ -346,7 +346,7 @@ void GraphicsDevice::UnbindTexture(const Texture *texture)
|
|||
if (texture == NULL)
|
||||
return;
|
||||
|
||||
for (uint32_t i = 0; i < MAX_BOUND_TEXTURES; ++i)
|
||||
for (uint i = 0; i < MAX_BOUND_TEXTURES; ++i)
|
||||
{
|
||||
if (m_boundTextures[i] == texture)
|
||||
UnbindTexture(i);
|
||||
|
@ -560,10 +560,10 @@ void GraphicsDevice::SetShaderVertexAttributes()
|
|||
ASSERT(m_enabledVertexAttribIndices.empty() == TRUE);
|
||||
ASSERT(m_boundVertexBuffer->GetNumAttributes() >= m_boundShader->GetNumAttributes());
|
||||
|
||||
uint32_t numAttributes = m_boundShader->GetNumAttributes();
|
||||
for (uint32_t i = 0; i < numAttributes; ++i)
|
||||
uint numAttributes = m_boundShader->GetNumAttributes();
|
||||
for (uint i = 0; i < numAttributes; ++i)
|
||||
{
|
||||
int32_t bufferAttribIndex = 0;
|
||||
int bufferAttribIndex = 0;
|
||||
if (m_boundShader->IsAttributeMappedToStandardType(i))
|
||||
{
|
||||
VERTEX_STANDARD_ATTRIBS standardType = m_boundShader->GetAttributeMappedStandardType(i);
|
||||
|
@ -575,10 +575,10 @@ void GraphicsDevice::SetShaderVertexAttributes()
|
|||
else
|
||||
bufferAttribIndex = m_boundShader->GetAttributeMappedBufferIndex(i);
|
||||
|
||||
uint32_t offset = 0;
|
||||
uint offset = 0;
|
||||
GLint size = 0;
|
||||
|
||||
const VertexBufferAttribute *bufferAttribInfo = m_boundVertexBuffer->GetAttributeInfo((uint32_t)bufferAttribIndex);
|
||||
const VertexBufferAttribute *bufferAttribInfo = m_boundVertexBuffer->GetAttributeInfo((uint)bufferAttribIndex);
|
||||
size = bufferAttribInfo->size;
|
||||
offset = bufferAttribInfo->offset;
|
||||
ASSERT(size != 0);
|
||||
|
@ -605,7 +605,7 @@ void GraphicsDevice::ClearSetShaderVertexAttributes()
|
|||
{
|
||||
while (!m_enabledVertexAttribIndices.empty())
|
||||
{
|
||||
uint32_t index = m_enabledVertexAttribIndices.back();
|
||||
uint index = m_enabledVertexAttribIndices.back();
|
||||
m_enabledVertexAttribIndices.pop_back();
|
||||
GL_CALL(glDisableVertexAttribArray(index));
|
||||
}
|
||||
|
@ -621,7 +621,7 @@ void GraphicsDevice::RenderTriangles(const IndexBuffer *buffer)
|
|||
ASSERT(m_boundIndexBuffer == NULL);
|
||||
if (!m_shaderVertexAttribsSet)
|
||||
SetShaderVertexAttributes();
|
||||
int numVertices = buffer->GetNumElements();
|
||||
uint numVertices = buffer->GetNumElements();
|
||||
ASSERT(numVertices % 3 == 0);
|
||||
GL_CALL(glDrawElements(GL_TRIANGLES, numVertices, GL_UNSIGNED_SHORT, buffer->GetBuffer()));
|
||||
}
|
||||
|
@ -657,12 +657,12 @@ void GraphicsDevice::RenderTriangles()
|
|||
}
|
||||
}
|
||||
|
||||
void GraphicsDevice::RenderTriangles(uint32_t startVertex, uint32_t numTriangles)
|
||||
void GraphicsDevice::RenderTriangles(uint startVertex, uint numTriangles)
|
||||
{
|
||||
ASSERT(m_boundVertexBuffer != NULL);
|
||||
if (!m_shaderVertexAttribsSet)
|
||||
SetShaderVertexAttributes();
|
||||
uint32_t numVertices = numTriangles * 3;
|
||||
uint numVertices = numTriangles * 3;
|
||||
|
||||
if (m_boundIndexBuffer != NULL)
|
||||
{
|
||||
|
@ -672,7 +672,7 @@ void GraphicsDevice::RenderTriangles(uint32_t startVertex, uint32_t numTriangles
|
|||
// get the offset from the beginning of the index buffer to start rendering at
|
||||
// client buffer is just a raw pointer to the first index to use
|
||||
// IBO is basically the same idea, but the pointer "starts" at NULL and goes from there
|
||||
uint32_t indexOffset = startVertex * m_boundIndexBuffer->GetElementWidthInBytes();
|
||||
uint indexOffset = startVertex * m_boundIndexBuffer->GetElementWidthInBytes();
|
||||
const void *offset;
|
||||
if (m_boundIndexBuffer->IsClientSideBuffer())
|
||||
offset = ((int8_t*)m_boundIndexBuffer->GetBuffer() + indexOffset);
|
||||
|
@ -697,7 +697,7 @@ void GraphicsDevice::RenderLines(const IndexBuffer *buffer)
|
|||
ASSERT(m_boundIndexBuffer == NULL);
|
||||
if (!m_shaderVertexAttribsSet)
|
||||
SetShaderVertexAttributes();
|
||||
uint32_t numVertices = buffer->GetNumElements();
|
||||
uint numVertices = buffer->GetNumElements();
|
||||
ASSERT(numVertices % 2 == 0);
|
||||
GL_CALL(glDrawElements(GL_LINES, numVertices, GL_UNSIGNED_SHORT, buffer->GetBuffer()));
|
||||
}
|
||||
|
@ -711,7 +711,7 @@ void GraphicsDevice::RenderLines()
|
|||
if (m_boundIndexBuffer != NULL)
|
||||
{
|
||||
// using bound index buffer
|
||||
int numIndices = m_boundIndexBuffer->GetNumElements();
|
||||
uint numIndices = m_boundIndexBuffer->GetNumElements();
|
||||
ASSERT(numIndices % 2 == 0);
|
||||
|
||||
// get the offset from the beginning of the index buffer to start rendering at
|
||||
|
@ -733,12 +733,12 @@ void GraphicsDevice::RenderLines()
|
|||
}
|
||||
}
|
||||
|
||||
void GraphicsDevice::RenderLines(uint32_t startVertex, uint32_t numLines)
|
||||
void GraphicsDevice::RenderLines(uint startVertex, uint numLines)
|
||||
{
|
||||
ASSERT(m_boundVertexBuffer != NULL);
|
||||
if (!m_shaderVertexAttribsSet)
|
||||
SetShaderVertexAttributes();
|
||||
uint32_t numVertices = numLines * 2;
|
||||
uint numVertices = numLines * 2;
|
||||
|
||||
if (m_boundIndexBuffer != NULL)
|
||||
{
|
||||
|
@ -748,7 +748,7 @@ void GraphicsDevice::RenderLines(uint32_t startVertex, uint32_t numLines)
|
|||
// get the offset from the beginning of the index buffer to start rendering at
|
||||
// client buffer is just a raw pointer to the first index to use
|
||||
// IBO is basically the same idea, but the pointer "starts" at NULL and goes from there
|
||||
uint32_t indexOffset = startVertex * m_boundIndexBuffer->GetElementWidthInBytes();
|
||||
uint indexOffset = startVertex * m_boundIndexBuffer->GetElementWidthInBytes();
|
||||
const void *offset;
|
||||
if (m_boundIndexBuffer->IsClientSideBuffer())
|
||||
offset = ((int8_t*)m_boundIndexBuffer->GetBuffer() + indexOffset);
|
||||
|
@ -773,7 +773,7 @@ void GraphicsDevice::RenderPoints(const IndexBuffer *buffer)
|
|||
ASSERT(m_boundIndexBuffer == NULL);
|
||||
if (!m_shaderVertexAttribsSet)
|
||||
SetShaderVertexAttributes();
|
||||
uint32_t numVertices = buffer->GetNumElements();
|
||||
uint numVertices = buffer->GetNumElements();
|
||||
GL_CALL(glDrawElements(GL_POINTS, numVertices, GL_UNSIGNED_SHORT, buffer->GetBuffer()));
|
||||
}
|
||||
|
||||
|
@ -786,7 +786,7 @@ void GraphicsDevice::RenderPoints()
|
|||
if (m_boundIndexBuffer != NULL)
|
||||
{
|
||||
// using bound index buffer
|
||||
int numIndices = m_boundIndexBuffer->GetNumElements();
|
||||
uint numIndices = m_boundIndexBuffer->GetNumElements();
|
||||
|
||||
// get the offset from the beginning of the index buffer to start rendering at
|
||||
// client buffer is just a raw pointer to the first index to use
|
||||
|
@ -806,7 +806,7 @@ void GraphicsDevice::RenderPoints()
|
|||
}
|
||||
}
|
||||
|
||||
void GraphicsDevice::RenderPoints(uint32_t startVertex, uint32_t numPoints)
|
||||
void GraphicsDevice::RenderPoints(uint startVertex, uint numPoints)
|
||||
{
|
||||
ASSERT(m_boundVertexBuffer != NULL);
|
||||
if (!m_shaderVertexAttribsSet)
|
||||
|
@ -820,7 +820,7 @@ void GraphicsDevice::RenderPoints(uint32_t startVertex, uint32_t numPoints)
|
|||
// get the offset from the beginning of the index buffer to start rendering at
|
||||
// client buffer is just a raw pointer to the first index to use
|
||||
// IBO is basically the same idea, but the pointer "starts" at NULL and goes from there
|
||||
uint32_t indexOffset = startVertex * m_boundIndexBuffer->GetElementWidthInBytes();
|
||||
uint indexOffset = startVertex * m_boundIndexBuffer->GetElementWidthInBytes();
|
||||
const void *offset;
|
||||
if (m_boundIndexBuffer->IsClientSideBuffer())
|
||||
offset = ((int8_t*)m_boundIndexBuffer->GetBuffer() + indexOffset);
|
||||
|
|
|
@ -35,7 +35,7 @@ class ViewContext;
|
|||
struct Color;
|
||||
|
||||
typedef stl::list<GraphicsContextResource*> ManagedResourceList;
|
||||
typedef stl::vector<uint32_t> EnabledVertexAttribList;
|
||||
typedef stl::vector<uint> EnabledVertexAttribList;
|
||||
|
||||
/**
|
||||
* Provides an abstraction over the underlying OpenGL context.
|
||||
|
@ -107,20 +107,20 @@ public:
|
|||
* @param texture the texture to bind
|
||||
* @param unit the texture unit to bind to
|
||||
*/
|
||||
void BindTexture(const Texture *texture, uint32_t unit = 0);
|
||||
void BindTexture(const Texture *texture, uint unit = 0);
|
||||
|
||||
/**
|
||||
* Binds a texture that is filled with the specified solid color.
|
||||
* @param color a color with which to find and bind a texture with
|
||||
* @param unit the texture unit that the solid color texture should be bound to
|
||||
*/
|
||||
void BindSolidColorTexture(const Color &color, uint32_t unit = 0);
|
||||
void BindSolidColorTexture(const Color &color, uint unit = 0);
|
||||
|
||||
/**
|
||||
* Unbinds the currently bound texture.
|
||||
* @param unit the texture unit to be unbound
|
||||
*/
|
||||
void UnbindTexture(uint32_t unit = 0);
|
||||
void UnbindTexture(uint unit = 0);
|
||||
|
||||
/**
|
||||
* Unbinds the specified texture only if it's bound already. If it's not
|
||||
|
@ -262,7 +262,7 @@ public:
|
|||
* @param startVertex the index of the first vertex to be rendered
|
||||
* @param numTriangles the number of triangles to be rendered
|
||||
*/
|
||||
void RenderTriangles(uint32_t startVertex, uint32_t numTriangles);
|
||||
void RenderTriangles(uint startVertex, uint numTriangles);
|
||||
|
||||
/**
|
||||
* Renders the currently bound vertex buffer as lines.
|
||||
|
@ -280,7 +280,7 @@ public:
|
|||
* @param startVertex the index of the first vertex to be rendered
|
||||
* @param numLines the number of lines to be rendered
|
||||
*/
|
||||
void RenderLines(uint32_t startVertex, uint32_t numLines);
|
||||
void RenderLines(uint startVertex, uint numLines);
|
||||
|
||||
/**
|
||||
* Renders the currently bound vertex buffer as points.
|
||||
|
@ -297,7 +297,7 @@ public:
|
|||
* @param startVertex the index of the first vertex to be rendered
|
||||
* @param numPoints the number of points to be rendered
|
||||
*/
|
||||
void RenderPoints(uint32_t startVertex, uint32_t numPoints);
|
||||
void RenderPoints(uint startVertex, uint numPoints);
|
||||
|
||||
/**
|
||||
* @return a debug geometry renderer
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
#include "texture.h"
|
||||
|
||||
GridTextureAtlas::GridTextureAtlas(uint16_t textureWidth, uint16_t textureHeight, uint16_t tileWidth, uint16_t tileHeight, uint16_t tileBorder, float texCoordEdgeOffset)
|
||||
GridTextureAtlas::GridTextureAtlas(uint textureWidth, uint textureHeight, uint tileWidth, uint tileHeight, uint tileBorder, float texCoordEdgeOffset)
|
||||
: TextureAtlas(textureWidth, textureHeight, texCoordEdgeOffset)
|
||||
{
|
||||
GenerateGrid(tileWidth, tileHeight, tileBorder);
|
||||
}
|
||||
|
||||
GridTextureAtlas::GridTextureAtlas(Texture *source, uint16_t tileWidth, uint16_t tileHeight, uint16_t tileBorder, float texCoordEdgeOffset)
|
||||
GridTextureAtlas::GridTextureAtlas(Texture *source, uint tileWidth, uint tileHeight, uint tileBorder, float texCoordEdgeOffset)
|
||||
: TextureAtlas(source, texCoordEdgeOffset)
|
||||
{
|
||||
GenerateGrid(tileWidth, tileHeight, tileBorder);
|
||||
|
@ -18,7 +18,7 @@ GridTextureAtlas::~GridTextureAtlas()
|
|||
{
|
||||
}
|
||||
|
||||
void GridTextureAtlas::GenerateGrid(uint16_t tileWidth, uint16_t tileHeight, uint16_t tileBorder)
|
||||
void GridTextureAtlas::GenerateGrid(uint tileWidth, uint tileHeight, uint tileBorder)
|
||||
{
|
||||
m_tileWidth = tileWidth;
|
||||
m_tileHeight = tileHeight;
|
||||
|
@ -26,14 +26,14 @@ void GridTextureAtlas::GenerateGrid(uint16_t tileWidth, uint16_t tileHeight, uin
|
|||
tileWidth += tileBorder;
|
||||
tileHeight += tileBorder;
|
||||
|
||||
uint16_t tilesX = (GetWidth() - tileBorder) / (m_tileWidth + tileBorder);
|
||||
uint16_t tilesY = (GetHeight() - tileBorder) / (m_tileHeight + tileBorder);
|
||||
uint tilesX = (GetWidth() - tileBorder) / (m_tileWidth + tileBorder);
|
||||
uint tilesY = (GetHeight() - tileBorder) / (m_tileHeight + tileBorder);
|
||||
|
||||
m_tiles.resize(tilesX * tilesY);
|
||||
|
||||
for (uint16_t y = 0; y < tilesY; ++y)
|
||||
for (uint y = 0; y < tilesY; ++y)
|
||||
{
|
||||
for (uint16_t x = 0; x < tilesX; ++x)
|
||||
for (uint x = 0; x < tilesX; ++x)
|
||||
{
|
||||
TextureAtlasTile *current = &m_tiles[(y * tilesX) + x];
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
* help alleviate "texture bleeding"
|
||||
* issues while rendering
|
||||
*/
|
||||
GridTextureAtlas(uint16_t textureWidth, uint16_t textureHeight, uint16_t tileWidth, uint16_t tileHeight, uint16_t tileBorder = 0, float texCoordEdgeOffset = TEXCOORD_EDGE_BLEED_OFFSET);
|
||||
GridTextureAtlas(uint textureWidth, uint textureHeight, uint tileWidth, uint tileHeight, uint tileBorder = 0, float texCoordEdgeOffset = TEXCOORD_EDGE_BLEED_OFFSET);
|
||||
|
||||
/**
|
||||
* Creates a texture atlas object with the specified properties.
|
||||
|
@ -39,25 +39,25 @@ public:
|
|||
* help alleviate "texture bleeding"
|
||||
* issues while rendering
|
||||
*/
|
||||
GridTextureAtlas(Texture *source, uint16_t tileWidth, uint16_t tileHeight, uint16_t tileBorder = 0, float texCoordEdgeOffset = TEXCOORD_EDGE_BLEED_OFFSET);
|
||||
GridTextureAtlas(Texture *source, uint tileWidth, uint tileHeight, uint tileBorder = 0, float texCoordEdgeOffset = TEXCOORD_EDGE_BLEED_OFFSET);
|
||||
|
||||
virtual ~GridTextureAtlas();
|
||||
|
||||
/**
|
||||
* @return width in pixels of each sub-texture / tile
|
||||
*/
|
||||
uint16_t GetTileWidth() const { return m_tileWidth; }
|
||||
uint GetTileWidth() const { return m_tileWidth; }
|
||||
|
||||
/**
|
||||
* @return height in pixels of each sub-texture / tile
|
||||
*/
|
||||
uint16_t GetTileHeight() const { return m_tileHeight; }
|
||||
uint GetTileHeight() const { return m_tileHeight; }
|
||||
|
||||
private:
|
||||
void GenerateGrid(uint16_t tileWidth, uint16_t tileHeight, uint16_t tileBorder);
|
||||
void GenerateGrid(uint tileWidth, uint tileHeight, uint tileBorder);
|
||||
|
||||
uint16_t m_tileWidth;
|
||||
uint16_t m_tileHeight;
|
||||
uint m_tileWidth;
|
||||
uint m_tileHeight;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -32,7 +32,7 @@ void Image::Release()
|
|||
}
|
||||
|
||||
|
||||
BOOL Image::Create(uint16_t width, uint16_t height, IMAGE_FORMAT format)
|
||||
BOOL Image::Create(uint width, uint height, IMAGE_FORMAT format)
|
||||
{
|
||||
ASSERT(m_pixels == NULL);
|
||||
if (m_pixels != NULL)
|
||||
|
@ -55,7 +55,7 @@ BOOL Image::Create(uint16_t width, uint16_t height, IMAGE_FORMAT format)
|
|||
if (bpp == 0)
|
||||
return FALSE;
|
||||
|
||||
size_t pixelsLength = (width * height) * (bpp / 8);
|
||||
uint pixelsLength = (width * height) * (bpp / 8);
|
||||
m_pixels = new uint8_t[pixelsLength];
|
||||
memset(m_pixels, 0, pixelsLength);
|
||||
|
||||
|
@ -77,7 +77,7 @@ BOOL Image::Create(const Image *source)
|
|||
return Create(source, 0, 0, source->GetWidth(), source->GetHeight());
|
||||
}
|
||||
|
||||
BOOL Image::Create(const Image *source, uint16_t x, uint16_t y, uint16_t width, uint16_t height)
|
||||
BOOL Image::Create(const Image *source, uint x, uint y, uint width, uint height)
|
||||
{
|
||||
ASSERT(m_pixels == NULL);
|
||||
if (m_pixels != NULL)
|
||||
|
@ -172,7 +172,7 @@ BOOL Image::Create(File *file)
|
|||
// copy from STB "owned" memory to our own, then free up the STB stuff
|
||||
// (this is kind of unnecessary, but I'd like this method to be the
|
||||
// *only* one that knows/cares about stb_image at all)
|
||||
size_t pixelsLength = (width * height) * componentsPerPixel;
|
||||
uint pixelsLength = (width * height) * componentsPerPixel;
|
||||
m_pixels = new uint8_t[pixelsLength];
|
||||
memcpy(m_pixels, pixels, pixelsLength);
|
||||
stbi_image_free(pixels);
|
||||
|
@ -187,7 +187,7 @@ BOOL Image::Create(File *file)
|
|||
}
|
||||
}
|
||||
|
||||
Color Image::GetColor(uint16_t x, uint16_t y) const
|
||||
Color Image::GetColor(uint x, uint y) const
|
||||
{
|
||||
ASSERT(m_format == IMAGE_FORMAT_RGB || m_format == IMAGE_FORMAT_RGBA);
|
||||
|
||||
|
@ -203,7 +203,7 @@ Color Image::GetColor(uint16_t x, uint16_t y) const
|
|||
}
|
||||
}
|
||||
|
||||
void Image::SetColor(uint16_t x, uint16_t y, const Color &color)
|
||||
void Image::SetColor(uint x, uint y, const Color &color)
|
||||
{
|
||||
ASSERT(m_format == IMAGE_FORMAT_RGB || m_format == IMAGE_FORMAT_RGBA);
|
||||
|
||||
|
@ -220,13 +220,13 @@ void Image::SetColor(uint16_t x, uint16_t y, const Color &color)
|
|||
}
|
||||
}
|
||||
|
||||
void Image::Copy(const Image *source, uint16_t destX, uint16_t destY)
|
||||
void Image::Copy(const Image *source, uint destX, uint destY)
|
||||
{
|
||||
ASSERT(source != NULL);
|
||||
Copy(source, 0, 0, source->GetWidth(), source->GetHeight(), destX, destY);
|
||||
}
|
||||
|
||||
void Image::Copy(const Image *source, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t destX, uint16_t destY)
|
||||
void Image::Copy(const Image *source, uint x, uint y, uint width, uint height, uint destX, uint destY)
|
||||
{
|
||||
ASSERT(source != NULL);
|
||||
if (source == NULL)
|
||||
|
@ -241,10 +241,10 @@ void Image::Copy(const Image *source, uint16_t x, uint16_t y, uint16_t width, ui
|
|||
uint8_t *sourcePixels = source->GetPixels() + source->GetOffsetFor(x, y);
|
||||
uint8_t *destPixels = m_pixels + GetOffsetFor(destX, destY);
|
||||
|
||||
size_t lineWidthInBytes = width * (m_bpp / 8);
|
||||
uint16_t numLinesToCopy = height;
|
||||
uint lineWidthInBytes = width * (m_bpp / 8);
|
||||
uint numLinesToCopy = height;
|
||||
|
||||
for (uint16_t i = 0; i < numLinesToCopy; ++i)
|
||||
for (uint i = 0; i < numLinesToCopy; ++i)
|
||||
{
|
||||
memcpy(destPixels, sourcePixels, lineWidthInBytes);
|
||||
sourcePixels += source->GetPitch();
|
||||
|
@ -261,14 +261,14 @@ void Image::Clear(const Color &color)
|
|||
{
|
||||
ASSERT(m_format == IMAGE_FORMAT_RGB || m_format == IMAGE_FORMAT_RGBA);
|
||||
|
||||
uint32_t sizeInBytes = GetSizeInBytes();
|
||||
uint sizeInBytes = GetSizeInBytes();
|
||||
uint8_t *pixel = m_pixels;
|
||||
|
||||
if (m_format == IMAGE_FORMAT_RGB)
|
||||
{
|
||||
ASSERT(sizeInBytes % 3 == 0);
|
||||
uint8_t dummy;
|
||||
for (uint32_t i = 0; i < sizeInBytes; i += 3)
|
||||
for (uint i = 0; i < sizeInBytes; i += 3)
|
||||
{
|
||||
color.ToInts(pixel, pixel + 1, pixel + 2, &dummy);
|
||||
pixel += 3;
|
||||
|
@ -277,7 +277,7 @@ void Image::Clear(const Color &color)
|
|||
else
|
||||
{
|
||||
ASSERT(sizeInBytes % 4 == 0);
|
||||
for (uint32_t i = 0; i < sizeInBytes; i += 4)
|
||||
for (uint i = 0; i < sizeInBytes; i += 4)
|
||||
{
|
||||
color.ToInts(pixel, pixel + 1, pixel + 2, pixel + 3);
|
||||
pixel += 4;
|
||||
|
@ -305,13 +305,13 @@ void Image::FlipVertically()
|
|||
// TODO: this is a naive implementation. fix so it can flip the image
|
||||
// one scanline at a time using the already allocated memory
|
||||
|
||||
size_t pixelsLength = (m_width * m_height) * (m_bpp / 8);
|
||||
uint pixelsLength = (m_width * m_height) * (m_bpp / 8);
|
||||
uint8_t *flippedPixels = new uint8_t[pixelsLength];
|
||||
|
||||
uint8_t *source = (m_pixels + pixelsLength) - m_pitch; // first pixel of the last line
|
||||
uint8_t *dest = flippedPixels; // first pixel of the first line
|
||||
|
||||
for (uint16_t y = 0; y < m_height; ++y)
|
||||
for (uint y = 0; y < m_height; ++y)
|
||||
{
|
||||
memcpy(dest, source, m_pitch);
|
||||
source -= m_pitch; // go up one line
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
* @param format the pixel format of the image
|
||||
* @return TRUE if successful
|
||||
*/
|
||||
BOOL Create(uint16_t width, uint16_t height, IMAGE_FORMAT format);
|
||||
BOOL Create(uint width, uint height, IMAGE_FORMAT format);
|
||||
|
||||
/**
|
||||
* Creates a copy of an image from another image object.
|
||||
|
@ -46,7 +46,7 @@ public:
|
|||
* @param height the height of the source region to copy
|
||||
* @return TRUE if successful
|
||||
*/
|
||||
BOOL Create(const Image *source, uint16_t x, uint16_t y, uint16_t width, uint16_t height);
|
||||
BOOL Create(const Image *source, uint x, uint y, uint width, uint height);
|
||||
|
||||
/**
|
||||
* Creates an image from an image file.
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
* @return offset into the raw image pixel data that corresponds
|
||||
* to the given X and Y coordinate on the image
|
||||
*/
|
||||
uint32_t GetOffsetFor(uint16_t x, uint16_t y) const;
|
||||
uint GetOffsetFor(uint x, uint y) const;
|
||||
|
||||
/**
|
||||
* Gets a pointer to the raw image pixel data beginning at the given
|
||||
|
@ -78,7 +78,7 @@ public:
|
|||
* @param y Y coordinate to get a pointer to
|
||||
* @return pointer to the raw image pixel data for this location
|
||||
*/
|
||||
uint8_t* Get(uint16_t x, uint16_t y) const;
|
||||
uint8_t* Get(uint x, uint y) const;
|
||||
|
||||
/**
|
||||
* Gets a filled color object that corresponds to the pixel located
|
||||
|
@ -87,7 +87,7 @@ public:
|
|||
* @param y Y coordinate to get the color of
|
||||
* @return color object containing the color of the specified pixel
|
||||
*/
|
||||
Color GetColor(uint16_t x, uint16_t y) const;
|
||||
Color GetColor(uint x, uint y) const;
|
||||
|
||||
/**
|
||||
* Sets the color of a pixel on the image.
|
||||
|
@ -95,7 +95,7 @@ public:
|
|||
* @param y Y coordinate of the pixel to set
|
||||
* @param color the color to set the pixel to
|
||||
*/
|
||||
void SetColor(uint16_t x, uint16_t y, const Color &color);
|
||||
void SetColor(uint x, uint y, const Color &color);
|
||||
|
||||
/**
|
||||
* Sets the color of a pixel on the image.
|
||||
|
@ -103,7 +103,7 @@ public:
|
|||
* @param y Y coordinate of the pixel to set
|
||||
* @param color the color (as a 32-bit hex value) to set the pixel to
|
||||
*/
|
||||
void SetColor(uint16_t x, uint16_t y, uint32_t color) { SetColor(x, y, Color::FromInt(color)); }
|
||||
void SetColor(uint x, uint y, uint32_t color) { SetColor(x, y, Color::FromInt(color)); }
|
||||
|
||||
/**
|
||||
* Copies a source image and draws it onto this image at the position
|
||||
|
@ -113,7 +113,7 @@ public:
|
|||
* @param destX the X coordinate to copy the source image to on this image
|
||||
* @param destY the Y coordinate to copy the source image to on this image
|
||||
*/
|
||||
void Copy(const Image *source, uint16_t destX, uint16_t destY);
|
||||
void Copy(const Image *source, uint destX, uint destY);
|
||||
|
||||
/**
|
||||
* Copies a source image and draws it onto this image at the position
|
||||
|
@ -127,22 +127,22 @@ public:
|
|||
* @param destX the X coordinate to copy the source image to on this image
|
||||
* @param destY the Y coordinate to copy the source image to on this image
|
||||
*/
|
||||
void Copy(const Image *source, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t destX, uint16_t destY);
|
||||
void Copy(const Image *source, uint x, uint y, uint width, uint height, uint destX, uint destY);
|
||||
|
||||
/**
|
||||
* @return the width of this image
|
||||
*/
|
||||
uint16_t GetWidth() const { return m_width; }
|
||||
uint GetWidth() const { return m_width; }
|
||||
|
||||
/**
|
||||
* @return the height of this image
|
||||
*/
|
||||
uint16_t GetHeight() const { return m_height; }
|
||||
uint GetHeight() const { return m_height; }
|
||||
|
||||
/**
|
||||
* @return the bits per pixel of this image's pixel data
|
||||
*/
|
||||
uint8_t GetBpp() const { return m_bpp; }
|
||||
uint GetBpp() const { return m_bpp; }
|
||||
|
||||
/**
|
||||
* @return the pixel format of this image
|
||||
|
@ -153,12 +153,12 @@ public:
|
|||
* @return the number of bytes equivalent to one horizontal line
|
||||
* of pixel data
|
||||
*/
|
||||
uint32_t GetPitch() const { return m_pitch; }
|
||||
uint GetPitch() const { return m_pitch; }
|
||||
|
||||
/**
|
||||
* @return the number of bytes the raw pixel data in this image
|
||||
*/
|
||||
uint32_t GetSizeInBytes() const;
|
||||
uint GetSizeInBytes() const;
|
||||
|
||||
/**
|
||||
* Zeros-out the pixel data for this image.
|
||||
|
@ -191,24 +191,24 @@ public:
|
|||
|
||||
private:
|
||||
uint8_t *m_pixels;
|
||||
uint32_t m_pitch;
|
||||
uint16_t m_width;
|
||||
uint16_t m_height;
|
||||
uint8_t m_bpp;
|
||||
uint m_pitch;
|
||||
uint m_width;
|
||||
uint m_height;
|
||||
uint m_bpp;
|
||||
IMAGE_FORMAT m_format;
|
||||
};
|
||||
|
||||
inline uint32_t Image::GetOffsetFor(uint16_t x, uint16_t y) const
|
||||
inline uint Image::GetOffsetFor(uint x, uint y) const
|
||||
{
|
||||
return (x + (y * m_width)) * (m_bpp / 8);
|
||||
}
|
||||
|
||||
inline uint8_t* Image::Get(uint16_t x, uint16_t y) const
|
||||
inline uint8_t* Image::Get(uint x, uint y) const
|
||||
{
|
||||
return m_pixels + GetOffsetFor(x, y);
|
||||
}
|
||||
|
||||
inline uint32_t Image::GetSizeInBytes() const
|
||||
inline uint Image::GetSizeInBytes() const
|
||||
{
|
||||
return (m_width * m_height) * (m_bpp / 8);
|
||||
}
|
||||
|
|
|
@ -18,12 +18,12 @@ void IndexBuffer::Release()
|
|||
BufferObject::Release();
|
||||
}
|
||||
|
||||
BOOL IndexBuffer::Initialize(uint32_t numIndices, BUFFEROBJECT_USAGE usage)
|
||||
BOOL IndexBuffer::Initialize(uint numIndices, BUFFEROBJECT_USAGE usage)
|
||||
{
|
||||
return Initialize(NULL, numIndices, usage);
|
||||
}
|
||||
|
||||
BOOL IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, uint32_t numIndices, BUFFEROBJECT_USAGE usage)
|
||||
BOOL IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, uint numIndices, BUFFEROBJECT_USAGE usage)
|
||||
{
|
||||
ASSERT(m_buffer.size() == 0);
|
||||
if (m_buffer.size() > 0)
|
||||
|
@ -67,12 +67,12 @@ BOOL IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, const IndexBuffer *
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void IndexBuffer::Set(const uint16_t *indices, uint32_t numIndices)
|
||||
void IndexBuffer::Set(const uint16_t *indices, uint numIndices)
|
||||
{
|
||||
memcpy(&m_buffer[0], indices, GetNumElements() * GetElementWidthInBytes());
|
||||
}
|
||||
|
||||
void IndexBuffer::Resize(uint32_t numIndices)
|
||||
void IndexBuffer::Resize(uint numIndices)
|
||||
{
|
||||
ASSERT(numIndices > 0);
|
||||
if (numIndices == 0)
|
||||
|
@ -87,9 +87,9 @@ void IndexBuffer::Resize(uint32_t numIndices)
|
|||
--m_currentIndex;
|
||||
}
|
||||
|
||||
void IndexBuffer::Extend(uint32_t amount)
|
||||
void IndexBuffer::Extend(uint amount)
|
||||
{
|
||||
uint32_t newSize = GetNumElements() + amount;
|
||||
uint newSize = GetNumElements() + amount;
|
||||
Resize(newSize);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
* @param usage the expected usage pattern of this index buffer
|
||||
* @return TRUE if successful, FALSE if not
|
||||
*/
|
||||
BOOL Initialize(uint32_t numIndices, BUFFEROBJECT_USAGE usage);
|
||||
BOOL Initialize(uint numIndices, BUFFEROBJECT_USAGE usage);
|
||||
|
||||
/**
|
||||
* Initializes the index buffer.
|
||||
|
@ -40,7 +40,7 @@ public:
|
|||
* @param usage the expected usage pattern of this index buffer
|
||||
* @return TRUE if successful, FALSE if not
|
||||
*/
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, uint32_t numIndices, BUFFEROBJECT_USAGE usage);
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, uint numIndices, BUFFEROBJECT_USAGE usage);
|
||||
|
||||
/**
|
||||
* Initializes the index buffer.
|
||||
|
@ -63,14 +63,14 @@ public:
|
|||
* @param indices the source index data to copy
|
||||
* @param numIndices the number of indices to copy from the source
|
||||
*/
|
||||
void Set(const uint16_t *indices, uint32_t numIndices);
|
||||
void Set(const uint16_t *indices, uint numIndices);
|
||||
|
||||
/**
|
||||
* Sets an index to a new value.
|
||||
* @param index the position of the index in this buffer to set
|
||||
* @param value the new value to set
|
||||
*/
|
||||
void SetIndex(uint32_t index, uint16_t value);
|
||||
void SetIndex(uint index, uint16_t value);
|
||||
|
||||
/**
|
||||
* Moves the current index position to the next position.
|
||||
|
@ -94,7 +94,7 @@ public:
|
|||
* direction, then it will be shrunk so as not to move
|
||||
* out of bounds.
|
||||
*/
|
||||
void Move(int32_t numIndices);
|
||||
void Move(int numIndices);
|
||||
|
||||
/**
|
||||
* Moves the current index position to the beginning of the buffer.
|
||||
|
@ -110,7 +110,7 @@ public:
|
|||
* Moves the current index position to the position specified.
|
||||
* @param index the position to move to
|
||||
*/
|
||||
void MoveTo(uint32_t index) { m_currentIndex = index; }
|
||||
void MoveTo(uint index) { m_currentIndex = index; }
|
||||
|
||||
/**
|
||||
* Sets the index at the current position to a new value.
|
||||
|
@ -123,18 +123,18 @@ public:
|
|||
* @param numIndices the amount of indices the buffer should be resized
|
||||
* to hold
|
||||
*/
|
||||
void Resize(uint32_t numIndices);
|
||||
void Resize(uint numIndices);
|
||||
|
||||
/**
|
||||
* Extends the buffer capacity to hold the specified number of extra indices.
|
||||
* @param amount the amount of indices to extend the buffer by
|
||||
*/
|
||||
void Extend(uint32_t amount);
|
||||
void Extend(uint amount);
|
||||
|
||||
/**
|
||||
* @return the number of indices contained in this buffer
|
||||
*/
|
||||
uint32_t GetNumElements() const { return m_buffer.size(); }
|
||||
uint GetNumElements() const { return m_buffer.size(); }
|
||||
|
||||
/**
|
||||
* @return the size in bytes of each index in this buffer object
|
||||
|
@ -149,21 +149,21 @@ public:
|
|||
/**
|
||||
* @return the current position in the buffer
|
||||
*/
|
||||
uint32_t GetCurrentPosition() const { return m_currentIndex; }
|
||||
uint GetCurrentPosition() const { return m_currentIndex; }
|
||||
|
||||
/**
|
||||
* @return the number of index spaces left between the current position
|
||||
* and the end of the buffer
|
||||
*/
|
||||
uint32_t GetRemainingSpace() const { return (GetNumElements() - 1) - GetCurrentPosition(); }
|
||||
uint GetRemainingSpace() const { return (GetNumElements() - 1) - GetCurrentPosition(); }
|
||||
|
||||
private:
|
||||
stl::vector<uint16_t> m_buffer;
|
||||
|
||||
uint32_t m_currentIndex;
|
||||
uint m_currentIndex;
|
||||
};
|
||||
|
||||
inline void IndexBuffer::SetIndex(uint32_t index, uint16_t value)
|
||||
inline void IndexBuffer::SetIndex(uint index, uint16_t value)
|
||||
{
|
||||
m_buffer[index] = value;
|
||||
}
|
||||
|
@ -191,10 +191,10 @@ inline BOOL IndexBuffer::MovePrevious()
|
|||
}
|
||||
}
|
||||
|
||||
inline void IndexBuffer::Move(int32_t numIndices)
|
||||
inline void IndexBuffer::Move(int numIndices)
|
||||
{
|
||||
// m_currentIndex is unsigned, so detect when we would go negative beforehand
|
||||
if (numIndices < 0 && (uint32_t)abs(numIndices) > m_currentIndex)
|
||||
if (numIndices < 0 && (uint)abs(numIndices) > m_currentIndex)
|
||||
m_currentIndex = 0;
|
||||
else
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@ Renderbuffer::Renderbuffer()
|
|||
m_type = FRAMEBUFFER_DATA_NONE;
|
||||
}
|
||||
|
||||
BOOL Renderbuffer::Initialize(GraphicsDevice *graphicsDevice, uint16_t width, uint16_t height, FRAMEBUFFER_DATA_TYPE type)
|
||||
BOOL Renderbuffer::Initialize(GraphicsDevice *graphicsDevice, uint width, uint height, FRAMEBUFFER_DATA_TYPE type)
|
||||
{
|
||||
ASSERT(m_renderbufferName == 0);
|
||||
if (m_renderbufferName != 0)
|
||||
|
@ -58,7 +58,7 @@ BOOL Renderbuffer::CreateRenderbuffer()
|
|||
{
|
||||
ASSERT(m_renderbufferName == 0);
|
||||
|
||||
uint32_t format = 0;
|
||||
uint format = 0;
|
||||
#ifdef MOBILE
|
||||
switch (m_type)
|
||||
{
|
||||
|
|
|
@ -31,22 +31,22 @@ public:
|
|||
* @param format the type of data this renderbuffer contains
|
||||
* @return TRUE if the renderbuffer was created successfully
|
||||
*/
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, uint16_t width, uint16_t height, FRAMEBUFFER_DATA_TYPE type);
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, uint width, uint height, FRAMEBUFFER_DATA_TYPE type);
|
||||
|
||||
/**
|
||||
* @return the name or ID assigned to this renderbuffer by OpenGL
|
||||
*/
|
||||
uint32_t GetRenderbufferName() const { return m_renderbufferName; }
|
||||
uint GetRenderbufferName() const { return m_renderbufferName; }
|
||||
|
||||
/**
|
||||
* @return the width of the renderbuffer in pixels
|
||||
*/
|
||||
uint16_t GetWidth() const { return m_width; }
|
||||
uint GetWidth() const { return m_width; }
|
||||
|
||||
/**
|
||||
* @return the height of the renderbuffer in pixels
|
||||
*/
|
||||
uint16_t GetHeight() const { return m_height; }
|
||||
uint GetHeight() const { return m_height; }
|
||||
|
||||
/**
|
||||
* @return the type of data this renderbuffer contains
|
||||
|
@ -71,9 +71,9 @@ public:
|
|||
private:
|
||||
BOOL CreateRenderbuffer();
|
||||
|
||||
uint32_t m_renderbufferName;
|
||||
uint16_t m_width;
|
||||
uint16_t m_height;
|
||||
uint m_renderbufferName;
|
||||
uint m_width;
|
||||
uint m_height;
|
||||
FRAMEBUFFER_DATA_TYPE m_type;
|
||||
};
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ STATIC_ASSERT(sizeof(Vector4) == 4 * sizeof(float));
|
|||
STATIC_ASSERT(sizeof(Quaternion) == 4 * sizeof(float));
|
||||
STATIC_ASSERT(sizeof(Matrix3x3) == 9 * sizeof(float));
|
||||
STATIC_ASSERT(sizeof(Matrix4x4) == 16 * sizeof(float));
|
||||
STATIC_ASSERT(sizeof(Point2) == 2 * sizeof(int32_t));
|
||||
STATIC_ASSERT(sizeof(Point3) == 3 * sizeof(int32_t));
|
||||
STATIC_ASSERT(sizeof(Point2) == 2 * sizeof(int));
|
||||
STATIC_ASSERT(sizeof(Point3) == 3 * sizeof(int));
|
||||
|
||||
Shader::Shader()
|
||||
{
|
||||
|
@ -352,7 +352,7 @@ void Shader::LoadUniformInfo()
|
|||
char *uniformName = new char[maxUniformNameLength];
|
||||
|
||||
// get info about each uniform
|
||||
for (int32_t i = 0; i < numUniforms; ++i)
|
||||
for (int i = 0; i < numUniforms; ++i)
|
||||
{
|
||||
GLint size;
|
||||
GLenum type;
|
||||
|
@ -364,9 +364,9 @@ void Shader::LoadUniformInfo()
|
|||
|
||||
// store the uniform info
|
||||
ShaderUniform uniform;
|
||||
uniform.location = (uint32_t)location;
|
||||
uniform.type = (uint32_t)type;
|
||||
uniform.size = (uint32_t)size;
|
||||
uniform.location = (uint)location;
|
||||
uniform.type = (uint)type;
|
||||
uniform.size = (uint)size;
|
||||
stl::string name = uniformName;
|
||||
|
||||
// it seems Windows/Mac (possibly Linux too) have differing opinions on
|
||||
|
@ -395,7 +395,7 @@ void Shader::LoadAttributeInfo()
|
|||
// sanity checking, which only matters for shader reloading (e.g. when a context is lost)
|
||||
if (m_attributeMapping != NULL)
|
||||
{
|
||||
ASSERT((uint32_t)numAttributes == m_numAttributes);
|
||||
ASSERT((uint)numAttributes == m_numAttributes);
|
||||
}
|
||||
|
||||
m_numAttributes = numAttributes;
|
||||
|
@ -419,7 +419,7 @@ void Shader::LoadAttributeInfo()
|
|||
char *attributeName = new char[maxAttributeNameLength];
|
||||
|
||||
// get info about each attribute
|
||||
for (int32_t i = 0; i < numAttributes; ++i)
|
||||
for (int i = 0; i < numAttributes; ++i)
|
||||
{
|
||||
GLint size;
|
||||
GLenum type;
|
||||
|
@ -431,9 +431,9 @@ void Shader::LoadAttributeInfo()
|
|||
|
||||
// store the attribute info
|
||||
ShaderAttribute attribute;
|
||||
attribute.location = (uint32_t)location;
|
||||
attribute.type = (uint32_t)type;
|
||||
attribute.size = (uint32_t)size;
|
||||
attribute.location = (uint)location;
|
||||
attribute.type = (uint)type;
|
||||
attribute.size = (uint)size;
|
||||
attribute.isTypeBound = FALSE;
|
||||
stl::string name = attributeName;
|
||||
|
||||
|
@ -565,7 +565,7 @@ void Shader::SetUniform(const stl::string &name, float x)
|
|||
}
|
||||
}
|
||||
|
||||
void Shader::SetUniform(const stl::string &name, int32_t x)
|
||||
void Shader::SetUniform(const stl::string &name, int x)
|
||||
{
|
||||
if (m_isBound)
|
||||
{
|
||||
|
@ -621,7 +621,7 @@ void Shader::SetUniform(const stl::string &name, const Vector2 &v)
|
|||
}
|
||||
}
|
||||
|
||||
void Shader::SetUniform(const stl::string &name, int32_t x, int32_t y)
|
||||
void Shader::SetUniform(const stl::string &name, int x, int y)
|
||||
{
|
||||
if (m_isBound)
|
||||
{
|
||||
|
@ -699,7 +699,7 @@ void Shader::SetUniform(const stl::string &name, const Vector3 &v)
|
|||
}
|
||||
}
|
||||
|
||||
void Shader::SetUniform(const stl::string &name, int32_t x, int32_t y, int32_t z)
|
||||
void Shader::SetUniform(const stl::string &name, int x, int y, int z)
|
||||
{
|
||||
if (m_isBound)
|
||||
{
|
||||
|
@ -823,7 +823,7 @@ void Shader::SetUniform(const stl::string &name, const Color &c)
|
|||
}
|
||||
}
|
||||
|
||||
void Shader::SetUniform(const stl::string &name, int32_t x, int32_t y, int32_t z, int32_t w)
|
||||
void Shader::SetUniform(const stl::string &name, int x, int y, int z, int w)
|
||||
{
|
||||
if (m_isBound)
|
||||
{
|
||||
|
@ -880,7 +880,7 @@ void Shader::SetUniform(const stl::string &name, const Matrix4x4 &m)
|
|||
}
|
||||
}
|
||||
|
||||
void Shader::SetUniform(const stl::string &name, const float *x, uint32_t count)
|
||||
void Shader::SetUniform(const stl::string &name, const float *x, uint count)
|
||||
{
|
||||
if (m_isBound)
|
||||
{
|
||||
|
@ -895,7 +895,7 @@ void Shader::SetUniform(const stl::string &name, const float *x, uint32_t count)
|
|||
}
|
||||
}
|
||||
|
||||
void Shader::SetUniform(const stl::string &name, const Vector2 *v, uint32_t count)
|
||||
void Shader::SetUniform(const stl::string &name, const Vector2 *v, uint count)
|
||||
{
|
||||
if (m_isBound)
|
||||
{
|
||||
|
@ -913,7 +913,7 @@ void Shader::SetUniform(const stl::string &name, const Vector2 *v, uint32_t coun
|
|||
}
|
||||
}
|
||||
|
||||
void Shader::SetUniform(const stl::string &name, const Vector3 *v, uint32_t count)
|
||||
void Shader::SetUniform(const stl::string &name, const Vector3 *v, uint count)
|
||||
{
|
||||
if (m_isBound)
|
||||
{
|
||||
|
@ -931,7 +931,7 @@ void Shader::SetUniform(const stl::string &name, const Vector3 *v, uint32_t coun
|
|||
}
|
||||
}
|
||||
|
||||
void Shader::SetUniform(const stl::string &name, const Vector4 *v, uint32_t count)
|
||||
void Shader::SetUniform(const stl::string &name, const Vector4 *v, uint count)
|
||||
{
|
||||
if (m_isBound)
|
||||
{
|
||||
|
@ -949,7 +949,7 @@ void Shader::SetUniform(const stl::string &name, const Vector4 *v, uint32_t coun
|
|||
}
|
||||
}
|
||||
|
||||
void Shader::SetUniform(const stl::string &name, const Quaternion *q, uint32_t count)
|
||||
void Shader::SetUniform(const stl::string &name, const Quaternion *q, uint count)
|
||||
{
|
||||
if (m_isBound)
|
||||
{
|
||||
|
@ -968,7 +968,7 @@ void Shader::SetUniform(const stl::string &name, const Quaternion *q, uint32_t c
|
|||
}
|
||||
}
|
||||
|
||||
void Shader::SetUniform(const stl::string &name, const Color *c, uint32_t count)
|
||||
void Shader::SetUniform(const stl::string &name, const Color *c, uint count)
|
||||
{
|
||||
if (m_isBound)
|
||||
{
|
||||
|
@ -987,7 +987,7 @@ void Shader::SetUniform(const stl::string &name, const Color *c, uint32_t count)
|
|||
}
|
||||
}
|
||||
|
||||
void Shader::SetUniform(const stl::string &name, const Matrix3x3 *m, uint32_t count)
|
||||
void Shader::SetUniform(const stl::string &name, const Matrix3x3 *m, uint count)
|
||||
{
|
||||
if (m_isBound)
|
||||
{
|
||||
|
@ -1006,7 +1006,7 @@ void Shader::SetUniform(const stl::string &name, const Matrix3x3 *m, uint32_t co
|
|||
}
|
||||
}
|
||||
|
||||
void Shader::SetUniform(const stl::string &name, const Matrix4x4 *m, uint32_t count)
|
||||
void Shader::SetUniform(const stl::string &name, const Matrix4x4 *m, uint count)
|
||||
{
|
||||
if (m_isBound)
|
||||
{
|
||||
|
@ -1025,7 +1025,7 @@ void Shader::SetUniform(const stl::string &name, const Matrix4x4 *m, uint32_t co
|
|||
}
|
||||
}
|
||||
|
||||
void Shader::MapAttributeToVboAttribIndex(const stl::string &name, uint32_t vboAttribIndex)
|
||||
void Shader::MapAttributeToVboAttribIndex(const stl::string &name, uint vboAttribIndex)
|
||||
{
|
||||
ShaderAttribute *attribute = GetAttribute(name);
|
||||
ASSERT(attribute != NULL);
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
/**
|
||||
* @return the OpenGL program ID that can be bound
|
||||
*/
|
||||
uint32_t GetProgramId() const { return m_programId; }
|
||||
uint GetProgramId() const { return m_programId; }
|
||||
|
||||
/**
|
||||
* Checks if this shader contains a uniform. Note that the GLSL compiler
|
||||
|
@ -114,7 +114,7 @@ public:
|
|||
* Sets the value of a uniform.
|
||||
* @param name the name of the uniform to set
|
||||
*/
|
||||
void SetUniform(const stl::string &name, int32_t x);
|
||||
void SetUniform(const stl::string &name, int x);
|
||||
|
||||
/**
|
||||
* Sets the value of a uniform.
|
||||
|
@ -132,7 +132,7 @@ public:
|
|||
* Sets the value of a uniform.
|
||||
* @param name the name of the uniform to set
|
||||
*/
|
||||
void SetUniform(const stl::string &name, int32_t x, int32_t y);
|
||||
void SetUniform(const stl::string &name, int x, int y);
|
||||
|
||||
/**
|
||||
* Sets the value of a uniform.
|
||||
|
@ -156,7 +156,7 @@ public:
|
|||
* Sets the value of a uniform.
|
||||
* @param name the name of the uniform to set
|
||||
*/
|
||||
void SetUniform(const stl::string &name, int32_t x, int32_t y, int32_t z);
|
||||
void SetUniform(const stl::string &name, int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Sets the value of a uniform.
|
||||
|
@ -192,7 +192,7 @@ public:
|
|||
* Sets the value of a uniform.
|
||||
* @param name the name of the uniform to set
|
||||
*/
|
||||
void SetUniform(const stl::string &name, int32_t x, int32_t y, int32_t z, int32_t w);
|
||||
void SetUniform(const stl::string &name, int x, int y, int z, int w);
|
||||
|
||||
/**
|
||||
* Sets the value of a uniform.
|
||||
|
@ -206,19 +206,19 @@ public:
|
|||
*/
|
||||
void SetUniform(const stl::string &name, const Matrix4x4 &m);
|
||||
|
||||
void SetUniform(const stl::string &name, const float *x, uint32_t count);
|
||||
void SetUniform(const stl::string &name, const Vector2 *v, uint32_t count);
|
||||
void SetUniform(const stl::string &name, const Vector3 *v, uint32_t count);
|
||||
void SetUniform(const stl::string &name, const Vector4 *v, uint32_t count);
|
||||
void SetUniform(const stl::string &name, const Quaternion *q, uint32_t count);
|
||||
void SetUniform(const stl::string &name, const Color *c, uint32_t count);
|
||||
void SetUniform(const stl::string &name, const Matrix3x3 *m, uint32_t count);
|
||||
void SetUniform(const stl::string &name, const Matrix4x4 *m, uint32_t count);
|
||||
void SetUniform(const stl::string &name, const float *x, uint count);
|
||||
void SetUniform(const stl::string &name, const Vector2 *v, uint count);
|
||||
void SetUniform(const stl::string &name, const Vector3 *v, uint count);
|
||||
void SetUniform(const stl::string &name, const Vector4 *v, uint count);
|
||||
void SetUniform(const stl::string &name, const Quaternion *q, uint count);
|
||||
void SetUniform(const stl::string &name, const Color *c, uint count);
|
||||
void SetUniform(const stl::string &name, const Matrix3x3 *m, uint count);
|
||||
void SetUniform(const stl::string &name, const Matrix4x4 *m, uint count);
|
||||
|
||||
/**
|
||||
* @return the number of attributes used in this shader
|
||||
*/
|
||||
uint32_t GetNumAttributes() const { return m_numAttributes; }
|
||||
uint GetNumAttributes() const { return m_numAttributes; }
|
||||
|
||||
/**
|
||||
* Returns whether the given shader attribute has been mapped to a standard
|
||||
|
@ -228,7 +228,7 @@ public:
|
|||
* @return TRUE if this shader attribute was mapped to a standard attribute
|
||||
* type or FALSE if it wasn't
|
||||
*/
|
||||
BOOL IsAttributeMappedToStandardType(uint32_t attribIndex) const;
|
||||
BOOL IsAttributeMappedToStandardType(uint attribIndex) const;
|
||||
|
||||
/**
|
||||
* Gets a vertex buffer object attribute index that corresponds to the
|
||||
|
@ -238,7 +238,7 @@ public:
|
|||
* @return an index for a vertex buffer object's attributes that
|
||||
* corresponds to the specified shader attribute
|
||||
*/
|
||||
uint32_t GetAttributeMappedBufferIndex(uint32_t attribIndex) const;
|
||||
uint GetAttributeMappedBufferIndex(uint attribIndex) const;
|
||||
|
||||
/**
|
||||
* Gets the standard attribute type mapping corresponding to the given
|
||||
|
@ -248,7 +248,7 @@ public:
|
|||
* @return the standard attribute type mapping associated with this
|
||||
* shader attribute
|
||||
*/
|
||||
VERTEX_STANDARD_ATTRIBS GetAttributeMappedStandardType(uint32_t attribIndex) const;
|
||||
VERTEX_STANDARD_ATTRIBS GetAttributeMappedStandardType(uint attribIndex) const;
|
||||
|
||||
/**
|
||||
* Maps the given shader attribute to an index that will be used to refer
|
||||
|
@ -259,7 +259,7 @@ public:
|
|||
* @param vboAttribIndex the index value to map that will be used to refer
|
||||
* to an attribute in bound vertex buffer objects
|
||||
*/
|
||||
void MapAttributeToVboAttribIndex(const stl::string &name, uint32_t vboAttribIndex);
|
||||
void MapAttributeToVboAttribIndex(const stl::string &name, uint vboAttribIndex);
|
||||
|
||||
/**
|
||||
* Maps the given shader attribute so that it will correspond to an
|
||||
|
@ -370,15 +370,15 @@ private:
|
|||
BOOL m_vertexShaderCompileStatus;
|
||||
BOOL m_fragmentShaderCompileStatus;
|
||||
BOOL m_linkStatus;
|
||||
uint32_t m_vertexShaderId;
|
||||
uint32_t m_fragmentShaderId;
|
||||
uint32_t m_programId;
|
||||
uint m_vertexShaderId;
|
||||
uint m_fragmentShaderId;
|
||||
uint m_programId;
|
||||
BOOL m_isBound;
|
||||
|
||||
ShaderUniformMap m_uniforms;
|
||||
ShaderAttributeMap m_attributes;
|
||||
ShaderAttributeMapInfo *m_attributeMapping;
|
||||
uint32_t m_numAttributes;
|
||||
uint m_numAttributes;
|
||||
|
||||
CachedShaderUniformMap m_cachedUniforms;
|
||||
};
|
||||
|
@ -391,17 +391,17 @@ inline BOOL Shader::IsReadyForUse() const
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
inline BOOL Shader::IsAttributeMappedToStandardType(uint32_t attribIndex) const
|
||||
inline BOOL Shader::IsAttributeMappedToStandardType(uint attribIndex) const
|
||||
{
|
||||
return m_attributeMapping[attribIndex].usesStandardType;
|
||||
}
|
||||
|
||||
inline uint32_t Shader::GetAttributeMappedBufferIndex(uint32_t attribIndex) const
|
||||
inline uint Shader::GetAttributeMappedBufferIndex(uint attribIndex) const
|
||||
{
|
||||
return m_attributeMapping[attribIndex].attribIndex;
|
||||
}
|
||||
|
||||
inline VERTEX_STANDARD_ATTRIBS Shader::GetAttributeMappedStandardType(uint32_t attribIndex) const
|
||||
inline VERTEX_STANDARD_ATTRIBS Shader::GetAttributeMappedStandardType(uint attribIndex) const
|
||||
{
|
||||
return m_attributeMapping[attribIndex].standardType;
|
||||
}
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
*/
|
||||
struct ShaderUniform
|
||||
{
|
||||
uint32_t location;
|
||||
uint32_t type;
|
||||
uint32_t size;
|
||||
uint location;
|
||||
uint type;
|
||||
uint size;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -22,9 +22,9 @@ struct ShaderUniform
|
|||
*/
|
||||
struct ShaderAttribute
|
||||
{
|
||||
uint32_t location;
|
||||
uint32_t type;
|
||||
uint32_t size;
|
||||
uint location;
|
||||
uint type;
|
||||
uint size;
|
||||
BOOL isTypeBound;
|
||||
};
|
||||
|
||||
|
@ -35,7 +35,7 @@ struct ShaderAttributeMapInfo
|
|||
{
|
||||
BOOL usesStandardType;
|
||||
VERTEX_STANDARD_ATTRIBS standardType;
|
||||
uint32_t attribIndex;
|
||||
uint attribIndex;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -69,7 +69,7 @@ struct CachedShaderUniform
|
|||
} f1;
|
||||
struct
|
||||
{
|
||||
int32_t x;
|
||||
int x;
|
||||
} i1;
|
||||
struct
|
||||
{
|
||||
|
@ -78,8 +78,8 @@ struct CachedShaderUniform
|
|||
} f2;
|
||||
struct
|
||||
{
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
int x;
|
||||
int y;
|
||||
} i2;
|
||||
struct
|
||||
{
|
||||
|
@ -89,9 +89,9 @@ struct CachedShaderUniform
|
|||
} f3;
|
||||
struct
|
||||
{
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
int32_t z;
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
} i3;
|
||||
struct
|
||||
{
|
||||
|
@ -102,10 +102,10 @@ struct CachedShaderUniform
|
|||
} f4;
|
||||
struct
|
||||
{
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
int32_t z;
|
||||
int32_t w;
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
int w;
|
||||
} i4;
|
||||
struct
|
||||
{
|
||||
|
@ -121,7 +121,7 @@ struct CachedShaderUniform
|
|||
struct CachedShaderArrayUniform
|
||||
{
|
||||
CACHED_SHADER_UNIFORM_TYPE type;
|
||||
uint32_t count;
|
||||
uint count;
|
||||
float *values;
|
||||
|
||||
CachedShaderArrayUniform()
|
||||
|
|
|
@ -129,25 +129,25 @@ void SpriteBatch::Begin(const RenderState &renderState, const BlendState &blendS
|
|||
InternalBegin(&renderState, &blendState, shader);
|
||||
}
|
||||
|
||||
void SpriteBatch::Render(const Texture *texture, int16_t x, int16_t y, const Color &color)
|
||||
void SpriteBatch::Render(const Texture *texture, int x, int y, const Color &color)
|
||||
{
|
||||
y = FixYCoord(y, texture->GetHeight());
|
||||
AddSprite(texture, x, y, x + texture->GetWidth(), y + texture->GetHeight(), 0, 0, texture->GetWidth(), texture->GetHeight(), color);
|
||||
}
|
||||
|
||||
void SpriteBatch::Render(const Texture *texture, int16_t x, int16_t y, uint16_t width, uint16_t height, const Color &color)
|
||||
void SpriteBatch::Render(const Texture *texture, int x, int y, uint width, uint height, const Color &color)
|
||||
{
|
||||
y = FixYCoord(y, height);
|
||||
AddSprite(texture, x, y, x + width, y + height, 0, 0, width, height, color);
|
||||
}
|
||||
|
||||
void SpriteBatch::Render(const Texture *texture, int16_t x, int16_t y, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color)
|
||||
void SpriteBatch::Render(const Texture *texture, int x, int y, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color)
|
||||
{
|
||||
y = FixYCoord(y, texture->GetHeight());
|
||||
AddSprite(texture, x, y, x + texture->GetWidth(), y + texture->GetHeight(), texCoordLeft, texCoordTop, texCoordRight, texCoordBottom, color);
|
||||
}
|
||||
|
||||
void SpriteBatch::Render(const Texture *texture, int16_t x, int16_t y, uint16_t width, uint16_t height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color)
|
||||
void SpriteBatch::Render(const Texture *texture, int x, int y, uint width, uint height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color)
|
||||
{
|
||||
y = FixYCoord(y, height);
|
||||
AddSprite(texture, x, y, x + width, y + height, texCoordLeft, texCoordTop, texCoordRight, texCoordBottom, color);
|
||||
|
@ -163,7 +163,7 @@ void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, c
|
|||
Render(texture, screenCoordinates.x, screenCoordinates.y, color);
|
||||
}
|
||||
|
||||
void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, uint16_t width, uint16_t height, const Color &color)
|
||||
void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, uint width, uint height, const Color &color)
|
||||
{
|
||||
Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection);
|
||||
|
||||
|
@ -183,7 +183,7 @@ void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, f
|
|||
Render(texture, screenCoordinates.x, screenCoordinates.y, texCoordLeft, texCoordTop, texCoordRight, texCoordBottom, color);
|
||||
}
|
||||
|
||||
void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, uint16_t width, uint16_t height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color)
|
||||
void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, uint width, uint height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color)
|
||||
{
|
||||
Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection);
|
||||
|
||||
|
@ -193,17 +193,17 @@ void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, u
|
|||
Render(texture, screenCoordinates.x, screenCoordinates.y, width, height, texCoordLeft, texCoordTop, texCoordRight, texCoordBottom, color);
|
||||
}
|
||||
|
||||
void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, int16_t x, int16_t y, const Color &color)
|
||||
void SpriteBatch::Render(const TextureAtlas *atlas, uint index, int x, int y, const Color &color)
|
||||
{
|
||||
const RectF *texCoords = &atlas->GetTile(index).texCoords;
|
||||
const Rect *tileSize = &atlas->GetTile(index).dimensions;
|
||||
const Texture *texture = atlas->GetTexture();
|
||||
|
||||
y = FixYCoord(y, (uint16_t)tileSize->GetHeight());
|
||||
y = FixYCoord(y, (uint)tileSize->GetHeight());
|
||||
AddSprite(texture, x, y, x + tileSize->GetWidth(), y + tileSize->GetHeight(), texCoords->left, texCoords->top, texCoords->right, texCoords->bottom, color);
|
||||
}
|
||||
|
||||
void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, int16_t x, int16_t y, uint16_t width, uint16_t height, const Color &color)
|
||||
void SpriteBatch::Render(const TextureAtlas *atlas, uint index, int x, int y, uint width, uint height, const Color &color)
|
||||
{
|
||||
const RectF *texCoords = &atlas->GetTile(index).texCoords;
|
||||
const Texture *texture = atlas->GetTexture();
|
||||
|
@ -212,7 +212,7 @@ void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, int16_t x, i
|
|||
AddSprite(texture, x, y, x + width, y + height, texCoords->left, texCoords->top, texCoords->right, texCoords->bottom, color);
|
||||
}
|
||||
|
||||
void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, const Vector3 &worldPosition, const Color &color)
|
||||
void SpriteBatch::Render(const TextureAtlas *atlas, uint index, const Vector3 &worldPosition, const Color &color)
|
||||
{
|
||||
Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection);
|
||||
|
||||
|
@ -223,7 +223,7 @@ void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, const Vector
|
|||
Render(atlas, index, screenCoordinates.x, screenCoordinates.y, color);
|
||||
}
|
||||
|
||||
void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, const Vector3 &worldPosition, uint16_t width, uint16_t height, const Color &color)
|
||||
void SpriteBatch::Render(const TextureAtlas *atlas, uint index, const Vector3 &worldPosition, uint width, uint height, const Color &color)
|
||||
{
|
||||
Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection);
|
||||
|
||||
|
@ -233,14 +233,14 @@ void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, const Vector
|
|||
Render(atlas, index, screenCoordinates.x, screenCoordinates.y, width, height, color);
|
||||
}
|
||||
|
||||
void SpriteBatch::Render(const SpriteFont *font, int16_t x, int16_t y, const Color &color, const char *text)
|
||||
void SpriteBatch::Render(const SpriteFont *font, int x, int y, const Color &color, const char *text)
|
||||
{
|
||||
size_t textLength = strlen(text);
|
||||
|
||||
y = FixYCoord(y, (uint16_t)font->GetLetterHeight());
|
||||
y = FixYCoord(y, (uint)font->GetLetterHeight());
|
||||
|
||||
int16_t drawX = x;
|
||||
int16_t drawY = y;
|
||||
int drawX = x;
|
||||
int drawY = y;
|
||||
|
||||
for (size_t i = 0; i < textLength; ++i)
|
||||
{
|
||||
|
@ -267,13 +267,13 @@ void SpriteBatch::Render(const SpriteFont *font, int16_t x, int16_t y, const Col
|
|||
}
|
||||
}
|
||||
|
||||
void SpriteBatch::Render(const SpriteFont *font, int16_t x, int16_t y, const Color &color, float scale, const char *text)
|
||||
void SpriteBatch::Render(const SpriteFont *font, int x, int y, const Color &color, float scale, const char *text)
|
||||
{
|
||||
size_t textLength = strlen(text);
|
||||
|
||||
float scaledLetterHeight = (float)font->GetLetterHeight() * scale;
|
||||
|
||||
y = (int16_t)FixYCoord(y, scaledLetterHeight);
|
||||
y = (int)FixYCoord(y, scaledLetterHeight);
|
||||
|
||||
float drawX = (float)x;
|
||||
float drawY = (float)y;
|
||||
|
@ -310,8 +310,8 @@ void SpriteBatch::Render(const SpriteFont *font, const Vector3 &worldPosition, c
|
|||
{
|
||||
Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection);
|
||||
|
||||
uint16_t textWidth = 0;
|
||||
uint16_t textHeight = 0;
|
||||
uint textWidth = 0;
|
||||
uint textHeight = 0;
|
||||
font->MeasureString(&textWidth, &textHeight, text);
|
||||
|
||||
screenCoordinates.x -= textWidth / 2;
|
||||
|
@ -324,8 +324,8 @@ void SpriteBatch::Render(const SpriteFont *font, const Vector3 &worldPosition, c
|
|||
{
|
||||
Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection);
|
||||
|
||||
uint16_t textWidth = 0;
|
||||
uint16_t textHeight = 0;
|
||||
uint textWidth = 0;
|
||||
uint textHeight = 0;
|
||||
font->MeasureString(&textWidth, &textHeight, scale, text);
|
||||
|
||||
screenCoordinates.x -= textWidth / 2;
|
||||
|
@ -334,7 +334,7 @@ void SpriteBatch::Render(const SpriteFont *font, const Vector3 &worldPosition, c
|
|||
Render(font, screenCoordinates.x, screenCoordinates.y, color, scale, text);
|
||||
}
|
||||
|
||||
void SpriteBatch::Printf(const SpriteFont *font, int16_t x, int16_t y, const Color &color, const char *format, ...)
|
||||
void SpriteBatch::Printf(const SpriteFont *font, int x, int y, const Color &color, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
@ -344,7 +344,7 @@ void SpriteBatch::Printf(const SpriteFont *font, int16_t x, int16_t y, const Col
|
|||
Render(font, x, y, color, __spriteBatch_printfBuffer);
|
||||
}
|
||||
|
||||
void SpriteBatch::Printf(const SpriteFont *font, int16_t x, int16_t y, const Color &color, float scale, const char *format, ...)
|
||||
void SpriteBatch::Printf(const SpriteFont *font, int x, int y, const Color &color, float scale, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
@ -374,17 +374,17 @@ void SpriteBatch::Printf(const SpriteFont *font, const Vector3 &worldPosition, c
|
|||
Render(font, worldPosition, color, scale, __spriteBatch_printfBuffer);
|
||||
}
|
||||
|
||||
void SpriteBatch::RenderLine(int16_t x1, int16_t y1, int16_t x2, int16_t y2, const Color &color)
|
||||
void SpriteBatch::RenderLine(int x1, int y1, int x2, int y2, const Color &color)
|
||||
{
|
||||
y1 = FixYCoord(y1, (uint16_t)1);
|
||||
y2 = FixYCoord(y2, (uint16_t)1);
|
||||
y1 = FixYCoord(y1, (uint)1);
|
||||
y2 = FixYCoord(y2, (uint)1);
|
||||
|
||||
AddLine(x1, y1, x2, y2, color);
|
||||
}
|
||||
|
||||
void SpriteBatch::RenderBox(int16_t left, int16_t top, int16_t right, int16_t bottom, const Color &color)
|
||||
void SpriteBatch::RenderBox(int left, int top, int right, int bottom, const Color &color)
|
||||
{
|
||||
uint16_t height = bottom - top;
|
||||
uint height = bottom - top;
|
||||
top = FixYCoord(top, height);
|
||||
bottom = top + height;
|
||||
|
||||
|
@ -396,12 +396,12 @@ void SpriteBatch::RenderBox(int16_t left, int16_t top, int16_t right, int16_t bo
|
|||
|
||||
void SpriteBatch::RenderBox(const Rect &rect, const Color &color)
|
||||
{
|
||||
int16_t left = (int16_t)rect.left;
|
||||
int16_t top = (int16_t)rect.top;
|
||||
int16_t right = (int16_t)rect.right;
|
||||
int16_t bottom = (int16_t)rect.bottom;
|
||||
int left = (int)rect.left;
|
||||
int top = (int)rect.top;
|
||||
int right = (int)rect.right;
|
||||
int bottom = (int)rect.bottom;
|
||||
|
||||
uint16_t height = bottom - top;
|
||||
uint height = bottom - top;
|
||||
top = FixYCoord(top, height);
|
||||
bottom = top + height;
|
||||
|
||||
|
@ -411,9 +411,9 @@ void SpriteBatch::RenderBox(const Rect &rect, const Color &color)
|
|||
AddLine(left, top, right, top, color);
|
||||
}
|
||||
|
||||
void SpriteBatch::RenderFilledBox(int16_t left, int16_t top, int16_t right, int16_t bottom, const Color &color)
|
||||
void SpriteBatch::RenderFilledBox(int left, int top, int right, int bottom, const Color &color)
|
||||
{
|
||||
uint16_t height = bottom - top;
|
||||
uint height = bottom - top;
|
||||
top = FixYCoord(top, height);
|
||||
bottom = top + height;
|
||||
|
||||
|
@ -422,25 +422,25 @@ void SpriteBatch::RenderFilledBox(int16_t left, int16_t top, int16_t right, int1
|
|||
|
||||
void SpriteBatch::RenderFilledBox(const Rect &rect, const Color &color)
|
||||
{
|
||||
int16_t left = (int16_t)rect.left;
|
||||
int16_t top = (int16_t)rect.top;
|
||||
int16_t right = (int16_t)rect.right;
|
||||
int16_t bottom = (int16_t)rect.bottom;
|
||||
int left = (int)rect.left;
|
||||
int top = (int)rect.top;
|
||||
int right = (int)rect.right;
|
||||
int bottom = (int)rect.bottom;
|
||||
|
||||
uint16_t height = bottom - top;
|
||||
uint height = bottom - top;
|
||||
top = FixYCoord(top, height);
|
||||
bottom = top + height;
|
||||
|
||||
AddFilledBox(left, top, right, bottom, color);
|
||||
}
|
||||
|
||||
void SpriteBatch::AddSprite(const Texture *texture, int16_t destLeft, int16_t destTop, int16_t destRight, int16_t destBottom, uint16_t sourceLeft, uint16_t sourceTop, uint16_t sourceRight, uint16_t sourceBottom, const Color &color)
|
||||
void SpriteBatch::AddSprite(const Texture *texture, int destLeft, int destTop, int destRight, int destBottom, uint sourceLeft, uint sourceTop, uint sourceRight, uint sourceBottom, const Color &color)
|
||||
{
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
|
||||
uint16_t width = sourceRight - sourceLeft;
|
||||
uint width = sourceRight - sourceLeft;
|
||||
ASSERT(width > 0);
|
||||
uint16_t height = sourceBottom - sourceTop;
|
||||
uint height = sourceBottom - sourceTop;
|
||||
ASSERT(height > 0);
|
||||
float texLeft = sourceLeft / (float)width;
|
||||
float texTop = sourceTop / (float)height;
|
||||
|
@ -462,7 +462,7 @@ void SpriteBatch::AddSprite(const Texture *texture, int16_t destLeft, int16_t de
|
|||
++m_currentSpritePointer;
|
||||
}
|
||||
|
||||
void SpriteBatch::AddSprite(const Texture *texture, int16_t destLeft, int16_t destTop, int16_t destRight, int16_t destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color)
|
||||
void SpriteBatch::AddSprite(const Texture *texture, int destLeft, int destTop, int destRight, int destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color)
|
||||
{
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
|
||||
|
@ -555,9 +555,9 @@ BOOL SpriteBatch::ClipSpriteCoords(float &left, float &top, float &right, float
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void SpriteBatch::SetSpriteInfo(uint32_t spriteIndex, const Texture *texture, float destLeft, float destTop, float destRight, float destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color)
|
||||
void SpriteBatch::SetSpriteInfo(uint spriteIndex, const Texture *texture, float destLeft, float destTop, float destRight, float destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color)
|
||||
{
|
||||
uint32_t base = m_vertices->GetCurrentPosition();
|
||||
uint base = m_vertices->GetCurrentPosition();
|
||||
|
||||
m_vertices->SetPosition2(base, destLeft, destTop);
|
||||
m_vertices->SetPosition2(base + 1, destRight, destTop);
|
||||
|
@ -606,9 +606,9 @@ void SpriteBatch::AddLine(float x1, float y1, float x2, float y2, const Color &c
|
|||
++m_currentSpritePointer;
|
||||
}
|
||||
|
||||
void SpriteBatch::SetLineInfo(uint32_t spriteIndex, float x1, float y1, float x2, float y2, const Color &color)
|
||||
void SpriteBatch::SetLineInfo(uint spriteIndex, float x1, float y1, float x2, float y2, const Color &color)
|
||||
{
|
||||
uint32_t base = m_vertices->GetCurrentPosition();
|
||||
uint base = m_vertices->GetCurrentPosition();
|
||||
|
||||
m_vertices->SetPosition2(base, x1, y1);
|
||||
m_vertices->SetPosition2(base + 1, x2, y2);
|
||||
|
@ -653,9 +653,9 @@ void SpriteBatch::AddFilledBox(float left, float top, float right, float bottom,
|
|||
++m_currentSpritePointer;
|
||||
}
|
||||
|
||||
void SpriteBatch::SetFilledBoxInfo(uint32_t spriteIndex, float left, float top, float right, float bottom, const Color &color)
|
||||
void SpriteBatch::SetFilledBoxInfo(uint spriteIndex, float left, float top, float right, float bottom, const Color &color)
|
||||
{
|
||||
uint32_t base = m_vertices->GetCurrentPosition();
|
||||
uint base = m_vertices->GetCurrentPosition();
|
||||
|
||||
m_vertices->SetPosition2(base, left, top);
|
||||
m_vertices->SetPosition2(base + 1, right, top);
|
||||
|
@ -764,7 +764,7 @@ void SpriteBatch::RenderQueue()
|
|||
const SpriteBatchEntity *firstEntity = &m_entities[0];
|
||||
const SpriteBatchEntity *lastEntity = &m_entities[0];
|
||||
|
||||
for (uint32_t i = 0; i < m_currentSpritePointer; ++i)
|
||||
for (uint i = 0; i < m_currentSpritePointer; ++i)
|
||||
{
|
||||
if (lastEntity->type != m_entities[i].type)
|
||||
{
|
||||
|
@ -799,8 +799,8 @@ void SpriteBatch::RenderQueue()
|
|||
|
||||
void SpriteBatch::RenderQueueRange(const SpriteBatchEntity *firstEntity, const SpriteBatchEntity *lastEntity)
|
||||
{
|
||||
uint32_t startVertex = firstEntity->firstVertex;
|
||||
uint32_t lastVertex = lastEntity->lastVertex + 1;
|
||||
uint startVertex = firstEntity->firstVertex;
|
||||
uint lastVertex = lastEntity->lastVertex + 1;
|
||||
|
||||
if (lastEntity->texture != NULL)
|
||||
{
|
||||
|
@ -832,7 +832,7 @@ void SpriteBatch::CheckForNewSpriteSpace(SPRITEBATCH_ENTITY_TYPE type)
|
|||
// time. This is because we use std::vector::push_back to expand the
|
||||
// entity object storage by only one.
|
||||
|
||||
uint32_t verticesRequired = GetVerticesRequiredFor(type);
|
||||
uint verticesRequired = GetVerticesRequiredFor(type);
|
||||
if (m_vertices->GetRemainingSpace() < verticesRequired)
|
||||
{
|
||||
// need to add more space for a new entity of the specified type to fit
|
||||
|
@ -844,9 +844,9 @@ void SpriteBatch::CheckForNewSpriteSpace(SPRITEBATCH_ENTITY_TYPE type)
|
|||
}
|
||||
}
|
||||
|
||||
inline uint32_t SpriteBatch::GetVerticesRequiredFor(SPRITEBATCH_ENTITY_TYPE type)
|
||||
inline uint SpriteBatch::GetVerticesRequiredFor(SPRITEBATCH_ENTITY_TYPE type)
|
||||
{
|
||||
uint32_t numVerticesRequired = 0;
|
||||
uint numVerticesRequired = 0;
|
||||
switch (type)
|
||||
{
|
||||
case SPRITEBATCH_ENTITY_SPRITE: numVerticesRequired = 6; break;
|
||||
|
@ -858,12 +858,12 @@ inline uint32_t SpriteBatch::GetVerticesRequiredFor(SPRITEBATCH_ENTITY_TYPE type
|
|||
return numVerticesRequired;
|
||||
}
|
||||
|
||||
inline int16_t SpriteBatch::FixYCoord(int16_t y, uint16_t sourceHeight) const
|
||||
inline int SpriteBatch::FixYCoord(int y, uint sourceHeight) const
|
||||
{
|
||||
return m_graphicsDevice->GetViewContext()->GetViewportHeight() - y - sourceHeight;
|
||||
}
|
||||
|
||||
inline float SpriteBatch::FixYCoord(int16_t y, float sourceHeight) const
|
||||
inline float SpriteBatch::FixYCoord(int y, float sourceHeight) const
|
||||
{
|
||||
return (float)m_graphicsDevice->GetViewContext()->GetViewportHeight() - (float)y - sourceHeight;
|
||||
}
|
||||
|
@ -873,8 +873,8 @@ void SpriteBatch::SetClipRegion(const Rect &rect)
|
|||
ASSERT(m_begunRendering == TRUE);
|
||||
m_isClipping = TRUE;
|
||||
|
||||
int32_t fixedTop = ((int32_t)m_graphicsDevice->GetViewContext()->GetViewportHeight() - rect.top - rect.GetHeight());
|
||||
int32_t fixedBottom = fixedTop + rect.GetHeight();
|
||||
int fixedTop = ((int)m_graphicsDevice->GetViewContext()->GetViewportHeight() - rect.top - rect.GetHeight());
|
||||
int fixedBottom = fixedTop + rect.GetHeight();
|
||||
|
||||
m_clipRegion.left = (float)rect.left;
|
||||
m_clipRegion.top = (float)fixedTop;
|
||||
|
@ -882,14 +882,14 @@ void SpriteBatch::SetClipRegion(const Rect &rect)
|
|||
m_clipRegion.bottom = (float)fixedBottom;
|
||||
}
|
||||
|
||||
void SpriteBatch::SetClipRegion(int16_t left, int16_t top, int16_t right, int16_t bottom)
|
||||
void SpriteBatch::SetClipRegion(int left, int top, int right, int bottom)
|
||||
{
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
m_isClipping = TRUE;
|
||||
|
||||
int16_t height = bottom - top;
|
||||
int16_t fixedTop = (m_graphicsDevice->GetViewContext()->GetViewportHeight() - top - height);
|
||||
int16_t fixedBottom = fixedTop + height;
|
||||
int height = bottom - top;
|
||||
int fixedTop = (m_graphicsDevice->GetViewContext()->GetViewportHeight() - top - height);
|
||||
int fixedBottom = fixedTop + height;
|
||||
|
||||
m_clipRegion.left = (float)left;
|
||||
m_clipRegion.top = (float)fixedTop;
|
||||
|
|
|
@ -29,8 +29,8 @@ struct SpriteBatchEntity
|
|||
{
|
||||
const Texture *texture;
|
||||
SPRITEBATCH_ENTITY_TYPE type;
|
||||
uint32_t firstVertex;
|
||||
uint32_t lastVertex;
|
||||
uint firstVertex;
|
||||
uint lastVertex;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
* @param y Y coordinate to render at
|
||||
* @param color color to tint the texture with
|
||||
*/
|
||||
void Render(const Texture *texture, int16_t x, int16_t y, const Color &color = COLOR_WHITE);
|
||||
void Render(const Texture *texture, int x, int y, const Color &color = COLOR_WHITE);
|
||||
|
||||
/**
|
||||
* Renders a texture as a sprite.
|
||||
|
@ -95,7 +95,7 @@ public:
|
|||
* @param height custom height to scale the texture to during rendering
|
||||
* @param color color to tint the texture with
|
||||
*/
|
||||
void Render(const Texture *texture, int16_t x, int16_t y, uint16_t width, uint16_t height, const Color &color = COLOR_WHITE);
|
||||
void Render(const Texture *texture, int x, int y, uint width, uint height, const Color &color = COLOR_WHITE);
|
||||
|
||||
/**
|
||||
* Renders a texture as a sprite.
|
||||
|
@ -107,7 +107,7 @@ public:
|
|||
* @param texCoordBottom bottom V texture coordinate defining a sub-region of the texture to render
|
||||
* @param color color to tint the texture with
|
||||
*/
|
||||
void Render(const Texture *texture, int16_t x, int16_t y, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color = COLOR_WHITE);
|
||||
void Render(const Texture *texture, int x, int y, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color = COLOR_WHITE);
|
||||
|
||||
/**
|
||||
* Renders a texture as a sprite.
|
||||
|
@ -121,7 +121,7 @@ public:
|
|||
* @param texCoordBottom bottom V texture coordinate defining a sub-region of the texture to render
|
||||
* @param color color to tint the texture with
|
||||
*/
|
||||
void Render(const Texture *texture, int16_t x, int16_t y, uint16_t width, uint16_t height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color = COLOR_WHITE);
|
||||
void Render(const Texture *texture, int x, int y, uint width, uint height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color = COLOR_WHITE);
|
||||
|
||||
/**
|
||||
* Renders a texture as a sprite. The given world position will be
|
||||
|
@ -141,7 +141,7 @@ public:
|
|||
* @param height custom height to scale the texture to during rendering
|
||||
* @param color color to tint the texture with
|
||||
*/
|
||||
void Render(const Texture *texture, const Vector3 &worldPosition, uint16_t width, uint16_t height, const Color &color = COLOR_WHITE);
|
||||
void Render(const Texture *texture, const Vector3 &worldPosition, uint width, uint height, const Color &color = COLOR_WHITE);
|
||||
|
||||
/**
|
||||
* Renders a texture as a sprite. The given world position will be
|
||||
|
@ -169,7 +169,7 @@ public:
|
|||
* @param texCoordBottom bottom V texture coordinate defining a sub-region of the texture to render
|
||||
* @param color color to tint the texture with
|
||||
*/
|
||||
void Render(const Texture *texture, const Vector3 &worldPosition, uint16_t width, uint16_t height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color = COLOR_WHITE);
|
||||
void Render(const Texture *texture, const Vector3 &worldPosition, uint width, uint height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color = COLOR_WHITE);
|
||||
|
||||
/**
|
||||
* Renders a texture atlas sub-texture / tile as a sprite.
|
||||
|
@ -178,7 +178,7 @@ public:
|
|||
* @param y Y coordinate to render at
|
||||
* @param color color to tint the texture with
|
||||
*/
|
||||
void Render(const TextureAtlas *atlas, uint32_t index, int16_t x, int16_t y, const Color &color = COLOR_WHITE);
|
||||
void Render(const TextureAtlas *atlas, uint index, int x, int y, const Color &color = COLOR_WHITE);
|
||||
|
||||
/**
|
||||
* Renders a texture atlas sub-texture / tile as a sprite.
|
||||
|
@ -189,7 +189,7 @@ public:
|
|||
* @param height custom height to scale the texture to during rendering
|
||||
* @param color color to tint the texture with
|
||||
*/
|
||||
void Render(const TextureAtlas *atlas, uint32_t index, int16_t x, int16_t y, uint16_t width, uint16_t height, const Color &color = COLOR_WHITE);
|
||||
void Render(const TextureAtlas *atlas, uint index, int x, int y, uint width, uint height, const Color &color = COLOR_WHITE);
|
||||
|
||||
/**
|
||||
* Renders a texture atlas sub-texture / tile as a sprite. The given
|
||||
|
@ -199,7 +199,7 @@ public:
|
|||
* @param worldPosition 3D world position to render at
|
||||
* @param color color to tint the texture with
|
||||
*/
|
||||
void Render(const TextureAtlas *atlas, uint32_t index, const Vector3 &worldPosition, const Color &color = COLOR_WHITE);
|
||||
void Render(const TextureAtlas *atlas, uint index, const Vector3 &worldPosition, const Color &color = COLOR_WHITE);
|
||||
|
||||
/**
|
||||
* Renders a texture atlas sub-texture / tile as a sprite. The given
|
||||
|
@ -211,7 +211,7 @@ public:
|
|||
* @param height custom height to scale the texture to during rendering
|
||||
* @param color color to tint the texture with
|
||||
*/
|
||||
void Render(const TextureAtlas *atlas, uint32_t index, const Vector3 &worldPosition, uint16_t width, uint16_t height, const Color &color = COLOR_WHITE);
|
||||
void Render(const TextureAtlas *atlas, uint index, const Vector3 &worldPosition, uint width, uint height, const Color &color = COLOR_WHITE);
|
||||
|
||||
/**
|
||||
* Renders text as series of sprites.
|
||||
|
@ -221,7 +221,7 @@ public:
|
|||
* @param color the color to render the text in
|
||||
* @param text the string of text to render
|
||||
*/
|
||||
void Render(const SpriteFont *font, int16_t x, int16_t y, const Color &color, const char *text);
|
||||
void Render(const SpriteFont *font, int x, int y, const Color &color, const char *text);
|
||||
|
||||
/**
|
||||
* Renders text as series of sprites.
|
||||
|
@ -232,7 +232,7 @@ public:
|
|||
* @param scale scaling factor to render with
|
||||
* @param text the string of text to render
|
||||
*/
|
||||
void Render(const SpriteFont *font, int16_t x, int16_t y, const Color &color, float scale, const char *text);
|
||||
void Render(const SpriteFont *font, int x, int y, const Color &color, float scale, const char *text);
|
||||
|
||||
/**
|
||||
* Renders text as series of sprites. The given world position will be
|
||||
|
@ -265,7 +265,7 @@ public:
|
|||
* @param color the color to render the text in
|
||||
* @param format the string of text to render
|
||||
*/
|
||||
void Printf(const SpriteFont *font, int16_t x, int16_t y, const Color &color, const char *format, ...);
|
||||
void Printf(const SpriteFont *font, int x, int y, const Color &color, const char *format, ...);
|
||||
|
||||
/**
|
||||
* Renders formatted text as series of sprites.
|
||||
|
@ -276,7 +276,7 @@ public:
|
|||
* @param scale scaling factor to render with
|
||||
* @param format the string of text to render
|
||||
*/
|
||||
void Printf(const SpriteFont *font, int16_t x, int16_t y, const Color &color, float scale, const char *format, ...);
|
||||
void Printf(const SpriteFont *font, int x, int y, const Color &color, float scale, const char *format, ...);
|
||||
|
||||
/**
|
||||
* Renders formatted text as series of sprites. The given world position
|
||||
|
@ -309,7 +309,7 @@ public:
|
|||
* @param y2 Y coordinate of the second point
|
||||
* @param color the color to render the line with
|
||||
*/
|
||||
void RenderLine(int16_t x1, int16_t y1, int16_t x2, int16_t y2, const Color &color);
|
||||
void RenderLine(int x1, int y1, int x2, int y2, const Color &color);
|
||||
|
||||
/**
|
||||
* Renders a box.
|
||||
|
@ -319,7 +319,7 @@ public:
|
|||
* @param bottom bottom Y coordinate of the box
|
||||
* @param color the color to render the box with
|
||||
*/
|
||||
void RenderBox(int16_t left, int16_t top, int16_t right, int16_t bottom, const Color &color);
|
||||
void RenderBox(int left, int top, int right, int bottom, const Color &color);
|
||||
|
||||
/**
|
||||
* Renders a box.
|
||||
|
@ -336,7 +336,7 @@ public:
|
|||
* @param bottom bottom Y coordinate of the box
|
||||
* @param color the color to render the box with
|
||||
*/
|
||||
void RenderFilledBox(int16_t left, int16_t top, int16_t right, int16_t bottom, const Color &color);
|
||||
void RenderFilledBox(int left, int top, int right, int bottom, const Color &color);
|
||||
|
||||
/**
|
||||
* Renders a filled box.
|
||||
|
@ -366,7 +366,7 @@ public:
|
|||
* @param right right X coordinate of the clipping region
|
||||
* @param bottom bottom Y coordinate of the clipping region
|
||||
*/
|
||||
void SetClipRegion(int16_t left, int16_t top, int16_t right, int16_t bottom);
|
||||
void SetClipRegion(int left, int top, int right, int bottom);
|
||||
|
||||
/**
|
||||
* Removes the clipping region. All subsequent rendering will no longer
|
||||
|
@ -377,18 +377,18 @@ public:
|
|||
private:
|
||||
void InternalBegin(const RenderState *renderState, const BlendState *blendState, SpriteShader *shader);
|
||||
|
||||
void AddSprite(const Texture *texture, int16_t destLeft, int16_t destTop, int16_t destRight, int16_t destBottom, uint16_t sourceLeft, uint16_t sourceTop, uint16_t sourceRight, uint16_t sourceBottom, const Color &color);
|
||||
void AddSprite(const Texture *texture, int16_t destLeft, int16_t destTop, int16_t destRight, int16_t destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color);
|
||||
void AddSprite(const Texture *texture, int destLeft, int destTop, int destRight, int destBottom, uint sourceLeft, uint sourceTop, uint sourceRight, uint sourceBottom, const Color &color);
|
||||
void AddSprite(const Texture *texture, int destLeft, int destTop, int destRight, int destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color);
|
||||
void AddSprite(const Texture *texture, float destLeft, float destTop, float destRight, float destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color);
|
||||
BOOL ClipSpriteCoords(float &left, float &top, float &right, float &bottom, float &texCoordLeft, float &texCoordTop, float &texCoordRight, float &texCoordBottom);
|
||||
void SetSpriteInfo(uint32_t spriteIndex, const Texture *texture, float destLeft, float destTop, float destRight, float destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color);
|
||||
void SetSpriteInfo(uint spriteIndex, const Texture *texture, float destLeft, float destTop, float destRight, float destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color);
|
||||
|
||||
void AddLine(float x1, float y1, float x2, float y2, const Color &color);
|
||||
void SetLineInfo(uint32_t spriteIndex, float x1, float y1, float x2, float y2, const Color &color);
|
||||
void SetLineInfo(uint spriteIndex, float x1, float y1, float x2, float y2, const Color &color);
|
||||
BOOL ClipLineCoords(float &x1, float &y1, float &x2, float &y2);
|
||||
|
||||
void AddFilledBox(float left, float top, float right, float bottom, const Color &color);
|
||||
void SetFilledBoxInfo(uint32_t spriteIndex, float left, float top, float right, float bottom, const Color &color);
|
||||
void SetFilledBoxInfo(uint spriteIndex, float left, float top, float right, float bottom, const Color &color);
|
||||
BOOL ClipFilledBoxCoords(float &left, float &top, float &right, float &bottom);
|
||||
|
||||
void RenderQueue();
|
||||
|
@ -396,9 +396,9 @@ private:
|
|||
|
||||
void CheckForNewSpriteSpace(SPRITEBATCH_ENTITY_TYPE type);
|
||||
|
||||
uint32_t GetVerticesRequiredFor(SPRITEBATCH_ENTITY_TYPE type);
|
||||
int16_t FixYCoord(int16_t y, uint16_t sourceHeight) const;
|
||||
float FixYCoord(int16_t y, float sourceHeight) const;
|
||||
uint GetVerticesRequiredFor(SPRITEBATCH_ENTITY_TYPE type);
|
||||
int FixYCoord(int y, uint sourceHeight) const;
|
||||
float FixYCoord(int y, float sourceHeight) const;
|
||||
|
||||
GraphicsDevice *m_graphicsDevice;
|
||||
SpriteShader *m_shader;
|
||||
|
@ -410,7 +410,7 @@ private:
|
|||
BlendState m_overrideBlendState;
|
||||
VertexBuffer *m_vertices;
|
||||
stl::vector<SpriteBatchEntity> m_entities;
|
||||
uint32_t m_currentSpritePointer;
|
||||
uint m_currentSpritePointer;
|
||||
Matrix4x4 m_previousProjection;
|
||||
Matrix4x4 m_previousModelview;
|
||||
BOOL m_isClipping;
|
||||
|
|
|
@ -23,7 +23,7 @@ SpriteFont::~SpriteFont()
|
|||
SAFE_DELETE(m_texture);
|
||||
}
|
||||
|
||||
void SpriteFont::Load(Texture *texture, TextureAtlas *glyphs, uint8_t size)
|
||||
void SpriteFont::Load(Texture *texture, TextureAtlas *glyphs, uint size)
|
||||
{
|
||||
m_texture = texture;
|
||||
m_glyphs = glyphs;
|
||||
|
@ -46,7 +46,7 @@ const TextureAtlasTile& SpriteFont::GetGlyph(unsigned char c) const
|
|||
return m_glyphs->GetTile((int)c - LOW_GLYPH);
|
||||
}
|
||||
|
||||
void SpriteFont::MeasureString(uint16_t *width, uint16_t *height, const char *format, ...) const
|
||||
void SpriteFont::MeasureString(uint *width, uint *height, const char *format, ...) const
|
||||
{
|
||||
if (width == NULL && height == NULL)
|
||||
return;
|
||||
|
@ -60,8 +60,8 @@ void SpriteFont::MeasureString(uint16_t *width, uint16_t *height, const char *fo
|
|||
|
||||
size_t textLength = strlen(buffer);
|
||||
|
||||
uint16_t currentMaxWidth = 0;
|
||||
uint16_t left = 0;
|
||||
uint currentMaxWidth = 0;
|
||||
uint left = 0;
|
||||
int numLines = 1;
|
||||
|
||||
for (size_t i = 0; i < textLength; ++i)
|
||||
|
@ -85,10 +85,10 @@ void SpriteFont::MeasureString(uint16_t *width, uint16_t *height, const char *fo
|
|||
if (width != NULL)
|
||||
*width = currentMaxWidth;
|
||||
if (height != NULL)
|
||||
*height = (uint16_t)(numLines * GetLetterHeight());
|
||||
*height = (uint)(numLines * GetLetterHeight());
|
||||
}
|
||||
|
||||
void SpriteFont::MeasureString(uint16_t *width, uint16_t *height, float scale, const char *format, ...) const
|
||||
void SpriteFont::MeasureString(uint *width, uint *height, float scale, const char *format, ...) const
|
||||
{
|
||||
if (width == NULL && height == NULL)
|
||||
return;
|
||||
|
@ -127,8 +127,8 @@ void SpriteFont::MeasureString(uint16_t *width, uint16_t *height, float scale, c
|
|||
}
|
||||
|
||||
if (width != NULL)
|
||||
*width = (uint16_t)ceil(currentMaxWidth);
|
||||
*width = (uint)ceil(currentMaxWidth);
|
||||
if (height != NULL)
|
||||
*height = (uint16_t)(numLines * scaledLetterHeight);
|
||||
*height = (uint)(numLines * scaledLetterHeight);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ class Texture;
|
|||
class TextureAtlas;
|
||||
struct TextureAtlasTile;
|
||||
|
||||
const uint8_t LOW_GLYPH = 32;
|
||||
const uint8_t HIGH_GLYPH = 127;
|
||||
const int LOW_GLYPH = 32;
|
||||
const int HIGH_GLYPH = 127;
|
||||
|
||||
/**
|
||||
* Represents a font that has been pre-rendered at a given size to a
|
||||
|
@ -37,7 +37,7 @@ public:
|
|||
* to the font's individual characters (glyphs)
|
||||
* @param size the size that the glyphs were rendered at
|
||||
*/
|
||||
void Load(Texture *texture, TextureAtlas *glyphs, uint8_t size);
|
||||
void Load(Texture *texture, TextureAtlas *glyphs, uint size);
|
||||
|
||||
/**
|
||||
* Lost OpenGL graphics context callback. This will free the texture
|
||||
|
@ -48,7 +48,7 @@ public:
|
|||
/**
|
||||
* @return the size that the glyphs were originally rendered at
|
||||
*/
|
||||
uint8_t GetSize() const { return m_size; }
|
||||
uint GetSize() const { return m_size; }
|
||||
|
||||
/**
|
||||
* @return the texture containing the font glyphs
|
||||
|
@ -59,7 +59,7 @@ public:
|
|||
* @return the number of pixels that one line of text rendered with this
|
||||
* font takes up
|
||||
*/
|
||||
uint8_t GetLetterHeight() const { return m_letterHeight; }
|
||||
uint GetLetterHeight() const { return m_letterHeight; }
|
||||
|
||||
/**
|
||||
* @param c the character to get sub-texture dimensions/positioning for
|
||||
|
@ -75,7 +75,7 @@ public:
|
|||
* @param height the height in pixels of the rendered text if not NULL
|
||||
* @param format the text to measure
|
||||
*/
|
||||
void MeasureString(uint16_t *width, uint16_t *height, const char *format, ...) const;
|
||||
void MeasureString(uint *width, uint *height, const char *format, ...) const;
|
||||
|
||||
/**
|
||||
* Measures the given string of text and returns the width and height
|
||||
|
@ -85,14 +85,14 @@ public:
|
|||
* @param scale a scaling factor for rendering to take into account
|
||||
* @param format the text to measure
|
||||
*/
|
||||
void MeasureString(uint16_t *width, uint16_t *height, float scale, const char *format, ...) const;
|
||||
void MeasureString(uint *width, uint *height, float scale, const char *format, ...) const;
|
||||
|
||||
private:
|
||||
uint8_t m_size;
|
||||
uint m_size;
|
||||
|
||||
Texture *m_texture;
|
||||
TextureAtlas *m_glyphs;
|
||||
uint8_t m_letterHeight;
|
||||
uint m_letterHeight;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -14,5 +14,5 @@ SpriteShader::~SpriteShader()
|
|||
void SpriteShader::SetTextureHasAlphaOnly(BOOL hasAlphaOnly)
|
||||
{
|
||||
ASSERT(IsReadyForUse() == TRUE);
|
||||
SetUniform(m_textureHasAlphaOnlyUniform, (int32_t)hasAlphaOnly);
|
||||
SetUniform(m_textureHasAlphaOnlyUniform, (int)hasAlphaOnly);
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@ BOOL Texture::Create(GraphicsDevice *graphicsDevice, Image *image)
|
|||
|
||||
const void* pixels = image->GetPixels();
|
||||
TEXTURE_FORMAT format = TEXTURE_FORMAT_NONE;
|
||||
uint32_t glFormat = 0;
|
||||
uint32_t glType = GL_UNSIGNED_BYTE;
|
||||
uint glFormat = 0;
|
||||
uint glType = GL_UNSIGNED_BYTE;
|
||||
|
||||
if (image->GetFormat() == IMAGE_FORMAT_ALPHA)
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ BOOL Texture::Create(GraphicsDevice *graphicsDevice, Image *image)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL Texture::Create(GraphicsDevice *graphicsDevice, uint16_t width, uint16_t height, TEXTURE_FORMAT textureFormat)
|
||||
BOOL Texture::Create(GraphicsDevice *graphicsDevice, uint width, uint height, TEXTURE_FORMAT textureFormat)
|
||||
{
|
||||
ASSERT(m_textureName == 0);
|
||||
if (m_textureName != 0)
|
||||
|
@ -94,8 +94,8 @@ BOOL Texture::Create(GraphicsDevice *graphicsDevice, uint16_t width, uint16_t he
|
|||
}
|
||||
|
||||
int bpp = 0;
|
||||
uint32_t format = 0;
|
||||
uint32_t type = 0;
|
||||
uint format = 0;
|
||||
uint type = 0;
|
||||
GetTextureSpecsFromFormat(textureFormat, &bpp, &format, &type);
|
||||
ASSERT(format != 0);
|
||||
if (format == 0)
|
||||
|
@ -142,7 +142,7 @@ void Texture::Release()
|
|||
m_format = TEXTURE_FORMAT_NONE;
|
||||
}
|
||||
|
||||
BOOL Texture::Update(Image *image, uint16_t destX, uint16_t destY)
|
||||
BOOL Texture::Update(Image *image, uint destX, uint destY)
|
||||
{
|
||||
ASSERT(m_textureName != 0);
|
||||
if (m_textureName == 0)
|
||||
|
@ -162,8 +162,8 @@ BOOL Texture::Update(Image *image, uint16_t destX, uint16_t destY)
|
|||
ASSERT(destY + image->GetHeight() <= m_height);
|
||||
|
||||
const void* pixels = image->GetPixels();
|
||||
uint32_t glFormat = 0;
|
||||
uint32_t glType = 0;
|
||||
uint glFormat = 0;
|
||||
uint glType = 0;
|
||||
|
||||
if (image->GetFormat() == IMAGE_FORMAT_ALPHA)
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ void Texture::OnLostContext()
|
|||
m_textureName = 0;
|
||||
}
|
||||
|
||||
void Texture::GetTextureSpecsFromFormat(TEXTURE_FORMAT textureFormat, int *bpp, uint32_t *format, uint32_t *type)
|
||||
void Texture::GetTextureSpecsFromFormat(TEXTURE_FORMAT textureFormat, int *bpp, uint *format, uint *type)
|
||||
{
|
||||
switch (textureFormat)
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
* @param height the height of the texture in pixels
|
||||
* @param textureFormat the format of the pixel data this texture contains
|
||||
*/
|
||||
BOOL Create(GraphicsDevice *graphicsDevice, uint16_t width, uint16_t height, TEXTURE_FORMAT textureFormat);
|
||||
BOOL Create(GraphicsDevice *graphicsDevice, uint width, uint height, TEXTURE_FORMAT textureFormat);
|
||||
|
||||
/**
|
||||
* Frees the texture resources.
|
||||
|
@ -51,22 +51,22 @@ public:
|
|||
* @param destY the Y coordinate on the texture to place the new image at
|
||||
* @return TRUE if the texture was updated successfully
|
||||
*/
|
||||
BOOL Update(Image *image, uint16_t destX = 0, uint16_t destY = 0);
|
||||
BOOL Update(Image *image, uint destX = 0, uint destY = 0);
|
||||
|
||||
/**
|
||||
* @return the texture name or ID assigned to this texture by OpenGL
|
||||
*/
|
||||
uint32_t GetTextureName() const { return m_textureName; }
|
||||
uint GetTextureName() const { return m_textureName; }
|
||||
|
||||
/**
|
||||
* @return the width of this texture in pixels
|
||||
*/
|
||||
uint16_t GetWidth() const { return m_width; }
|
||||
uint GetWidth() const { return m_width; }
|
||||
|
||||
/**
|
||||
* @return the height of this texture in pixels
|
||||
*/
|
||||
uint16_t GetHeight() const { return m_height; }
|
||||
uint GetHeight() const { return m_height; }
|
||||
|
||||
/**
|
||||
* @return the pixel format of this texture
|
||||
|
@ -86,12 +86,12 @@ public:
|
|||
void OnLostContext();
|
||||
|
||||
private:
|
||||
void GetTextureSpecsFromFormat(TEXTURE_FORMAT textureFormat, int *bpp, uint32_t *format, uint32_t *type);
|
||||
void GetTextureSpecsFromFormat(TEXTURE_FORMAT textureFormat, int *bpp, uint *format, uint *type);
|
||||
|
||||
GraphicsDevice *m_graphicsDevice;
|
||||
uint32_t m_textureName;
|
||||
uint16_t m_width;
|
||||
uint16_t m_height;
|
||||
uint m_textureName;
|
||||
uint m_width;
|
||||
uint m_height;
|
||||
TEXTURE_FORMAT m_format;
|
||||
};
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "texture.h"
|
||||
|
||||
TextureAtlas::TextureAtlas(uint16_t textureWidth, uint16_t textureHeight, float texCoordEdgeOffset)
|
||||
TextureAtlas::TextureAtlas(uint textureWidth, uint textureHeight, float texCoordEdgeOffset)
|
||||
{
|
||||
ASSERT(textureWidth > 0);
|
||||
ASSERT(textureHeight > 0);
|
||||
|
|
|
@ -45,17 +45,17 @@ public:
|
|||
/**
|
||||
* @return the width in pixels of the underlying texture object
|
||||
*/
|
||||
uint16_t GetWidth() const { return m_textureWidth; }
|
||||
uint GetWidth() const { return m_textureWidth; }
|
||||
|
||||
/**
|
||||
* @return the height in pixels of the underlying texture object
|
||||
*/
|
||||
uint16_t GetHeight() const { return m_textureHeight; }
|
||||
uint GetHeight() const { return m_textureHeight; }
|
||||
|
||||
/**
|
||||
* @return the number of sub-textures or tiles currently contained in this atlas
|
||||
*/
|
||||
uint32_t GetNumTextures() const { return m_tiles.size(); }
|
||||
uint GetNumTextures() const { return m_tiles.size(); }
|
||||
|
||||
/**
|
||||
* Gets position and dimension information about a specified
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
* @param index the index of the sub-texture or tile to retrieve
|
||||
* @return the sub-texture/tile's information
|
||||
*/
|
||||
const TextureAtlasTile& GetTile(uint32_t index) const { return m_tiles[index]; }
|
||||
const TextureAtlasTile& GetTile(uint index) const { return m_tiles[index]; }
|
||||
|
||||
/**
|
||||
* Sets the underlying texture object for this atlas.
|
||||
|
@ -82,7 +82,7 @@ protected:
|
|||
* help alleviate "texture bleeding"
|
||||
* issues while rendering
|
||||
*/
|
||||
TextureAtlas(uint16_t textureWidth, uint16_t textureHeight, float texCoordEdgeOffset = TEXCOORD_EDGE_BLEED_OFFSET);
|
||||
TextureAtlas(uint textureWidth, uint textureHeight, float texCoordEdgeOffset = TEXCOORD_EDGE_BLEED_OFFSET);
|
||||
|
||||
/**
|
||||
* Sets the base texture object.
|
||||
|
@ -103,8 +103,8 @@ protected:
|
|||
stl::vector<TextureAtlasTile> m_tiles;
|
||||
|
||||
private:
|
||||
uint16_t m_textureWidth;
|
||||
uint16_t m_textureHeight;
|
||||
uint m_textureWidth;
|
||||
uint m_textureHeight;
|
||||
Texture *m_source;
|
||||
float m_texCoordEdgeOffset;
|
||||
};
|
||||
|
|
|
@ -56,14 +56,14 @@ struct VertexBufferAttribute
|
|||
* The number of floating point value components that make up the
|
||||
* attribute. e.g. 3 for a Vector3, 4 for a Color, etc.
|
||||
*/
|
||||
uint32_t size;
|
||||
uint size;
|
||||
|
||||
/**
|
||||
* The offset from the start of a vertex to where this attribute's data
|
||||
* begins. Specified as the number of floating point components
|
||||
* (Multiply by sizeof(float) to get the offset as the number of bytes).
|
||||
*/
|
||||
uint32_t offset;
|
||||
uint offset;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -44,12 +44,12 @@ void VertexBuffer::Release()
|
|||
BufferObject::Release();
|
||||
}
|
||||
|
||||
BOOL VertexBuffer::Initialize(const VERTEX_ATTRIBS *attributes, uint32_t numAttributes, uint32_t numVertices, BUFFEROBJECT_USAGE usage)
|
||||
BOOL VertexBuffer::Initialize(const VERTEX_ATTRIBS *attributes, uint numAttributes, uint numVertices, BUFFEROBJECT_USAGE usage)
|
||||
{
|
||||
return Initialize(NULL, attributes, numAttributes, numVertices, usage);
|
||||
}
|
||||
|
||||
BOOL VertexBuffer::Initialize(GraphicsDevice *graphicsDevice, const VERTEX_ATTRIBS *attributes, uint32_t numAttributes, uint32_t numVertices, BUFFEROBJECT_USAGE usage)
|
||||
BOOL VertexBuffer::Initialize(GraphicsDevice *graphicsDevice, const VERTEX_ATTRIBS *attributes, uint numAttributes, uint numVertices, BUFFEROBJECT_USAGE usage)
|
||||
{
|
||||
ASSERT(m_buffer.size() == 0);
|
||||
if (m_buffer.size() > 0)
|
||||
|
@ -88,9 +88,9 @@ BOOL VertexBuffer::Initialize(GraphicsDevice *graphicsDevice, const VertexBuffer
|
|||
if (!BufferObject::Initialize(graphicsDevice, BUFFEROBJECT_TYPE_VERTEX, source->GetUsage()))
|
||||
return FALSE;
|
||||
|
||||
uint32_t numAttribs = source->GetNumAttributes();
|
||||
uint numAttribs = source->GetNumAttributes();
|
||||
VERTEX_ATTRIBS *attribs = new VERTEX_ATTRIBS[numAttribs];
|
||||
for (uint32_t i = 0; i < numAttribs; ++i)
|
||||
for (uint i = 0; i < numAttribs; ++i)
|
||||
attribs[i] = source->GetAttributeInfo(i)->standardType;
|
||||
|
||||
BOOL success = SetSizesAndOffsets(attribs, numAttribs);
|
||||
|
@ -105,7 +105,7 @@ BOOL VertexBuffer::Initialize(GraphicsDevice *graphicsDevice, const VertexBuffer
|
|||
return success;
|
||||
}
|
||||
|
||||
BOOL VertexBuffer::SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint32_t numAttributes)
|
||||
BOOL VertexBuffer::SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint numAttributes)
|
||||
{
|
||||
ASSERT(attributes != NULL);
|
||||
ASSERT(numAttributes > 0);
|
||||
|
@ -121,13 +121,13 @@ BOOL VertexBuffer::SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint32_t
|
|||
if (m_attribs != NULL)
|
||||
return FALSE;
|
||||
|
||||
uint32_t numGpuSlotsUsed = 0;
|
||||
uint32_t offset = 0;
|
||||
uint numGpuSlotsUsed = 0;
|
||||
uint offset = 0;
|
||||
|
||||
VertexBufferAttribute *attribsInfo = new VertexBufferAttribute[numAttributes];
|
||||
BOOL success = TRUE;
|
||||
|
||||
for (uint32_t i = 0; i < numAttributes; ++i)
|
||||
for (uint i = 0; i < numAttributes; ++i)
|
||||
{
|
||||
VERTEX_ATTRIBS attrib = attributes[i];
|
||||
|
||||
|
@ -136,7 +136,7 @@ BOOL VertexBuffer::SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint32_t
|
|||
uint8_t standardTypeBitMask = (uint8_t)((uint16_t)attrib >> 8);
|
||||
|
||||
// using integer division that rounds up (so given size = 13, result is 4, not 3)
|
||||
uint32_t thisAttribsGpuSlotSize = ((uint32_t)size + (FLOATS_PER_GPU_ATTRIB_SLOT - 1)) / FLOATS_PER_GPU_ATTRIB_SLOT;
|
||||
uint thisAttribsGpuSlotSize = ((uint)size + (FLOATS_PER_GPU_ATTRIB_SLOT - 1)) / FLOATS_PER_GPU_ATTRIB_SLOT;
|
||||
ASSERT(numGpuSlotsUsed + thisAttribsGpuSlotSize <= MAX_GPU_ATTRIB_SLOTS);
|
||||
if (numGpuSlotsUsed + thisAttribsGpuSlotSize > MAX_GPU_ATTRIB_SLOTS)
|
||||
{
|
||||
|
@ -200,18 +200,18 @@ BOOL VertexBuffer::SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint32_t
|
|||
return success;
|
||||
}
|
||||
|
||||
int32_t VertexBuffer::GetIndexOfStandardAttrib(VERTEX_STANDARD_ATTRIBS standardAttrib) const
|
||||
int VertexBuffer::GetIndexOfStandardAttrib(VERTEX_STANDARD_ATTRIBS standardAttrib) const
|
||||
{
|
||||
for (uint32_t i = 0; i < m_numAttributes; ++i)
|
||||
for (uint i = 0; i < m_numAttributes; ++i)
|
||||
{
|
||||
if ((uint32_t)m_attribs[i].standardType == (uint32_t)standardAttrib)
|
||||
return (int32_t)i;
|
||||
if ((uint)m_attribs[i].standardType == (uint)standardAttrib)
|
||||
return (int)i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void VertexBuffer::Resize(uint32_t numVertices)
|
||||
void VertexBuffer::Resize(uint numVertices)
|
||||
{
|
||||
ASSERT(numVertices > 0);
|
||||
if (numVertices == 0)
|
||||
|
@ -227,13 +227,13 @@ void VertexBuffer::Resize(uint32_t numVertices)
|
|||
--m_currentVertex;
|
||||
}
|
||||
|
||||
void VertexBuffer::Extend(uint32_t amount)
|
||||
void VertexBuffer::Extend(uint amount)
|
||||
{
|
||||
uint32_t newSize = GetNumElements() + amount;
|
||||
uint newSize = GetNumElements() + amount;
|
||||
Resize(newSize);
|
||||
}
|
||||
|
||||
void VertexBuffer::Copy(const VertexBuffer *source, uint32_t destIndex)
|
||||
void VertexBuffer::Copy(const VertexBuffer *source, uint destIndex)
|
||||
{
|
||||
ASSERT(source != NULL);
|
||||
ASSERT(source->GetNumElements() > 0);
|
||||
|
@ -241,7 +241,7 @@ void VertexBuffer::Copy(const VertexBuffer *source, uint32_t destIndex)
|
|||
ASSERT(destIndex >= 0);
|
||||
ASSERT(destIndex + source->GetNumElements() <= GetNumElements());
|
||||
|
||||
uint32_t destOffset = GetVertexPosition(destIndex);
|
||||
uint destOffset = GetVertexPosition(destIndex);
|
||||
memcpy(&m_buffer[destOffset], source->GetBuffer(), GetNumElements() * GetElementWidthInBytes());
|
||||
|
||||
SetDirty();
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
* @param usage the expected usage pattern of this vertex buffer
|
||||
* @return TRUE if successful, FALSE if not
|
||||
*/
|
||||
BOOL Initialize(const VERTEX_ATTRIBS *attributes, uint32_t numAttributes, uint32_t numVertices, BUFFEROBJECT_USAGE usage);
|
||||
BOOL Initialize(const VERTEX_ATTRIBS *attributes, uint numAttributes, uint numVertices, BUFFEROBJECT_USAGE usage);
|
||||
|
||||
/**
|
||||
* Initializes the vertex buffer.
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
* @param usage the expected usage pattern of this vertex buffer
|
||||
* @return TRUE if successful, FALSE if not
|
||||
*/
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, const VERTEX_ATTRIBS *attributes, uint32_t numAttributes, uint32_t numVertices, BUFFEROBJECT_USAGE usage);
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, const VERTEX_ATTRIBS *attributes, uint numAttributes, uint numVertices, BUFFEROBJECT_USAGE usage);
|
||||
|
||||
/**
|
||||
* Initializes the vertex buffer.
|
||||
|
@ -76,21 +76,21 @@ public:
|
|||
/**
|
||||
* @return the number of attributes in this vertex buffer
|
||||
*/
|
||||
uint32_t GetNumAttributes() const { return m_numAttributes; }
|
||||
uint GetNumAttributes() const { return m_numAttributes; }
|
||||
|
||||
/**
|
||||
* Returns information about the specified attribute.
|
||||
* @param index the index of the attribute to get information about
|
||||
* @return the attribute's information
|
||||
*/
|
||||
const VertexBufferAttribute* GetAttributeInfo(uint32_t index) const { return &m_attribs[index]; }
|
||||
const VertexBufferAttribute* GetAttributeInfo(uint index) const { return &m_attribs[index]; }
|
||||
|
||||
/**
|
||||
* @return the standard attributes included in this buffer's data. Note
|
||||
* that this is not necessarily all of the attributes contained in
|
||||
* this buffer.
|
||||
*/
|
||||
uint32_t GetStandardAttribs() const { return m_standardTypeAttribs; }
|
||||
uint GetStandardAttribs() const { return m_standardTypeAttribs; }
|
||||
|
||||
/**
|
||||
* Checks whether this buffer's vertex data includes the specified standard
|
||||
|
@ -99,120 +99,120 @@ public:
|
|||
* @return TRUE if the vertex data in this buffer contains this standard
|
||||
* attribute
|
||||
*/
|
||||
BOOL HasStandardAttrib(VERTEX_STANDARD_ATTRIBS standardAttrib) const { return (m_standardTypeAttribs & (uint32_t)standardAttrib) > 0; }
|
||||
BOOL HasStandardAttrib(VERTEX_STANDARD_ATTRIBS standardAttrib) const { return (m_standardTypeAttribs & (uint)standardAttrib) > 0; }
|
||||
|
||||
/**
|
||||
* Returns the index of the specified standard attribute.
|
||||
* @param standardAttrib the standard attribute to get the index of
|
||||
* @return the index of the attribute, or -1 if it is not present
|
||||
*/
|
||||
int32_t GetIndexOfStandardAttrib(VERTEX_STANDARD_ATTRIBS standardAttrib) const;
|
||||
int GetIndexOfStandardAttrib(VERTEX_STANDARD_ATTRIBS standardAttrib) const;
|
||||
|
||||
/**
|
||||
* @return the offset from the start of a single vertex's data that the
|
||||
* color attribute starts at (in floats)
|
||||
*/
|
||||
uint32_t GetColorOffset() const { return m_colorOffset; }
|
||||
uint GetColorOffset() const { return m_colorOffset; }
|
||||
|
||||
/**
|
||||
* @return the offset from the start of a single vertex's data that the
|
||||
* 3D position attribute starts at (in floats)
|
||||
*/
|
||||
uint32_t GetPosition3Offset() const { return m_position3Offset; }
|
||||
uint GetPosition3Offset() const { return m_position3Offset; }
|
||||
|
||||
/**
|
||||
* @return the offset from the start of a single vertex's data that the
|
||||
* 2D position attribute starts at (in floats)
|
||||
*/
|
||||
uint32_t GetPosition2Offset() const { return m_position2Offset; }
|
||||
uint GetPosition2Offset() const { return m_position2Offset; }
|
||||
|
||||
/**
|
||||
* @return the offset from the start of a single vertex's data that the
|
||||
* normal attribute starts at (in floats)
|
||||
*/
|
||||
uint32_t GetNormalOffset() const { return m_normalOffset; }
|
||||
uint GetNormalOffset() const { return m_normalOffset; }
|
||||
|
||||
/**
|
||||
* @return the offset from the start of a single vertex's data that the
|
||||
* texture coordinate attribute starts at (in floats)
|
||||
*/
|
||||
uint32_t GetTexCoordOffset() const { return m_texCoordOffset; }
|
||||
uint GetTexCoordOffset() const { return m_texCoordOffset; }
|
||||
|
||||
/**
|
||||
* @return the offset from the start of a single vertex's data that the
|
||||
* color attribute starts at (in bytes)
|
||||
*/
|
||||
uint32_t GetColorOffsetBytes() const { return m_colorOffset * sizeof(float); }
|
||||
uint GetColorOffsetBytes() const { return m_colorOffset * sizeof(float); }
|
||||
|
||||
/**
|
||||
* @return the offset from the start of a single vertex's data that the
|
||||
* 3D position attribute starts at (in bytes)
|
||||
*/
|
||||
uint32_t GetPosition3OffsetBytes() const { return m_position3Offset * sizeof(float); }
|
||||
uint GetPosition3OffsetBytes() const { return m_position3Offset * sizeof(float); }
|
||||
|
||||
/**
|
||||
* @return the offset from the start of a single vertex's data that the
|
||||
* 2D position attribute starts at (in bytes)
|
||||
*/
|
||||
uint32_t GetPosition2OffsetBytes() const { return m_position2Offset * sizeof(float); }
|
||||
uint GetPosition2OffsetBytes() const { return m_position2Offset * sizeof(float); }
|
||||
|
||||
/**
|
||||
* @return the offset from the start of a single vertex's data that the
|
||||
* normal attribute starts at (in bytes)
|
||||
*/
|
||||
uint32_t GetNormalOffsetBytes() const { return m_normalOffset * sizeof(float); }
|
||||
uint GetNormalOffsetBytes() const { return m_normalOffset * sizeof(float); }
|
||||
|
||||
/**
|
||||
* @return the offset from the start of a single vertex's data that the
|
||||
* texture coordinate attribute starts at (in bytes)
|
||||
*/
|
||||
uint32_t GetTexCoordOffsetBytes() const { return m_texCoordOffset * sizeof(float); }
|
||||
uint GetTexCoordOffsetBytes() const { return m_texCoordOffset * sizeof(float); }
|
||||
|
||||
/**
|
||||
* @param index the vertex to get the color data for
|
||||
* @return the vertex's color data
|
||||
*/
|
||||
Color GetColor(uint32_t index) const;
|
||||
Color GetColor(uint index) const;
|
||||
|
||||
/**
|
||||
* @param index the vertex to get the position data for
|
||||
* @return the vertex's 3D position data
|
||||
*/
|
||||
Vector3 GetPosition3(uint32_t index) const;
|
||||
Vector3 GetPosition3(uint index) const;
|
||||
|
||||
/**
|
||||
* @param index the vertex to get the position data for
|
||||
* @return the vertex's 2D position data
|
||||
*/
|
||||
Vector2 GetPosition2(uint32_t index) const;
|
||||
Vector2 GetPosition2(uint index) const;
|
||||
|
||||
/**
|
||||
* @param index the vertex to get the normal data for
|
||||
* @return the vertex's normal data
|
||||
*/
|
||||
Vector3 GetNormal(uint32_t index) const;
|
||||
Vector3 GetNormal(uint index) const;
|
||||
|
||||
/**
|
||||
* @param index the vertex to get the texture coordinate data for
|
||||
* @return the vertex's texture coordinate data
|
||||
*/
|
||||
Vector2 GetTexCoord(uint32_t index) const;
|
||||
Vector2 GetTexCoord(uint index) const;
|
||||
|
||||
void Get1f(uint32_t attrib, uint32_t index, float &x) const;
|
||||
float Get1f(uint32_t attrib, uint32_t index) const;
|
||||
void Get2f(uint32_t attrib, uint32_t index, float &x, float &y) const;
|
||||
void Get2f(uint32_t attrib, uint32_t index, Vector2 &v) const;
|
||||
Vector2 Get2f(uint32_t attrib, uint32_t index) const;
|
||||
void Get3f(uint32_t attrib, uint32_t index, float &x, float &y, float &z) const;
|
||||
void Get3f(uint32_t attrib, uint32_t index, Vector3 &v) const;
|
||||
Vector3 Get3f(uint32_t attrib, uint32_t index) const;
|
||||
void Get4f(uint32_t attrib, uint32_t index, float &x, float &y, float &z, float &w) const;
|
||||
void Get4f(uint32_t attrib, uint32_t index, Color &c) const;
|
||||
Color Get4f(uint32_t attrib, uint32_t index) const;
|
||||
void Get9f(uint32_t attrib, uint32_t index, Matrix3x3 &m) const;
|
||||
Matrix3x3 Get9f(uint32_t attrib, uint32_t index) const;
|
||||
void Get16f(uint32_t attrib, uint32_t index, Matrix4x4 &m) const;
|
||||
Matrix4x4 Get16f(uint32_t attrib, uint32_t index) const;
|
||||
void Get1f(uint attrib, uint index, float &x) const;
|
||||
float Get1f(uint attrib, uint index) const;
|
||||
void Get2f(uint attrib, uint index, float &x, float &y) const;
|
||||
void Get2f(uint attrib, uint index, Vector2 &v) const;
|
||||
Vector2 Get2f(uint attrib, uint index) const;
|
||||
void Get3f(uint attrib, uint index, float &x, float &y, float &z) const;
|
||||
void Get3f(uint attrib, uint index, Vector3 &v) const;
|
||||
Vector3 Get3f(uint attrib, uint index) const;
|
||||
void Get4f(uint attrib, uint index, float &x, float &y, float &z, float &w) const;
|
||||
void Get4f(uint attrib, uint index, Color &c) const;
|
||||
Color Get4f(uint attrib, uint index) const;
|
||||
void Get9f(uint attrib, uint index, Matrix3x3 &m) const;
|
||||
Matrix3x3 Get9f(uint attrib, uint index) const;
|
||||
void Get16f(uint attrib, uint index, Matrix4x4 &m) const;
|
||||
Matrix4x4 Get16f(uint attrib, uint index) const;
|
||||
|
||||
/**
|
||||
* @return the current vertex's color data
|
||||
|
@ -239,28 +239,28 @@ public:
|
|||
*/
|
||||
Vector2 GetCurrentTexCoord() const { return GetTexCoord(GetCurrentPosition()); }
|
||||
|
||||
void GetCurrent1f(uint32_t attrib, float &x) const { Get1f(attrib, GetCurrentPosition(), x); }
|
||||
float GetCurrent1f(uint32_t attrib) const { return Get1f(attrib, GetCurrentPosition()); }
|
||||
void GetCurrent2f(uint32_t attrib, float &x, float &y) const { Get2f(attrib, GetCurrentPosition(), x, y); }
|
||||
void GetCurrent2f(uint32_t attrib, Vector2 &v) const { Get2f(attrib, GetCurrentPosition(), v); }
|
||||
Vector2 GetCurrent2f(uint32_t attrib) const { return Get2f(attrib, GetCurrentPosition()); }
|
||||
void GetCurrent3f(uint32_t attrib, float &x, float &y, float &z) const { Get3f(attrib, GetCurrentPosition(), x, y, z); }
|
||||
void GetCurrent3f(uint32_t attrib, Vector3 &v) const { Get3f(attrib, GetCurrentPosition(), v); }
|
||||
Vector3 GetCurrent3f(uint32_t attrib) const { return Get3f(attrib, GetCurrentPosition()); }
|
||||
void GetCurrent4f(uint32_t attrib, float &x, float &y, float &z, float &w) const { Get4f(attrib, GetCurrentPosition(), x, y, z, w); }
|
||||
void GetCurrent4f(uint32_t attrib, Color &c) const { Get4f(attrib, GetCurrentPosition(), c); }
|
||||
Color GetCurrent4f(uint32_t attrib) const { return Get4f(attrib, GetCurrentPosition()); }
|
||||
void GetCurrent9f(uint32_t attrib, Matrix3x3 &m) const { Get9f(attrib, GetCurrentPosition(), m); }
|
||||
Matrix3x3 GetCurrent9f(uint32_t attrib) const { return Get9f(attrib, GetCurrentPosition()); }
|
||||
void GetCurrent16f(uint32_t attrib, Matrix4x4 &m) const { Get16f(attrib, GetCurrentPosition(), m); }
|
||||
Matrix4x4 GetCurrent16f(uint32_t attrib) const { return Get16f(attrib, GetCurrentPosition()); }
|
||||
void GetCurrent1f(uint attrib, float &x) const { Get1f(attrib, GetCurrentPosition(), x); }
|
||||
float GetCurrent1f(uint attrib) const { return Get1f(attrib, GetCurrentPosition()); }
|
||||
void GetCurrent2f(uint attrib, float &x, float &y) const { Get2f(attrib, GetCurrentPosition(), x, y); }
|
||||
void GetCurrent2f(uint attrib, Vector2 &v) const { Get2f(attrib, GetCurrentPosition(), v); }
|
||||
Vector2 GetCurrent2f(uint attrib) const { return Get2f(attrib, GetCurrentPosition()); }
|
||||
void GetCurrent3f(uint attrib, float &x, float &y, float &z) const { Get3f(attrib, GetCurrentPosition(), x, y, z); }
|
||||
void GetCurrent3f(uint attrib, Vector3 &v) const { Get3f(attrib, GetCurrentPosition(), v); }
|
||||
Vector3 GetCurrent3f(uint attrib) const { return Get3f(attrib, GetCurrentPosition()); }
|
||||
void GetCurrent4f(uint attrib, float &x, float &y, float &z, float &w) const { Get4f(attrib, GetCurrentPosition(), x, y, z, w); }
|
||||
void GetCurrent4f(uint attrib, Color &c) const { Get4f(attrib, GetCurrentPosition(), c); }
|
||||
Color GetCurrent4f(uint attrib) const { return Get4f(attrib, GetCurrentPosition()); }
|
||||
void GetCurrent9f(uint attrib, Matrix3x3 &m) const { Get9f(attrib, GetCurrentPosition(), m); }
|
||||
Matrix3x3 GetCurrent9f(uint attrib) const { return Get9f(attrib, GetCurrentPosition()); }
|
||||
void GetCurrent16f(uint attrib, Matrix4x4 &m) const { Get16f(attrib, GetCurrentPosition(), m); }
|
||||
Matrix4x4 GetCurrent16f(uint attrib) const { return Get16f(attrib, GetCurrentPosition()); }
|
||||
|
||||
/**
|
||||
* Sets a vertex's color attribute.
|
||||
* @param index the vertex to set
|
||||
* @param color the new color attribute to set
|
||||
*/
|
||||
void SetColor(uint32_t index, const Color &color);
|
||||
void SetColor(uint index, const Color &color);
|
||||
|
||||
/**
|
||||
* Sets a vertex's color attribute.
|
||||
|
@ -269,7 +269,7 @@ public:
|
|||
* @param g green component of the color attribute to set
|
||||
* @param b blue component of the color attribute to set
|
||||
*/
|
||||
void SetColor(uint32_t index, float r, float g, float b);
|
||||
void SetColor(uint index, float r, float g, float b);
|
||||
|
||||
/**
|
||||
* Sets a vertex's color attribute.
|
||||
|
@ -279,14 +279,14 @@ public:
|
|||
* @param b blue component of the color attribute to set
|
||||
* @param a alpha component of the color attribute to set
|
||||
*/
|
||||
void SetColor(uint32_t index, float r, float g, float b, float a);
|
||||
void SetColor(uint index, float r, float g, float b, float a);
|
||||
|
||||
/**
|
||||
* Sets a vertex's 3D position attribute.
|
||||
* @param index the vertex to set
|
||||
* @param position the new 3D position attribute to set
|
||||
*/
|
||||
void SetPosition3(uint32_t index, const Vector3 &position);
|
||||
void SetPosition3(uint index, const Vector3 &position);
|
||||
|
||||
/**
|
||||
* Sets a vertex's 3D position attribute.
|
||||
|
@ -295,14 +295,14 @@ public:
|
|||
* @param y Y coordinate of the 3D position attribute to set
|
||||
* @param z Z coordinate of the 3D position attribute to set
|
||||
*/
|
||||
void SetPosition3(uint32_t index, float x, float y, float z);
|
||||
void SetPosition3(uint index, float x, float y, float z);
|
||||
|
||||
/**
|
||||
* Sets a vertex's 2D position attribute.
|
||||
* @param index the vertex to set
|
||||
* @param position the new 2D position attribute to set
|
||||
*/
|
||||
void SetPosition2(uint32_t index, const Vector2 &position);
|
||||
void SetPosition2(uint index, const Vector2 &position);
|
||||
|
||||
/**
|
||||
* Sets a vertex's 2D position attribute.
|
||||
|
@ -310,14 +310,14 @@ public:
|
|||
* @param x X coordinate of the 2D position attribute to set
|
||||
* @param y Y coordinate of the 2D position attribute to set
|
||||
*/
|
||||
void SetPosition2(uint32_t index, float x, float y);
|
||||
void SetPosition2(uint index, float x, float y);
|
||||
|
||||
/**
|
||||
* Sets a vertex's normal attribute.
|
||||
* @param index the vertex to set
|
||||
* @param position the new normal attribute to set
|
||||
*/
|
||||
void SetNormal(uint32_t index, const Vector3 &normal);
|
||||
void SetNormal(uint index, const Vector3 &normal);
|
||||
|
||||
/**
|
||||
* Sets a vertex's normal attribute.
|
||||
|
@ -326,14 +326,14 @@ public:
|
|||
* @param y Y coordinate of the normal attribute to set
|
||||
* @param z Z coordinate of the normal attribute to set
|
||||
*/
|
||||
void SetNormal(uint32_t index, float x, float y, float z);
|
||||
void SetNormal(uint index, float x, float y, float z);
|
||||
|
||||
/**
|
||||
* Sets a vertex's texture coordinate attribute.
|
||||
* @param index the vertex to set
|
||||
* @param texCoord the new texture coordinate attribute to set
|
||||
*/
|
||||
void SetTexCoord(uint32_t index, const Vector2 &texCoord);
|
||||
void SetTexCoord(uint index, const Vector2 &texCoord);
|
||||
|
||||
/**
|
||||
* Sets a vertex's texture coordinate attribute.
|
||||
|
@ -341,17 +341,17 @@ public:
|
|||
* @param x U coordinate of the texture coordinate attribute to set
|
||||
* @param y V coordinate of the texture coordinate attribute to set
|
||||
*/
|
||||
void SetTexCoord(uint32_t index, float x, float y);
|
||||
void SetTexCoord(uint index, float x, float y);
|
||||
|
||||
void Set1f(uint32_t attrib, uint32_t index, float x);
|
||||
void Set2f(uint32_t attrib, uint32_t index, float x, float y);
|
||||
void Set2f(uint32_t attrib, uint32_t index, const Vector2 &v);
|
||||
void Set3f(uint32_t attrib, uint32_t index, float x, float y, float z);
|
||||
void Set3f(uint32_t attrib, uint32_t index, const Vector3 &v);
|
||||
void Set4f(uint32_t attrib, uint32_t index, float x, float y, float z, float w);
|
||||
void Set4f(uint32_t attrib, uint32_t index, const Color &c);
|
||||
void Set9f(uint32_t attrib, uint32_t index, const Matrix3x3 &m);
|
||||
void Set16f(uint32_t attrib, uint32_t index, const Matrix4x4 &m);
|
||||
void Set1f(uint attrib, uint index, float x);
|
||||
void Set2f(uint attrib, uint index, float x, float y);
|
||||
void Set2f(uint attrib, uint index, const Vector2 &v);
|
||||
void Set3f(uint attrib, uint index, float x, float y, float z);
|
||||
void Set3f(uint attrib, uint index, const Vector3 &v);
|
||||
void Set4f(uint attrib, uint index, float x, float y, float z, float w);
|
||||
void Set4f(uint attrib, uint index, const Color &c);
|
||||
void Set9f(uint attrib, uint index, const Matrix3x3 &m);
|
||||
void Set16f(uint attrib, uint index, const Matrix4x4 &m);
|
||||
|
||||
/**
|
||||
* Sets the current vertex's color attribute.
|
||||
|
@ -430,15 +430,15 @@ public:
|
|||
*/
|
||||
void SetCurrentTexCoord(float x, float y) { SetTexCoord(GetCurrentPosition(), x, y); }
|
||||
|
||||
void SetCurrent1f(uint32_t attrib, float x) { Set1f(attrib, GetCurrentPosition(), x); }
|
||||
void SetCurrent2f(uint32_t attrib, float x, float y) { Set2f(attrib, GetCurrentPosition(), x, y); }
|
||||
void SetCurrent2f(uint32_t attrib, const Vector2 &v) { Set2f(attrib, GetCurrentPosition(), v); }
|
||||
void SetCurrent3f(uint32_t attrib, float x, float y, float z) { Set3f(attrib, GetCurrentPosition(), x, y, z); }
|
||||
void SetCurrent3f(uint32_t attrib, const Vector3 &v) { Set3f(attrib, GetCurrentPosition(), v); }
|
||||
void SetCurrent4f(uint32_t attrib, float x, float y, float z, float w) { Set4f(attrib, GetCurrentPosition(), x, y, z, w); }
|
||||
void SetCurrent4f(uint32_t attrib, const Color &c) { Set4f(attrib, GetCurrentPosition(), c); }
|
||||
void SetCurrent9f(uint32_t attrib, const Matrix3x3 &m) { Set9f(attrib, GetCurrentPosition(), m); }
|
||||
void SetCurrent16f(uint32_t attrib, const Matrix4x4 &m) { Set16f(attrib, GetCurrentPosition(), m); }
|
||||
void SetCurrent1f(uint attrib, float x) { Set1f(attrib, GetCurrentPosition(), x); }
|
||||
void SetCurrent2f(uint attrib, float x, float y) { Set2f(attrib, GetCurrentPosition(), x, y); }
|
||||
void SetCurrent2f(uint attrib, const Vector2 &v) { Set2f(attrib, GetCurrentPosition(), v); }
|
||||
void SetCurrent3f(uint attrib, float x, float y, float z) { Set3f(attrib, GetCurrentPosition(), x, y, z); }
|
||||
void SetCurrent3f(uint attrib, const Vector3 &v) { Set3f(attrib, GetCurrentPosition(), v); }
|
||||
void SetCurrent4f(uint attrib, float x, float y, float z, float w) { Set4f(attrib, GetCurrentPosition(), x, y, z, w); }
|
||||
void SetCurrent4f(uint attrib, const Color &c) { Set4f(attrib, GetCurrentPosition(), c); }
|
||||
void SetCurrent9f(uint attrib, const Matrix3x3 &m) { Set9f(attrib, GetCurrentPosition(), m); }
|
||||
void SetCurrent16f(uint attrib, const Matrix4x4 &m) { Set16f(attrib, GetCurrentPosition(), m); }
|
||||
|
||||
/**
|
||||
* Moves the current vertex position to the next position.
|
||||
|
@ -462,7 +462,7 @@ public:
|
|||
* direction, then it will be shrunk so as not to move
|
||||
* out of bounds.
|
||||
*/
|
||||
void Move(int32_t numVertices);
|
||||
void Move(int numVertices);
|
||||
|
||||
/**
|
||||
* Moves the current vertex position to the beginning of the buffer.
|
||||
|
@ -478,20 +478,20 @@ public:
|
|||
* Moves the current vertex position to the position specified.
|
||||
* @param index the position to move to
|
||||
*/
|
||||
void MoveTo(uint32_t index) { m_currentVertex = index; }
|
||||
void MoveTo(uint index) { m_currentVertex = index; }
|
||||
|
||||
/**
|
||||
* Resizes the buffer capacity to hold the specified number of vertices.
|
||||
* @param numVertices the amount of vertices the buffer should be resized
|
||||
* to hold
|
||||
*/
|
||||
void Resize(uint32_t numVertices);
|
||||
void Resize(uint numVertices);
|
||||
|
||||
/**
|
||||
* Extends the buffer capacity to hold the specified number of extra vertices.
|
||||
* @param amount the amount of vertices to extend the buffer by
|
||||
*/
|
||||
void Extend(uint32_t amount);
|
||||
void Extend(uint amount);
|
||||
|
||||
/**
|
||||
* Copies vertices from a source buffer to this one. The copied vertices
|
||||
|
@ -500,12 +500,12 @@ public:
|
|||
* @param destIndex the index of the vertex position in this buffer to
|
||||
* start copying the vertices to
|
||||
*/
|
||||
void Copy(const VertexBuffer *source, uint32_t destIndex);
|
||||
void Copy(const VertexBuffer *source, uint destIndex);
|
||||
|
||||
/**
|
||||
* @return the number of vertices contained in this buffer
|
||||
*/
|
||||
uint32_t GetNumElements() const { return m_numVertices; }
|
||||
uint GetNumElements() const { return m_numVertices; }
|
||||
|
||||
/**
|
||||
* @return the size in bytes of each vertex in this buffer object
|
||||
|
@ -520,49 +520,49 @@ public:
|
|||
/**
|
||||
* @return the current position in the buffer
|
||||
*/
|
||||
uint32_t GetCurrentPosition() const { return m_currentVertex; }
|
||||
uint GetCurrentPosition() const { return m_currentVertex; }
|
||||
|
||||
/**
|
||||
* @return the number of vertex spaces left between the current position
|
||||
* and the end of the buffer
|
||||
*/
|
||||
uint32_t GetRemainingSpace() const { return (GetNumElements() - 1) - GetCurrentPosition(); }
|
||||
uint GetRemainingSpace() const { return (GetNumElements() - 1) - GetCurrentPosition(); }
|
||||
|
||||
private:
|
||||
BOOL SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint32_t numAttributes);
|
||||
BOOL SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint numAttributes);
|
||||
|
||||
BOOL IsBufferAllocated() const { return m_buffer.size() > 0; }
|
||||
|
||||
uint32_t GetVertexPosition(uint32_t index) const { return (index * m_elementWidth); }
|
||||
uint32_t GetColorBufferPosition(uint32_t index) const { return GetVertexPosition(index) + m_colorOffset; }
|
||||
uint32_t GetPosition3BufferPosition(uint32_t index) const { return GetVertexPosition(index) + m_position3Offset; }
|
||||
uint32_t GetPosition2BufferPosition(uint32_t index) const { return GetVertexPosition(index) + m_position2Offset; }
|
||||
uint32_t GetNormalBufferPosition(uint32_t index) const { return GetVertexPosition(index) + m_normalOffset; }
|
||||
uint32_t GetTexCoordBufferPosition(uint32_t index) const { return GetVertexPosition(index) + m_texCoordOffset; }
|
||||
uint32_t GetGenericBufferPosition(uint32_t attrib, uint32_t index) const { return GetVertexPosition(index) + m_attribs[attrib].offset; }
|
||||
uint GetVertexPosition(uint index) const { return (index * m_elementWidth); }
|
||||
uint GetColorBufferPosition(uint index) const { return GetVertexPosition(index) + m_colorOffset; }
|
||||
uint GetPosition3BufferPosition(uint index) const { return GetVertexPosition(index) + m_position3Offset; }
|
||||
uint GetPosition2BufferPosition(uint index) const { return GetVertexPosition(index) + m_position2Offset; }
|
||||
uint GetNormalBufferPosition(uint index) const { return GetVertexPosition(index) + m_normalOffset; }
|
||||
uint GetTexCoordBufferPosition(uint index) const { return GetVertexPosition(index) + m_texCoordOffset; }
|
||||
uint GetGenericBufferPosition(uint attrib, uint index) const { return GetVertexPosition(index) + m_attribs[attrib].offset; }
|
||||
|
||||
uint32_t m_numVertices;
|
||||
uint32_t m_currentVertex;
|
||||
uint32_t m_standardTypeAttribs;
|
||||
uint m_numVertices;
|
||||
uint m_currentVertex;
|
||||
uint m_standardTypeAttribs;
|
||||
|
||||
// the below are all in terms of floats. multiply by sizeof(float) to get in bytes!
|
||||
uint32_t m_elementWidth;
|
||||
uint32_t m_colorOffset;
|
||||
uint32_t m_position3Offset;
|
||||
uint32_t m_position2Offset;
|
||||
uint32_t m_normalOffset;
|
||||
uint32_t m_texCoordOffset;
|
||||
uint m_elementWidth;
|
||||
uint m_colorOffset;
|
||||
uint m_position3Offset;
|
||||
uint m_position2Offset;
|
||||
uint m_normalOffset;
|
||||
uint m_texCoordOffset;
|
||||
// ---
|
||||
|
||||
VertexBufferAttribute *m_attribs;
|
||||
uint32_t m_numAttributes;
|
||||
uint32_t m_numGPUAttributeSlotsUsed;
|
||||
uint m_numAttributes;
|
||||
uint m_numGPUAttributeSlotsUsed;
|
||||
stl::vector<float> m_buffer;
|
||||
};
|
||||
|
||||
inline Color VertexBuffer::GetColor(uint32_t index) const
|
||||
inline Color VertexBuffer::GetColor(uint index) const
|
||||
{
|
||||
uint32_t p = GetColorBufferPosition(index);
|
||||
uint p = GetColorBufferPosition(index);
|
||||
return Color(
|
||||
m_buffer[p],
|
||||
m_buffer[p + 1],
|
||||
|
@ -571,9 +571,9 @@ inline Color VertexBuffer::GetColor(uint32_t index) const
|
|||
);
|
||||
}
|
||||
|
||||
inline Vector3 VertexBuffer::GetPosition3(uint32_t index) const
|
||||
inline Vector3 VertexBuffer::GetPosition3(uint index) const
|
||||
{
|
||||
uint32_t p = GetPosition3BufferPosition(index);
|
||||
uint p = GetPosition3BufferPosition(index);
|
||||
return Vector3(
|
||||
m_buffer[p],
|
||||
m_buffer[p + 1],
|
||||
|
@ -581,18 +581,18 @@ inline Vector3 VertexBuffer::GetPosition3(uint32_t index) const
|
|||
);
|
||||
}
|
||||
|
||||
inline Vector2 VertexBuffer::GetPosition2(uint32_t index) const
|
||||
inline Vector2 VertexBuffer::GetPosition2(uint index) const
|
||||
{
|
||||
uint32_t p = GetPosition2BufferPosition(index);
|
||||
uint p = GetPosition2BufferPosition(index);
|
||||
return Vector2(
|
||||
m_buffer[p],
|
||||
m_buffer[p + 1]
|
||||
);
|
||||
}
|
||||
|
||||
inline Vector3 VertexBuffer::GetNormal(uint32_t index) const
|
||||
inline Vector3 VertexBuffer::GetNormal(uint index) const
|
||||
{
|
||||
uint32_t p = GetNormalBufferPosition(index);
|
||||
uint p = GetNormalBufferPosition(index);
|
||||
return Vector3(
|
||||
m_buffer[p],
|
||||
m_buffer[p + 1],
|
||||
|
@ -600,69 +600,69 @@ inline Vector3 VertexBuffer::GetNormal(uint32_t index) const
|
|||
);
|
||||
}
|
||||
|
||||
inline Vector2 VertexBuffer::GetTexCoord(uint32_t index) const
|
||||
inline Vector2 VertexBuffer::GetTexCoord(uint index) const
|
||||
{
|
||||
uint32_t p = GetTexCoordBufferPosition(index);
|
||||
uint p = GetTexCoordBufferPosition(index);
|
||||
return Vector2(
|
||||
m_buffer[p],
|
||||
m_buffer[p + 1]
|
||||
);
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Get1f(uint32_t attrib, uint32_t index, float &x) const
|
||||
inline void VertexBuffer::Get1f(uint attrib, uint index, float &x) const
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
x = m_buffer[p];
|
||||
}
|
||||
|
||||
inline float VertexBuffer::Get1f(uint32_t attrib, uint32_t index) const
|
||||
inline float VertexBuffer::Get1f(uint attrib, uint index) const
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
return m_buffer[p];
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Get2f(uint32_t attrib, uint32_t index, float &x, float &y) const
|
||||
inline void VertexBuffer::Get2f(uint attrib, uint index, float &x, float &y) const
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
x = m_buffer[p];
|
||||
y = m_buffer[p + 1];
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Get2f(uint32_t attrib, uint32_t index, Vector2 &v) const
|
||||
inline void VertexBuffer::Get2f(uint attrib, uint index, Vector2 &v) const
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
v.x = m_buffer[p];
|
||||
v.y = m_buffer[p + 1];
|
||||
}
|
||||
|
||||
inline Vector2 VertexBuffer::Get2f(uint32_t attrib, uint32_t index) const
|
||||
inline Vector2 VertexBuffer::Get2f(uint attrib, uint index) const
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
return Vector2(
|
||||
m_buffer[p],
|
||||
m_buffer[p + 1]
|
||||
);
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Get3f(uint32_t attrib, uint32_t index, float &x, float &y, float &z) const
|
||||
inline void VertexBuffer::Get3f(uint attrib, uint index, float &x, float &y, float &z) const
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
x = m_buffer[p];
|
||||
y = m_buffer[p + 1];
|
||||
z = m_buffer[p + 2];
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Get3f(uint32_t attrib, uint32_t index, Vector3 &v) const
|
||||
inline void VertexBuffer::Get3f(uint attrib, uint index, Vector3 &v) const
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
v.x = m_buffer[p];
|
||||
v.y = m_buffer[p + 1];
|
||||
v.z = m_buffer[p + 2];
|
||||
}
|
||||
|
||||
inline Vector3 VertexBuffer::Get3f(uint32_t attrib, uint32_t index) const
|
||||
inline Vector3 VertexBuffer::Get3f(uint attrib, uint index) const
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
return Vector3(
|
||||
m_buffer[p],
|
||||
m_buffer[p + 1],
|
||||
|
@ -670,27 +670,27 @@ inline Vector3 VertexBuffer::Get3f(uint32_t attrib, uint32_t index) const
|
|||
);
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Get4f(uint32_t attrib, uint32_t index, float &x, float &y, float &z, float &w) const
|
||||
inline void VertexBuffer::Get4f(uint attrib, uint index, float &x, float &y, float &z, float &w) const
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
x = m_buffer[p];
|
||||
y = m_buffer[p + 1];
|
||||
z = m_buffer[p + 2];
|
||||
w = m_buffer[p + 3];
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Get4f(uint32_t attrib, uint32_t index, Color &c) const
|
||||
inline void VertexBuffer::Get4f(uint attrib, uint index, Color &c) const
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
c.r = m_buffer[p];
|
||||
c.g = m_buffer[p + 1];
|
||||
c.b = m_buffer[p + 2];
|
||||
c.a = m_buffer[p + 3];
|
||||
}
|
||||
|
||||
inline Color VertexBuffer::Get4f(uint32_t attrib, uint32_t index) const
|
||||
inline Color VertexBuffer::Get4f(uint attrib, uint index) const
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
return Color(
|
||||
m_buffer[p],
|
||||
m_buffer[p + 1],
|
||||
|
@ -699,17 +699,17 @@ inline Color VertexBuffer::Get4f(uint32_t attrib, uint32_t index) const
|
|||
);
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Get9f(uint32_t attrib, uint32_t index, Matrix3x3 &m) const
|
||||
inline void VertexBuffer::Get9f(uint attrib, uint index, Matrix3x3 &m) const
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
void *dest = m.m;
|
||||
const void *src = &m_buffer[p];
|
||||
memcpy(dest, src, sizeof(float) * 9);
|
||||
}
|
||||
|
||||
inline Matrix3x3 VertexBuffer::Get9f(uint32_t attrib, uint32_t index) const
|
||||
inline Matrix3x3 VertexBuffer::Get9f(uint attrib, uint index) const
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
Matrix3x3 m;
|
||||
void *dest = m.m;
|
||||
const void *src = &m_buffer[p];
|
||||
|
@ -717,17 +717,17 @@ inline Matrix3x3 VertexBuffer::Get9f(uint32_t attrib, uint32_t index) const
|
|||
return m;
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Get16f(uint32_t attrib, uint32_t index, Matrix4x4 &m) const
|
||||
inline void VertexBuffer::Get16f(uint attrib, uint index, Matrix4x4 &m) const
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
void *dest = m.m;
|
||||
const void *src = &m_buffer[p];
|
||||
memcpy(dest, src, sizeof(float) * 16);
|
||||
}
|
||||
|
||||
inline Matrix4x4 VertexBuffer::Get16f(uint32_t attrib, uint32_t index) const
|
||||
inline Matrix4x4 VertexBuffer::Get16f(uint attrib, uint index) const
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
Matrix4x4 m;
|
||||
void *dest = m.m;
|
||||
const void *src = &m_buffer[p];
|
||||
|
@ -735,9 +735,9 @@ inline Matrix4x4 VertexBuffer::Get16f(uint32_t attrib, uint32_t index) const
|
|||
return m;
|
||||
}
|
||||
|
||||
inline void VertexBuffer::SetColor(uint32_t index, const Color &color)
|
||||
inline void VertexBuffer::SetColor(uint index, const Color &color)
|
||||
{
|
||||
uint32_t p = GetColorBufferPosition(index);
|
||||
uint p = GetColorBufferPosition(index);
|
||||
m_buffer[p] = color.r;
|
||||
m_buffer[p + 1] = color.g;
|
||||
m_buffer[p + 2] = color.b;
|
||||
|
@ -745,9 +745,9 @@ inline void VertexBuffer::SetColor(uint32_t index, const Color &color)
|
|||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::SetColor(uint32_t index, float r, float g, float b)
|
||||
inline void VertexBuffer::SetColor(uint index, float r, float g, float b)
|
||||
{
|
||||
uint32_t p = GetColorBufferPosition(index);
|
||||
uint p = GetColorBufferPosition(index);
|
||||
m_buffer[p] = r;
|
||||
m_buffer[p + 1] = g;
|
||||
m_buffer[p + 2] = b;
|
||||
|
@ -755,9 +755,9 @@ inline void VertexBuffer::SetColor(uint32_t index, float r, float g, float b)
|
|||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::SetColor(uint32_t index, float r, float g, float b, float a)
|
||||
inline void VertexBuffer::SetColor(uint index, float r, float g, float b, float a)
|
||||
{
|
||||
uint32_t p = GetColorBufferPosition(index);
|
||||
uint p = GetColorBufferPosition(index);
|
||||
m_buffer[p] = r;
|
||||
m_buffer[p + 1] = g;
|
||||
m_buffer[p + 2] = b;
|
||||
|
@ -765,118 +765,118 @@ inline void VertexBuffer::SetColor(uint32_t index, float r, float g, float b, fl
|
|||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::SetPosition3(uint32_t index, const Vector3 &position)
|
||||
inline void VertexBuffer::SetPosition3(uint index, const Vector3 &position)
|
||||
{
|
||||
uint32_t p = GetPosition3BufferPosition(index);
|
||||
uint p = GetPosition3BufferPosition(index);
|
||||
m_buffer[p] = position.x;
|
||||
m_buffer[p + 1] = position.y;
|
||||
m_buffer[p + 2] = position.z;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::SetPosition3(uint32_t index, float x, float y, float z)
|
||||
inline void VertexBuffer::SetPosition3(uint index, float x, float y, float z)
|
||||
{
|
||||
uint32_t p = GetPosition3BufferPosition(index);
|
||||
uint p = GetPosition3BufferPosition(index);
|
||||
m_buffer[p] = x;
|
||||
m_buffer[p + 1] = y;
|
||||
m_buffer[p + 2] = z;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::SetPosition2(uint32_t index, const Vector2 &position)
|
||||
inline void VertexBuffer::SetPosition2(uint index, const Vector2 &position)
|
||||
{
|
||||
uint32_t p = GetPosition2BufferPosition(index);
|
||||
uint p = GetPosition2BufferPosition(index);
|
||||
m_buffer[p] = position.x;
|
||||
m_buffer[p + 1] = position.y;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::SetPosition2(uint32_t index, float x, float y)
|
||||
inline void VertexBuffer::SetPosition2(uint index, float x, float y)
|
||||
{
|
||||
uint32_t p = GetPosition2BufferPosition(index);
|
||||
uint p = GetPosition2BufferPosition(index);
|
||||
m_buffer[p] = x;
|
||||
m_buffer[p + 1] = y;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::SetNormal(uint32_t index, const Vector3 &normal)
|
||||
inline void VertexBuffer::SetNormal(uint index, const Vector3 &normal)
|
||||
{
|
||||
uint32_t p = GetNormalBufferPosition(index);
|
||||
uint p = GetNormalBufferPosition(index);
|
||||
m_buffer[p] = normal.x;
|
||||
m_buffer[p + 1] = normal.y;
|
||||
m_buffer[p + 2] = normal.z;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::SetNormal(uint32_t index, float x, float y, float z)
|
||||
inline void VertexBuffer::SetNormal(uint index, float x, float y, float z)
|
||||
{
|
||||
uint32_t p = GetNormalBufferPosition(index);
|
||||
uint p = GetNormalBufferPosition(index);
|
||||
m_buffer[p] = x;
|
||||
m_buffer[p + 1] = y;
|
||||
m_buffer[p + 2] = z;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::SetTexCoord(uint32_t index, const Vector2 &texCoord)
|
||||
inline void VertexBuffer::SetTexCoord(uint index, const Vector2 &texCoord)
|
||||
{
|
||||
uint32_t p = GetTexCoordBufferPosition(index);
|
||||
uint p = GetTexCoordBufferPosition(index);
|
||||
m_buffer[p] = texCoord.x;
|
||||
m_buffer[p + 1] = texCoord.y;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::SetTexCoord(uint32_t index, float x, float y)
|
||||
inline void VertexBuffer::SetTexCoord(uint index, float x, float y)
|
||||
{
|
||||
uint32_t p = GetTexCoordBufferPosition(index);
|
||||
uint p = GetTexCoordBufferPosition(index);
|
||||
m_buffer[p] = x;
|
||||
m_buffer[p + 1] = y;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Set1f(uint32_t attrib, uint32_t index, float x)
|
||||
inline void VertexBuffer::Set1f(uint attrib, uint index, float x)
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
m_buffer[p] = x;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Set2f(uint32_t attrib, uint32_t index, float x, float y)
|
||||
inline void VertexBuffer::Set2f(uint attrib, uint index, float x, float y)
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
m_buffer[p] = x;
|
||||
m_buffer[p + 1] = y;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Set2f(uint32_t attrib, uint32_t index, const Vector2 &v)
|
||||
inline void VertexBuffer::Set2f(uint attrib, uint index, const Vector2 &v)
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
m_buffer[p] = v.x;
|
||||
m_buffer[p + 1] = v.y;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Set3f(uint32_t attrib, uint32_t index, float x, float y, float z)
|
||||
inline void VertexBuffer::Set3f(uint attrib, uint index, float x, float y, float z)
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
m_buffer[p] = x;
|
||||
m_buffer[p + 1] = y;
|
||||
m_buffer[p + 2] = z;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Set3f(uint32_t attrib, uint32_t index, const Vector3 &v)
|
||||
inline void VertexBuffer::Set3f(uint attrib, uint index, const Vector3 &v)
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
m_buffer[p] = v.x;
|
||||
m_buffer[p + 1] = v.y;
|
||||
m_buffer[p + 2] = v.z;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Set4f(uint32_t attrib, uint32_t index, float x, float y, float z, float w)
|
||||
inline void VertexBuffer::Set4f(uint attrib, uint index, float x, float y, float z, float w)
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
m_buffer[p] = x;
|
||||
m_buffer[p + 1] = y;
|
||||
m_buffer[p + 2] = z;
|
||||
|
@ -884,9 +884,9 @@ inline void VertexBuffer::Set4f(uint32_t attrib, uint32_t index, float x, float
|
|||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Set4f(uint32_t attrib, uint32_t index, const Color &c)
|
||||
inline void VertexBuffer::Set4f(uint attrib, uint index, const Color &c)
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
m_buffer[p] = c.r;
|
||||
m_buffer[p + 1] = c.g;
|
||||
m_buffer[p + 2] = c.b;
|
||||
|
@ -894,18 +894,18 @@ inline void VertexBuffer::Set4f(uint32_t attrib, uint32_t index, const Color &c)
|
|||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Set9f(uint32_t attrib, uint32_t index, const Matrix3x3 &m)
|
||||
inline void VertexBuffer::Set9f(uint attrib, uint index, const Matrix3x3 &m)
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
void *dest = &m_buffer[p];
|
||||
const void *src = m.m;
|
||||
memcpy(dest, src, sizeof(float) * 9);
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Set16f(uint32_t attrib, uint32_t index, const Matrix4x4 &m)
|
||||
inline void VertexBuffer::Set16f(uint attrib, uint index, const Matrix4x4 &m)
|
||||
{
|
||||
uint32_t p = GetGenericBufferPosition(attrib, index);
|
||||
uint p = GetGenericBufferPosition(attrib, index);
|
||||
void *dest = &m_buffer[p];
|
||||
const void *src = m.m;
|
||||
memcpy(dest, src, sizeof(float) * 16);
|
||||
|
@ -935,10 +935,10 @@ inline BOOL VertexBuffer::MovePrevious()
|
|||
}
|
||||
}
|
||||
|
||||
inline void VertexBuffer::Move(int32_t numVertices)
|
||||
inline void VertexBuffer::Move(int numVertices)
|
||||
{
|
||||
// m_currentVertex is unsigned, so detect when we would go negative beforehand
|
||||
if (numVertices < 0 && (uint32_t)abs(numVertices) > m_currentVertex)
|
||||
if (numVertices < 0 && (uint)abs(numVertices) > m_currentVertex)
|
||||
m_currentVertex = 0;
|
||||
else
|
||||
{
|
||||
|
|
|
@ -14,13 +14,13 @@ VertexSkinningShader::~VertexSkinningShader()
|
|||
{
|
||||
}
|
||||
|
||||
void VertexSkinningShader::SetJointPositions(const Vector3 *positions, uint32_t count)
|
||||
void VertexSkinningShader::SetJointPositions(const Vector3 *positions, uint count)
|
||||
{
|
||||
ASSERT(IsReadyForUse() == TRUE);
|
||||
SetUniform(m_positionsUniform, positions, count);
|
||||
}
|
||||
|
||||
void VertexSkinningShader::SetJointRotations(const Quaternion *rotations, uint32_t count)
|
||||
void VertexSkinningShader::SetJointRotations(const Quaternion *rotations, uint count)
|
||||
{
|
||||
ASSERT(IsReadyForUse() == TRUE);
|
||||
SetUniform(m_rotationsUniform, rotations, count);
|
||||
|
|
|
@ -13,8 +13,8 @@ class VertexSkinningShader : public StandardShader
|
|||
public:
|
||||
virtual ~VertexSkinningShader();
|
||||
|
||||
void SetJointPositions(const Vector3 *positions, uint32_t count);
|
||||
void SetJointRotations(const Quaternion *rotations, uint32_t count);
|
||||
void SetJointPositions(const Vector3 *positions, uint count);
|
||||
void SetJointRotations(const Quaternion *rotations, uint count);
|
||||
|
||||
protected:
|
||||
VertexSkinningShader();
|
||||
|
|
|
@ -40,12 +40,12 @@ public:
|
|||
Camera* GetCamera() const { return m_camera; }
|
||||
void SetCamera(Camera *camera);
|
||||
|
||||
uint16_t GetViewportTop() const { return (uint16_t)m_viewport.top; }
|
||||
uint16_t GetViewportLeft() const { return (uint16_t)m_viewport.left; }
|
||||
uint16_t GetViewportBottom() const { return (uint16_t)m_viewport.bottom; }
|
||||
uint16_t GetViewportRight() const { return (uint16_t)m_viewport.right; }
|
||||
uint16_t GetViewportWidth() const { return (uint16_t)m_viewport.GetWidth(); }
|
||||
uint16_t GetViewportHeight() const { return (uint16_t)m_viewport.GetHeight(); }
|
||||
uint GetViewportTop() const { return (uint)m_viewport.top; }
|
||||
uint GetViewportLeft() const { return (uint)m_viewport.left; }
|
||||
uint GetViewportBottom() const { return (uint)m_viewport.bottom; }
|
||||
uint GetViewportRight() const { return (uint)m_viewport.right; }
|
||||
uint GetViewportWidth() const { return (uint)m_viewport.GetWidth(); }
|
||||
uint GetViewportHeight() const { return (uint)m_viewport.GetHeight(); }
|
||||
|
||||
BOOL IsViewportFixedSize() const { return m_viewportIsFixedSize; }
|
||||
BOOL IgnoringScreenRotation() const { return m_viewportIsFixedSize; }
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace Gwen
|
|||
return (BOOL)m_canvas->InputKey(gwenKey, FALSE);
|
||||
}
|
||||
|
||||
BOOL InputProcessor::OnMouseButtonDown(MOUSE_BUTTONS button, uint16_t x, uint16_t y)
|
||||
BOOL InputProcessor::OnMouseButtonDown(MOUSE_BUTTONS button, uint x, uint y)
|
||||
{
|
||||
int gwenButton = ConvertToGwenButton(button);
|
||||
|
||||
|
@ -53,7 +53,7 @@ namespace Gwen
|
|||
return (movedResult || clickResult);
|
||||
}
|
||||
|
||||
BOOL InputProcessor::OnMouseButtonUp(MOUSE_BUTTONS button, uint16_t x, uint16_t y)
|
||||
BOOL InputProcessor::OnMouseButtonUp(MOUSE_BUTTONS button, uint x, uint y)
|
||||
{
|
||||
int gwenButton = ConvertToGwenButton(button);
|
||||
|
||||
|
@ -69,7 +69,7 @@ namespace Gwen
|
|||
return (movedResult || clickResult);
|
||||
}
|
||||
|
||||
BOOL InputProcessor::OnMouseMove(uint16_t x, uint16_t y, int16_t deltaX, int16_t deltaY)
|
||||
BOOL InputProcessor::OnMouseMove(uint x, uint y, int deltaX, int deltaY)
|
||||
{
|
||||
// Gwen's input handling only processes coordinates in terms of scale = 1.0f
|
||||
int scaledX = (float)x / m_canvas->Scale();
|
||||
|
@ -80,7 +80,7 @@ namespace Gwen
|
|||
return (BOOL)m_canvas->InputMouseMoved(scaledX, scaledY, scaledDeltaX, scaledDeltaY);
|
||||
}
|
||||
|
||||
BOOL InputProcessor::OnTouchDown(int32_t id, uint16_t x, uint16_t y, BOOL isPrimary)
|
||||
BOOL InputProcessor::OnTouchDown(int id, uint x, uint y, BOOL isPrimary)
|
||||
{
|
||||
if (!isPrimary)
|
||||
return FALSE;
|
||||
|
@ -96,7 +96,7 @@ namespace Gwen
|
|||
return (movedResult || clickResult);
|
||||
}
|
||||
|
||||
BOOL InputProcessor::OnTouchUp(int32_t id, BOOL isPrimary)
|
||||
BOOL InputProcessor::OnTouchUp(int id, BOOL isPrimary)
|
||||
{
|
||||
if (!isPrimary)
|
||||
return FALSE;
|
||||
|
@ -113,7 +113,7 @@ namespace Gwen
|
|||
return (movedResult || clickResult);
|
||||
}
|
||||
|
||||
BOOL InputProcessor::OnTouchMove(int32_t id, uint16_t x, uint16_t y, int16_t deltaX, int16_t deltaY, BOOL isPrimary)
|
||||
BOOL InputProcessor::OnTouchMove(int id, uint x, uint y, int deltaX, int deltaY, BOOL isPrimary)
|
||||
{
|
||||
if (!isPrimary)
|
||||
return FALSE;
|
||||
|
|
|
@ -22,13 +22,13 @@ namespace Gwen
|
|||
BOOL OnKeyDown(KEYS key);
|
||||
BOOL OnKeyUp(KEYS key);
|
||||
|
||||
BOOL OnMouseButtonDown(MOUSE_BUTTONS button, uint16_t x, uint16_t y);
|
||||
BOOL OnMouseButtonUp(MOUSE_BUTTONS button, uint16_t x, uint16_t y);
|
||||
BOOL OnMouseMove(uint16_t x, uint16_t y, int16_t deltaX, int16_t deltaY);
|
||||
BOOL OnMouseButtonDown(MOUSE_BUTTONS button, uint x, uint y);
|
||||
BOOL OnMouseButtonUp(MOUSE_BUTTONS button, uint x, uint y);
|
||||
BOOL OnMouseMove(uint x, uint y, int deltaX, int deltaY);
|
||||
|
||||
BOOL OnTouchDown(int32_t id, uint16_t x, uint16_t y, BOOL isPrimary);
|
||||
BOOL OnTouchUp(int32_t id, BOOL isPrimary);
|
||||
BOOL OnTouchMove(int32_t id, uint16_t x, uint16_t y, int16_t deltaX, int16_t deltaY, BOOL isPrimary);
|
||||
BOOL OnTouchDown(int id, uint x, uint y, BOOL isPrimary);
|
||||
BOOL OnTouchUp(int id, BOOL isPrimary);
|
||||
BOOL OnTouchMove(int id, uint x, uint y, int deltaX, int deltaY, BOOL isPrimary);
|
||||
|
||||
BOOL IsEnabled() const { return m_enabled; }
|
||||
void Enable(BOOL enable);
|
||||
|
|
|
@ -77,10 +77,10 @@ namespace Gwen
|
|||
ASSERT(m_spriteBatch != NULL);
|
||||
Gwen::Rect rect = ClipRegion();
|
||||
|
||||
int16_t left = (int16_t)((float)rect.x * Scale());
|
||||
int16_t top = (int16_t)((float)rect.y * Scale());
|
||||
int16_t right = (int16_t)((float)(rect.x + rect.w) * Scale());
|
||||
int16_t bottom = (int16_t)((float)(rect.y + rect.h) * Scale());
|
||||
int left = (int)((float)rect.x * Scale());
|
||||
int top = (int)((float)rect.y * Scale());
|
||||
int right = (int)((float)(rect.x + rect.w) * Scale());
|
||||
int bottom = (int)((float)(rect.y + rect.h) * Scale());
|
||||
|
||||
m_spriteBatch->SetClipRegion(left, top, right, bottom);
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ namespace Gwen
|
|||
void SpriteBatchRenderer::LoadFont(Gwen::Font *pFont)
|
||||
{
|
||||
LOG_INFO(LOGCAT_GWENUI, "Gwen::Renderer::SpriteBatchRenderer loading font \"%s\"\n", pFont->facename.c_str());
|
||||
SpriteFontParam fontParam((uint8_t)pFont->size);
|
||||
SpriteFontParam fontParam((uint)pFont->size);
|
||||
SpriteFont *font = m_contentManager->Get<SpriteFont>(pFont->facename, fontParam);
|
||||
ASSERT(font != NULL);
|
||||
|
||||
|
@ -202,8 +202,8 @@ namespace Gwen
|
|||
|
||||
ASSERT(font != NULL);
|
||||
|
||||
uint16_t width = 0;
|
||||
uint16_t height = 0;
|
||||
uint width = 0;
|
||||
uint height = 0;
|
||||
font->MeasureString(&width, &height, text.c_str());
|
||||
|
||||
Gwen::Point result(width, height);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue