remove all uses of STACK_TRACE
This commit is contained in:
parent
39c8ee2a79
commit
2c432a0b1f
|
@ -13,14 +13,12 @@
|
|||
|
||||
ContentCache::ContentCache(ContentManager *contentManager)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_contentManager = contentManager;
|
||||
m_uiFontSize = 0;
|
||||
}
|
||||
|
||||
ContentCache::~ContentCache()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_contentManager->Free<Texture>(m_uiSkin, TRUE);
|
||||
m_contentManager->Free<Image>(m_uiSkinImage, TRUE);
|
||||
m_contentManager->Free<SpriteFont>(m_standardFont, TRUE);
|
||||
|
@ -29,7 +27,6 @@ ContentCache::~ContentCache()
|
|||
|
||||
void ContentCache::OnLoadGame()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_uiSkinFilename = "assets://ui_skin.png";
|
||||
m_uiSkinImage = m_contentManager->Get<Image>(m_uiSkinFilename, TRUE);
|
||||
m_uiSkin = m_contentManager->Get<Texture>(m_uiSkinFilename, TRUE);
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
RenderContext::RenderContext(GraphicsDevice *graphicsDevice, ContentManager *contentManager)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(graphicsDevice != NULL);
|
||||
ASSERT(contentManager != NULL);
|
||||
|
||||
|
@ -34,7 +33,6 @@ RenderContext::RenderContext(GraphicsDevice *graphicsDevice, ContentManager *con
|
|||
|
||||
RenderContext::~RenderContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(m_spriteBatch);
|
||||
SAFE_DELETE(m_billboardSpriteBatch);
|
||||
SAFE_DELETE(m_keyframeMeshRenderer);
|
||||
|
@ -44,12 +42,10 @@ RenderContext::~RenderContext()
|
|||
|
||||
void RenderContext::OnLoadGame()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void RenderContext::OnPreRender()
|
||||
{
|
||||
STACK_TRACE;
|
||||
RENDERSTATE_DEFAULT.Apply();
|
||||
BLENDSTATE_DEFAULT.Apply();
|
||||
|
||||
|
@ -60,7 +56,6 @@ void RenderContext::OnPreRender()
|
|||
|
||||
void RenderContext::OnPostRender()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_billboardSpriteBatch->End();
|
||||
m_spriteBatch->End();
|
||||
m_graphicsDevice->GetDebugRenderer()->End();
|
||||
|
@ -68,13 +63,11 @@ void RenderContext::OnPostRender()
|
|||
|
||||
void RenderContext::OnResize()
|
||||
{
|
||||
STACK_TRACE;
|
||||
CalculateScreenScale();
|
||||
}
|
||||
|
||||
void RenderContext::CalculateScreenScale()
|
||||
{
|
||||
STACK_TRACE;
|
||||
uint16_t width = m_graphicsDevice->GetViewContext()->GetViewportWidth();
|
||||
uint16_t height = m_graphicsDevice->GetViewContext()->GetViewportHeight();
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#include "../framework/debug.h"
|
||||
|
||||
#include "dimeffect.h"
|
||||
#include "../contexts/rendercontext.h"
|
||||
#include "../framework/graphics/color.h"
|
||||
|
@ -11,21 +9,17 @@ const float DEFAULT_DIM_ALPHA = 0.5f;
|
|||
const Color DEFAULT_DIM_COLOR = COLOR_BLACK;
|
||||
|
||||
DimEffect::DimEffect()
|
||||
: Effect()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_alpha = DEFAULT_DIM_ALPHA;
|
||||
m_color = DEFAULT_DIM_COLOR;
|
||||
}
|
||||
|
||||
DimEffect::~DimEffect()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void DimEffect::OnRender(RenderContext *renderContext)
|
||||
{
|
||||
STACK_TRACE;
|
||||
uint16_t width = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportWidth();
|
||||
uint16_t height = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportHeight();
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
EffectInfo::EffectInfo(Effect *effect, BOOL isLocal)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(effect != NULL);
|
||||
m_effect = effect;
|
||||
m_isLocal = isLocal;
|
||||
|
@ -13,7 +12,6 @@ EffectInfo::EffectInfo(Effect *effect, BOOL isLocal)
|
|||
|
||||
EffectInfo::~EffectInfo()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(m_effect);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,20 +5,17 @@
|
|||
|
||||
EffectManager::EffectManager()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_numLocalEffects = 0;
|
||||
m_numGlobalEffects = 0;
|
||||
}
|
||||
|
||||
EffectManager::~EffectManager()
|
||||
{
|
||||
STACK_TRACE;
|
||||
RemoveAll();
|
||||
}
|
||||
|
||||
void EffectManager::RemoveAll()
|
||||
{
|
||||
STACK_TRACE;
|
||||
EffectListItor itor = m_effects.begin();
|
||||
while (itor != m_effects.end())
|
||||
Remove(itor++);
|
||||
|
@ -26,7 +23,6 @@ void EffectManager::RemoveAll()
|
|||
|
||||
void EffectManager::Add(EFFECT_TYPE type, EffectInfo *effectInfo)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(effectInfo != NULL);
|
||||
m_effects.insert(EffectList::value_type(type, effectInfo));
|
||||
effectInfo->GetEffect()->OnAdd();
|
||||
|
@ -39,7 +35,6 @@ void EffectManager::Add(EFFECT_TYPE type, EffectInfo *effectInfo)
|
|||
|
||||
void EffectManager::Remove(EffectListItor itor)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (itor->second->IsLocal())
|
||||
--m_numLocalEffects;
|
||||
else
|
||||
|
@ -52,49 +47,42 @@ void EffectManager::Remove(EffectListItor itor)
|
|||
|
||||
void EffectManager::OnAppGainFocus()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (EffectListItor itor = m_effects.begin(); itor != m_effects.end(); ++itor)
|
||||
itor->second->GetEffect()->OnAppGainFocus();
|
||||
}
|
||||
|
||||
void EffectManager::OnAppLostFocus()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (EffectListItor itor = m_effects.begin(); itor != m_effects.end(); ++itor)
|
||||
itor->second->GetEffect()->OnAppLostFocus();
|
||||
}
|
||||
|
||||
void EffectManager::OnAppPause()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (EffectListItor itor = m_effects.begin(); itor != m_effects.end(); ++itor)
|
||||
itor->second->GetEffect()->OnAppPause();
|
||||
}
|
||||
|
||||
void EffectManager::OnAppResume()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (EffectListItor itor = m_effects.begin(); itor != m_effects.end(); ++itor)
|
||||
itor->second->GetEffect()->OnAppResume();
|
||||
}
|
||||
|
||||
void EffectManager::OnLostContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (EffectListItor itor = m_effects.begin(); itor != m_effects.end(); ++itor)
|
||||
itor->second->GetEffect()->OnLostContext();
|
||||
}
|
||||
|
||||
void EffectManager::OnNewContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (EffectListItor itor = m_effects.begin(); itor != m_effects.end(); ++itor)
|
||||
itor->second->GetEffect()->OnNewContext();
|
||||
}
|
||||
|
||||
void EffectManager::OnRenderLocal(RenderContext *renderContext)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_numLocalEffects == 0)
|
||||
return;
|
||||
|
||||
|
@ -107,7 +95,6 @@ void EffectManager::OnRenderLocal(RenderContext *renderContext)
|
|||
|
||||
void EffectManager::OnRenderGlobal(RenderContext *renderContext)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_numGlobalEffects == 0)
|
||||
return;
|
||||
|
||||
|
@ -120,14 +107,12 @@ void EffectManager::OnRenderGlobal(RenderContext *renderContext)
|
|||
|
||||
void EffectManager::OnResize()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (EffectListItor itor = m_effects.begin(); itor != m_effects.end(); ++itor)
|
||||
itor->second->GetEffect()->OnResize();
|
||||
}
|
||||
|
||||
void EffectManager::OnUpdate(float delta)
|
||||
{
|
||||
STACK_TRACE;
|
||||
EffectListItor itor = m_effects.begin();
|
||||
while (itor != m_effects.end())
|
||||
{
|
||||
|
@ -143,4 +128,3 @@ void EffectManager::OnUpdate(float delta)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,6 @@ T* EffectManager::Get() const
|
|||
template<class T>
|
||||
T* EffectManager::Add(BOOL isLocalEffect)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (Get<T>() != NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -72,7 +71,6 @@ T* EffectManager::Add(BOOL isLocalEffect)
|
|||
template<class T>
|
||||
void EffectManager::Remove()
|
||||
{
|
||||
STACK_TRACE;
|
||||
EffectListItor itor = m_effects.find(T::GetType());
|
||||
ASSERT(itor != m_effects.end());
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#include "../framework/debug.h"
|
||||
|
||||
#include "fadeeffect.h"
|
||||
#include "../contexts/rendercontext.h"
|
||||
#include "../framework/graphics/color.h"
|
||||
|
@ -12,9 +10,7 @@ const float DEFAULT_FADE_SPEED = 3.0f;
|
|||
const Color DEFAULT_FADE_COLOR = COLOR_BLACK;
|
||||
|
||||
FadeEffect::FadeEffect()
|
||||
: Effect()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_doneFading = FALSE;
|
||||
m_fadeSpeed = DEFAULT_FADE_SPEED;
|
||||
m_fadingOut = TRUE;
|
||||
|
@ -25,12 +21,10 @@ FadeEffect::FadeEffect()
|
|||
|
||||
FadeEffect::~FadeEffect()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void FadeEffect::OnRender(RenderContext *renderContext)
|
||||
{
|
||||
STACK_TRACE;
|
||||
uint16_t width = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportWidth();
|
||||
uint16_t height = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportHeight();
|
||||
|
||||
|
@ -45,7 +39,6 @@ void FadeEffect::OnRender(RenderContext *renderContext)
|
|||
|
||||
void FadeEffect::OnUpdate(float delta)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_doneFading)
|
||||
return;
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#include "../framework/debug.h"
|
||||
|
||||
#include "flasheffect.h"
|
||||
#include "../contexts/rendercontext.h"
|
||||
#include "../framework/graphics/color.h"
|
||||
|
@ -12,9 +10,7 @@ const float DEFAULT_FLASH_SPEED = 16.0f;
|
|||
const float DEFAULT_MAX_INTENSITY = 1.0f;
|
||||
|
||||
FlashEffect::FlashEffect()
|
||||
: Effect()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_flashingIn = TRUE;
|
||||
m_flashInSpeed = DEFAULT_FLASH_SPEED;
|
||||
m_flashOutSpeed = DEFAULT_FLASH_SPEED;
|
||||
|
@ -25,12 +21,10 @@ FlashEffect::FlashEffect()
|
|||
|
||||
FlashEffect::~FlashEffect()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void FlashEffect::OnRender(RenderContext *renderContext)
|
||||
{
|
||||
STACK_TRACE;
|
||||
uint16_t width = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportWidth();
|
||||
uint16_t height = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportHeight();
|
||||
|
||||
|
@ -45,7 +39,6 @@ void FlashEffect::OnRender(RenderContext *renderContext)
|
|||
|
||||
void FlashEffect::OnUpdate(float delta)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_flashingIn)
|
||||
{
|
||||
m_alpha += (delta * m_flashInSpeed);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include "../framework/debug.h"
|
||||
#include "../framework/common.h"
|
||||
|
||||
#include "entity.h"
|
||||
|
@ -6,12 +5,10 @@
|
|||
|
||||
Entity::Entity(EntityManager *entityManager)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_entityManager = entityManager;
|
||||
}
|
||||
|
||||
Entity::~Entity()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,13 +9,11 @@
|
|||
|
||||
EntityManager::EntityManager(EventManager *eventManager)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_eventManager = eventManager;
|
||||
}
|
||||
|
||||
EntityManager::~EntityManager()
|
||||
{
|
||||
STACK_TRACE;
|
||||
RemoveAll();
|
||||
RemoveAllSubsystems();
|
||||
RemoveAllPresets();
|
||||
|
@ -24,7 +22,6 @@ EntityManager::~EntityManager()
|
|||
|
||||
void EntityManager::RemoveAllSubsystems()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (ComponentSystemList::iterator i = m_componentSystems.begin(); i != m_componentSystems.end(); ++i)
|
||||
SAFE_DELETE(*i);
|
||||
|
||||
|
@ -33,7 +30,6 @@ void EntityManager::RemoveAllSubsystems()
|
|||
|
||||
void EntityManager::RemoveAllPresets()
|
||||
{
|
||||
STACK_TRACE;
|
||||
while (!m_entityPresets.empty())
|
||||
{
|
||||
EntityPresetMap::iterator i = m_entityPresets.begin();
|
||||
|
@ -47,7 +43,6 @@ void EntityManager::RemoveAllPresets()
|
|||
|
||||
Entity* EntityManager::Add()
|
||||
{
|
||||
STACK_TRACE;
|
||||
Entity *entity = new Entity(this);
|
||||
m_entities.insert(entity);
|
||||
return entity;
|
||||
|
@ -55,7 +50,6 @@ Entity* EntityManager::Add()
|
|||
|
||||
Entity* EntityManager::AddUsingPreset(ENTITYPRESET_TYPE preset, EntityPresetArgs *args)
|
||||
{
|
||||
STACK_TRACE;
|
||||
EntityPresetMap::iterator i = m_entityPresets.find(preset);
|
||||
ASSERT(i != m_entityPresets.end());
|
||||
if (i == m_entityPresets.end())
|
||||
|
@ -73,7 +67,6 @@ Entity* EntityManager::AddUsingPreset(ENTITYPRESET_TYPE preset, EntityPresetArgs
|
|||
|
||||
BOOL EntityManager::WasCreatedUsingPreset(const Entity *entity, ENTITYPRESET_TYPE type) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(entity != NULL);
|
||||
ASSERT(type != NULL);
|
||||
EntityPresetComponent *preset = entity->Get<EntityPresetComponent>();
|
||||
|
@ -85,7 +78,6 @@ BOOL EntityManager::WasCreatedUsingPreset(const Entity *entity, ENTITYPRESET_TYP
|
|||
|
||||
void EntityManager::Remove(Entity *entity)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(entity != NULL);
|
||||
if (!IsValid(entity))
|
||||
return;
|
||||
|
@ -100,7 +92,6 @@ void EntityManager::Remove(Entity *entity)
|
|||
|
||||
void EntityManager::RemoveAll()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (EntitySet::iterator i = m_entities.begin(); i != m_entities.end(); ++i)
|
||||
{
|
||||
Entity *entity = *i;
|
||||
|
@ -113,7 +104,6 @@ void EntityManager::RemoveAll()
|
|||
|
||||
void EntityManager::RemoveAllComponentsFrom(Entity *entity)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(entity != NULL);
|
||||
|
||||
for (ComponentStore::iterator i = m_components.begin(); i != m_components.end(); ++i)
|
||||
|
@ -143,7 +133,6 @@ BOOL EntityManager::IsValid(const Entity *entity) const
|
|||
|
||||
void EntityManager::GetAllComponentsFor(const Entity *entity, ComponentList &list) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(entity != NULL);
|
||||
if (!IsValid(entity))
|
||||
return;
|
||||
|
@ -159,7 +148,6 @@ void EntityManager::GetAllComponentsFor(const Entity *entity, ComponentList &lis
|
|||
|
||||
void EntityManager::RemoveAllGlobalComponents()
|
||||
{
|
||||
STACK_TRACE;
|
||||
while (!m_globalComponents.empty())
|
||||
{
|
||||
GlobalComponentStore::iterator i = m_globalComponents.begin();
|
||||
|
@ -173,35 +161,30 @@ void EntityManager::RemoveAllGlobalComponents()
|
|||
|
||||
void EntityManager::OnLostContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (ComponentSystemList::iterator i = m_componentSystems.begin(); i != m_componentSystems.end(); ++i)
|
||||
(*i)->OnLostContext();
|
||||
}
|
||||
|
||||
void EntityManager::OnNewContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (ComponentSystemList::iterator i = m_componentSystems.begin(); i != m_componentSystems.end(); ++i)
|
||||
(*i)->OnNewContext();
|
||||
}
|
||||
|
||||
void EntityManager::OnRender(RenderContext *renderContext)
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (ComponentSystemList::iterator i = m_componentSystems.begin(); i != m_componentSystems.end(); ++i)
|
||||
(*i)->OnRender(renderContext);
|
||||
}
|
||||
|
||||
void EntityManager::OnResize()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (ComponentSystemList::iterator i = m_componentSystems.begin(); i != m_componentSystems.end(); ++i)
|
||||
(*i)->OnResize();
|
||||
}
|
||||
|
||||
void EntityManager::OnUpdate(float delta)
|
||||
{
|
||||
STACK_TRACE;
|
||||
// find any inactive components and remove the associated entities before
|
||||
// we update anything
|
||||
EntityList list;
|
||||
|
|
|
@ -89,7 +89,6 @@ private:
|
|||
template<class T>
|
||||
T* EntityManager::AddSubsystem()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(GetSubsystem<T>() == NULL);
|
||||
T* subsystem = new T(this, m_eventManager);
|
||||
m_componentSystems.push_back(subsystem);
|
||||
|
@ -99,7 +98,6 @@ T* EntityManager::AddSubsystem()
|
|||
template<class T, class TBefore>
|
||||
T* EntityManager::AddSubsystemBefore()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(GetSubsystem<T>() == NULL);
|
||||
ComponentSystemList::const_iterator i = FindSubsystem<TBefore>();
|
||||
ASSERT(i != m_componentSystems.end());
|
||||
|
@ -111,7 +109,6 @@ T* EntityManager::AddSubsystemBefore()
|
|||
template<class T>
|
||||
T* EntityManager::GetSubsystem() const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ComponentSystemList::const_iterator i = FindSubsystem<T>();
|
||||
if (i == m_componentSystems.end())
|
||||
return NULL;
|
||||
|
@ -122,7 +119,6 @@ T* EntityManager::GetSubsystem() const
|
|||
template<class T>
|
||||
void EntityManager::RemoveSubsystem()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ComponentSystemList::iterator i = FindSubsystem<T>();
|
||||
if (i == m_componentSystems.end())
|
||||
return;
|
||||
|
@ -134,7 +130,6 @@ void EntityManager::RemoveSubsystem()
|
|||
template<class T>
|
||||
void EntityManager::AddPreset()
|
||||
{
|
||||
STACK_TRACE;
|
||||
T* preset = new T(this);
|
||||
EntityPresetMap::const_iterator i = m_entityPresets.find(T::GetType());
|
||||
ASSERT(i == m_entityPresets.end());
|
||||
|
@ -147,7 +142,6 @@ void EntityManager::AddPreset()
|
|||
template<class T>
|
||||
void EntityManager::RemovePreset()
|
||||
{
|
||||
STACK_TRACE;
|
||||
EntityPresetMap::iterator i = m_entityPresets.find(T::GetType());
|
||||
if (i == m_entityPresets.end())
|
||||
return;
|
||||
|
@ -161,14 +155,12 @@ void EntityManager::RemovePreset()
|
|||
template<class T>
|
||||
Entity* EntityManager::AddUsingPreset(EntityPresetArgs *args)
|
||||
{
|
||||
STACK_TRACE;
|
||||
return AddUsingPreset(T::GetType(), args);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T* EntityManager::AddComponent(Entity *entity)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(GetComponent<T>(entity) == NULL);
|
||||
T* component = new T();
|
||||
m_components[T::GetType()].insert(EntityComponentsMap::value_type(entity, component));
|
||||
|
@ -178,7 +170,6 @@ T* EntityManager::AddComponent(Entity *entity)
|
|||
template <class T>
|
||||
T* EntityManager::GetComponent(const Entity *entity) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ComponentStore::const_iterator i = m_components.find(T::GetType());
|
||||
if (i == m_components.end())
|
||||
return NULL;
|
||||
|
@ -194,7 +185,6 @@ T* EntityManager::GetComponent(const Entity *entity) const
|
|||
template<class T>
|
||||
void EntityManager::RemoveComponent(Entity *entity)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ComponentStore::iterator i = m_components.find(T::GetType());
|
||||
if (i == m_components.end())
|
||||
return;
|
||||
|
@ -213,7 +203,6 @@ void EntityManager::RemoveComponent(Entity *entity)
|
|||
template<class T>
|
||||
BOOL EntityManager::HasComponent(const Entity *entity) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ComponentStore::const_iterator i = m_components.find(T::GetType());
|
||||
if (i == m_components.end())
|
||||
return FALSE;
|
||||
|
@ -229,7 +218,6 @@ BOOL EntityManager::HasComponent(const Entity *entity) const
|
|||
template<class T>
|
||||
T* EntityManager::AddGlobalComponent()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(GetGlobalComponent<T>() == NULL);
|
||||
T* newComponent = new T();
|
||||
m_globalComponents.insert(GlobalComponentStore::value_type(T::GetType(), newComponent));
|
||||
|
@ -239,7 +227,6 @@ T* EntityManager::AddGlobalComponent()
|
|||
template<class T>
|
||||
T* EntityManager::GetGlobalComponent() const
|
||||
{
|
||||
STACK_TRACE;
|
||||
GlobalComponentStore::const_iterator i = m_globalComponents.find(T::GetType());
|
||||
if (i == m_globalComponents.end())
|
||||
return NULL;
|
||||
|
@ -261,7 +248,6 @@ void EntityManager::RemoveGlobalComponent()
|
|||
template<class T>
|
||||
BOOL EntityManager::HasGlobalComponent() const
|
||||
{
|
||||
STACK_TRACE;
|
||||
GlobalComponentStore::const_iterator i = m_globalComponents.find(T::GetType());
|
||||
if (i == m_globalComponents.end())
|
||||
return FALSE;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include "../framework/debug.h"
|
||||
#include "../framework/log.h"
|
||||
|
||||
#include "eventlogger.h"
|
||||
|
@ -6,20 +5,16 @@
|
|||
#include "eventmanager.h"
|
||||
|
||||
EventLogger::EventLogger(EventManager *eventManager)
|
||||
: EventListener()
|
||||
{
|
||||
STACK_TRACE;
|
||||
eventManager->AddListener(this, EVENT_TYPE_WILDCARD);
|
||||
}
|
||||
|
||||
EventLogger::~EventLogger()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
BOOL EventLogger::Handle(const Event *event)
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO("EVENTLOGGER", "Event \"%s\" occurred.\n", event->GetTypeOf());
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -6,18 +6,15 @@
|
|||
|
||||
EventManager::EventManager()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_activeQueue = 0;
|
||||
}
|
||||
|
||||
EventManager::~EventManager()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
BOOL EventManager::AddListener(EventListener *listener, EVENT_TYPE type)
|
||||
{
|
||||
STACK_TRACE;
|
||||
// TODO: validate type
|
||||
|
||||
EventListenerMap::iterator listenerItor = m_registry.find(type);
|
||||
|
@ -48,7 +45,6 @@ BOOL EventManager::AddListener(EventListener *listener, EVENT_TYPE type)
|
|||
|
||||
BOOL EventManager::RemoveListener(EventListener *listener, EVENT_TYPE type)
|
||||
{
|
||||
STACK_TRACE;
|
||||
BOOL result = FALSE;
|
||||
|
||||
// TODO: validate type
|
||||
|
@ -82,7 +78,6 @@ BOOL EventManager::RemoveListener(EventListener *listener, EVENT_TYPE type)
|
|||
|
||||
BOOL EventManager::Trigger(const Event *event) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
// TODO: validate type
|
||||
|
||||
// trigger events for wildcard listeners first
|
||||
|
@ -121,7 +116,6 @@ BOOL EventManager::Trigger(const Event *event) const
|
|||
|
||||
BOOL EventManager::Queue(const Event *event)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_activeQueue >= 0);
|
||||
ASSERT(m_activeQueue < NUM_EVENT_QUEUES);
|
||||
|
||||
|
@ -145,7 +139,6 @@ BOOL EventManager::Queue(const Event *event)
|
|||
|
||||
BOOL EventManager::Abort(EVENT_TYPE type, BOOL allOfType)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_activeQueue >= 0);
|
||||
ASSERT(m_activeQueue < NUM_EVENT_QUEUES);
|
||||
|
||||
|
@ -179,7 +172,6 @@ BOOL EventManager::Abort(EVENT_TYPE type, BOOL allOfType)
|
|||
|
||||
BOOL EventManager::ProcessQueue()
|
||||
{
|
||||
STACK_TRACE;
|
||||
EventListenerMap::const_iterator wildcardItor = m_registry.find(EVENT_TYPE_WILDCARD);
|
||||
|
||||
// swap active queues and empty the new queue
|
||||
|
@ -243,7 +235,6 @@ BOOL EventManager::ProcessQueue()
|
|||
|
||||
EventListenerList EventManager::GetListenerList(EVENT_TYPE type) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
EventListenerMap::const_iterator listenerItor = m_registry.find(type);
|
||||
if (listenerItor == m_registry.end())
|
||||
return EventListenerList(); // no registered listeners for this type
|
||||
|
@ -263,7 +254,6 @@ EventListenerList EventManager::GetListenerList(EVENT_TYPE type) const
|
|||
|
||||
EventTypeList EventManager::GetTypeList() const
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_typeList.size() == 0)
|
||||
return EventTypeList(); // no types have been registered
|
||||
|
||||
|
|
|
@ -6,20 +6,17 @@
|
|||
|
||||
Keyframe::Keyframe(uint32_t numVertices)
|
||||
{
|
||||
STACK_TRACE;
|
||||
AllocateMemory(numVertices);
|
||||
}
|
||||
|
||||
Keyframe::Keyframe(const stl::string &name, uint32_t numVertices)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_name = name;
|
||||
AllocateMemory(numVertices);
|
||||
}
|
||||
|
||||
void Keyframe::AllocateMemory(uint32_t numVertices)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_numVertices = numVertices;
|
||||
m_vertices = new Vector3[m_numVertices];
|
||||
ASSERT(m_vertices != NULL);
|
||||
|
@ -29,7 +26,6 @@ void Keyframe::AllocateMemory(uint32_t numVertices)
|
|||
|
||||
Keyframe::~Keyframe()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE_ARRAY(m_vertices);
|
||||
SAFE_DELETE_ARRAY(m_normals);
|
||||
}
|
||||
|
|
|
@ -12,9 +12,7 @@
|
|||
#include <string.h>
|
||||
|
||||
KeyframeMesh::KeyframeMesh(const KeyframeMeshFile *file)
|
||||
: Content()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_numFrames = file->GetNumFrames();
|
||||
m_frames = new Keyframe*[m_numFrames];
|
||||
ASSERT(m_frames != NULL);
|
||||
|
@ -68,7 +66,6 @@ KeyframeMesh::KeyframeMesh(const KeyframeMeshFile *file)
|
|||
|
||||
KeyframeMesh::~KeyframeMesh()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (uint32_t i = 0; i < m_numFrames; ++i)
|
||||
SAFE_DELETE(m_frames[i]);
|
||||
SAFE_DELETE_ARRAY(m_frames);
|
||||
|
@ -79,7 +76,6 @@ KeyframeMesh::~KeyframeMesh()
|
|||
|
||||
const AnimationSequence* KeyframeMesh::GetAnimation(const stl::string &name) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
AnimationList::const_iterator itor = m_animations.find(name);
|
||||
if (itor != m_animations.end())
|
||||
return &itor->second;
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
KeyframeMeshFile::KeyframeMeshFile(File *file)
|
||||
: MeshFile(file)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_numFrames = 0;
|
||||
m_numTexCoords = 0;
|
||||
m_numTriangles = 0;
|
||||
|
@ -26,7 +25,6 @@ KeyframeMeshFile::KeyframeMeshFile(File *file)
|
|||
|
||||
KeyframeMeshFile::~KeyframeMeshFile()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (uint32_t i = 0; i < m_numFrames; ++i)
|
||||
SAFE_DELETE(m_frames[i]);
|
||||
SAFE_DELETE_ARRAY(m_frames);
|
||||
|
@ -37,7 +35,6 @@ KeyframeMeshFile::~KeyframeMeshFile()
|
|||
|
||||
void KeyframeMeshFile::Load()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ChunkDescriptor *keyframesDesc = GetChunkDesc("KFR");
|
||||
ChunkDescriptor *texCoordsDesc = GetChunkDesc("TXT");
|
||||
ChunkDescriptor *trianglesDesc = GetChunkDesc("KTR");
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
KeyframeMeshInstance::KeyframeMeshInstance(KeyframeMesh *mesh)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_mesh = mesh;
|
||||
m_texture = NULL;
|
||||
|
||||
|
@ -29,13 +28,11 @@ KeyframeMeshInstance::KeyframeMeshInstance(KeyframeMesh *mesh)
|
|||
|
||||
KeyframeMeshInstance::~KeyframeMeshInstance()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(m_renderState);
|
||||
}
|
||||
|
||||
void KeyframeMeshInstance::OnUpdate(float delta)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_currentSequenceStart != m_currentSequenceEnd)
|
||||
{
|
||||
m_interpolation += delta * 10;
|
||||
|
@ -76,7 +73,6 @@ void KeyframeMeshInstance::OnUpdate(float delta)
|
|||
|
||||
void KeyframeMeshInstance::SetSequence(uint32_t startFrame, uint32_t endFrame, BOOL loop)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_currentSequenceName.clear();
|
||||
m_currentSequenceStart = startFrame;
|
||||
m_currentSequenceEnd = endFrame;
|
||||
|
@ -92,7 +88,6 @@ void KeyframeMeshInstance::SetSequence(uint32_t startFrame, uint32_t endFrame, B
|
|||
|
||||
void KeyframeMeshInstance::SetSequence(const stl::string &name, BOOL loop)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_currentSequenceName == name)
|
||||
return;
|
||||
|
||||
|
@ -104,7 +99,6 @@ void KeyframeMeshInstance::SetSequence(const stl::string &name, BOOL loop)
|
|||
|
||||
void KeyframeMeshInstance::RunSequenceOnce(const stl::string &name)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isRunningTempSequence)
|
||||
return;
|
||||
|
||||
|
@ -118,7 +112,6 @@ void KeyframeMeshInstance::RunSequenceOnce(const stl::string &name)
|
|||
|
||||
void KeyframeMeshInstance::RecoverFromTempSequence()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_isRunningTempSequence = FALSE;
|
||||
SetSequence(m_oldSequenceName, m_oldSequenceLoop);
|
||||
m_oldSequenceName.clear();
|
||||
|
|
|
@ -15,17 +15,14 @@
|
|||
|
||||
KeyframeMeshRenderer::KeyframeMeshRenderer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
KeyframeMeshRenderer::~KeyframeMeshRenderer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, VertexLerpShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
instance->GetRenderState()->Apply();
|
||||
Render(graphicsDevice, instance->GetMesh(), instance->GetTexture(), instance->GetCurrentFrame(), instance->GetNextFrame(), instance->GetInterpolation(), shader);
|
||||
|
@ -33,7 +30,6 @@ void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshIn
|
|||
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint32_t frame, VertexLerpShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
instance->GetRenderState()->Apply();
|
||||
Render(graphicsDevice, instance->GetMesh(), instance->GetTexture(), frame, shader);
|
||||
|
@ -41,7 +37,6 @@ void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshIn
|
|||
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint32_t startFrame, uint32_t endFrame, float interpolation, VertexLerpShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
instance->GetRenderState()->Apply();
|
||||
Render(graphicsDevice, instance->GetMesh(), instance->GetTexture(), instance->GetCurrentFrame(), instance->GetNextFrame(), instance->GetInterpolation(), shader);
|
||||
|
@ -49,14 +44,12 @@ void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshIn
|
|||
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, VertexLerpShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
Render(graphicsDevice, mesh, texture, 0, shader);
|
||||
}
|
||||
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint32_t frame, VertexLerpShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
SetFrameVertices(mesh, frame);
|
||||
|
||||
|
@ -72,7 +65,6 @@ void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *
|
|||
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint32_t startFrame, uint32_t endFrame, float interpolation, VertexLerpShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
SetFrameVertices(mesh, startFrame, endFrame);
|
||||
|
||||
|
@ -88,7 +80,6 @@ void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *
|
|||
|
||||
void KeyframeMeshRenderer::SetFrameVertices(KeyframeMesh *mesh, uint32_t frame)
|
||||
{
|
||||
STACK_TRACE;
|
||||
int pos;
|
||||
Keyframe *keyframe = mesh->GetFrames()[frame];
|
||||
KeyframeMeshTriangle *triangle;
|
||||
|
@ -121,7 +112,6 @@ void KeyframeMeshRenderer::SetFrameVertices(KeyframeMesh *mesh, uint32_t frame)
|
|||
|
||||
void KeyframeMeshRenderer::SetFrameVertices(KeyframeMesh *mesh, uint32_t startFrame, uint32_t endFrame)
|
||||
{
|
||||
STACK_TRACE;
|
||||
uint32_t pos;
|
||||
Keyframe *frame1 = mesh->GetFrames()[startFrame];
|
||||
Keyframe *frame2 = mesh->GetFrames()[endFrame];
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
SkeletalMesh::SkeletalMesh()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_numVertices = 0;
|
||||
m_numSubsets = 0;
|
||||
m_numJoints = 0;
|
||||
|
@ -31,7 +30,6 @@ SkeletalMesh::SkeletalMesh()
|
|||
|
||||
SkeletalMesh::~SkeletalMesh()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE_ARRAY(m_joints);
|
||||
SAFE_DELETE_ARRAY(m_jointMappings);
|
||||
SAFE_DELETE_ARRAY(m_vertices);
|
||||
|
@ -42,7 +40,6 @@ SkeletalMesh::~SkeletalMesh()
|
|||
|
||||
int32_t SkeletalMesh::GetIndexOfSubset(const stl::string &name) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (uint32_t i = 0; i < m_numSubsets; ++i)
|
||||
{
|
||||
if (m_subsets[i].GetName() == name)
|
||||
|
@ -54,7 +51,6 @@ int32_t SkeletalMesh::GetIndexOfSubset(const stl::string &name) const
|
|||
|
||||
Joint* SkeletalMesh::GetJoint(const stl::string &name) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
int32_t jointIndex = GetIndexOfJoint(name);
|
||||
if (jointIndex == NO_JOINT)
|
||||
return NULL;
|
||||
|
@ -64,7 +60,6 @@ Joint* SkeletalMesh::GetJoint(const stl::string &name) const
|
|||
|
||||
int32_t SkeletalMesh::GetIndexOfJoint(const stl::string &name) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (uint32_t i = 0; i < m_numJoints; ++i)
|
||||
{
|
||||
if (m_joints[i].name == name)
|
||||
|
@ -76,7 +71,6 @@ int32_t SkeletalMesh::GetIndexOfJoint(const stl::string &name) const
|
|||
|
||||
const AnimationSequence* SkeletalMesh::GetAnimation(const stl::string &name) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
AnimationList::const_iterator itor = m_animations.find(name);
|
||||
if (itor != m_animations.end())
|
||||
return &itor->second;
|
||||
|
@ -86,7 +80,6 @@ const AnimationSequence* SkeletalMesh::GetAnimation(const stl::string &name) con
|
|||
|
||||
void SkeletalMesh::FindAndSetRootJointIndex()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_numJoints > 0);
|
||||
|
||||
// if this mesh has only one joint, then that one has to be the root...
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
SkeletalMeshAnimationInstance::SkeletalMeshAnimationInstance(SkeletalMesh *mesh)
|
||||
: SkeletalMeshInstance(mesh)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_currentSequenceStart = 0;
|
||||
m_currentSequenceEnd = 0;
|
||||
m_currentSequenceLoop = FALSE;
|
||||
|
@ -23,12 +22,10 @@ SkeletalMeshAnimationInstance::SkeletalMeshAnimationInstance(SkeletalMesh *mesh)
|
|||
|
||||
SkeletalMeshAnimationInstance::~SkeletalMeshAnimationInstance()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void SkeletalMeshAnimationInstance::OnUpdate(float delta)
|
||||
{
|
||||
STACK_TRACE;
|
||||
SkeletalMeshInstance::OnUpdate(delta);
|
||||
if (m_currentSequenceStart != m_currentSequenceEnd)
|
||||
{
|
||||
|
@ -70,7 +67,6 @@ void SkeletalMeshAnimationInstance::OnUpdate(float delta)
|
|||
|
||||
void SkeletalMeshAnimationInstance::SetSequence(uint32_t startFrame, uint32_t endFrame, BOOL loop)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_currentSequenceName.clear();
|
||||
m_currentSequenceStart = startFrame;
|
||||
m_currentSequenceEnd = endFrame;
|
||||
|
@ -86,7 +82,6 @@ void SkeletalMeshAnimationInstance::SetSequence(uint32_t startFrame, uint32_t en
|
|||
|
||||
void SkeletalMeshAnimationInstance::SetSequence(const stl::string &name, BOOL loop)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_currentSequenceName == name)
|
||||
return;
|
||||
|
||||
|
@ -97,7 +92,6 @@ void SkeletalMeshAnimationInstance::SetSequence(const stl::string &name, BOOL lo
|
|||
|
||||
void SkeletalMeshAnimationInstance::RunSequenceOnce(const stl::string &name)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isRunningTempSequence)
|
||||
return;
|
||||
|
||||
|
@ -111,7 +105,6 @@ void SkeletalMeshAnimationInstance::RunSequenceOnce(const stl::string &name)
|
|||
|
||||
void SkeletalMeshAnimationInstance::RecoverFromTempSequence()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_isRunningTempSequence = FALSE;
|
||||
SetSequence(m_oldSequenceName, m_oldSequenceLoop);
|
||||
m_oldSequenceName.clear();
|
||||
|
|
|
@ -20,17 +20,14 @@
|
|||
SkeletalMeshFile::SkeletalMeshFile(File *file)
|
||||
: MeshFile(file)
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
SkeletalMeshFile::~SkeletalMeshFile()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
SkeletalMesh* SkeletalMeshFile::CreateMesh()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ChunkDescriptor *verticesDesc = GetChunkDesc("VTX");
|
||||
ChunkDescriptor *normalsDesc = GetChunkDesc("NRL");
|
||||
ChunkDescriptor *texCoordsDesc = GetChunkDesc("TXT");
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
SkeletalMeshInstance::SkeletalMeshInstance(SkeletalMesh *mesh)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_mesh = mesh;
|
||||
|
||||
m_numSubsets = m_mesh->GetNumSubsets();
|
||||
|
@ -43,7 +42,6 @@ SkeletalMeshInstance::SkeletalMeshInstance(SkeletalMesh *mesh)
|
|||
|
||||
SkeletalMeshInstance::~SkeletalMeshInstance()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(m_renderState);
|
||||
SAFE_DELETE(m_blendState);
|
||||
SAFE_DELETE(m_alphaBlendState);
|
||||
|
@ -56,12 +54,10 @@ SkeletalMeshInstance::~SkeletalMeshInstance()
|
|||
|
||||
void SkeletalMeshInstance::OnUpdate(float delta)
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
const Matrix4x4* SkeletalMeshInstance::GetJointTransformation(const stl::string &jointName) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
int32_t jointIndex = GetMesh()->GetIndexOfJoint(jointName);
|
||||
if (jointIndex == NO_JOINT)
|
||||
return NULL;
|
||||
|
@ -71,7 +67,6 @@ const Matrix4x4* SkeletalMeshInstance::GetJointTransformation(const stl::string
|
|||
|
||||
void SkeletalMeshInstance::SetFixedRootJointTransformation(const Matrix4x4 &transform)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(GetMesh()->GetRootJointIndex() != NO_JOINT);
|
||||
m_rootJointHasFixedTransform = TRUE;
|
||||
m_jointTransformations[GetMesh()->GetRootJointIndex()] = transform;
|
||||
|
@ -79,14 +74,12 @@ void SkeletalMeshInstance::SetFixedRootJointTransformation(const Matrix4x4 &tran
|
|||
|
||||
void SkeletalMeshInstance::ClearFixedRootJointTransformation()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(GetMesh()->GetRootJointIndex() != NO_JOINT);
|
||||
m_rootJointHasFixedTransform = FALSE;
|
||||
}
|
||||
|
||||
void SkeletalMeshInstance::CalculateJointTransformations(uint32_t frame)
|
||||
{
|
||||
STACK_TRACE;
|
||||
int32_t rootJointIndex = GetMesh()->GetRootJointIndex();
|
||||
|
||||
for (uint32_t i = 0; i < m_numJoints; ++i)
|
||||
|
@ -124,7 +117,6 @@ void SkeletalMeshInstance::CalculateJointTransformations(uint32_t frame)
|
|||
|
||||
void SkeletalMeshInstance::CalculateJointTransformations(uint32_t startFrame, uint32_t endFrame, float interpolation)
|
||||
{
|
||||
STACK_TRACE;
|
||||
int32_t rootJointIndex = GetMesh()->GetRootJointIndex();
|
||||
|
||||
for (uint32_t i = 0; i < m_numJoints; ++i)
|
||||
|
@ -165,7 +157,6 @@ void SkeletalMeshInstance::CalculateJointTransformations(uint32_t startFrame, ui
|
|||
|
||||
void SkeletalMeshInstance::BreakDownJointTransformationMatrix(uint32_t jointMatrixIndex)
|
||||
{
|
||||
STACK_TRACE;
|
||||
const Matrix4x4 *jointMatrix = &m_jointTransformations[jointMatrixIndex];
|
||||
|
||||
m_jointPositions[jointMatrixIndex] = jointMatrix->GetTranslation();
|
||||
|
@ -174,7 +165,6 @@ void SkeletalMeshInstance::BreakDownJointTransformationMatrix(uint32_t jointMatr
|
|||
|
||||
void SkeletalMeshInstance::EnableSubset(const stl::string &subset, BOOL enable)
|
||||
{
|
||||
STACK_TRACE;
|
||||
int32_t index = m_mesh->GetIndexOfSubset(subset);
|
||||
ASSERT(index != -1);
|
||||
if (index == -1)
|
||||
|
@ -185,14 +175,12 @@ void SkeletalMeshInstance::EnableSubset(const stl::string &subset, BOOL enable)
|
|||
|
||||
void SkeletalMeshInstance::SetTexture(uint32_t index, Texture *texture)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(index < m_numSubsets);
|
||||
m_textures[index] = texture;
|
||||
}
|
||||
|
||||
void SkeletalMeshInstance::SetTexture(const stl::string &subset, Texture *texture)
|
||||
{
|
||||
STACK_TRACE;
|
||||
int32_t index = m_mesh->GetIndexOfSubset(subset);
|
||||
ASSERT(index != -1);
|
||||
if (index == -1)
|
||||
|
|
|
@ -14,24 +14,20 @@
|
|||
|
||||
SkeletalMeshRenderer::SkeletalMeshRenderer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
SkeletalMeshRenderer::~SkeletalMeshRenderer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, VertexSkinningShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
Render(graphicsDevice, instance, 0, shader);
|
||||
}
|
||||
|
||||
void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint32_t frame, VertexSkinningShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
instance->CalculateJointTransformations(frame);
|
||||
shader->SetJointPositions(instance->GetJointPositions(), instance->GetNumJoints());
|
||||
|
@ -41,7 +37,6 @@ void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshIn
|
|||
|
||||
void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint32_t startFrame, uint32_t endFrame, float interpolation, VertexSkinningShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
instance->CalculateJointTransformations(startFrame, endFrame, interpolation);
|
||||
shader->SetJointPositions(instance->GetJointPositions(), instance->GetNumJoints());
|
||||
|
@ -51,14 +46,12 @@ void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshIn
|
|||
|
||||
void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshAnimationInstance *instance, VertexSkinningShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
Render(graphicsDevice, instance, instance->GetCurrentFrame(), instance->GetNextFrame(), instance->GetInterpolation(), shader);
|
||||
}
|
||||
|
||||
void SkeletalMeshRenderer::RenderAllSubsets(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, VertexSkinningShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
instance->GetRenderState()->Apply();
|
||||
graphicsDevice->BindVertexBuffer(instance->GetMesh()->GetVertexBuffer());
|
||||
|
||||
|
@ -107,7 +100,6 @@ void SkeletalMeshRenderer::RenderAllSubsets(GraphicsDevice *graphicsDevice, Skel
|
|||
|
||||
void SkeletalMeshRenderer::RenderSubset(GraphicsDevice *graphicsDevice, const SkeletalMeshSubset *subset, const Texture *texture)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (texture != NULL)
|
||||
graphicsDevice->BindTexture(texture);
|
||||
|
||||
|
|
|
@ -7,20 +7,17 @@
|
|||
|
||||
SkeletalMeshSubset::SkeletalMeshSubset()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_indices = NULL;
|
||||
m_alpha = FALSE;
|
||||
}
|
||||
|
||||
SkeletalMeshSubset::~SkeletalMeshSubset()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(m_indices);
|
||||
}
|
||||
|
||||
void SkeletalMeshSubset::Create(const stl::string &name, uint32_t numTriangles, BOOL alpha)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_indices == NULL);
|
||||
ASSERT(numTriangles > 0);
|
||||
m_name = name;
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
MeshFile::MeshFile(File *file)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(file != NULL);
|
||||
ASSERT(file->IsOpen());
|
||||
m_file = file;
|
||||
|
@ -25,12 +24,10 @@ MeshFile::MeshFile(File *file)
|
|||
|
||||
MeshFile::~MeshFile()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void MeshFile::CollectChunks()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_chunks.clear();
|
||||
|
||||
// start off just after the header (start of the first chunk)
|
||||
|
@ -59,7 +56,6 @@ void MeshFile::CollectChunks()
|
|||
|
||||
ChunkDescriptor* MeshFile::GetChunkDesc(const stl::string &name)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ChunkMap::iterator itor = m_chunks.find(name);
|
||||
if (itor == m_chunks.end())
|
||||
return NULL;
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
StaticMesh::StaticMesh(uint32_t numSubsets, StaticMeshSubset **subsets)
|
||||
: Content()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(numSubsets > 0);
|
||||
ASSERT(subsets != NULL);
|
||||
|
||||
|
@ -28,14 +27,12 @@ StaticMesh::StaticMesh(uint32_t numSubsets, StaticMeshSubset **subsets)
|
|||
StaticMesh::StaticMesh(const StaticMeshFile *file, ContentManager *contentManager)
|
||||
: Content()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_numSubsets = 0;
|
||||
CreateSubsets(file, contentManager);
|
||||
}
|
||||
|
||||
StaticMesh::~StaticMesh()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (uint32_t i = 0; i < m_numSubsets; ++i)
|
||||
SAFE_DELETE(m_subsets[i]);
|
||||
SAFE_DELETE_ARRAY(m_subsets);
|
||||
|
@ -43,7 +40,6 @@ StaticMesh::~StaticMesh()
|
|||
|
||||
void StaticMesh::CreateSubsets(const StaticMeshFile *file, ContentManager *contentManager)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_numSubsets = file->GetNumSubMeshes();
|
||||
m_subsets = new StaticMeshSubset*[m_numSubsets];
|
||||
ASSERT(m_subsets != NULL);
|
||||
|
|
|
@ -12,13 +12,11 @@
|
|||
|
||||
StaticMeshBuilder::StaticMeshBuilder()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_transform = IDENTITY_MATRIX;
|
||||
}
|
||||
|
||||
StaticMeshBuilder::~StaticMeshBuilder()
|
||||
{
|
||||
STACK_TRACE;
|
||||
// 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
|
||||
|
@ -35,7 +33,6 @@ void StaticMeshBuilder::Reset()
|
|||
|
||||
uint32_t StaticMeshBuilder::AddSubset(uint32_t numTriangles, Texture *texture)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(numTriangles > 0);
|
||||
StaticMeshSubset *subset = new StaticMeshSubset(numTriangles, texture);
|
||||
ASSERT(subset != NULL);
|
||||
|
@ -53,7 +50,6 @@ void StaticMeshBuilder::SetTriangle(
|
|||
const Vector2 &t1, const Vector2 &t2, const Vector2 &t3
|
||||
)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_subsets.size() > subsetIndex);
|
||||
|
||||
StaticMeshSubset *subset = m_subsets[subsetIndex];
|
||||
|
@ -79,7 +75,6 @@ void StaticMeshBuilder::SetTriangle(
|
|||
const Vector2 &t1, const Vector2 &t2, const Vector2 &t3
|
||||
)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_subsets.size() > subsetIndex);
|
||||
|
||||
StaticMeshSubset *subset = m_subsets[subsetIndex];
|
||||
|
@ -105,7 +100,6 @@ void StaticMeshBuilder::SetQuad(
|
|||
const Vector2 &t1, const Vector2 &t2, const Vector2 &t3, const Vector2 &t4
|
||||
)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_subsets.size() > subsetIndex);
|
||||
|
||||
StaticMeshSubset *subset = m_subsets[subsetIndex];
|
||||
|
@ -137,7 +131,6 @@ void StaticMeshBuilder::SetQuad(
|
|||
const Vector2 &t1, const Vector2 &t2, const Vector2 &t3, const Vector2 &t4
|
||||
)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_subsets.size() > subsetIndex);
|
||||
|
||||
StaticMeshSubset *subset = m_subsets[subsetIndex];
|
||||
|
@ -166,7 +159,6 @@ void StaticMeshBuilder::SetBox(
|
|||
const Vector3 ¢er, float width, float height, float depth
|
||||
)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(width > 0.0f);
|
||||
ASSERT(height > 0.0f);
|
||||
ASSERT(depth > 0.0f);
|
||||
|
@ -187,7 +179,6 @@ void StaticMeshBuilder::SetBox(
|
|||
const Vector3 &min, const Vector3 &max
|
||||
)
|
||||
{
|
||||
STACK_TRACE;
|
||||
// front
|
||||
SetQuad(
|
||||
subsetIndex, firstTriangle,
|
||||
|
@ -239,7 +230,6 @@ void StaticMeshBuilder::SetBox(
|
|||
|
||||
void StaticMeshBuilder::GenerateNormals()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_subsets.size() > 0);
|
||||
|
||||
for (uint32_t i = 0; i < m_subsets.size(); ++i)
|
||||
|
@ -284,7 +274,6 @@ void StaticMeshBuilder::GenerateNormals()
|
|||
|
||||
StaticMesh* StaticMeshBuilder::BuildMesh()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_subsets.size() > 0);
|
||||
|
||||
// convert the mesh vector to an array so it can be passed into the mesh object
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
StaticMeshFile::StaticMeshFile(File *file)
|
||||
: MeshFile(file)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_vertices = NULL;
|
||||
m_normals = NULL;
|
||||
m_texCoords = NULL;
|
||||
|
@ -28,7 +27,6 @@ StaticMeshFile::StaticMeshFile(File *file)
|
|||
|
||||
StaticMeshFile::~StaticMeshFile()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE_ARRAY(m_vertices);
|
||||
SAFE_DELETE_ARRAY(m_normals);
|
||||
SAFE_DELETE_ARRAY(m_texCoords);
|
||||
|
@ -39,7 +37,6 @@ StaticMeshFile::~StaticMeshFile()
|
|||
|
||||
void StaticMeshFile::Load()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ChunkDescriptor *verticesDesc = GetChunkDesc("VTX");
|
||||
ChunkDescriptor *normalsDesc = GetChunkDesc("NRL");
|
||||
ChunkDescriptor *texCoordsDesc = GetChunkDesc("TXT");
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
StaticMeshInstance::StaticMeshInstance(StaticMesh *mesh)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_mesh = mesh;
|
||||
|
||||
m_renderState = new RENDERSTATE_DEFAULT;
|
||||
|
@ -30,19 +29,17 @@ StaticMeshInstance::StaticMeshInstance(StaticMesh *mesh)
|
|||
|
||||
StaticMeshInstance::~StaticMeshInstance()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(m_renderState);
|
||||
}
|
||||
|
||||
void StaticMeshInstance::SetTexture(uint32_t index, Texture *texture)
|
||||
{
|
||||
STACK_TRACE;
|
||||
|
||||
m_textures[index] = texture;
|
||||
}
|
||||
|
||||
void StaticMeshInstance::ResetTexture(uint32_t index)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_textures[index] = m_mesh->GetSubset(index)->GetTexture();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#include "../../debug.h"
|
||||
|
||||
#include "staticmeshrenderer.h"
|
||||
|
||||
#include "staticmesh.h"
|
||||
|
@ -12,17 +10,14 @@
|
|||
|
||||
StaticMeshRenderer::StaticMeshRenderer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
StaticMeshRenderer::~StaticMeshRenderer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void StaticMeshRenderer::Render(GraphicsDevice *graphicsDevice, StaticMeshInstance *instance)
|
||||
{
|
||||
STACK_TRACE;
|
||||
instance->GetRenderState()->Apply();
|
||||
|
||||
if (instance->GetNumTextures() > 0)
|
||||
|
@ -33,21 +28,18 @@ void StaticMeshRenderer::Render(GraphicsDevice *graphicsDevice, StaticMeshInstan
|
|||
|
||||
void StaticMeshRenderer::RenderAllSubsets(GraphicsDevice *graphicsDevice, StaticMeshInstance *instance)
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (uint32_t i = 0; i < instance->GetMesh()->GetNumSubsets(); ++i)
|
||||
RenderSubset(graphicsDevice, instance->GetMesh()->GetSubset(i), instance->GetTexture(i));
|
||||
}
|
||||
|
||||
void StaticMeshRenderer::RenderAllSubsetsTextureless(GraphicsDevice *graphicsDevice, StaticMeshInstance *instance)
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (uint32_t i = 0; i < instance->GetMesh()->GetNumSubsets(); ++i)
|
||||
RenderTexturelessSubset(graphicsDevice, instance->GetMesh()->GetSubset(i));
|
||||
}
|
||||
|
||||
void StaticMeshRenderer::RenderSubset(GraphicsDevice *graphicsDevice, const StaticMeshSubset *subset, const Texture *texture)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (texture != NULL)
|
||||
graphicsDevice->BindTexture(texture);
|
||||
graphicsDevice->BindVertexBuffer(subset->GetVertices());
|
||||
|
@ -57,7 +49,6 @@ void StaticMeshRenderer::RenderSubset(GraphicsDevice *graphicsDevice, const Stat
|
|||
|
||||
void StaticMeshRenderer::RenderTexturelessSubset(GraphicsDevice *graphicsDevice, const StaticMeshSubset *subset)
|
||||
{
|
||||
STACK_TRACE;
|
||||
graphicsDevice->BindVertexBuffer(subset->GetVertices());
|
||||
graphicsDevice->RenderTriangles();
|
||||
graphicsDevice->UnbindVertexBuffer();
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
StaticMeshSubset::StaticMeshSubset(uint32_t numTriangles, Texture *texture)
|
||||
{
|
||||
STACK_TRACE;
|
||||
VERTEX_ATTRIBS attribs[] = {
|
||||
VERTEX_POS_3D,
|
||||
VERTEX_NORMAL,
|
||||
|
@ -22,6 +21,5 @@ StaticMeshSubset::StaticMeshSubset(uint32_t numTriangles, Texture *texture)
|
|||
|
||||
StaticMeshSubset::~StaticMeshSubset()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(m_vertices);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ const uint32_t DEFAULT_MAX_FRAMESKIP = 10;
|
|||
|
||||
BaseGameApp::BaseGameApp()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_stop = FALSE;
|
||||
m_isPaused = FALSE;
|
||||
m_fps = 0;
|
||||
|
@ -43,7 +42,6 @@ BaseGameApp::BaseGameApp()
|
|||
|
||||
BaseGameApp::~BaseGameApp()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "Releasing.\n");
|
||||
if (m_graphics != NULL)
|
||||
OnLostContext();
|
||||
|
@ -54,7 +52,6 @@ BaseGameApp::~BaseGameApp()
|
|||
|
||||
BOOL BaseGameApp::Start(OperatingSystem *system)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_system = system;
|
||||
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "Starting.\n");
|
||||
|
@ -72,7 +69,6 @@ BOOL BaseGameApp::Start(OperatingSystem *system)
|
|||
|
||||
BOOL BaseGameApp::Initialize(GameWindowParams *windowParams)
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "Starting initialization.\n");
|
||||
|
||||
if (!m_system->CreateGameWindow(this, windowParams))
|
||||
|
@ -106,7 +102,6 @@ BOOL BaseGameApp::Initialize(GameWindowParams *windowParams)
|
|||
|
||||
void BaseGameApp::Loop()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "OnLoadGame event.\n");
|
||||
m_content->OnLoadGame();
|
||||
OnLoadGame();
|
||||
|
@ -208,7 +203,6 @@ void BaseGameApp::Loop()
|
|||
|
||||
void BaseGameApp::Quit()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "Quit requested.\n");
|
||||
if (!m_system->IsQuitting())
|
||||
m_system->Quit();
|
||||
|
@ -217,26 +211,22 @@ void BaseGameApp::Quit()
|
|||
|
||||
void BaseGameApp::OnAppGainFocus()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "Gained focus.\n");
|
||||
}
|
||||
|
||||
void BaseGameApp::OnAppLostFocus()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "Lost focus.\n");
|
||||
}
|
||||
|
||||
void BaseGameApp::OnAppPause()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "Paused.\n");
|
||||
m_isPaused = TRUE;
|
||||
}
|
||||
|
||||
void BaseGameApp::OnAppResume()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "Resumed.\n");
|
||||
m_isPaused = FALSE;
|
||||
|
||||
|
@ -248,7 +238,6 @@ void BaseGameApp::OnAppResume()
|
|||
|
||||
void BaseGameApp::OnLostContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "Lost OpenGL context.\n");
|
||||
|
||||
if (m_graphics != NULL)
|
||||
|
@ -259,7 +248,6 @@ void BaseGameApp::OnLostContext()
|
|||
|
||||
void BaseGameApp::OnNewContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "New OpenGL context.\n");
|
||||
m_graphics->OnNewContext();
|
||||
m_content->OnNewContext();
|
||||
|
@ -270,13 +258,11 @@ void BaseGameApp::OnNewContext()
|
|||
|
||||
void BaseGameApp::OnRender()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_graphics->OnRender();
|
||||
}
|
||||
|
||||
void BaseGameApp::OnResize()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "Window resize complete.\n");
|
||||
m_graphics->OnResize(m_window->GetRect());
|
||||
|
||||
|
@ -286,7 +272,6 @@ void BaseGameApp::OnResize()
|
|||
|
||||
void BaseGameApp::InternalUpdate()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_system->ProcessEvents();
|
||||
|
||||
if (m_window->IsClosing() && !m_stop)
|
||||
|
@ -295,13 +280,11 @@ void BaseGameApp::InternalUpdate()
|
|||
|
||||
void BaseGameApp::OnUpdate(float delta)
|
||||
{
|
||||
STACK_TRACE;
|
||||
InternalUpdate();
|
||||
}
|
||||
|
||||
void BaseGameApp::SetUpdateFrequency(uint32_t targetFrequency)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_targetUpdatesPerSecond = targetFrequency;
|
||||
m_ticksPerUpdate = 1000 / m_targetUpdatesPerSecond;
|
||||
m_fixedUpdateInterval = m_ticksPerUpdate / 1000.0f;
|
||||
|
@ -309,7 +292,6 @@ void BaseGameApp::SetUpdateFrequency(uint32_t targetFrequency)
|
|||
|
||||
BOOL BaseGameApp::IsAppFocused() const
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_window != NULL)
|
||||
return m_window->IsFocused();
|
||||
else
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
Content::Content()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_referenceCount = 0;
|
||||
m_isReferenceCounted = FALSE;
|
||||
m_wasLoadedByContentLoader = FALSE;
|
||||
|
@ -12,20 +11,17 @@ Content::Content()
|
|||
|
||||
Content::~Content()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_isReferenceCounted == FALSE || m_referenceCount == 0);
|
||||
}
|
||||
|
||||
void Content::Reference()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_isReferenceCounted = TRUE;
|
||||
++m_referenceCount;
|
||||
}
|
||||
|
||||
void Content::ReleaseReference()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_isReferenceCounted == TRUE);
|
||||
ASSERT(IsReferenced() == TRUE);
|
||||
if (m_referenceCount > 0)
|
||||
|
|
|
@ -6,21 +6,18 @@
|
|||
|
||||
void ContentLoaderBase::MarkLoadedByContentLoader(Content *content)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(content != NULL);
|
||||
content->m_wasLoadedByContentLoader = TRUE;
|
||||
}
|
||||
|
||||
void ContentLoaderBase::Reference(Content *content)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(content != NULL);
|
||||
content->Reference();
|
||||
}
|
||||
|
||||
void ContentLoaderBase::ReleaseReference(Content *content)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(content != NULL);
|
||||
content->ReleaseReference();
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@ template <class T>
|
|||
ContentLoaderMapStoreBase<T>::ContentLoaderMapStoreBase(const stl::string &loggingTag, ContentManager *contentManager, const stl::string &defaultPath)
|
||||
: ContentLoader<T>(contentManager)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(loggingTag.length() > 0);
|
||||
m_loggingTag = loggingTag;
|
||||
SetDefaultPath(defaultPath);
|
||||
|
@ -67,14 +66,12 @@ ContentLoaderMapStoreBase<T>::ContentLoaderMapStoreBase(const stl::string &loggi
|
|||
template <class T>
|
||||
ContentLoaderMapStoreBase<T>::~ContentLoaderMapStoreBase()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_content.empty());
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T* ContentLoaderMapStoreBase<T>::Get(const stl::string &name, const ContentParam *params, BOOL preload)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ContentContainer<T> content;
|
||||
|
||||
stl::string filename = AddDefaultPathIfNeeded(name);
|
||||
|
@ -111,7 +108,6 @@ T* ContentLoaderMapStoreBase<T>::Get(const stl::string &name, const ContentParam
|
|||
template<class T>
|
||||
void ContentLoaderMapStoreBase<T>::Free(T *content, BOOL preload)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(content != NULL);
|
||||
|
||||
for (ContentStoreItor itor = m_content.begin(); itor != m_content.end(); ++itor)
|
||||
|
@ -138,7 +134,6 @@ void ContentLoaderMapStoreBase<T>::Free(const stl::string &name, const ContentPa
|
|||
template<class T>
|
||||
void ContentLoaderMapStoreBase<T>::Free(ContentStoreItor &itor, BOOL force, BOOL preload)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(itor->second.content->WasLoadedByContentLoader() == TRUE);
|
||||
|
||||
if (!itor->second.isPreLoaded)
|
||||
|
@ -177,7 +172,6 @@ void ContentLoaderMapStoreBase<T>::Free(ContentStoreItor &itor, BOOL force, BOOL
|
|||
template<class T>
|
||||
void ContentLoaderMapStoreBase<T>::RemoveAllContent()
|
||||
{
|
||||
STACK_TRACE;
|
||||
while (m_content.size() > 0)
|
||||
{
|
||||
ContentStoreItor itor = m_content.begin();
|
||||
|
@ -196,7 +190,6 @@ void ContentLoaderMapStoreBase<T>::RemoveAllContent()
|
|||
template<class T>
|
||||
stl::string ContentLoaderMapStoreBase<T>::GetNameOf(T *content) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(content != NULL);
|
||||
|
||||
for (ContentStoreConstItor itor = m_content.begin(); itor != m_content.end(); ++itor)
|
||||
|
@ -218,7 +211,6 @@ typename ContentLoaderMapStoreBase<T>::ContentStoreItor ContentLoaderMapStoreBas
|
|||
template<class T>
|
||||
void ContentLoaderMapStoreBase<T>::SetDefaultPath(const stl::string &path)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (path.length() == 0)
|
||||
{
|
||||
m_defaultPath = "";
|
||||
|
@ -239,7 +231,6 @@ void ContentLoaderMapStoreBase<T>::SetDefaultPath(const stl::string &path)
|
|||
template<class T>
|
||||
stl::string ContentLoaderMapStoreBase<T>::AddDefaultPathIfNeeded(const stl::string &imageFile) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (imageFile[0] == '/' || m_defaultPath.length() == 0 || imageFile.substr(0, 9) == "assets://")
|
||||
return imageFile;
|
||||
else
|
||||
|
@ -249,7 +240,6 @@ stl::string ContentLoaderMapStoreBase<T>::AddDefaultPathIfNeeded(const stl::stri
|
|||
template<class T>
|
||||
stl::string ContentLoaderMapStoreBase<T>::ProcessFilename(const stl::string &filename, const ContentParam *params) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,13 +9,11 @@
|
|||
|
||||
ContentManager::ContentManager(BaseGameApp *gameApp)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_gameApp = gameApp;
|
||||
}
|
||||
|
||||
ContentManager::~ContentManager()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (ContentLoaderMap::iterator itor = m_loaders.begin(); itor != m_loaders.end(); ++itor)
|
||||
{
|
||||
ContentLoaderBase *loader = itor->second;
|
||||
|
@ -26,7 +24,6 @@ ContentManager::~ContentManager()
|
|||
|
||||
void ContentManager::OnLoadGame()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (ContentLoaderMap::iterator itor = m_loaders.begin(); itor != m_loaders.end(); ++itor)
|
||||
{
|
||||
ContentLoaderBase *loader = itor->second;
|
||||
|
@ -36,7 +33,6 @@ void ContentManager::OnLoadGame()
|
|||
|
||||
void ContentManager::OnNewContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (ContentLoaderMap::iterator itor = m_loaders.begin(); itor != m_loaders.end(); ++itor)
|
||||
{
|
||||
ContentLoaderBase *loader = itor->second;
|
||||
|
@ -46,7 +42,6 @@ void ContentManager::OnNewContext()
|
|||
|
||||
void ContentManager::OnLostContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (ContentLoaderMap::iterator itor = m_loaders.begin(); itor != m_loaders.end(); ++itor)
|
||||
{
|
||||
ContentLoaderBase *loader = itor->second;
|
||||
|
@ -56,7 +51,6 @@ void ContentManager::OnLostContext()
|
|||
|
||||
void ContentManager::RegisterLoader(ContentLoaderBase *loader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(loader != NULL);
|
||||
|
||||
ContentLoaderBase *existingLoader = GetLoaderFor(loader->GetTypeOf());
|
||||
|
@ -67,7 +61,6 @@ void ContentManager::RegisterLoader(ContentLoaderBase *loader)
|
|||
|
||||
ContentLoaderBase* ContentManager::GetLoaderFor(CONTENT_TYPE type) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ContentLoaderMap::const_iterator itor = m_loaders.find(type);
|
||||
if (itor == m_loaders.end())
|
||||
return NULL;
|
||||
|
|
|
@ -189,7 +189,6 @@ private:
|
|||
template <class T>
|
||||
T* ContentManager::Get(const stl::string &name, BOOL preload)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ContentLoader<T> *loader = GetLoader<T>();
|
||||
T* content = loader->Get(name, NULL, preload);
|
||||
return content;
|
||||
|
@ -198,7 +197,6 @@ T* ContentManager::Get(const stl::string &name, BOOL preload)
|
|||
template <class T>
|
||||
T* ContentManager::Get(const stl::string &name, const ContentParam ¶ms, BOOL preload)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ContentLoader<T> *loader = GetLoader<T>();
|
||||
T* content = loader->Get(name, ¶ms, preload);
|
||||
return content;
|
||||
|
@ -207,21 +205,18 @@ T* ContentManager::Get(const stl::string &name, const ContentParam ¶ms, BOOL
|
|||
template<class T>
|
||||
T* ContentManager::Load(const stl::string &name)
|
||||
{
|
||||
STACK_TRACE;
|
||||
return Get<T>(name, TRUE);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T* ContentManager::Load(const stl::string &name, const ContentParam ¶ms)
|
||||
{
|
||||
STACK_TRACE;
|
||||
return Get<T>(name, params, TRUE);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void ContentManager::Free(const stl::string &name, BOOL preload)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ContentLoader<T> *loader = GetLoader<T>();
|
||||
loader->Free(name, NULL, preload);
|
||||
}
|
||||
|
@ -229,7 +224,6 @@ void ContentManager::Free(const stl::string &name, BOOL preload)
|
|||
template <class T>
|
||||
void ContentManager::Free(const stl::string &name, const ContentParam ¶ms, BOOL preload)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ContentLoader<T> *loader = GetLoader<T>();
|
||||
loader->Free(name, ¶ms, preload);
|
||||
}
|
||||
|
@ -237,7 +231,6 @@ void ContentManager::Free(const stl::string &name, const ContentParam ¶ms, B
|
|||
template <class T>
|
||||
void ContentManager::Free(T *content, BOOL preload)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ContentLoader<T> *loader = GetLoader<T>();
|
||||
loader->Free(content, preload);
|
||||
}
|
||||
|
@ -245,28 +238,24 @@ void ContentManager::Free(T *content, BOOL preload)
|
|||
template <class T>
|
||||
void ContentManager::Unload(const stl::string &name)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Free<T>(name, TRUE);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void ContentManager::Unload(const stl::string &name, const ContentParam ¶ms)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Free<T>(name, params, TRUE);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void ContentManager::Unload(T *content)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Free<T>(content, TRUE);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
stl::string ContentManager::GetNameOf(T *content) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ContentLoader<T> *loader = GetLoader<T>();
|
||||
return loader->GetNameOf(content);
|
||||
}
|
||||
|
@ -274,7 +263,6 @@ stl::string ContentManager::GetNameOf(T *content) const
|
|||
template <class T>
|
||||
ContentLoader<T>* ContentManager::GetLoaderForType() const
|
||||
{
|
||||
STACK_TRACE;
|
||||
return GetLoader<T>();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,23 +16,19 @@
|
|||
ImageLoader::ImageLoader(ContentManager *contentManager)
|
||||
: ContentLoaderMapStoreBase<Image>(LOGGING_TAG, contentManager, "assets://images/")
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
ImageLoader::ImageLoader(ContentManager *contentManager, const stl::string &defaultPath)
|
||||
: ContentLoaderMapStoreBase<Image>(LOGGING_TAG, contentManager, defaultPath)
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
ImageLoader::~ImageLoader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
Image* ImageLoader::LoadContent(const stl::string &file, const ContentParam *params)
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_ASSETS, "%s: loading \"%s\"\n",
|
||||
GetLoggingTag(),
|
||||
file.c_str()
|
||||
|
@ -54,6 +50,5 @@ Image* ImageLoader::LoadContent(const stl::string &file, const ContentParam *par
|
|||
|
||||
void ImageLoader::FreeContent(Image *content)
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(content);
|
||||
}
|
||||
|
|
|
@ -17,23 +17,19 @@
|
|||
KeyframeMeshLoader::KeyframeMeshLoader(ContentManager *contentManager)
|
||||
: ContentLoaderMapStoreBase<KeyframeMesh>(LOGGING_TAG, contentManager, "assets://meshes/")
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
KeyframeMeshLoader::KeyframeMeshLoader(ContentManager *contentManager, const stl::string &defaultPath)
|
||||
: ContentLoaderMapStoreBase<KeyframeMesh>(LOGGING_TAG, contentManager, defaultPath)
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
KeyframeMeshLoader::~KeyframeMeshLoader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
KeyframeMesh* KeyframeMeshLoader::LoadContent(const stl::string &file, const ContentParam *params)
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_ASSETS, "%s: loading \"%s\"\n",
|
||||
GetLoggingTag(),
|
||||
file.c_str()
|
||||
|
@ -56,7 +52,6 @@ KeyframeMesh* KeyframeMeshLoader::LoadContent(const stl::string &file, const Con
|
|||
|
||||
void KeyframeMeshLoader::FreeContent(KeyframeMesh *content)
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(content);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,23 +17,19 @@
|
|||
SkeletalMeshLoader::SkeletalMeshLoader(ContentManager *contentManager)
|
||||
: ContentLoaderMapStoreBase<SkeletalMesh>(LOGGING_TAG, contentManager, "assets://meshes/")
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
SkeletalMeshLoader::SkeletalMeshLoader(ContentManager *contentManager, const stl::string &defaultPath)
|
||||
: ContentLoaderMapStoreBase<SkeletalMesh>(LOGGING_TAG, contentManager, defaultPath)
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
SkeletalMeshLoader::~SkeletalMeshLoader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
SkeletalMesh* SkeletalMeshLoader::LoadContent(const stl::string &file, const ContentParam *params)
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_ASSETS, "%s: loading \"%s\"\n",
|
||||
GetLoggingTag(),
|
||||
file.c_str()
|
||||
|
@ -56,7 +52,6 @@ SkeletalMesh* SkeletalMeshLoader::LoadContent(const stl::string &file, const Con
|
|||
|
||||
void SkeletalMeshLoader::FreeContent(SkeletalMesh *content)
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(content);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,23 +28,19 @@
|
|||
SpriteFontLoader::SpriteFontLoader(ContentManager *contentManager)
|
||||
: ContentLoaderMapStoreBase<SpriteFont>(LOGGING_TAG, contentManager, "assets://fonts/")
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
SpriteFontLoader::SpriteFontLoader(ContentManager *contentManager, const stl::string &defaultPath)
|
||||
: ContentLoaderMapStoreBase<SpriteFont>(LOGGING_TAG, contentManager, defaultPath)
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
SpriteFontLoader::~SpriteFontLoader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void SpriteFontLoader::OnNewContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_ASSETS, "%s: reloading previous fonts for new OpenGL context.\n", GetLoggingTag());
|
||||
|
||||
for (ContentStoreItor itor = m_content.begin(); itor != m_content.end(); ++itor)
|
||||
|
@ -69,7 +65,6 @@ void SpriteFontLoader::OnNewContext()
|
|||
|
||||
void SpriteFontLoader::OnLostContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_ASSETS, "%s: invoking lost OpenGL context event for all loaded fonts.\n", GetLoggingTag());
|
||||
|
||||
for (ContentStoreItor itor = m_content.begin(); itor != m_content.end(); ++itor)
|
||||
|
@ -81,7 +76,6 @@ void SpriteFontLoader::OnLostContext()
|
|||
|
||||
SpriteFont* SpriteFontLoader::LoadContent(const stl::string &file, const ContentParam *params)
|
||||
{
|
||||
STACK_TRACE;
|
||||
stl::string filename;
|
||||
uint8_t size = 0;
|
||||
|
||||
|
@ -113,7 +107,6 @@ stl::string SpriteFontLoader::ProcessFilename(const stl::string &filename, const
|
|||
|
||||
void SpriteFontLoader::DecomposeFilename(const stl::string &filename, stl::string &outFilename, uint8_t &outSize) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(filename.length() > 0);
|
||||
|
||||
size_t startOfSize = filename.find_last_of(':');
|
||||
|
@ -126,7 +119,6 @@ void SpriteFontLoader::DecomposeFilename(const stl::string &filename, stl::strin
|
|||
|
||||
SpriteFont* SpriteFontLoader::Load(File *file, uint8_t size, SpriteFont *existing) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_ASSETS, "%s: loading \"%s:%d\"\n", GetLoggingTag(), file->GetFilename().c_str(), size);
|
||||
|
||||
// TODO: somehow find a way to base this on the font size requested, as this
|
||||
|
@ -276,13 +268,11 @@ SpriteFont* SpriteFontLoader::Load(File *file, uint8_t size, SpriteFont *existin
|
|||
|
||||
void SpriteFontLoader::FreeContent(SpriteFont *content)
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(content);
|
||||
}
|
||||
|
||||
BOOL SpriteFontLoader::GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uint8_t size, SpriteFontGlyphMetrics *metrics) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(metrics != NULL);
|
||||
|
||||
// need to properly scale! sizes as returned from most (all?) metric-related functions will be huge
|
||||
|
|
|
@ -18,23 +18,19 @@ const char* LOGGING_TAG = "StaticMeshLoader";
|
|||
StaticMeshLoader::StaticMeshLoader(ContentManager *contentManager)
|
||||
: ContentLoaderMapStoreBase<StaticMesh>(LOGGING_TAG, contentManager, "assets://meshes/")
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
StaticMeshLoader::StaticMeshLoader(ContentManager *contentManager, const stl::string &defaultPath)
|
||||
: ContentLoaderMapStoreBase<StaticMesh>(LOGGING_TAG, contentManager, defaultPath)
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
StaticMeshLoader::~StaticMeshLoader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
StaticMesh* StaticMeshLoader::LoadContent(const stl::string &file, const ContentParam *params)
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_ASSETS, "%s: loading \"%s\"\n",
|
||||
GetLoggingTag(),
|
||||
file.c_str()
|
||||
|
@ -57,6 +53,5 @@ StaticMesh* StaticMeshLoader::LoadContent(const stl::string &file, const Content
|
|||
|
||||
void StaticMeshLoader::FreeContent(StaticMesh *content)
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(content);
|
||||
}
|
||||
|
|
|
@ -17,23 +17,19 @@
|
|||
TextLoader::TextLoader(ContentManager *contentManager)
|
||||
: ContentLoaderMapStoreBase<Text>(LOGGING_TAG, contentManager, "")
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
TextLoader::TextLoader(ContentManager *contentManager, const stl::string &defaultPath)
|
||||
: ContentLoaderMapStoreBase<Text>(LOGGING_TAG, contentManager, defaultPath)
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
TextLoader::~TextLoader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
Text* TextLoader::LoadContent(const stl::string &file, const ContentParam *params)
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_ASSETS, "%s: loading \"%s\"\n",
|
||||
GetLoggingTag(),
|
||||
file.c_str()
|
||||
|
@ -52,6 +48,5 @@ Text* TextLoader::LoadContent(const stl::string &file, const ContentParam *param
|
|||
|
||||
void TextLoader::FreeContent(Text *content)
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(content);
|
||||
}
|
||||
|
|
|
@ -20,23 +20,19 @@
|
|||
TextureLoader::TextureLoader(ContentManager *contentManager)
|
||||
: ContentLoaderMapStoreBase<Texture>(LOGGING_TAG, contentManager, "assets://textures/")
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
TextureLoader::TextureLoader(ContentManager *contentManager, const stl::string &defaultPath)
|
||||
: ContentLoaderMapStoreBase<Texture>(LOGGING_TAG, contentManager, defaultPath)
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
TextureLoader::~TextureLoader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void TextureLoader::OnNewContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_ASSETS, "%s: reloading previous textures for new OpenGL context.\n", GetLoggingTag());
|
||||
|
||||
for (ContentStoreItor itor = m_content.begin(); itor != m_content.end(); ++itor)
|
||||
|
@ -54,7 +50,6 @@ void TextureLoader::OnNewContext()
|
|||
|
||||
void TextureLoader::OnLostContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_ASSETS, "%s: resetting loaded texture IDs due to lost OpenGL context.\n", GetLoggingTag());
|
||||
|
||||
for (ContentStoreItor itor = m_content.begin(); itor != m_content.end(); ++itor)
|
||||
|
@ -63,19 +58,16 @@ void TextureLoader::OnLostContext()
|
|||
|
||||
Texture* TextureLoader::LoadContent(const stl::string &file, const ContentParam *params)
|
||||
{
|
||||
STACK_TRACE;
|
||||
return Load(file, NULL);
|
||||
}
|
||||
|
||||
void TextureLoader::FreeContent(Texture *content)
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(content);
|
||||
}
|
||||
|
||||
Texture* TextureLoader::Load(const stl::string &file, Texture *existingTexture)
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_ASSETS, "%s: loading \"%s\"\n",
|
||||
GetLoggingTag(),
|
||||
file.c_str()
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
#include "diskfile.h"
|
||||
|
||||
DiskFile::DiskFile()
|
||||
: File()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_fp = NULL;
|
||||
m_mode = 0;
|
||||
m_canRead = FALSE;
|
||||
|
@ -15,13 +13,11 @@ DiskFile::DiskFile()
|
|||
|
||||
DiskFile::~DiskFile()
|
||||
{
|
||||
STACK_TRACE;
|
||||
Close();
|
||||
}
|
||||
|
||||
BOOL DiskFile::Open(const stl::string &filename, int mode)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen() == FALSE);
|
||||
m_filename = filename;
|
||||
|
||||
|
@ -70,7 +66,6 @@ BOOL DiskFile::Open(const stl::string &filename, int mode)
|
|||
|
||||
void DiskFile::Close()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (IsOpen())
|
||||
{
|
||||
LOG_INFO(LOGCAT_FILEIO, "Closed DiskFile \"%s\"\n", m_filename.c_str());
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
#include "s3eFile.h"
|
||||
|
||||
MarmaladeFile::MarmaladeFile()
|
||||
: File()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_fp = NULL;
|
||||
m_mode = 0;
|
||||
m_canRead = FALSE;
|
||||
|
@ -17,13 +15,11 @@ MarmaladeFile::MarmaladeFile()
|
|||
|
||||
MarmaladeFile::~MarmaladeFile()
|
||||
{
|
||||
STACK_TRACE;
|
||||
Close();
|
||||
}
|
||||
|
||||
BOOL MarmaladeFile::Open(const stl::string &filename, int mode)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen() == FALSE);
|
||||
m_filename = filename;
|
||||
|
||||
|
@ -72,7 +68,6 @@ BOOL MarmaladeFile::Open(const stl::string &filename, int mode)
|
|||
|
||||
void MarmaladeFile::Close()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (IsOpen())
|
||||
{
|
||||
LOG_INFO(LOGCAT_FILEIO, "Closed MarmaladeFile \"%s\"\n", m_filename.c_str());
|
||||
|
@ -88,7 +83,6 @@ void MarmaladeFile::Close()
|
|||
|
||||
int8_t MarmaladeFile::ReadChar()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanRead());
|
||||
int8_t buffer;
|
||||
|
@ -98,7 +92,6 @@ int8_t MarmaladeFile::ReadChar()
|
|||
|
||||
uint8_t MarmaladeFile::ReadUnsignedChar()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanRead());
|
||||
uint8_t buffer;
|
||||
|
@ -108,7 +101,6 @@ uint8_t MarmaladeFile::ReadUnsignedChar()
|
|||
|
||||
int16_t MarmaladeFile::ReadShort()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanRead());
|
||||
int16_t buffer;
|
||||
|
@ -118,7 +110,6 @@ int16_t MarmaladeFile::ReadShort()
|
|||
|
||||
uint16_t MarmaladeFile::ReadUnsignedShort()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanRead());
|
||||
uint16_t buffer;
|
||||
|
@ -128,7 +119,6 @@ uint16_t MarmaladeFile::ReadUnsignedShort()
|
|||
|
||||
int32_t MarmaladeFile::ReadInt()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanRead());
|
||||
int32_t buffer;
|
||||
|
@ -138,7 +128,6 @@ int32_t MarmaladeFile::ReadInt()
|
|||
|
||||
uint32_t MarmaladeFile::ReadUnsignedInt()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanRead());
|
||||
uint32_t buffer;
|
||||
|
@ -148,7 +137,6 @@ uint32_t MarmaladeFile::ReadUnsignedInt()
|
|||
|
||||
int64_t MarmaladeFile::ReadLong()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanRead());
|
||||
int64_t buffer;
|
||||
|
@ -158,7 +146,6 @@ int64_t MarmaladeFile::ReadLong()
|
|||
|
||||
uint64_t MarmaladeFile::ReadUnsignedLong()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanRead());
|
||||
uint64_t buffer;
|
||||
|
@ -168,7 +155,6 @@ uint64_t MarmaladeFile::ReadUnsignedLong()
|
|||
|
||||
float MarmaladeFile::ReadFloat()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanRead());
|
||||
float buffer;
|
||||
|
@ -178,7 +164,6 @@ float MarmaladeFile::ReadFloat()
|
|||
|
||||
double MarmaladeFile::ReadDouble()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanRead());
|
||||
double buffer;
|
||||
|
@ -188,7 +173,6 @@ double MarmaladeFile::ReadDouble()
|
|||
|
||||
size_t MarmaladeFile::Read(int8_t *buffer, size_t bytesToRead)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanRead());
|
||||
ASSERT(buffer != NULL);
|
||||
|
@ -199,7 +183,6 @@ size_t MarmaladeFile::Read(int8_t *buffer, size_t bytesToRead)
|
|||
|
||||
size_t MarmaladeFile::ReadString(stl::string &buffer)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanRead());
|
||||
size_t charactersRead = 0;
|
||||
|
@ -219,7 +202,6 @@ size_t MarmaladeFile::ReadString(stl::string &buffer)
|
|||
|
||||
size_t MarmaladeFile::ReadFixedString(stl::string &buffer, size_t maxLength)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanRead());
|
||||
size_t charactersRead = 0;
|
||||
|
@ -241,7 +223,6 @@ size_t MarmaladeFile::ReadFixedString(stl::string &buffer, size_t maxLength)
|
|||
|
||||
size_t MarmaladeFile::WriteChar(int8_t data)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanWrite());
|
||||
size_t numWritten = s3eFileWrite(&data, sizeof(int8_t), 1, m_fp);
|
||||
|
@ -250,7 +231,6 @@ size_t MarmaladeFile::WriteChar(int8_t data)
|
|||
|
||||
size_t MarmaladeFile::WriteUnsignedChar(uint8_t data)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanWrite());
|
||||
size_t numWritten = s3eFileWrite(&data, sizeof(uint8_t), 1, m_fp);
|
||||
|
@ -259,7 +239,6 @@ size_t MarmaladeFile::WriteUnsignedChar(uint8_t data)
|
|||
|
||||
size_t MarmaladeFile::WriteShort(int16_t data)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanWrite());
|
||||
size_t numWritten = s3eFileWrite(&data, sizeof(int16_t), 1, m_fp);
|
||||
|
@ -268,7 +247,6 @@ size_t MarmaladeFile::WriteShort(int16_t data)
|
|||
|
||||
size_t MarmaladeFile::WriteUnsignedShort(uint16_t data)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanWrite());
|
||||
size_t numWritten = s3eFileWrite(&data, sizeof(uint16_t), 1, m_fp);
|
||||
|
@ -277,7 +255,6 @@ size_t MarmaladeFile::WriteUnsignedShort(uint16_t data)
|
|||
|
||||
size_t MarmaladeFile::WriteInt(int32_t data)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanWrite());
|
||||
size_t numWritten = s3eFileWrite(&data, sizeof(int32_t), 1, m_fp);
|
||||
|
@ -286,7 +263,6 @@ size_t MarmaladeFile::WriteInt(int32_t data)
|
|||
|
||||
size_t MarmaladeFile::WriteUnsignedInt(uint32_t data)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanWrite());
|
||||
size_t numWritten = s3eFileWrite(&data, sizeof(uint32_t), 1, m_fp);
|
||||
|
@ -295,7 +271,6 @@ size_t MarmaladeFile::WriteUnsignedInt(uint32_t data)
|
|||
|
||||
size_t MarmaladeFile::WriteLong(int64_t data)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanWrite());
|
||||
size_t numWritten = s3eFileWrite(&data, sizeof(int64_t), 1, m_fp);
|
||||
|
@ -304,7 +279,6 @@ size_t MarmaladeFile::WriteLong(int64_t data)
|
|||
|
||||
size_t MarmaladeFile::WriteUnsignedLong(uint64_t data)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanWrite());
|
||||
size_t numWritten = s3eFileWrite(&data, sizeof(uint64_t), 1, m_fp);
|
||||
|
@ -313,7 +287,6 @@ size_t MarmaladeFile::WriteUnsignedLong(uint64_t data)
|
|||
|
||||
size_t MarmaladeFile::WriteFloat(float data)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanWrite());
|
||||
size_t numWritten = s3eFileWrite(&data, sizeof(float), 1, m_fp);
|
||||
|
@ -322,7 +295,6 @@ size_t MarmaladeFile::WriteFloat(float data)
|
|||
|
||||
size_t MarmaladeFile::WriteDouble(double data)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanWrite());
|
||||
size_t numWritten = s3eFileWrite(&data, sizeof(double), 1, m_fp);
|
||||
|
@ -331,7 +303,6 @@ size_t MarmaladeFile::WriteDouble(double data)
|
|||
|
||||
size_t MarmaladeFile::Write(int8_t *buffer, size_t bytesToWrite)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
ASSERT(CanWrite());
|
||||
ASSERT(buffer != NULL);
|
||||
|
@ -342,14 +313,12 @@ size_t MarmaladeFile::Write(int8_t *buffer, size_t bytesToWrite)
|
|||
|
||||
size_t MarmaladeFile::Tell()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
return (size_t)s3eFileTell(m_fp);
|
||||
}
|
||||
|
||||
void MarmaladeFile::Seek(size_t offset, FileSeek from)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
|
||||
s3eFileSeekOrigin origin = S3E_FILESEEK_CUR;
|
||||
|
@ -363,7 +332,6 @@ void MarmaladeFile::Seek(size_t offset, FileSeek from)
|
|||
|
||||
BOOL MarmaladeFile::AtEOF()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
if (s3eFileEOF(m_fp) == S3E_TRUE)
|
||||
return TRUE;
|
||||
|
@ -373,7 +341,6 @@ BOOL MarmaladeFile::AtEOF()
|
|||
|
||||
size_t MarmaladeFile::GetFileSize()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen());
|
||||
return (size_t)s3eFileGetSize(m_fp);
|
||||
}
|
||||
|
|
|
@ -12,21 +12,17 @@
|
|||
#include "util.h"
|
||||
|
||||
MarmaladeFileSystem::MarmaladeFileSystem()
|
||||
: FileSystem()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_assetsPath = ::GetAssetsPath();
|
||||
LOG_INFO(LOGCAT_FILEIO, "FileSystem assets path is \"%s\".\n", m_assetsPath.c_str());
|
||||
}
|
||||
|
||||
MarmaladeFileSystem::~MarmaladeFileSystem()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
File* MarmaladeFileSystem::Open(const stl::string &filename, int mode)
|
||||
{
|
||||
STACK_TRACE;
|
||||
File *result = NULL;
|
||||
stl::string realFilename = TranslateFilePath(filename);
|
||||
|
||||
|
@ -40,7 +36,6 @@ File* MarmaladeFileSystem::Open(const stl::string &filename, int mode)
|
|||
|
||||
File* MarmaladeFileSystem::OpenFile(const stl::string &filename, int mode)
|
||||
{
|
||||
STACK_TRACE;
|
||||
MarmaladeFile *file = new MarmaladeFile();
|
||||
ASSERT(file != NULL);
|
||||
|
||||
|
@ -55,7 +50,6 @@ File* MarmaladeFileSystem::OpenFile(const stl::string &filename, int mode)
|
|||
|
||||
File* MarmaladeFileSystem::OpenMemory(const stl::string &filename, int mode)
|
||||
{
|
||||
STACK_TRACE;
|
||||
// open the specified file off the disk (or whatever)
|
||||
File *file = OpenFile(filename, mode);
|
||||
if (file == NULL)
|
||||
|
@ -78,7 +72,6 @@ File* MarmaladeFileSystem::OpenMemory(const stl::string &filename, int mode)
|
|||
|
||||
stl::string MarmaladeFileSystem::TranslateFilePath(const stl::string &filename) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (filename.substr(0, 9) == "assets://")
|
||||
return m_assetsPath + filename.substr(9);
|
||||
else
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
#include <string.h>
|
||||
|
||||
MemoryFile::MemoryFile()
|
||||
: File()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_data = NULL;
|
||||
m_ownData = FALSE;
|
||||
m_length = 0;
|
||||
|
@ -19,13 +17,11 @@ MemoryFile::MemoryFile()
|
|||
|
||||
MemoryFile::~MemoryFile()
|
||||
{
|
||||
STACK_TRACE;
|
||||
Close();
|
||||
}
|
||||
|
||||
BOOL MemoryFile::Open(File *srcFile)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen() == FALSE);
|
||||
ASSERT(srcFile->IsOpen());
|
||||
size_t filesize = srcFile->GetFileSize();
|
||||
|
@ -47,7 +43,6 @@ BOOL MemoryFile::Open(File *srcFile)
|
|||
|
||||
BOOL MemoryFile::Open(const void *memory, size_t numBytes, BOOL canRead, BOOL canWrite, BOOL assumeOwnershipOfMemory)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen() == FALSE);
|
||||
ASSERT(memory != NULL);
|
||||
ASSERT(numBytes > 0);
|
||||
|
@ -66,7 +61,6 @@ BOOL MemoryFile::Open(const void *memory, size_t numBytes, BOOL canRead, BOOL ca
|
|||
|
||||
void MemoryFile::Close()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (IsOpen())
|
||||
{
|
||||
if (m_ownData)
|
||||
|
|
|
@ -5,9 +5,7 @@
|
|||
#include "sdlfile.h"
|
||||
|
||||
SDLFile::SDLFile()
|
||||
: File()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_fp = NULL;
|
||||
m_mode = 0;
|
||||
m_canRead = FALSE;
|
||||
|
@ -16,13 +14,11 @@ SDLFile::SDLFile()
|
|||
|
||||
SDLFile::~SDLFile()
|
||||
{
|
||||
STACK_TRACE;
|
||||
Close();
|
||||
}
|
||||
|
||||
BOOL SDLFile::Open(const stl::string &filename, int mode)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsOpen() == FALSE);
|
||||
m_filename = filename;
|
||||
|
||||
|
@ -71,7 +67,6 @@ BOOL SDLFile::Open(const stl::string &filename, int mode)
|
|||
|
||||
void SDLFile::Close()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (IsOpen())
|
||||
{
|
||||
LOG_INFO(LOGCAT_FILEIO, "Closed SDLFIle \"%s\"\n", m_filename.c_str());
|
||||
|
|
|
@ -12,21 +12,17 @@
|
|||
#include "util.h"
|
||||
|
||||
SDLFileSystem::SDLFileSystem()
|
||||
: FileSystem()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_assetsPath = ::GetAssetsPath();
|
||||
LOG_INFO(LOGCAT_FILEIO, "FileSystem assets path is \"%s\".\n", m_assetsPath.c_str());
|
||||
}
|
||||
|
||||
SDLFileSystem::~SDLFileSystem()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
File* SDLFileSystem::Open(const stl::string &filename, int mode)
|
||||
{
|
||||
STACK_TRACE;
|
||||
File *result = NULL;
|
||||
stl::string realFilename = TranslateFilePath(filename);
|
||||
|
||||
|
@ -40,7 +36,6 @@ File* SDLFileSystem::Open(const stl::string &filename, int mode)
|
|||
|
||||
File* SDLFileSystem::OpenFile(const stl::string &filename, int mode)
|
||||
{
|
||||
STACK_TRACE;
|
||||
SDLFile *file = new SDLFile();
|
||||
ASSERT(file != NULL);
|
||||
|
||||
|
@ -55,7 +50,6 @@ File* SDLFileSystem::OpenFile(const stl::string &filename, int mode)
|
|||
|
||||
File* SDLFileSystem::OpenMemory(const stl::string &filename, int mode)
|
||||
{
|
||||
STACK_TRACE;
|
||||
// open the specified file off the disk (or whatever)
|
||||
File *file = OpenFile(filename, mode);
|
||||
if (file == NULL)
|
||||
|
@ -78,7 +72,6 @@ File* SDLFileSystem::OpenMemory(const stl::string &filename, int mode)
|
|||
|
||||
stl::string SDLFileSystem::TranslateFilePath(const stl::string &filename) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (filename.substr(0, 9) == "assets://")
|
||||
return m_assetsPath + filename.substr(9);
|
||||
else
|
||||
|
|
|
@ -23,7 +23,6 @@ stl::string g_assetsPath;
|
|||
|
||||
const stl::string& GetAppPath()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (g_appPath.length() > 0)
|
||||
return g_appPath;
|
||||
|
||||
|
@ -94,7 +93,6 @@ const stl::string& GetAppPath()
|
|||
|
||||
const stl::string& GetAssetsPath()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (g_assetsPath.length() > 0)
|
||||
return g_assetsPath;
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ char __billboardSpriteBatch_PrintfBuffer[PRINTF_BUFFER_SIZE + 1];
|
|||
|
||||
BillboardSpriteBatch::BillboardSpriteBatch(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_graphicsDevice = graphicsDevice;
|
||||
m_shader = NULL;
|
||||
|
||||
|
@ -63,7 +62,6 @@ BillboardSpriteBatch::BillboardSpriteBatch(GraphicsDevice *graphicsDevice)
|
|||
|
||||
BillboardSpriteBatch::~BillboardSpriteBatch()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(m_vertices);
|
||||
SAFE_DELETE(m_renderState);
|
||||
SAFE_DELETE(m_blendState);
|
||||
|
@ -71,7 +69,6 @@ BillboardSpriteBatch::~BillboardSpriteBatch()
|
|||
|
||||
void BillboardSpriteBatch::InternalBegin(const RenderState *renderState, const BlendState *blendState, SpriteShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == FALSE);
|
||||
|
||||
m_cameraPosition = m_graphicsDevice->GetViewContext()->GetCamera()->GetPosition();
|
||||
|
@ -107,43 +104,36 @@ void BillboardSpriteBatch::InternalBegin(const RenderState *renderState, const B
|
|||
|
||||
void BillboardSpriteBatch::Begin(SpriteShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
InternalBegin(NULL, NULL, shader);
|
||||
}
|
||||
|
||||
void BillboardSpriteBatch::Begin(const RenderState &renderState, SpriteShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
InternalBegin(&renderState, NULL, shader);
|
||||
}
|
||||
|
||||
void BillboardSpriteBatch::Begin(const BlendState &blendState, SpriteShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
InternalBegin(NULL, &blendState, shader);
|
||||
}
|
||||
|
||||
void BillboardSpriteBatch::Begin(const RenderState &renderState, const BlendState &blendState, SpriteShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
InternalBegin(&renderState, &blendState, shader);
|
||||
}
|
||||
|
||||
void BillboardSpriteBatch::Render(const Texture *texture, float x, float y, float z, float width, float height, BILLBOARDSPRITE_TYPE type, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
AddSprite(type, texture, Vector3(x, y, z), width, height, 0, 0, texture->GetWidth(), texture->GetHeight(), color);
|
||||
}
|
||||
|
||||
void BillboardSpriteBatch::Render(const Texture *texture, const Vector3 &position, float width, float height, BILLBOARDSPRITE_TYPE type, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
const RectF *texCoords = &atlas->GetTile(index).texCoords;
|
||||
const Texture *texture = atlas->GetTexture();
|
||||
|
||||
|
@ -152,7 +142,6 @@ void BillboardSpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, flo
|
|||
|
||||
void BillboardSpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, const Vector3 &position, float width, float height, BILLBOARDSPRITE_TYPE type, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
const RectF *texCoords = &atlas->GetTile(index).texCoords;
|
||||
const Texture *texture = atlas->GetTexture();
|
||||
|
||||
|
@ -161,13 +150,11 @@ void BillboardSpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, con
|
|||
|
||||
void BillboardSpriteBatch::Render(const SpriteFont *font, float x, float y, float z, BILLBOARDSPRITE_TYPE type, const Color &color, float pixelScale, const char *text)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Render(font, Vector3(x, y, z), type, color, pixelScale, text);
|
||||
}
|
||||
|
||||
void BillboardSpriteBatch::Render(const SpriteFont *font, const Vector3 &position, BILLBOARDSPRITE_TYPE type, const Color &color, float pixelScale, const char *text)
|
||||
{
|
||||
STACK_TRACE;
|
||||
size_t textLength = strlen(text);
|
||||
|
||||
uint16_t textWidth = 0;
|
||||
|
@ -217,7 +204,6 @@ void BillboardSpriteBatch::Render(const SpriteFont *font, const Vector3 &positio
|
|||
|
||||
void BillboardSpriteBatch::Printf(const SpriteFont *font, float x, float y, float z, BILLBOARDSPRITE_TYPE type, const Color &color, float pixelScale, const char *format, ...)
|
||||
{
|
||||
STACK_TRACE;
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vsnprintf(__billboardSpriteBatch_PrintfBuffer, PRINTF_BUFFER_SIZE, format, args);
|
||||
|
@ -228,7 +214,6 @@ void BillboardSpriteBatch::Printf(const SpriteFont *font, float x, float y, floa
|
|||
|
||||
void BillboardSpriteBatch::Printf(const SpriteFont *font, const Vector3 &position, BILLBOARDSPRITE_TYPE type, const Color &color, float pixelScale, const char *format, ...)
|
||||
{
|
||||
STACK_TRACE;
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vsnprintf(__billboardSpriteBatch_PrintfBuffer, PRINTF_BUFFER_SIZE, format, args);
|
||||
|
@ -239,7 +224,6 @@ void BillboardSpriteBatch::Printf(const SpriteFont *font, const Vector3 &positio
|
|||
|
||||
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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
Matrix4x4 transform = GetTransformFor(type, position);
|
||||
|
||||
|
@ -250,7 +234,6 @@ void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Texture *t
|
|||
|
||||
void BillboardSpriteBatch::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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
Matrix4x4 transform = GetTransformFor(type, position);
|
||||
|
||||
|
@ -261,7 +244,6 @@ void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Texture *t
|
|||
|
||||
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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
|
||||
uint16_t sourceWidth = sourceRight - sourceLeft;
|
||||
|
@ -280,7 +262,6 @@ void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Matrix4x4
|
|||
|
||||
void BillboardSpriteBatch::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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
CheckForNewSpriteSpace();
|
||||
SetSpriteInfo(m_currentSpritePointer, type, transform, texture, offset, width, height, texCoordLeft, texCoordTop, texCoordRight, texCoordBottom, color);
|
||||
|
@ -289,7 +270,6 @@ void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Matrix4x4
|
|||
|
||||
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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
uint32_t base = spriteIndex * VERTICES_PER_SPRITE;
|
||||
|
||||
float halfWidth = width / 2.0f;
|
||||
|
@ -338,7 +318,6 @@ void BillboardSpriteBatch::SetSpriteInfo(uint32_t spriteIndex, BILLBOARDSPRITE_T
|
|||
|
||||
void BillboardSpriteBatch::End()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
|
||||
if (m_isRenderStateOverridden)
|
||||
|
@ -361,7 +340,6 @@ void BillboardSpriteBatch::End()
|
|||
|
||||
void BillboardSpriteBatch::RenderQueue()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_graphicsDevice->BindVertexBuffer(m_vertices);
|
||||
|
||||
const Texture *currentTexture = NULL;
|
||||
|
@ -393,7 +371,6 @@ void BillboardSpriteBatch::RenderQueue()
|
|||
|
||||
void BillboardSpriteBatch::RenderQueueRange(const Texture *texture, uint32_t firstSprite, uint32_t lastSprite)
|
||||
{
|
||||
STACK_TRACE;
|
||||
const int TRIANGLES_PER_SPRITE = 2;
|
||||
uint32_t vertexOffset = firstSprite * VERTICES_PER_SPRITE;
|
||||
uint32_t numTriangles = (lastSprite - firstSprite) * TRIANGLES_PER_SPRITE;
|
||||
|
@ -428,7 +405,6 @@ inline Matrix4x4 BillboardSpriteBatch::GetTransformFor(BILLBOARDSPRITE_TYPE type
|
|||
|
||||
void BillboardSpriteBatch::CheckForNewSpriteSpace()
|
||||
{
|
||||
STACK_TRACE;
|
||||
// m_currentSpritePointer = zero-based index
|
||||
// m_currentSpriteCapacity = count of items (not zero-based)
|
||||
if (m_currentSpritePointer >= m_currentSpriteCapacity)
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#include "../debug.h"
|
||||
|
||||
#include "blendstate.h"
|
||||
|
||||
#include "glincludes.h"
|
||||
|
@ -7,13 +5,11 @@
|
|||
|
||||
BlendState::BlendState()
|
||||
{
|
||||
STACK_TRACE;
|
||||
Initialize();
|
||||
}
|
||||
|
||||
BlendState::BlendState(BLEND_FACTOR sourceFactor, BLEND_FACTOR destinationFactor)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Initialize();
|
||||
|
||||
m_blending = TRUE;
|
||||
|
@ -23,12 +19,10 @@ BlendState::BlendState(BLEND_FACTOR sourceFactor, BLEND_FACTOR destinationFactor
|
|||
|
||||
BlendState::~BlendState()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void BlendState::Initialize()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_blending = FALSE;
|
||||
m_sourceBlendFactor = ONE;
|
||||
m_destBlendFactor = ZERO;
|
||||
|
@ -36,7 +30,6 @@ void BlendState::Initialize()
|
|||
|
||||
void BlendState::Apply() const
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_blending)
|
||||
{
|
||||
GL_CALL(glEnable(GL_BLEND));
|
||||
|
@ -50,7 +43,6 @@ void BlendState::Apply() const
|
|||
|
||||
int BlendState::FindBlendFactorValue(BLEND_FACTOR factor) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
switch (factor)
|
||||
{
|
||||
case ZERO: return GL_ZERO;
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
BufferObject::BufferObject()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_type = BUFFEROBJECT_TYPE_VERTEX;
|
||||
m_usage = BUFFEROBJECT_USAGE_STATIC;
|
||||
m_bufferId = 0;
|
||||
|
@ -16,7 +15,6 @@ BufferObject::BufferObject()
|
|||
|
||||
void BufferObject::Release()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!IsClientSideBuffer())
|
||||
FreeBufferObject();
|
||||
|
||||
|
@ -31,7 +29,6 @@ void BufferObject::Release()
|
|||
|
||||
BOOL BufferObject::Initialize(GraphicsDevice *graphicsDevice, BUFFEROBJECT_TYPE type, BUFFEROBJECT_USAGE usage)
|
||||
{
|
||||
STACK_TRACE;
|
||||
BOOL success = TRUE;
|
||||
if (graphicsDevice != NULL)
|
||||
success = GraphicsContextResource::Initialize(graphicsDevice);
|
||||
|
@ -46,14 +43,12 @@ BOOL BufferObject::Initialize(GraphicsDevice *graphicsDevice, BUFFEROBJECT_TYPE
|
|||
|
||||
void BufferObject::CreateOnGpu()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsClientSideBuffer() == TRUE);
|
||||
CreateBufferObject();
|
||||
}
|
||||
|
||||
void BufferObject::RecreateOnGpu()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsClientSideBuffer() == FALSE);
|
||||
FreeBufferObject();
|
||||
CreateBufferObject();
|
||||
|
@ -61,14 +56,12 @@ void BufferObject::RecreateOnGpu()
|
|||
|
||||
void BufferObject::FreeFromGpu()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsClientSideBuffer() == FALSE);
|
||||
FreeBufferObject();
|
||||
}
|
||||
|
||||
void BufferObject::CreateBufferObject()
|
||||
{
|
||||
STACK_TRACE;
|
||||
GL_CALL(glGenBuffers(1, &m_bufferId));
|
||||
SizeBufferObject();
|
||||
|
||||
|
@ -77,7 +70,6 @@ void BufferObject::CreateBufferObject()
|
|||
|
||||
void BufferObject::FreeBufferObject()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_bufferId != 0);
|
||||
GL_CALL(glDeleteBuffers(1, &m_bufferId));
|
||||
|
||||
|
@ -88,7 +80,6 @@ void BufferObject::FreeBufferObject()
|
|||
|
||||
void BufferObject::Update()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsClientSideBuffer() == FALSE);
|
||||
ASSERT(IsDirty() == TRUE);
|
||||
ASSERT(GetNumElements() > 0);
|
||||
|
@ -142,7 +133,6 @@ void BufferObject::Update()
|
|||
|
||||
void BufferObject::SizeBufferObject()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsClientSideBuffer() == FALSE);
|
||||
ASSERT(GetNumElements() > 0);
|
||||
ASSERT(GetElementWidthInBytes() > 0);
|
||||
|
@ -175,11 +165,9 @@ void BufferObject::SizeBufferObject()
|
|||
|
||||
void BufferObject::OnNewContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
RecreateOnGpu();
|
||||
}
|
||||
|
||||
void BufferObject::OnLostContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
|
|
@ -4,17 +4,14 @@
|
|||
|
||||
CustomSpriteShader::CustomSpriteShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
CustomSpriteShader::~CustomSpriteShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
BOOL CustomSpriteShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!SpriteShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource))
|
||||
return FALSE;
|
||||
|
||||
|
@ -27,7 +24,6 @@ BOOL CustomSpriteShader::Initialize(GraphicsDevice *graphicsDevice, const char *
|
|||
|
||||
BOOL CustomSpriteShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!SpriteShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource))
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -4,17 +4,14 @@
|
|||
|
||||
CustomStandardShader::CustomStandardShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
CustomStandardShader::~CustomStandardShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
BOOL CustomStandardShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!StandardShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource))
|
||||
return FALSE;
|
||||
|
||||
|
@ -26,7 +23,6 @@ BOOL CustomStandardShader::Initialize(GraphicsDevice *graphicsDevice, const char
|
|||
|
||||
BOOL CustomStandardShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!StandardShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource))
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -8,29 +8,24 @@
|
|||
CustomTextureAtlas::CustomTextureAtlas(uint16_t textureWidth, uint16_t textureHeight, float texCoordEdgeOffset)
|
||||
: TextureAtlas(textureWidth, textureHeight, texCoordEdgeOffset)
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
CustomTextureAtlas::CustomTextureAtlas(Texture *source, float texCoordEdgeOffset)
|
||||
: TextureAtlas(source, texCoordEdgeOffset)
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
CustomTextureAtlas::~CustomTextureAtlas()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
uint32_t CustomTextureAtlas::Add(const Rect &position)
|
||||
{
|
||||
STACK_TRACE;
|
||||
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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(right <= GetWidth());
|
||||
ASSERT(bottom <= GetHeight());
|
||||
ASSERT(left < right);
|
||||
|
@ -61,6 +56,5 @@ uint32_t CustomTextureAtlas::Add(uint16_t left, uint16_t top, uint16_t right, ui
|
|||
|
||||
void CustomTextureAtlas::Reset()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_tiles.clear();
|
||||
}
|
||||
|
|
|
@ -4,17 +4,14 @@
|
|||
|
||||
CustomVertexLerpShader::CustomVertexLerpShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
CustomVertexLerpShader::~CustomVertexLerpShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
BOOL CustomVertexLerpShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!VertexLerpShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource))
|
||||
return FALSE;
|
||||
|
||||
|
@ -27,7 +24,6 @@ BOOL CustomVertexLerpShader::Initialize(GraphicsDevice *graphicsDevice, const ch
|
|||
|
||||
BOOL CustomVertexLerpShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!VertexLerpShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource))
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -5,17 +5,14 @@
|
|||
|
||||
CustomVertexSkinningShader::CustomVertexSkinningShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
CustomVertexSkinningShader::~CustomVertexSkinningShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
BOOL CustomVertexSkinningShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!VertexSkinningShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource))
|
||||
return FALSE;
|
||||
|
||||
|
@ -29,7 +26,6 @@ BOOL CustomVertexSkinningShader::Initialize(GraphicsDevice *graphicsDevice, cons
|
|||
|
||||
BOOL CustomVertexSkinningShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!VertexSkinningShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource))
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -32,17 +32,14 @@ const char* DebugShader::m_fragmentShaderSource =
|
|||
|
||||
DebugShader::DebugShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
DebugShader::~DebugShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
BOOL DebugShader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!StandardShader::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
Framebuffer::Framebuffer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_viewContext = NULL;
|
||||
m_framebufferName = 0;
|
||||
m_fixedWidth = 0;
|
||||
|
@ -24,7 +23,6 @@ Framebuffer::Framebuffer()
|
|||
|
||||
BOOL Framebuffer::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_framebufferName == 0);
|
||||
if (m_framebufferName != 0)
|
||||
return FALSE;
|
||||
|
@ -43,7 +41,6 @@ BOOL Framebuffer::Initialize(GraphicsDevice *graphicsDevice)
|
|||
|
||||
BOOL Framebuffer::Initialize(GraphicsDevice *graphicsDevice, uint16_t fixedWidth, uint16_t fixedHeight)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(fixedWidth != 0);
|
||||
ASSERT(fixedHeight != 0);
|
||||
if (fixedWidth == 0 || fixedHeight == 0)
|
||||
|
@ -61,7 +58,6 @@ BOOL Framebuffer::Initialize(GraphicsDevice *graphicsDevice, uint16_t fixedWidth
|
|||
|
||||
void Framebuffer::Release()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_framebufferName != 0)
|
||||
{
|
||||
for (FramebufferRenderbufferMap::iterator i = m_renderbuffers.begin(); i != m_renderbuffers.end(); ++i)
|
||||
|
@ -98,14 +94,12 @@ void Framebuffer::Release()
|
|||
|
||||
void Framebuffer::CreateFramebuffer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_framebufferName == 0);
|
||||
GL_CALL(glGenFramebuffers(1, &m_framebufferName));
|
||||
}
|
||||
|
||||
BOOL Framebuffer::AttachViewContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_framebufferName != 0);
|
||||
if (m_framebufferName == 0)
|
||||
return FALSE;
|
||||
|
@ -131,7 +125,6 @@ BOOL Framebuffer::AttachViewContext()
|
|||
|
||||
BOOL Framebuffer::AttachTexture(FRAMEBUFFER_DATA_TYPE type)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_framebufferName != 0);
|
||||
if (m_framebufferName == 0)
|
||||
return FALSE;
|
||||
|
@ -204,7 +197,6 @@ BOOL Framebuffer::AttachTexture(FRAMEBUFFER_DATA_TYPE type)
|
|||
|
||||
BOOL Framebuffer::ReCreateAndAttach(FramebufferTextureMap::iterator &itor, BOOL releaseFirst)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Texture *existing = itor->second;
|
||||
|
||||
// determine attachment type
|
||||
|
@ -243,7 +235,6 @@ BOOL Framebuffer::ReCreateAndAttach(FramebufferTextureMap::iterator &itor, BOOL
|
|||
|
||||
BOOL Framebuffer::AttachRenderbuffer(FRAMEBUFFER_DATA_TYPE type)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_framebufferName != 0);
|
||||
if (m_framebufferName == 0)
|
||||
return FALSE;
|
||||
|
@ -301,7 +292,6 @@ BOOL Framebuffer::AttachRenderbuffer(FRAMEBUFFER_DATA_TYPE type)
|
|||
|
||||
BOOL Framebuffer::ReCreateAndAttach(FramebufferRenderbufferMap::iterator &itor, BOOL releaseFirst)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Renderbuffer *existing = itor->second;
|
||||
|
||||
// determine framebuffer attachment type
|
||||
|
@ -341,7 +331,6 @@ BOOL Framebuffer::ReCreateAndAttach(FramebufferRenderbufferMap::iterator &itor,
|
|||
|
||||
BOOL Framebuffer::ReleaseViewContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_framebufferName != 0);
|
||||
if (m_framebufferName == 0)
|
||||
return FALSE;
|
||||
|
@ -360,7 +349,6 @@ BOOL Framebuffer::ReleaseViewContext()
|
|||
|
||||
BOOL Framebuffer::ReleaseTexture(FRAMEBUFFER_DATA_TYPE type)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_framebufferName != 0);
|
||||
if (m_framebufferName == 0)
|
||||
return FALSE;
|
||||
|
@ -404,7 +392,6 @@ BOOL Framebuffer::ReleaseTexture(FRAMEBUFFER_DATA_TYPE type)
|
|||
|
||||
BOOL Framebuffer::ReleaseRenderbuffer(FRAMEBUFFER_DATA_TYPE type)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_framebufferName != 0);
|
||||
if (m_framebufferName == 0)
|
||||
return FALSE;
|
||||
|
@ -448,7 +435,6 @@ BOOL Framebuffer::ReleaseRenderbuffer(FRAMEBUFFER_DATA_TYPE type)
|
|||
|
||||
Texture* Framebuffer::GetTexture(FRAMEBUFFER_DATA_TYPE type) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_framebufferName != 0);
|
||||
if (m_framebufferName == 0)
|
||||
return NULL;
|
||||
|
@ -474,7 +460,6 @@ Texture* Framebuffer::GetTexture(FRAMEBUFFER_DATA_TYPE type) const
|
|||
|
||||
Renderbuffer* Framebuffer::GetRenderbuffer(FRAMEBUFFER_DATA_TYPE type) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_framebufferName != 0);
|
||||
if (m_framebufferName == 0)
|
||||
return NULL;
|
||||
|
@ -500,7 +485,6 @@ Renderbuffer* Framebuffer::GetRenderbuffer(FRAMEBUFFER_DATA_TYPE type) const
|
|||
|
||||
void Framebuffer::OnNewContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_framebufferName == 0 && GetGraphicsDevice() != NULL)
|
||||
{
|
||||
// recreate the framebuffer
|
||||
|
@ -537,7 +521,6 @@ void Framebuffer::OnNewContext()
|
|||
|
||||
void Framebuffer::OnLostContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_framebufferName = 0;
|
||||
if (m_viewContext != NULL)
|
||||
m_viewContext->OnLostContext();
|
||||
|
@ -549,7 +532,6 @@ void Framebuffer::OnLostContext()
|
|||
|
||||
void Framebuffer::OnResize()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_framebufferName != 0 && GetGraphicsDevice() != NULL)
|
||||
{
|
||||
if (m_viewContext != NULL)
|
||||
|
@ -586,17 +568,14 @@ void Framebuffer::OnResize()
|
|||
|
||||
void Framebuffer::OnBind()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void Framebuffer::OnUnBind()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
BOOL Framebuffer::RemoveTexture(Texture *texture)
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (FramebufferTextureMap::iterator i = m_textures.begin(); i != m_textures.end(); ++i)
|
||||
{
|
||||
if (i->second == texture)
|
||||
|
@ -612,7 +591,6 @@ BOOL Framebuffer::RemoveTexture(Texture *texture)
|
|||
|
||||
BOOL Framebuffer::RemoveRenderbuffer(Renderbuffer *renderbuffer)
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (FramebufferRenderbufferMap::iterator i = m_renderbuffers.begin(); i != m_renderbuffers.end(); ++i)
|
||||
{
|
||||
if (i->second == renderbuffer)
|
||||
|
@ -628,7 +606,6 @@ BOOL Framebuffer::RemoveRenderbuffer(Renderbuffer *renderbuffer)
|
|||
|
||||
void Framebuffer::GetDimensionsForAttachment(uint16_t &width, uint16_t &height) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (IsUsingFixedDimensions())
|
||||
{
|
||||
width = m_fixedWidth;
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
GeometryDebugRenderer::GeometryDebugRenderer(GraphicsDevice *graphicsDevice, BOOL depthTesting)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_graphicsDevice = graphicsDevice;
|
||||
m_color1 = Color(1.0f, 1.0f, 0.0f);
|
||||
m_color2 = Color(1.0f, 0.0f, 0.0f);
|
||||
|
@ -43,21 +42,18 @@ GeometryDebugRenderer::GeometryDebugRenderer(GraphicsDevice *graphicsDevice, BOO
|
|||
|
||||
GeometryDebugRenderer::~GeometryDebugRenderer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(m_vertices);
|
||||
SAFE_DELETE(m_renderState);
|
||||
}
|
||||
|
||||
void GeometryDebugRenderer::Begin()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_currentVertex = 0;
|
||||
m_begunRendering = TRUE;
|
||||
}
|
||||
|
||||
void GeometryDebugRenderer::Render(const BoundingBox &box, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 24));
|
||||
|
||||
|
@ -115,14 +111,12 @@ void GeometryDebugRenderer::Render(const BoundingBox &box, const Color &color)
|
|||
|
||||
void GeometryDebugRenderer::Render(const Point3 &boxMin, const Point3 &boxMax, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
BoundingBox b((float)boxMin.x, (float)boxMin.y, (float)boxMin.z, (float)boxMax.x, (float)boxMax.y, (float)boxMax.z);
|
||||
Render(b, color);
|
||||
}
|
||||
|
||||
void GeometryDebugRenderer::Render(const BoundingSphere &sphere, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 615));
|
||||
|
||||
|
@ -184,7 +178,6 @@ void GeometryDebugRenderer::Render(const BoundingSphere &sphere, const Color &co
|
|||
|
||||
void GeometryDebugRenderer::Render(const Ray &ray, float length, const Color &color1, const Color &color2)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 2));
|
||||
|
||||
|
@ -200,7 +193,6 @@ void GeometryDebugRenderer::Render(const Ray &ray, float length, const Color &co
|
|||
|
||||
void GeometryDebugRenderer::Render(const LineSegment &line, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 2));
|
||||
|
||||
|
@ -214,7 +206,6 @@ void GeometryDebugRenderer::Render(const LineSegment &line, const Color &color)
|
|||
|
||||
void GeometryDebugRenderer::Render(const Vector3 &a, const Vector3 &b, const Vector3 &c, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 6));
|
||||
|
||||
|
@ -236,7 +227,6 @@ void GeometryDebugRenderer::Render(const Vector3 &a, const Vector3 &b, const Vec
|
|||
|
||||
void GeometryDebugRenderer::End()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
|
||||
if (m_currentVertex > 0)
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
BOOL IsGLExtensionPresent(const char* extension)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(extension != NULL);
|
||||
ASSERT(strlen(extension) > 0);
|
||||
|
||||
|
|
|
@ -5,13 +5,11 @@
|
|||
|
||||
GraphicsContextResource::GraphicsContextResource()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_graphicsDevice = NULL;
|
||||
}
|
||||
|
||||
void GraphicsContextResource::Release()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_graphicsDevice != NULL)
|
||||
m_graphicsDevice->UnregisterManagedResource(this);
|
||||
|
||||
|
@ -20,7 +18,6 @@ void GraphicsContextResource::Release()
|
|||
|
||||
BOOL GraphicsContextResource::Initialize()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_graphicsDevice == NULL);
|
||||
if (m_graphicsDevice != NULL)
|
||||
return FALSE;
|
||||
|
@ -30,7 +27,6 @@ BOOL GraphicsContextResource::Initialize()
|
|||
|
||||
BOOL GraphicsContextResource::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_graphicsDevice == NULL);
|
||||
if (m_graphicsDevice != NULL)
|
||||
return FALSE;
|
||||
|
|
|
@ -44,7 +44,6 @@ const unsigned int MAX_GPU_ATTRIB_SLOTS = 8;
|
|||
|
||||
GraphicsDevice::GraphicsDevice()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_hasNewContextRunYet = FALSE;
|
||||
m_boundVertexBuffer = NULL;
|
||||
m_boundIndexBuffer = NULL;
|
||||
|
@ -72,7 +71,6 @@ GraphicsDevice::GraphicsDevice()
|
|||
|
||||
BOOL GraphicsDevice::Initialize(GameWindow *window)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_window == NULL);
|
||||
if (m_window != NULL)
|
||||
return FALSE;
|
||||
|
@ -113,7 +111,6 @@ BOOL GraphicsDevice::Initialize(GameWindow *window)
|
|||
|
||||
void GraphicsDevice::Release()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(m_defaultViewContext);
|
||||
SAFE_DELETE(m_debugRenderer);
|
||||
SAFE_DELETE(m_solidColorTextures);
|
||||
|
@ -144,7 +141,6 @@ void GraphicsDevice::Release()
|
|||
|
||||
SimpleColorShader* GraphicsDevice::GetSimpleColorShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_simpleColorShader == NULL)
|
||||
{
|
||||
m_simpleColorShader = new SimpleColorShader();
|
||||
|
@ -156,7 +152,6 @@ SimpleColorShader* GraphicsDevice::GetSimpleColorShader()
|
|||
|
||||
SimpleColorTextureShader* GraphicsDevice::GetSimpleColorTextureShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_simpleColorTextureShader == NULL)
|
||||
{
|
||||
m_simpleColorTextureShader = new SimpleColorTextureShader();
|
||||
|
@ -168,7 +163,6 @@ SimpleColorTextureShader* GraphicsDevice::GetSimpleColorTextureShader()
|
|||
|
||||
SimpleTextureShader* GraphicsDevice::GetSimpleTextureShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_simpleTextureShader == NULL)
|
||||
{
|
||||
m_simpleTextureShader = new SimpleTextureShader();
|
||||
|
@ -180,7 +174,6 @@ SimpleTextureShader* GraphicsDevice::GetSimpleTextureShader()
|
|||
|
||||
Sprite2DShader* GraphicsDevice::GetSprite2DShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_sprite2dShader == NULL)
|
||||
{
|
||||
m_sprite2dShader = new Sprite2DShader();
|
||||
|
@ -192,7 +185,6 @@ Sprite2DShader* GraphicsDevice::GetSprite2DShader()
|
|||
|
||||
Sprite3DShader* GraphicsDevice::GetSprite3DShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_sprite3dShader == NULL)
|
||||
{
|
||||
m_sprite3dShader = new Sprite3DShader();
|
||||
|
@ -204,7 +196,6 @@ Sprite3DShader* GraphicsDevice::GetSprite3DShader()
|
|||
|
||||
SimpleTextureVertexLerpShader* GraphicsDevice::GetSimpleTextureVertexLerpShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_simpleTextureVertexLerpShader == NULL)
|
||||
{
|
||||
m_simpleTextureVertexLerpShader = new SimpleTextureVertexLerpShader();
|
||||
|
@ -216,7 +207,6 @@ SimpleTextureVertexLerpShader* GraphicsDevice::GetSimpleTextureVertexLerpShader(
|
|||
|
||||
SimpleTextureVertexSkinningShader* GraphicsDevice::GetSimpleTextureVertexSkinningShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_simpleTextureVertexSkinningShader == NULL)
|
||||
{
|
||||
m_simpleTextureVertexSkinningShader = new SimpleTextureVertexSkinningShader();
|
||||
|
@ -228,7 +218,6 @@ SimpleTextureVertexSkinningShader* GraphicsDevice::GetSimpleTextureVertexSkinnin
|
|||
|
||||
DebugShader* GraphicsDevice::GetDebugShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_debugShader == NULL)
|
||||
{
|
||||
m_debugShader = new DebugShader();
|
||||
|
@ -240,7 +229,6 @@ DebugShader* GraphicsDevice::GetDebugShader()
|
|||
|
||||
void GraphicsDevice::OnNewContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_GRAPHICS, "Initializing default state for new OpenGL context.\n");
|
||||
|
||||
m_activeViewContext->OnNewContext();
|
||||
|
@ -273,7 +261,6 @@ void GraphicsDevice::OnNewContext()
|
|||
|
||||
void GraphicsDevice::OnLostContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_GRAPHICS, "Cleaning up objects/state specific to the lost OpenGL context.\n");
|
||||
|
||||
m_activeViewContext->OnLostContext();
|
||||
|
@ -288,8 +275,6 @@ void GraphicsDevice::OnLostContext()
|
|||
|
||||
void GraphicsDevice::OnResize(const Rect &size)
|
||||
{
|
||||
STACK_TRACE;
|
||||
|
||||
LOG_INFO(LOGCAT_GRAPHICS, "Window resized (%d, %d) - (%d, %d).\n", size.left, size.top, size.GetWidth(), size.GetHeight());
|
||||
if (m_window->GetScreenOrientation() != SCREEN_ANGLE_0)
|
||||
LOG_INFO(LOGCAT_GRAPHICS, "Screen is rotated (angle = %d).\n", (int)m_window->GetScreenOrientation());
|
||||
|
@ -298,7 +283,6 @@ void GraphicsDevice::OnResize(const Rect &size)
|
|||
|
||||
void GraphicsDevice::OnRender()
|
||||
{
|
||||
STACK_TRACE;
|
||||
GLenum error = glGetError();
|
||||
ASSERT(error == GL_NO_ERROR);
|
||||
if (error != GL_NO_ERROR)
|
||||
|
@ -315,26 +299,22 @@ void GraphicsDevice::OnRender()
|
|||
|
||||
void GraphicsDevice::Clear(float r, float g, float b, float a)
|
||||
{
|
||||
STACK_TRACE;
|
||||
GL_CALL(glClearColor(r, g, b, a));
|
||||
GL_CALL(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
|
||||
}
|
||||
|
||||
void GraphicsDevice::Clear(const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Clear(color.r, color.g, color.b, color.a);
|
||||
}
|
||||
|
||||
Texture* GraphicsDevice::GetSolidColorTexture(const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
return m_solidColorTextures->Get(color);
|
||||
}
|
||||
|
||||
void GraphicsDevice::BindTexture(const Texture *texture, uint32_t unit)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(unit < MAX_BOUND_TEXTURES);
|
||||
ASSERT(texture != NULL);
|
||||
ASSERT(texture->IsInvalidated() == FALSE);
|
||||
|
@ -348,14 +328,12 @@ void GraphicsDevice::BindTexture(const Texture *texture, uint32_t unit)
|
|||
|
||||
void GraphicsDevice::BindSolidColorTexture(const Color &color, uint32_t unit)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Texture *texture = m_solidColorTextures->Get(color);
|
||||
BindTexture(texture, unit);
|
||||
}
|
||||
|
||||
void GraphicsDevice::UnbindTexture(uint32_t unit)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(unit < MAX_BOUND_TEXTURES);
|
||||
GL_CALL(glActiveTexture(GL_TEXTURE0 + unit));
|
||||
GL_CALL(glBindTexture(GL_TEXTURE_2D, 0));
|
||||
|
@ -364,7 +342,6 @@ void GraphicsDevice::UnbindTexture(uint32_t unit)
|
|||
|
||||
void GraphicsDevice::UnbindTexture(const Texture *texture)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(texture != NULL);
|
||||
if (texture == NULL)
|
||||
return;
|
||||
|
@ -378,7 +355,6 @@ void GraphicsDevice::UnbindTexture(const Texture *texture)
|
|||
|
||||
void GraphicsDevice::BindRenderbuffer(Renderbuffer *renderbuffer)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(renderbuffer != NULL);
|
||||
ASSERT(renderbuffer->IsInvalidated() == FALSE);
|
||||
if (m_boundRenderbuffer != renderbuffer)
|
||||
|
@ -390,14 +366,12 @@ void GraphicsDevice::BindRenderbuffer(Renderbuffer *renderbuffer)
|
|||
|
||||
void GraphicsDevice::UnbindRenderbuffer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
GL_CALL(glBindRenderbuffer(GL_RENDERBUFFER, 0));
|
||||
m_boundRenderbuffer = NULL;
|
||||
}
|
||||
|
||||
void GraphicsDevice::UnbindRenderBuffer(Renderbuffer *renderBuffer)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(renderBuffer != NULL);
|
||||
if (renderBuffer == NULL)
|
||||
return;
|
||||
|
@ -408,7 +382,6 @@ void GraphicsDevice::UnbindRenderBuffer(Renderbuffer *renderBuffer)
|
|||
|
||||
void GraphicsDevice::BindFramebuffer(Framebuffer *framebuffer)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(framebuffer != NULL);
|
||||
ASSERT(framebuffer->IsInvalidated() == FALSE);
|
||||
if (m_boundFramebuffer != framebuffer)
|
||||
|
@ -421,7 +394,6 @@ void GraphicsDevice::BindFramebuffer(Framebuffer *framebuffer)
|
|||
|
||||
void GraphicsDevice::UnbindFramebuffer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
GL_CALL(glBindFramebuffer(GL_FRAMEBUFFER, 0));
|
||||
if (m_boundFramebuffer != NULL)
|
||||
m_boundFramebuffer->OnUnBind();
|
||||
|
@ -430,7 +402,6 @@ void GraphicsDevice::UnbindFramebuffer()
|
|||
|
||||
void GraphicsDevice::UnbindFramebuffer(Framebuffer *framebuffer)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(framebuffer != NULL);
|
||||
if (framebuffer == NULL)
|
||||
return;
|
||||
|
@ -441,7 +412,6 @@ void GraphicsDevice::UnbindFramebuffer(Framebuffer *framebuffer)
|
|||
|
||||
void GraphicsDevice::SetViewContext(ViewContext *viewContext)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (viewContext == m_activeViewContext)
|
||||
return; // nothing has changed
|
||||
|
||||
|
@ -455,7 +425,6 @@ void GraphicsDevice::SetViewContext(ViewContext *viewContext)
|
|||
|
||||
void GraphicsDevice::RegisterManagedResource(GraphicsContextResource *resource)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(resource != NULL);
|
||||
|
||||
// make sure this resource isn't in our list already
|
||||
|
@ -472,20 +441,17 @@ void GraphicsDevice::RegisterManagedResource(GraphicsContextResource *resource)
|
|||
|
||||
void GraphicsDevice::UnregisterManagedResource(GraphicsContextResource *resource)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(resource != NULL);
|
||||
m_managedResources.remove(resource);
|
||||
}
|
||||
|
||||
void GraphicsDevice::UnregisterAllManagedResources()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_managedResources.clear();
|
||||
}
|
||||
|
||||
void GraphicsDevice::BindVertexBuffer(VertexBuffer *buffer)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(buffer != NULL);
|
||||
ASSERT(buffer->GetNumElements() > 0);
|
||||
|
||||
|
@ -505,7 +471,6 @@ void GraphicsDevice::BindVertexBuffer(VertexBuffer *buffer)
|
|||
|
||||
void GraphicsDevice::UnbindVertexBuffer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
GL_CALL(glBindBuffer(GL_ARRAY_BUFFER, 0));
|
||||
|
||||
m_boundVertexBuffer = NULL;
|
||||
|
@ -515,7 +480,6 @@ void GraphicsDevice::UnbindVertexBuffer()
|
|||
|
||||
void GraphicsDevice::BindIndexBuffer(IndexBuffer *buffer)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(buffer != NULL);
|
||||
ASSERT(buffer->GetNumElements() > 0);
|
||||
|
||||
|
@ -533,7 +497,6 @@ void GraphicsDevice::BindIndexBuffer(IndexBuffer *buffer)
|
|||
|
||||
void GraphicsDevice::UnbindIndexBuffer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
GL_CALL(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
|
||||
|
||||
m_boundIndexBuffer = NULL;
|
||||
|
@ -541,7 +504,6 @@ void GraphicsDevice::UnbindIndexBuffer()
|
|||
|
||||
void GraphicsDevice::BindShader(Shader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(shader != NULL);
|
||||
ASSERT(shader->IsReadyForUse() == TRUE);
|
||||
GL_CALL(glUseProgram(shader->GetProgramId()));
|
||||
|
@ -555,7 +517,6 @@ void GraphicsDevice::BindShader(Shader *shader)
|
|||
|
||||
void GraphicsDevice::UnbindShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
GL_CALL(glUseProgram(0));
|
||||
|
||||
if (m_boundShader != NULL)
|
||||
|
@ -568,7 +529,6 @@ void GraphicsDevice::UnbindShader()
|
|||
|
||||
void GraphicsDevice::BindVBO(VertexBuffer *buffer)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (buffer->IsDirty())
|
||||
buffer->Update();
|
||||
|
||||
|
@ -577,13 +537,11 @@ void GraphicsDevice::BindVBO(VertexBuffer *buffer)
|
|||
|
||||
void GraphicsDevice::BindClientBuffer(VertexBuffer *buffer)
|
||||
{
|
||||
STACK_TRACE;
|
||||
GL_CALL(glBindBuffer(GL_ARRAY_BUFFER, 0));
|
||||
}
|
||||
|
||||
void GraphicsDevice::BindIBO(IndexBuffer *buffer)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (buffer->IsDirty())
|
||||
buffer->Update();
|
||||
|
||||
|
@ -592,13 +550,11 @@ void GraphicsDevice::BindIBO(IndexBuffer *buffer)
|
|||
|
||||
void GraphicsDevice::BindClientBuffer(IndexBuffer *buffer)
|
||||
{
|
||||
STACK_TRACE;
|
||||
GL_CALL(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
|
||||
}
|
||||
|
||||
void GraphicsDevice::SetShaderVertexAttributes()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_boundVertexBuffer != NULL);
|
||||
ASSERT(m_boundShader != NULL);
|
||||
ASSERT(m_enabledVertexAttribIndices.empty() == TRUE);
|
||||
|
@ -647,7 +603,6 @@ void GraphicsDevice::SetShaderVertexAttributes()
|
|||
|
||||
void GraphicsDevice::ClearSetShaderVertexAttributes()
|
||||
{
|
||||
STACK_TRACE;
|
||||
while (!m_enabledVertexAttribIndices.empty())
|
||||
{
|
||||
uint32_t index = m_enabledVertexAttribIndices.back();
|
||||
|
@ -660,7 +615,6 @@ void GraphicsDevice::ClearSetShaderVertexAttributes()
|
|||
|
||||
void GraphicsDevice::RenderTriangles(const IndexBuffer *buffer)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(buffer != NULL);
|
||||
ASSERT(buffer->IsClientSideBuffer() == TRUE);
|
||||
ASSERT(m_boundVertexBuffer != NULL);
|
||||
|
@ -674,7 +628,6 @@ void GraphicsDevice::RenderTriangles(const IndexBuffer *buffer)
|
|||
|
||||
void GraphicsDevice::RenderTriangles()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_boundVertexBuffer != NULL);
|
||||
if (!m_shaderVertexAttribsSet)
|
||||
SetShaderVertexAttributes();
|
||||
|
@ -706,7 +659,6 @@ void GraphicsDevice::RenderTriangles()
|
|||
|
||||
void GraphicsDevice::RenderTriangles(uint32_t startVertex, uint32_t numTriangles)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_boundVertexBuffer != NULL);
|
||||
if (!m_shaderVertexAttribsSet)
|
||||
SetShaderVertexAttributes();
|
||||
|
@ -739,7 +691,6 @@ void GraphicsDevice::RenderTriangles(uint32_t startVertex, uint32_t numTriangles
|
|||
|
||||
void GraphicsDevice::RenderLines(const IndexBuffer *buffer)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(buffer != NULL);
|
||||
ASSERT(buffer->IsClientSideBuffer() == TRUE);
|
||||
ASSERT(m_boundVertexBuffer != NULL);
|
||||
|
@ -753,7 +704,6 @@ void GraphicsDevice::RenderLines(const IndexBuffer *buffer)
|
|||
|
||||
void GraphicsDevice::RenderLines()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_boundVertexBuffer != NULL);
|
||||
if (!m_shaderVertexAttribsSet)
|
||||
SetShaderVertexAttributes();
|
||||
|
@ -785,7 +735,6 @@ void GraphicsDevice::RenderLines()
|
|||
|
||||
void GraphicsDevice::RenderLines(uint32_t startVertex, uint32_t numLines)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_boundVertexBuffer != NULL);
|
||||
if (!m_shaderVertexAttribsSet)
|
||||
SetShaderVertexAttributes();
|
||||
|
@ -818,7 +767,6 @@ void GraphicsDevice::RenderLines(uint32_t startVertex, uint32_t numLines)
|
|||
|
||||
void GraphicsDevice::RenderPoints(const IndexBuffer *buffer)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(buffer != NULL);
|
||||
ASSERT(buffer->IsClientSideBuffer() == TRUE);
|
||||
ASSERT(m_boundVertexBuffer != NULL);
|
||||
|
@ -831,7 +779,6 @@ void GraphicsDevice::RenderPoints(const IndexBuffer *buffer)
|
|||
|
||||
void GraphicsDevice::RenderPoints()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_boundVertexBuffer != NULL);
|
||||
if (!m_shaderVertexAttribsSet)
|
||||
SetShaderVertexAttributes();
|
||||
|
@ -861,7 +808,6 @@ void GraphicsDevice::RenderPoints()
|
|||
|
||||
void GraphicsDevice::RenderPoints(uint32_t startVertex, uint32_t numPoints)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_boundVertexBuffer != NULL);
|
||||
if (!m_shaderVertexAttribsSet)
|
||||
SetShaderVertexAttributes();
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#include "../debug.h"
|
||||
|
||||
#include "gridtextureatlas.h"
|
||||
|
||||
#include "texture.h"
|
||||
|
@ -7,25 +5,21 @@
|
|||
GridTextureAtlas::GridTextureAtlas(uint16_t textureWidth, uint16_t textureHeight, uint16_t tileWidth, uint16_t tileHeight, uint16_t tileBorder, float texCoordEdgeOffset)
|
||||
: TextureAtlas(textureWidth, textureHeight, texCoordEdgeOffset)
|
||||
{
|
||||
STACK_TRACE;
|
||||
GenerateGrid(tileWidth, tileHeight, tileBorder);
|
||||
}
|
||||
|
||||
GridTextureAtlas::GridTextureAtlas(Texture *source, uint16_t tileWidth, uint16_t tileHeight, uint16_t tileBorder, float texCoordEdgeOffset)
|
||||
: TextureAtlas(source, texCoordEdgeOffset)
|
||||
{
|
||||
STACK_TRACE;
|
||||
GenerateGrid(tileWidth, tileHeight, tileBorder);
|
||||
}
|
||||
|
||||
GridTextureAtlas::~GridTextureAtlas()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void GridTextureAtlas::GenerateGrid(uint16_t tileWidth, uint16_t tileHeight, uint16_t tileBorder)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_tileWidth = tileWidth;
|
||||
m_tileHeight = tileHeight;
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
Image::Image()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_pixels = NULL;
|
||||
m_width = 0;
|
||||
m_height = 0;
|
||||
|
@ -24,7 +23,6 @@ Image::Image()
|
|||
|
||||
void Image::Release()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(m_pixels);
|
||||
m_width = 0;
|
||||
m_height = 0;
|
||||
|
@ -36,7 +34,6 @@ void Image::Release()
|
|||
|
||||
BOOL Image::Create(uint16_t width, uint16_t height, IMAGE_FORMAT format)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_pixels == NULL);
|
||||
if (m_pixels != NULL)
|
||||
return FALSE;
|
||||
|
@ -73,7 +70,6 @@ BOOL Image::Create(uint16_t width, uint16_t height, IMAGE_FORMAT format)
|
|||
|
||||
BOOL Image::Create(const Image *source)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(source != NULL);
|
||||
if (source == NULL)
|
||||
return FALSE;
|
||||
|
@ -83,7 +79,6 @@ BOOL Image::Create(const Image *source)
|
|||
|
||||
BOOL Image::Create(const Image *source, uint16_t x, uint16_t y, uint16_t width, uint16_t height)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_pixels == NULL);
|
||||
if (m_pixels != NULL)
|
||||
return FALSE;
|
||||
|
@ -112,7 +107,6 @@ BOOL Image::Create(const Image *source, uint16_t x, uint16_t y, uint16_t width,
|
|||
|
||||
BOOL Image::Create(File *file)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_pixels == NULL);
|
||||
if (m_pixels != NULL)
|
||||
return FALSE;
|
||||
|
@ -195,7 +189,6 @@ BOOL Image::Create(File *file)
|
|||
|
||||
Color Image::GetColor(uint16_t x, uint16_t y) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_format == IMAGE_FORMAT_RGB || m_format == IMAGE_FORMAT_RGBA);
|
||||
|
||||
if (m_format == IMAGE_FORMAT_RGB)
|
||||
|
@ -212,7 +205,6 @@ Color Image::GetColor(uint16_t x, uint16_t y) const
|
|||
|
||||
void Image::SetColor(uint16_t x, uint16_t y, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_format == IMAGE_FORMAT_RGB || m_format == IMAGE_FORMAT_RGBA);
|
||||
|
||||
if (m_format == IMAGE_FORMAT_RGB)
|
||||
|
@ -230,14 +222,12 @@ void Image::SetColor(uint16_t x, uint16_t y, const Color &color)
|
|||
|
||||
void Image::Copy(const Image *source, uint16_t destX, uint16_t destY)
|
||||
{
|
||||
STACK_TRACE;
|
||||
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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(source != NULL);
|
||||
if (source == NULL)
|
||||
return;
|
||||
|
@ -264,13 +254,11 @@ void Image::Copy(const Image *source, uint16_t x, uint16_t y, uint16_t width, ui
|
|||
|
||||
void Image::Clear()
|
||||
{
|
||||
STACK_TRACE;
|
||||
memset(m_pixels, 0, GetSizeInBytes());
|
||||
}
|
||||
|
||||
void Image::Clear(const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_format == IMAGE_FORMAT_RGB || m_format == IMAGE_FORMAT_RGBA);
|
||||
|
||||
uint32_t sizeInBytes = GetSizeInBytes();
|
||||
|
@ -299,20 +287,17 @@ void Image::Clear(const Color &color)
|
|||
|
||||
void Image::Clear(const uint32_t color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Clear(Color::FromInt(color));
|
||||
}
|
||||
|
||||
void Image::Clear(const uint8_t alpha)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_format == IMAGE_FORMAT_ALPHA);
|
||||
memset(m_pixels, alpha, GetSizeInBytes());
|
||||
}
|
||||
|
||||
void Image::FlipVertically()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_pixels != NULL);
|
||||
if (m_pixels == NULL)
|
||||
return;
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
IndexBuffer::IndexBuffer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_currentIndex = 0;
|
||||
}
|
||||
|
||||
|
@ -21,13 +20,11 @@ void IndexBuffer::Release()
|
|||
|
||||
BOOL IndexBuffer::Initialize(uint32_t numIndices, BUFFEROBJECT_USAGE usage)
|
||||
{
|
||||
STACK_TRACE;
|
||||
return Initialize(NULL, numIndices, usage);
|
||||
}
|
||||
|
||||
BOOL IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, uint32_t numIndices, BUFFEROBJECT_USAGE usage)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_buffer.size() == 0);
|
||||
if (m_buffer.size() > 0)
|
||||
return FALSE;
|
||||
|
@ -46,13 +43,11 @@ BOOL IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, uint32_t numIndices
|
|||
|
||||
BOOL IndexBuffer::Initialize(const IndexBuffer *source)
|
||||
{
|
||||
STACK_TRACE;
|
||||
return Initialize(NULL, source);
|
||||
}
|
||||
|
||||
BOOL IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, const IndexBuffer *source)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_buffer.size() == 0);
|
||||
if (m_buffer.size() > 0)
|
||||
return FALSE;
|
||||
|
@ -74,13 +69,11 @@ BOOL IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, const IndexBuffer *
|
|||
|
||||
void IndexBuffer::Set(const uint16_t *indices, uint32_t numIndices)
|
||||
{
|
||||
STACK_TRACE;
|
||||
memcpy(&m_buffer[0], indices, GetNumElements() * GetElementWidthInBytes());
|
||||
}
|
||||
|
||||
void IndexBuffer::Resize(uint32_t numIndices)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(numIndices > 0);
|
||||
if (numIndices == 0)
|
||||
return;
|
||||
|
@ -96,7 +89,6 @@ void IndexBuffer::Resize(uint32_t numIndices)
|
|||
|
||||
void IndexBuffer::Extend(uint32_t amount)
|
||||
{
|
||||
STACK_TRACE;
|
||||
uint32_t newSize = GetNumElements() + amount;
|
||||
Resize(newSize);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
Renderbuffer::Renderbuffer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_renderbufferName = 0;
|
||||
m_width = 0;
|
||||
m_height = 0;
|
||||
|
@ -18,7 +17,6 @@ Renderbuffer::Renderbuffer()
|
|||
|
||||
BOOL Renderbuffer::Initialize(GraphicsDevice *graphicsDevice, uint16_t width, uint16_t height, FRAMEBUFFER_DATA_TYPE type)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_renderbufferName == 0);
|
||||
if (m_renderbufferName != 0)
|
||||
return FALSE;
|
||||
|
@ -43,7 +41,6 @@ BOOL Renderbuffer::Initialize(GraphicsDevice *graphicsDevice, uint16_t width, ui
|
|||
|
||||
void Renderbuffer::Release()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_renderbufferName != 0)
|
||||
{
|
||||
GetGraphicsDevice()->UnbindRenderBuffer(this);
|
||||
|
@ -59,7 +56,6 @@ void Renderbuffer::Release()
|
|||
|
||||
BOOL Renderbuffer::CreateRenderbuffer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_renderbufferName == 0);
|
||||
|
||||
uint32_t format = 0;
|
||||
|
@ -117,7 +113,6 @@ BOOL Renderbuffer::CreateRenderbuffer()
|
|||
|
||||
void Renderbuffer::OnNewContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_renderbufferName == 0 && GetGraphicsDevice() != NULL)
|
||||
{
|
||||
BOOL success = CreateRenderbuffer();
|
||||
|
@ -127,6 +122,5 @@ void Renderbuffer::OnNewContext()
|
|||
|
||||
void Renderbuffer::OnLostContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_renderbufferName = 0;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#include "../debug.h"
|
||||
|
||||
#include "renderstate.h"
|
||||
|
||||
#include "glincludes.h"
|
||||
|
@ -7,18 +5,15 @@
|
|||
|
||||
RenderState::RenderState()
|
||||
{
|
||||
STACK_TRACE;
|
||||
Initialize();
|
||||
}
|
||||
|
||||
RenderState::~RenderState()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void RenderState::Initialize()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_depthTesting = TRUE;
|
||||
m_depthFunction = DEPTH_LESS;
|
||||
m_faceCulling = TRUE;
|
||||
|
@ -28,7 +23,6 @@ void RenderState::Initialize()
|
|||
|
||||
void RenderState::Apply() const
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_depthTesting)
|
||||
{
|
||||
GL_CALL(glEnable(GL_DEPTH_TEST));
|
||||
|
@ -46,7 +40,6 @@ void RenderState::Apply() const
|
|||
|
||||
void RenderState::SetFaceCulling() const
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_faceCulling)
|
||||
{
|
||||
GL_CALL(glEnable(GL_CULL_FACE));
|
||||
|
|
|
@ -32,7 +32,6 @@ STATIC_ASSERT(sizeof(Point3) == 3 * sizeof(int32_t));
|
|||
|
||||
Shader::Shader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_isBound = FALSE;
|
||||
m_cachedVertexShaderSource = NULL;
|
||||
m_cachedFragmentShaderSource = NULL;
|
||||
|
@ -48,7 +47,6 @@ Shader::Shader()
|
|||
|
||||
BOOL Shader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!GraphicsContextResource::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
|
||||
|
@ -57,7 +55,6 @@ BOOL Shader::Initialize(GraphicsDevice *graphicsDevice)
|
|||
|
||||
BOOL Shader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!GraphicsContextResource::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
|
||||
|
@ -79,7 +76,6 @@ BOOL Shader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShader
|
|||
|
||||
BOOL Shader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(vertexShaderSource != NULL && vertexShaderSource->GetLength() > 0);
|
||||
if (vertexShaderSource == NULL || vertexShaderSource->GetLength() == 0)
|
||||
return FALSE;
|
||||
|
@ -93,7 +89,6 @@ BOOL Shader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShader
|
|||
|
||||
void Shader::Release()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_vertexShaderId)
|
||||
{
|
||||
GL_CALL(glDeleteShader(m_vertexShaderId));
|
||||
|
@ -143,7 +138,6 @@ void Shader::Release()
|
|||
|
||||
BOOL Shader::LoadCompileAndLink(const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
{
|
||||
STACK_TRACE;
|
||||
const char *vertexShaderToLoad = vertexShaderSource;
|
||||
const char *fragmentShaderToLoad = fragmentShaderSource;
|
||||
|
||||
|
@ -171,7 +165,6 @@ BOOL Shader::LoadCompileAndLink(const char *vertexShaderSource, const char *frag
|
|||
|
||||
BOOL Shader::ReloadCompileAndLink(const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
{
|
||||
STACK_TRACE;
|
||||
// clear out data that will be reset during the reload first
|
||||
m_isBound = FALSE;
|
||||
m_vertexShaderCompileStatus = FALSE;
|
||||
|
@ -197,7 +190,6 @@ BOOL Shader::ReloadCompileAndLink(const char *vertexShaderSource, const char *fr
|
|||
|
||||
void Shader::CacheShaderSources(const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(vertexShaderSource != NULL);
|
||||
ASSERT(fragmentShaderSource != NULL);
|
||||
|
||||
|
@ -226,7 +218,6 @@ void Shader::CacheShaderSources(const char *vertexShaderSource, const char *frag
|
|||
|
||||
BOOL Shader::Compile(const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_vertexShaderId == 0);
|
||||
ASSERT(m_fragmentShaderId == 0);
|
||||
ASSERT(m_programId == 0);
|
||||
|
@ -308,7 +299,6 @@ BOOL Shader::Compile(const char *vertexShaderSource, const char *fragmentShaderS
|
|||
|
||||
BOOL Shader::Link()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_vertexShaderId != 0);
|
||||
ASSERT(m_fragmentShaderId != 0);
|
||||
ASSERT(m_programId == 0);
|
||||
|
@ -344,7 +334,6 @@ BOOL Shader::Link()
|
|||
|
||||
void Shader::LoadUniformInfo()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_programId != 0);
|
||||
|
||||
m_uniforms.clear();
|
||||
|
@ -396,7 +385,6 @@ void Shader::LoadUniformInfo()
|
|||
|
||||
void Shader::LoadAttributeInfo()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_programId != 0);
|
||||
|
||||
m_attributes.clear();
|
||||
|
@ -457,7 +445,6 @@ void Shader::LoadAttributeInfo()
|
|||
|
||||
BOOL Shader::HasUniform(const stl::string &name) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ShaderUniformMap::const_iterator i = m_uniforms.find(name);
|
||||
if (i == m_uniforms.end())
|
||||
return FALSE;
|
||||
|
@ -467,7 +454,6 @@ BOOL Shader::HasUniform(const stl::string &name) const
|
|||
|
||||
const ShaderUniform* Shader::GetUniform(const stl::string &name) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ShaderUniformMap::const_iterator i = m_uniforms.find(name);
|
||||
if (i == m_uniforms.end())
|
||||
return NULL;
|
||||
|
@ -477,7 +463,6 @@ const ShaderUniform* Shader::GetUniform(const stl::string &name) const
|
|||
|
||||
ShaderUniform* Shader::GetUniform(const stl::string &name)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ShaderUniformMap::iterator i = m_uniforms.find(name);
|
||||
if (i == m_uniforms.end())
|
||||
return NULL;
|
||||
|
@ -487,7 +472,6 @@ ShaderUniform* Shader::GetUniform(const stl::string &name)
|
|||
|
||||
BOOL Shader::HasAttribute(const stl::string &name) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ShaderAttributeMap::const_iterator i = m_attributes.find(name);
|
||||
if (i == m_attributes.end())
|
||||
return FALSE;
|
||||
|
@ -497,7 +481,6 @@ BOOL Shader::HasAttribute(const stl::string &name) const
|
|||
|
||||
const ShaderAttribute* Shader::GetAttribute(const stl::string &name) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ShaderAttributeMap::const_iterator i = m_attributes.find(name);
|
||||
if (i == m_attributes.end())
|
||||
return NULL;
|
||||
|
@ -507,7 +490,6 @@ const ShaderAttribute* Shader::GetAttribute(const stl::string &name) const
|
|||
|
||||
ShaderAttribute* Shader::GetAttribute(const stl::string &name)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ShaderAttributeMap::iterator i = m_attributes.find(name);
|
||||
if (i == m_attributes.end())
|
||||
return NULL;
|
||||
|
@ -517,13 +499,11 @@ ShaderAttribute* Shader::GetAttribute(const stl::string &name)
|
|||
|
||||
void Shader::CacheUniform(const stl::string &name, CachedShaderUniform uniform)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_cachedUniforms[name] = uniform;
|
||||
}
|
||||
|
||||
CachedShaderUniform* Shader::GetCachedUniform(const stl::string &name)
|
||||
{
|
||||
STACK_TRACE;
|
||||
CachedShaderUniformMap::iterator i = m_cachedUniforms.find(name);
|
||||
if (i == m_cachedUniforms.end())
|
||||
{
|
||||
|
@ -536,7 +516,6 @@ CachedShaderUniform* Shader::GetCachedUniform(const stl::string &name)
|
|||
|
||||
void Shader::FlushCachedUniforms()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_isBound == TRUE);
|
||||
if (m_cachedUniforms.empty())
|
||||
return;
|
||||
|
@ -570,7 +549,6 @@ void Shader::FlushCachedUniforms()
|
|||
|
||||
void Shader::SetUniform(const stl::string &name, float x)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
const ShaderUniform *uniform = GetUniform(name);
|
||||
|
@ -589,7 +567,6 @@ void Shader::SetUniform(const stl::string &name, float x)
|
|||
|
||||
void Shader::SetUniform(const stl::string &name, int32_t x)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
const ShaderUniform *uniform = GetUniform(name);
|
||||
|
@ -608,7 +585,6 @@ void Shader::SetUniform(const stl::string &name, int32_t x)
|
|||
|
||||
void Shader::SetUniform(const stl::string &name, float x, float y)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
const ShaderUniform *uniform = GetUniform(name);
|
||||
|
@ -628,7 +604,6 @@ void Shader::SetUniform(const stl::string &name, float x, float y)
|
|||
|
||||
void Shader::SetUniform(const stl::string &name, const Vector2 &v)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
const ShaderUniform *uniform = GetUniform(name);
|
||||
|
@ -648,7 +623,6 @@ void Shader::SetUniform(const stl::string &name, const Vector2 &v)
|
|||
|
||||
void Shader::SetUniform(const stl::string &name, int32_t x, int32_t y)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
const ShaderUniform *uniform = GetUniform(name);
|
||||
|
@ -668,7 +642,6 @@ void Shader::SetUniform(const stl::string &name, int32_t x, int32_t y)
|
|||
|
||||
void Shader::SetUniform(const stl::string &name, const Point2 &p)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
const ShaderUniform *uniform = GetUniform(name);
|
||||
|
@ -688,7 +661,6 @@ void Shader::SetUniform(const stl::string &name, const Point2 &p)
|
|||
|
||||
void Shader::SetUniform(const stl::string &name, float x, float y, float z)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
const ShaderUniform *uniform = GetUniform(name);
|
||||
|
@ -709,7 +681,6 @@ void Shader::SetUniform(const stl::string &name, float x, float y, float z)
|
|||
|
||||
void Shader::SetUniform(const stl::string &name, const Vector3 &v)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
const ShaderUniform *uniform = GetUniform(name);
|
||||
|
@ -730,7 +701,6 @@ 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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
const ShaderUniform *uniform = GetUniform(name);
|
||||
|
@ -751,7 +721,6 @@ void Shader::SetUniform(const stl::string &name, int32_t x, int32_t y, int32_t z
|
|||
|
||||
void Shader::SetUniform(const stl::string &name, const Point3 &p)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
const ShaderUniform *uniform = GetUniform(name);
|
||||
|
@ -772,7 +741,6 @@ void Shader::SetUniform(const stl::string &name, const Point3 &p)
|
|||
|
||||
void Shader::SetUniform(const stl::string &name, float x, float y, float z, float w)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
const ShaderUniform *uniform = GetUniform(name);
|
||||
|
@ -794,7 +762,6 @@ void Shader::SetUniform(const stl::string &name, float x, float y, float z, floa
|
|||
|
||||
void Shader::SetUniform(const stl::string &name, const Vector4 &v)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
const ShaderUniform *uniform = GetUniform(name);
|
||||
|
@ -816,7 +783,6 @@ void Shader::SetUniform(const stl::string &name, const Vector4 &v)
|
|||
|
||||
void Shader::SetUniform(const stl::string &name, const Quaternion &q)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
const ShaderUniform *uniform = GetUniform(name);
|
||||
|
@ -838,7 +804,6 @@ void Shader::SetUniform(const stl::string &name, const Quaternion &q)
|
|||
|
||||
void Shader::SetUniform(const stl::string &name, const Color &c)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
const ShaderUniform *uniform = GetUniform(name);
|
||||
|
@ -860,7 +825,6 @@ 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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
const ShaderUniform *uniform = GetUniform(name);
|
||||
|
@ -882,7 +846,6 @@ void Shader::SetUniform(const stl::string &name, int32_t x, int32_t y, int32_t z
|
|||
|
||||
void Shader::SetUniform(const stl::string &name, const Matrix3x3 &m)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
const ShaderUniform *uniform = GetUniform(name);
|
||||
|
@ -901,7 +864,6 @@ void Shader::SetUniform(const stl::string &name, const Matrix3x3 &m)
|
|||
|
||||
void Shader::SetUniform(const stl::string &name, const Matrix4x4 &m)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
const ShaderUniform *uniform = GetUniform(name);
|
||||
|
@ -920,7 +882,6 @@ void Shader::SetUniform(const stl::string &name, const Matrix4x4 &m)
|
|||
|
||||
void Shader::SetUniform(const stl::string &name, const float *x, uint32_t count)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
const ShaderUniform *uniform = GetUniform(name);
|
||||
|
@ -936,7 +897,6 @@ 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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
// TODO: erm... this _seems_ unnecessarily ugly... even for me
|
||||
|
@ -955,7 +915,6 @@ 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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
// TODO: erm... this _seems_ unnecessarily ugly... even for me
|
||||
|
@ -974,7 +933,6 @@ 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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
// TODO: erm... this _seems_ unnecessarily ugly... even for me
|
||||
|
@ -993,7 +951,6 @@ 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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
// TODO: erm... this _seems_ unnecessarily ugly... even for me
|
||||
|
@ -1013,7 +970,6 @@ 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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
// TODO: erm... this _seems_ unnecessarily ugly... even for me
|
||||
|
@ -1033,7 +989,6 @@ 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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
// TODO: erm... this _seems_ unnecessarily ugly... even for me
|
||||
|
@ -1053,7 +1008,6 @@ 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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isBound)
|
||||
{
|
||||
// TODO: erm... this _seems_ unnecessarily ugly... even for me
|
||||
|
@ -1073,7 +1027,6 @@ void Shader::SetUniform(const stl::string &name, const Matrix4x4 *m, uint32_t co
|
|||
|
||||
void Shader::MapAttributeToVboAttribIndex(const stl::string &name, uint32_t vboAttribIndex)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ShaderAttribute *attribute = GetAttribute(name);
|
||||
ASSERT(attribute != NULL);
|
||||
ASSERT(attribute->location < m_numAttributes);
|
||||
|
@ -1087,7 +1040,6 @@ void Shader::MapAttributeToVboAttribIndex(const stl::string &name, uint32_t vboA
|
|||
|
||||
void Shader::MapAttributeToStandardAttribType(const stl::string &name, VERTEX_STANDARD_ATTRIBS standardAttribType)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ShaderAttribute *attribute = GetAttribute(name);
|
||||
ASSERT(attribute != NULL);
|
||||
ASSERT(attribute->location < m_numAttributes);
|
||||
|
@ -1101,18 +1053,15 @@ void Shader::MapAttributeToStandardAttribType(const stl::string &name, VERTEX_ST
|
|||
|
||||
void Shader::OnNewContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ReloadCompileAndLink(NULL, NULL);
|
||||
}
|
||||
|
||||
void Shader::OnLostContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void Shader::OnBind()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_isBound == FALSE);
|
||||
m_isBound = TRUE;
|
||||
FlushCachedUniforms();
|
||||
|
@ -1120,7 +1069,6 @@ void Shader::OnBind()
|
|||
|
||||
void Shader::OnUnbind()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_isBound == TRUE);
|
||||
m_isBound = FALSE;
|
||||
m_cachedUniforms.clear();
|
||||
|
|
|
@ -31,17 +31,14 @@ const char* SimpleColorShader::m_fragmentShaderSource =
|
|||
|
||||
SimpleColorShader::SimpleColorShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
SimpleColorShader::~SimpleColorShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
BOOL SimpleColorShader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!StandardShader::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -36,17 +36,14 @@ const char* SimpleColorTextureShader::m_fragmentShaderSource =
|
|||
|
||||
SimpleColorTextureShader::SimpleColorTextureShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
SimpleColorTextureShader::~SimpleColorTextureShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
BOOL SimpleColorTextureShader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!StandardShader::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -31,17 +31,14 @@ const char* SimpleTextureShader::m_fragmentShaderSource =
|
|||
|
||||
SimpleTextureShader::SimpleTextureShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
SimpleTextureShader::~SimpleTextureShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
BOOL SimpleTextureShader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!StandardShader::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -32,17 +32,14 @@ const char* SimpleTextureVertexLerpShader::m_fragmentShaderSource =
|
|||
|
||||
SimpleTextureVertexLerpShader::SimpleTextureVertexLerpShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
SimpleTextureVertexLerpShader::~SimpleTextureVertexLerpShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
BOOL SimpleTextureVertexLerpShader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!VertexLerpShader::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -50,17 +50,14 @@ const char* SimpleTextureVertexSkinningShader::m_fragmentShaderSource =
|
|||
|
||||
SimpleTextureVertexSkinningShader::SimpleTextureVertexSkinningShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
SimpleTextureVertexSkinningShader::~SimpleTextureVertexSkinningShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
BOOL SimpleTextureVertexSkinningShader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!VertexSkinningShader::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -11,19 +11,16 @@
|
|||
|
||||
SolidColorTextureCache::SolidColorTextureCache(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_graphicsDevice = graphicsDevice;
|
||||
}
|
||||
|
||||
SolidColorTextureCache::~SolidColorTextureCache()
|
||||
{
|
||||
STACK_TRACE;
|
||||
FreeAll();
|
||||
}
|
||||
|
||||
void SolidColorTextureCache::OnNewContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_ASSETS, "SolidColorTextureCache: regenerating previous textures for new OpenGL context.\n");
|
||||
|
||||
for (ColorTextureMap::iterator itor = m_textures.begin(); itor != m_textures.end(); ++itor)
|
||||
|
@ -37,7 +34,6 @@ void SolidColorTextureCache::OnNewContext()
|
|||
|
||||
void SolidColorTextureCache::OnLostContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_ASSETS, "SolidColorTextureCache: resetting generated texture IDs due to lost OpenGL context.\n");
|
||||
|
||||
for (ColorTextureMap::iterator itor = m_textures.begin(); itor != m_textures.end(); ++itor)
|
||||
|
@ -46,7 +42,6 @@ void SolidColorTextureCache::OnLostContext()
|
|||
|
||||
Texture* SolidColorTextureCache::Get(const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Texture *texture;
|
||||
uint32_t colorInt = color.ToInt();
|
||||
|
||||
|
@ -65,7 +60,6 @@ Texture* SolidColorTextureCache::Get(const Color &color)
|
|||
|
||||
Texture* SolidColorTextureCache::CreateFor(const Color &color, Texture *existing)
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_ASSETS, "SolidColorTextureCache: creating texture for color 0x%8x.\n", color.ToInt());
|
||||
|
||||
Image *img = new Image();
|
||||
|
@ -99,7 +93,6 @@ Texture* SolidColorTextureCache::CreateFor(const Color &color, Texture *existing
|
|||
|
||||
void SolidColorTextureCache::FreeAll()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_ASSETS, "SolidColorTextureCache: freeing all generated textures.\n");
|
||||
for (ColorTextureMap::iterator itor = m_textures.begin(); itor != m_textures.end(); ++itor)
|
||||
{
|
||||
|
@ -108,4 +101,3 @@ void SolidColorTextureCache::FreeAll()
|
|||
|
||||
m_textures.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -42,17 +42,14 @@ const char* Sprite2DShader::m_fragmentShaderSource =
|
|||
|
||||
Sprite2DShader::Sprite2DShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
Sprite2DShader::~Sprite2DShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
BOOL Sprite2DShader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!SpriteShader::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -48,17 +48,14 @@ const char* Sprite3DShader::m_fragmentShaderSource =
|
|||
|
||||
Sprite3DShader::Sprite3DShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
Sprite3DShader::~Sprite3DShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
BOOL Sprite3DShader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!SpriteShader::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ char __spriteBatch_printfBuffer[PRINTF_BUFFER_SIZE + 1];
|
|||
|
||||
SpriteBatch::SpriteBatch(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_graphicsDevice = graphicsDevice;
|
||||
m_shader = NULL;
|
||||
|
||||
|
@ -67,7 +66,6 @@ SpriteBatch::SpriteBatch(GraphicsDevice *graphicsDevice)
|
|||
|
||||
SpriteBatch::~SpriteBatch()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(m_vertices);
|
||||
SAFE_DELETE(m_renderState);
|
||||
SAFE_DELETE(m_blendState);
|
||||
|
@ -75,7 +73,6 @@ SpriteBatch::~SpriteBatch()
|
|||
|
||||
void SpriteBatch::InternalBegin(const RenderState *renderState, const BlendState *blendState, SpriteShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == FALSE);
|
||||
|
||||
// keep these around for any 3d -> 2d coordinate projection we may need to do
|
||||
|
@ -114,59 +111,50 @@ void SpriteBatch::InternalBegin(const RenderState *renderState, const BlendState
|
|||
|
||||
void SpriteBatch::Begin(SpriteShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
InternalBegin(NULL, NULL, shader);
|
||||
}
|
||||
|
||||
void SpriteBatch::Begin(const RenderState &renderState, SpriteShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
InternalBegin(&renderState, NULL, shader);
|
||||
}
|
||||
|
||||
void SpriteBatch::Begin(const BlendState &blendState, SpriteShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
InternalBegin(NULL, &blendState, shader);
|
||||
}
|
||||
|
||||
void SpriteBatch::Begin(const RenderState &renderState, const BlendState &blendState, SpriteShader *shader)
|
||||
{
|
||||
STACK_TRACE;
|
||||
InternalBegin(&renderState, &blendState, shader);
|
||||
}
|
||||
|
||||
void SpriteBatch::Render(const Texture *texture, int16_t x, int16_t y, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
y = FixYCoord(y, height);
|
||||
AddSprite(texture, x, y, x + width, y + height, texCoordLeft, texCoordTop, texCoordRight, texCoordBottom, color);
|
||||
}
|
||||
|
||||
void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection);
|
||||
|
||||
screenCoordinates.x -= texture->GetWidth() / 2;
|
||||
|
@ -177,7 +165,6 @@ void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, c
|
|||
|
||||
void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, uint16_t width, uint16_t height, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection);
|
||||
|
||||
screenCoordinates.x -= width / 2;
|
||||
|
@ -188,7 +175,6 @@ void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, u
|
|||
|
||||
void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection);
|
||||
|
||||
screenCoordinates.x -= texture->GetWidth() / 2;
|
||||
|
@ -199,7 +185,6 @@ void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, f
|
|||
|
||||
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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection);
|
||||
|
||||
screenCoordinates.x -= width / 2;
|
||||
|
@ -210,7 +195,6 @@ void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, u
|
|||
|
||||
void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, int16_t x, int16_t y, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
const RectF *texCoords = &atlas->GetTile(index).texCoords;
|
||||
const Rect *tileSize = &atlas->GetTile(index).dimensions;
|
||||
const Texture *texture = atlas->GetTexture();
|
||||
|
@ -221,7 +205,6 @@ void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, int16_t x, i
|
|||
|
||||
void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, int16_t x, int16_t y, uint16_t width, uint16_t height, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
const RectF *texCoords = &atlas->GetTile(index).texCoords;
|
||||
const Texture *texture = atlas->GetTexture();
|
||||
|
||||
|
@ -231,7 +214,6 @@ void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, int16_t x, i
|
|||
|
||||
void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, const Vector3 &worldPosition, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection);
|
||||
|
||||
const TextureAtlasTile &tile = atlas->GetTile(index);
|
||||
|
@ -243,7 +225,6 @@ void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, const Vector
|
|||
|
||||
void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, const Vector3 &worldPosition, uint16_t width, uint16_t height, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection);
|
||||
|
||||
screenCoordinates.x -= width / 2;
|
||||
|
@ -254,7 +235,6 @@ void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, const Vector
|
|||
|
||||
void SpriteBatch::Render(const SpriteFont *font, int16_t x, int16_t y, const Color &color, const char *text)
|
||||
{
|
||||
STACK_TRACE;
|
||||
size_t textLength = strlen(text);
|
||||
|
||||
y = FixYCoord(y, (uint16_t)font->GetLetterHeight());
|
||||
|
@ -289,7 +269,6 @@ 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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
size_t textLength = strlen(text);
|
||||
|
||||
float scaledLetterHeight = (float)font->GetLetterHeight() * scale;
|
||||
|
@ -329,7 +308,6 @@ void SpriteBatch::Render(const SpriteFont *font, int16_t x, int16_t y, const Col
|
|||
|
||||
void SpriteBatch::Render(const SpriteFont *font, const Vector3 &worldPosition, const Color &color, const char *text)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection);
|
||||
|
||||
uint16_t textWidth = 0;
|
||||
|
@ -344,7 +322,6 @@ void SpriteBatch::Render(const SpriteFont *font, const Vector3 &worldPosition, c
|
|||
|
||||
void SpriteBatch::Render(const SpriteFont *font, const Vector3 &worldPosition, const Color &color, float scale, const char *text)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection);
|
||||
|
||||
uint16_t textWidth = 0;
|
||||
|
@ -359,7 +336,6 @@ void SpriteBatch::Render(const SpriteFont *font, const Vector3 &worldPosition, c
|
|||
|
||||
void SpriteBatch::Printf(const SpriteFont *font, int16_t x, int16_t y, const Color &color, const char *format, ...)
|
||||
{
|
||||
STACK_TRACE;
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vsnprintf(__spriteBatch_printfBuffer, PRINTF_BUFFER_SIZE, format, args);
|
||||
|
@ -370,7 +346,6 @@ void SpriteBatch::Printf(const SpriteFont *font, int16_t x, int16_t y, const Col
|
|||
|
||||
void SpriteBatch::Printf(const SpriteFont *font, int16_t x, int16_t y, const Color &color, float scale, const char *format, ...)
|
||||
{
|
||||
STACK_TRACE;
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vsnprintf(__spriteBatch_printfBuffer, PRINTF_BUFFER_SIZE, format, args);
|
||||
|
@ -381,7 +356,6 @@ void SpriteBatch::Printf(const SpriteFont *font, int16_t x, int16_t y, const Col
|
|||
|
||||
void SpriteBatch::Printf(const SpriteFont *font, const Vector3 &worldPosition, const Color &color, const char *format, ...)
|
||||
{
|
||||
STACK_TRACE;
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vsnprintf(__spriteBatch_printfBuffer, PRINTF_BUFFER_SIZE, format, args);
|
||||
|
@ -392,7 +366,6 @@ void SpriteBatch::Printf(const SpriteFont *font, const Vector3 &worldPosition, c
|
|||
|
||||
void SpriteBatch::Printf(const SpriteFont *font, const Vector3 &worldPosition, const Color &color, float scale, const char *format, ...)
|
||||
{
|
||||
STACK_TRACE;
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vsnprintf(__spriteBatch_printfBuffer, PRINTF_BUFFER_SIZE, format, args);
|
||||
|
@ -403,7 +376,6 @@ void SpriteBatch::Printf(const SpriteFont *font, const Vector3 &worldPosition, c
|
|||
|
||||
void SpriteBatch::RenderLine(int16_t x1, int16_t y1, int16_t x2, int16_t y2, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
y1 = FixYCoord(y1, (uint16_t)1);
|
||||
y2 = FixYCoord(y2, (uint16_t)1);
|
||||
|
||||
|
@ -412,7 +384,6 @@ void SpriteBatch::RenderLine(int16_t x1, int16_t y1, int16_t x2, int16_t y2, con
|
|||
|
||||
void SpriteBatch::RenderBox(int16_t left, int16_t top, int16_t right, int16_t bottom, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
uint16_t height = bottom - top;
|
||||
top = FixYCoord(top, height);
|
||||
bottom = top + height;
|
||||
|
@ -425,7 +396,6 @@ void SpriteBatch::RenderBox(int16_t left, int16_t top, int16_t right, int16_t bo
|
|||
|
||||
void SpriteBatch::RenderBox(const Rect &rect, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
int16_t left = (int16_t)rect.left;
|
||||
int16_t top = (int16_t)rect.top;
|
||||
int16_t right = (int16_t)rect.right;
|
||||
|
@ -443,7 +413,6 @@ void SpriteBatch::RenderBox(const Rect &rect, const Color &color)
|
|||
|
||||
void SpriteBatch::RenderFilledBox(int16_t left, int16_t top, int16_t right, int16_t bottom, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
uint16_t height = bottom - top;
|
||||
top = FixYCoord(top, height);
|
||||
bottom = top + height;
|
||||
|
@ -453,7 +422,6 @@ void SpriteBatch::RenderFilledBox(int16_t left, int16_t top, int16_t right, int1
|
|||
|
||||
void SpriteBatch::RenderFilledBox(const Rect &rect, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
int16_t left = (int16_t)rect.left;
|
||||
int16_t top = (int16_t)rect.top;
|
||||
int16_t right = (int16_t)rect.right;
|
||||
|
@ -468,7 +436,6 @@ void SpriteBatch::RenderFilledBox(const Rect &rect, const Color &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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
|
||||
uint16_t width = sourceRight - sourceLeft;
|
||||
|
@ -497,7 +464,6 @@ void SpriteBatch::AddSprite(const Texture *texture, int16_t destLeft, int16_t de
|
|||
|
||||
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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
|
||||
float destLeftF = (float)destLeft;
|
||||
|
@ -518,7 +484,6 @@ void SpriteBatch::AddSprite(const Texture *texture, int16_t destLeft, int16_t de
|
|||
|
||||
void SpriteBatch::AddSprite(const Texture *texture, float destLeft, float destTop, float destRight, float destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
|
||||
if (m_isClipping)
|
||||
|
@ -534,8 +499,6 @@ void SpriteBatch::AddSprite(const Texture *texture, float destLeft, float destTo
|
|||
|
||||
BOOL SpriteBatch::ClipSpriteCoords(float &left, float &top, float &right, float &bottom, float &texCoordLeft, float &texCoordTop, float &texCoordRight, float &texCoordBottom)
|
||||
{
|
||||
STACK_TRACE;
|
||||
|
||||
// check for completely out of bounds scenarios first
|
||||
if (left >= m_clipRegion.right)
|
||||
return FALSE;
|
||||
|
@ -594,7 +557,6 @@ BOOL SpriteBatch::ClipSpriteCoords(float &left, float &top, float &right, float
|
|||
|
||||
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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
uint32_t base = m_vertices->GetCurrentPosition();
|
||||
|
||||
m_vertices->SetPosition2(base, destLeft, destTop);
|
||||
|
@ -631,7 +593,6 @@ void SpriteBatch::SetSpriteInfo(uint32_t spriteIndex, const Texture *texture, fl
|
|||
|
||||
void SpriteBatch::AddLine(float x1, float y1, float x2, float y2, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
|
||||
if (m_isClipping)
|
||||
|
@ -647,7 +608,6 @@ void SpriteBatch::AddLine(float x1, float y1, float x2, float y2, const Color &c
|
|||
|
||||
void SpriteBatch::SetLineInfo(uint32_t spriteIndex, float x1, float y1, float x2, float y2, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
uint32_t base = m_vertices->GetCurrentPosition();
|
||||
|
||||
m_vertices->SetPosition2(base, x1, y1);
|
||||
|
@ -673,8 +633,6 @@ void SpriteBatch::SetLineInfo(uint32_t spriteIndex, float x1, float y1, float x2
|
|||
|
||||
BOOL SpriteBatch::ClipLineCoords(float &x1, float &y1, float &x2, float &y2)
|
||||
{
|
||||
STACK_TRACE;
|
||||
|
||||
// TODO: implementation
|
||||
|
||||
return TRUE;
|
||||
|
@ -682,7 +640,6 @@ BOOL SpriteBatch::ClipLineCoords(float &x1, float &y1, float &x2, float &y2)
|
|||
|
||||
void SpriteBatch::AddFilledBox(float left, float top, float right, float bottom, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
|
||||
if (m_isClipping)
|
||||
|
@ -698,7 +655,6 @@ void SpriteBatch::AddFilledBox(float left, float top, float right, float bottom,
|
|||
|
||||
void SpriteBatch::SetFilledBoxInfo(uint32_t spriteIndex, float left, float top, float right, float bottom, const Color &color)
|
||||
{
|
||||
STACK_TRACE;
|
||||
uint32_t base = m_vertices->GetCurrentPosition();
|
||||
|
||||
m_vertices->SetPosition2(base, left, top);
|
||||
|
@ -736,8 +692,6 @@ void SpriteBatch::SetFilledBoxInfo(uint32_t spriteIndex, float left, float top,
|
|||
|
||||
BOOL SpriteBatch::ClipFilledBoxCoords(float &left, float &top, float &right, float &bottom)
|
||||
{
|
||||
STACK_TRACE;
|
||||
|
||||
// check for completely out of bounds scenarios first
|
||||
if (left >= m_clipRegion.right)
|
||||
return FALSE;
|
||||
|
@ -772,7 +726,6 @@ BOOL SpriteBatch::ClipFilledBoxCoords(float &left, float &top, float &right, flo
|
|||
|
||||
void SpriteBatch::End()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
|
||||
// don't do anything if nothing is to be rendered!
|
||||
|
@ -806,7 +759,6 @@ void SpriteBatch::End()
|
|||
|
||||
void SpriteBatch::RenderQueue()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_graphicsDevice->BindVertexBuffer(m_vertices);
|
||||
|
||||
const SpriteBatchEntity *firstEntity = &m_entities[0];
|
||||
|
@ -847,7 +799,6 @@ void SpriteBatch::RenderQueue()
|
|||
|
||||
void SpriteBatch::RenderQueueRange(const SpriteBatchEntity *firstEntity, const SpriteBatchEntity *lastEntity)
|
||||
{
|
||||
STACK_TRACE;
|
||||
uint32_t startVertex = firstEntity->firstVertex;
|
||||
uint32_t lastVertex = lastEntity->lastVertex + 1;
|
||||
|
||||
|
@ -876,7 +827,6 @@ void SpriteBatch::RenderQueueRange(const SpriteBatchEntity *firstEntity, const S
|
|||
|
||||
void SpriteBatch::CheckForNewSpriteSpace(SPRITEBATCH_ENTITY_TYPE type)
|
||||
{
|
||||
STACK_TRACE;
|
||||
// HACK: the assumption is made here that this will never expand the buffers
|
||||
// by an amount that could be used to store more then one entity at a
|
||||
// time. This is because we use std::vector::push_back to expand the
|
||||
|
@ -920,7 +870,6 @@ inline float SpriteBatch::FixYCoord(int16_t y, float sourceHeight) const
|
|||
|
||||
void SpriteBatch::SetClipRegion(const Rect &rect)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
m_isClipping = TRUE;
|
||||
|
||||
|
@ -935,7 +884,6 @@ void SpriteBatch::SetClipRegion(const Rect &rect)
|
|||
|
||||
void SpriteBatch::SetClipRegion(int16_t left, int16_t top, int16_t right, int16_t bottom)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
m_isClipping = TRUE;
|
||||
|
||||
|
@ -951,7 +899,6 @@ void SpriteBatch::SetClipRegion(int16_t left, int16_t top, int16_t right, int16_
|
|||
|
||||
void SpriteBatch::ClearClipRegion()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
m_isClipping = FALSE;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#include "../debug.h"
|
||||
|
||||
#include "spritefont.h"
|
||||
|
||||
#include <math.h>
|
||||
|
@ -12,7 +10,6 @@
|
|||
#include "textureatlas.h"
|
||||
|
||||
SpriteFont::SpriteFont()
|
||||
: Content()
|
||||
{
|
||||
m_size = 0;
|
||||
m_texture = NULL;
|
||||
|
@ -22,14 +19,12 @@ SpriteFont::SpriteFont()
|
|||
|
||||
SpriteFont::~SpriteFont()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(m_glyphs);
|
||||
SAFE_DELETE(m_texture);
|
||||
}
|
||||
|
||||
void SpriteFont::Load(Texture *texture, TextureAtlas *glyphs, uint8_t size)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_texture = texture;
|
||||
m_glyphs = glyphs;
|
||||
m_size = size;
|
||||
|
@ -38,7 +33,6 @@ void SpriteFont::Load(Texture *texture, TextureAtlas *glyphs, uint8_t size)
|
|||
|
||||
void SpriteFont::OnLostContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE(m_glyphs);
|
||||
m_letterHeight = 0;
|
||||
SAFE_DELETE(m_texture);
|
||||
|
@ -46,7 +40,6 @@ void SpriteFont::OnLostContext()
|
|||
|
||||
const TextureAtlasTile& SpriteFont::GetGlyph(unsigned char c) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (c < LOW_GLYPH || c > HIGH_GLYPH)
|
||||
return m_glyphs->GetTile(HIGH_GLYPH - LOW_GLYPH);
|
||||
else
|
||||
|
@ -55,8 +48,9 @@ const TextureAtlasTile& SpriteFont::GetGlyph(unsigned char c) const
|
|||
|
||||
void SpriteFont::MeasureString(uint16_t *width, uint16_t *height, const char *format, ...) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(width != NULL || height != NULL);
|
||||
if (width == NULL && height == NULL)
|
||||
return;
|
||||
|
||||
static char buffer[8096]; // probably way more then adequate
|
||||
|
||||
va_list args;
|
||||
|
@ -96,8 +90,9 @@ void SpriteFont::MeasureString(uint16_t *width, uint16_t *height, const char *fo
|
|||
|
||||
void SpriteFont::MeasureString(uint16_t *width, uint16_t *height, float scale, const char *format, ...) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(width != NULL || height != NULL);
|
||||
if (width == NULL && height == NULL)
|
||||
return;
|
||||
|
||||
static char buffer[8096]; // probably way more then adequate
|
||||
|
||||
va_list args;
|
||||
|
|
|
@ -4,18 +4,15 @@
|
|||
|
||||
SpriteShader::SpriteShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SetTextureHasAlphaOnlyUniform("u_textureHasAlphaOnly");
|
||||
}
|
||||
|
||||
SpriteShader::~SpriteShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void SpriteShader::SetTextureHasAlphaOnly(BOOL hasAlphaOnly)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsReadyForUse() == TRUE);
|
||||
SetUniform(m_textureHasAlphaOnlyUniform, (int32_t)hasAlphaOnly);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
StandardShader::StandardShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_inlineVertexShaderSource = NULL;
|
||||
m_inlineFragmentShaderSource = NULL;
|
||||
|
||||
|
@ -15,12 +14,10 @@ StandardShader::StandardShader()
|
|||
|
||||
StandardShader::~StandardShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
BOOL StandardShader::LoadCompileAndLinkInlineSources(const char *inlineVertexShaderSource, const char *inlineFragmentShaderSource)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(inlineVertexShaderSource != NULL);
|
||||
ASSERT(inlineFragmentShaderSource != NULL);
|
||||
|
||||
|
@ -38,25 +35,21 @@ BOOL StandardShader::LoadCompileAndLinkInlineSources(const char *inlineVertexSha
|
|||
|
||||
void StandardShader::SetModelViewMatrix(const Matrix4x4 &matrix)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsReadyForUse() == TRUE);
|
||||
SetUniform(m_modelViewMatrixUniform, matrix);
|
||||
}
|
||||
|
||||
void StandardShader::SetProjectionMatrix(const Matrix4x4 &matrix)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsReadyForUse() == TRUE);
|
||||
SetUniform(m_projectionMatrixUniform, matrix);
|
||||
}
|
||||
|
||||
void StandardShader::OnNewContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ReloadCompileAndLink(m_inlineVertexShaderSource, m_inlineFragmentShaderSource);
|
||||
}
|
||||
|
||||
void StandardShader::OnLostContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
|
|
@ -11,9 +11,7 @@
|
|||
#include "../math/mathhelpers.h"
|
||||
|
||||
Texture::Texture()
|
||||
: Content()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_graphicsDevice = NULL;
|
||||
m_textureName = 0;
|
||||
m_width = 0;
|
||||
|
@ -23,13 +21,11 @@ Texture::Texture()
|
|||
|
||||
Texture::~Texture()
|
||||
{
|
||||
STACK_TRACE;
|
||||
Release();
|
||||
}
|
||||
|
||||
BOOL Texture::Create(GraphicsDevice *graphicsDevice, Image *image)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_textureName == 0);
|
||||
if (m_textureName != 0)
|
||||
return FALSE;
|
||||
|
@ -85,7 +81,6 @@ BOOL Texture::Create(GraphicsDevice *graphicsDevice, Image *image)
|
|||
|
||||
BOOL Texture::Create(GraphicsDevice *graphicsDevice, uint16_t width, uint16_t height, TEXTURE_FORMAT textureFormat)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_textureName == 0);
|
||||
if (m_textureName != 0)
|
||||
return FALSE;
|
||||
|
@ -132,7 +127,6 @@ BOOL Texture::Create(GraphicsDevice *graphicsDevice, uint16_t width, uint16_t he
|
|||
|
||||
void Texture::Release()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_textureName != 0)
|
||||
{
|
||||
m_graphicsDevice->UnbindTexture(this);
|
||||
|
@ -150,7 +144,6 @@ void Texture::Release()
|
|||
|
||||
BOOL Texture::Update(Image *image, uint16_t destX, uint16_t destY)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_textureName != 0);
|
||||
if (m_textureName == 0)
|
||||
return FALSE;
|
||||
|
@ -198,13 +191,11 @@ BOOL Texture::Update(Image *image, uint16_t destX, uint16_t destY)
|
|||
|
||||
void Texture::OnLostContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_textureName = 0;
|
||||
}
|
||||
|
||||
void Texture::GetTextureSpecsFromFormat(TEXTURE_FORMAT textureFormat, int *bpp, uint32_t *format, uint32_t *type)
|
||||
{
|
||||
STACK_TRACE;
|
||||
switch (textureFormat)
|
||||
{
|
||||
case TEXTURE_FORMAT_ALPHA:
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
TextureAtlas::TextureAtlas(uint16_t textureWidth, uint16_t textureHeight, float texCoordEdgeOffset)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(textureWidth > 0);
|
||||
ASSERT(textureHeight > 0);
|
||||
|
||||
|
@ -18,7 +17,6 @@ TextureAtlas::TextureAtlas(uint16_t textureWidth, uint16_t textureHeight, float
|
|||
|
||||
TextureAtlas::TextureAtlas(Texture *source, float texCoordEdgeOffset)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(source != NULL);
|
||||
|
||||
m_source = source;
|
||||
|
@ -29,12 +27,10 @@ TextureAtlas::TextureAtlas(Texture *source, float texCoordEdgeOffset)
|
|||
|
||||
TextureAtlas::~TextureAtlas()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void TextureAtlas::SetTexture(Texture *source)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (source == NULL)
|
||||
m_source = NULL;
|
||||
else
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#include "../debug.h"
|
||||
|
||||
#include "textureparameters.h"
|
||||
|
||||
#include "glincludes.h"
|
||||
|
@ -7,13 +5,11 @@
|
|||
|
||||
TextureParameters::TextureParameters()
|
||||
{
|
||||
STACK_TRACE;
|
||||
Initialize();
|
||||
}
|
||||
|
||||
TextureParameters::TextureParameters(MINIFICATION_FILTER minFilter, MAGNIFICATION_FILTER magFilter)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Initialize();
|
||||
|
||||
m_minFilter = minFilter;
|
||||
|
@ -22,12 +18,10 @@ TextureParameters::TextureParameters(MINIFICATION_FILTER minFilter, MAGNIFICATIO
|
|||
|
||||
TextureParameters::~TextureParameters()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void TextureParameters::Initialize()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_minFilter = MIN_NEAREST;
|
||||
m_magFilter = MAG_LINEAR;
|
||||
m_wrapS = REPEAT;
|
||||
|
@ -36,7 +30,6 @@ void TextureParameters::Initialize()
|
|||
|
||||
void TextureParameters::Apply() const
|
||||
{
|
||||
STACK_TRACE;
|
||||
GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, FindMinificationFilterValue(m_minFilter)));
|
||||
GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, FindMagnificationFilterValue(m_magFilter)));
|
||||
GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, FindWrapModeValue(m_wrapS)));
|
||||
|
@ -45,7 +38,6 @@ void TextureParameters::Apply() const
|
|||
|
||||
int TextureParameters::FindMinificationFilterValue(MINIFICATION_FILTER filter) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
switch (filter)
|
||||
{
|
||||
case MIN_NEAREST: return GL_NEAREST;
|
||||
|
@ -59,7 +51,6 @@ int TextureParameters::FindMinificationFilterValue(MINIFICATION_FILTER filter) c
|
|||
|
||||
int TextureParameters::FindMagnificationFilterValue(MAGNIFICATION_FILTER filter) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
switch (filter)
|
||||
{
|
||||
case MAG_NEAREST: return GL_NEAREST;
|
||||
|
@ -69,7 +60,6 @@ int TextureParameters::FindMagnificationFilterValue(MAGNIFICATION_FILTER filter)
|
|||
|
||||
int TextureParameters::FindWrapModeValue(WRAP_MODE mode) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
switch (mode)
|
||||
{
|
||||
case CLAMP_TO_EDGE: return GL_CLAMP_TO_EDGE;
|
||||
|
|
|
@ -9,7 +9,6 @@ const unsigned int MAX_GPU_ATTRIB_SLOTS = 8;
|
|||
|
||||
VertexBuffer::VertexBuffer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_numVertices = 0;
|
||||
m_currentVertex = 0;
|
||||
m_standardTypeAttribs = 0;
|
||||
|
@ -26,7 +25,6 @@ VertexBuffer::VertexBuffer()
|
|||
|
||||
void VertexBuffer::Release()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_buffer.clear();
|
||||
stl::vector<float>().swap(m_buffer);
|
||||
|
||||
|
@ -48,13 +46,11 @@ void VertexBuffer::Release()
|
|||
|
||||
BOOL VertexBuffer::Initialize(const VERTEX_ATTRIBS *attributes, uint32_t numAttributes, uint32_t numVertices, BUFFEROBJECT_USAGE usage)
|
||||
{
|
||||
STACK_TRACE;
|
||||
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)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_buffer.size() == 0);
|
||||
if (m_buffer.size() > 0)
|
||||
return FALSE;
|
||||
|
@ -72,13 +68,11 @@ BOOL VertexBuffer::Initialize(GraphicsDevice *graphicsDevice, const VERTEX_ATTRI
|
|||
|
||||
BOOL VertexBuffer::Initialize(const VertexBuffer *source)
|
||||
{
|
||||
STACK_TRACE;
|
||||
return Initialize(NULL, source);
|
||||
}
|
||||
|
||||
BOOL VertexBuffer::Initialize(GraphicsDevice *graphicsDevice, const VertexBuffer *source)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_buffer.size() == 0);
|
||||
if (m_buffer.size() > 0)
|
||||
return FALSE;
|
||||
|
@ -113,7 +107,6 @@ BOOL VertexBuffer::Initialize(GraphicsDevice *graphicsDevice, const VertexBuffer
|
|||
|
||||
BOOL VertexBuffer::SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint32_t numAttributes)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(attributes != NULL);
|
||||
ASSERT(numAttributes > 0);
|
||||
ASSERT(m_buffer.size() == 0);
|
||||
|
@ -209,7 +202,6 @@ BOOL VertexBuffer::SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint32_t
|
|||
|
||||
int32_t VertexBuffer::GetIndexOfStandardAttrib(VERTEX_STANDARD_ATTRIBS standardAttrib) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (uint32_t i = 0; i < m_numAttributes; ++i)
|
||||
{
|
||||
if ((uint32_t)m_attribs[i].standardType == (uint32_t)standardAttrib)
|
||||
|
@ -221,7 +213,6 @@ int32_t VertexBuffer::GetIndexOfStandardAttrib(VERTEX_STANDARD_ATTRIBS standardA
|
|||
|
||||
void VertexBuffer::Resize(uint32_t numVertices)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(numVertices > 0);
|
||||
if (numVertices == 0)
|
||||
return;
|
||||
|
@ -238,14 +229,12 @@ void VertexBuffer::Resize(uint32_t numVertices)
|
|||
|
||||
void VertexBuffer::Extend(uint32_t amount)
|
||||
{
|
||||
STACK_TRACE;
|
||||
uint32_t newSize = GetNumElements() + amount;
|
||||
Resize(newSize);
|
||||
}
|
||||
|
||||
void VertexBuffer::Copy(const VertexBuffer *source, uint32_t destIndex)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(source != NULL);
|
||||
ASSERT(source->GetNumElements() > 0);
|
||||
ASSERT(source->GetStandardAttribs() == m_standardTypeAttribs);
|
||||
|
|
|
@ -4,18 +4,15 @@
|
|||
|
||||
VertexLerpShader::VertexLerpShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SetLerpUniform("u_lerp");
|
||||
}
|
||||
|
||||
VertexLerpShader::~VertexLerpShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void VertexLerpShader::SetLerp(float t)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsReadyForUse() == TRUE);
|
||||
SetUniform(m_lerpUniform, t);
|
||||
}
|
||||
|
|
|
@ -6,26 +6,22 @@
|
|||
|
||||
VertexSkinningShader::VertexSkinningShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SetJointPositionsUniform("u_jointPositions");
|
||||
SetJointRotationsUniform("u_jointRotations");
|
||||
}
|
||||
|
||||
VertexSkinningShader::~VertexSkinningShader()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void VertexSkinningShader::SetJointPositions(const Vector3 *positions, uint32_t count)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsReadyForUse() == TRUE);
|
||||
SetUniform(m_positionsUniform, positions, count);
|
||||
}
|
||||
|
||||
void VertexSkinningShader::SetJointRotations(const Quaternion *rotations, uint32_t count)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(IsReadyForUse() == TRUE);
|
||||
SetUniform(m_rotationsUniform, rotations, count);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
ViewContext::ViewContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_graphicsDevice = NULL;
|
||||
m_viewport = Rect(0, 0, 0, 0);
|
||||
m_viewportIsFixedSize = FALSE;
|
||||
|
@ -25,13 +24,11 @@ ViewContext::ViewContext()
|
|||
|
||||
ViewContext::~ViewContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
Release();
|
||||
}
|
||||
|
||||
void ViewContext::Release()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_usingDefaultCamera)
|
||||
SAFE_DELETE(m_camera);
|
||||
|
||||
|
@ -45,7 +42,6 @@ void ViewContext::Release()
|
|||
|
||||
BOOL ViewContext::Create(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_graphicsDevice == NULL);
|
||||
if (m_graphicsDevice != NULL)
|
||||
return FALSE;
|
||||
|
@ -65,7 +61,6 @@ BOOL ViewContext::Create(GraphicsDevice *graphicsDevice)
|
|||
|
||||
BOOL ViewContext::Create(GraphicsDevice *graphicsDevice, const Rect &fixedViewportSize)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_graphicsDevice == NULL);
|
||||
if (m_graphicsDevice != NULL)
|
||||
return FALSE;
|
||||
|
@ -85,7 +80,6 @@ BOOL ViewContext::Create(GraphicsDevice *graphicsDevice, const Rect &fixedViewpo
|
|||
|
||||
void ViewContext::OnNewContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_modelviewStack.Clear();
|
||||
m_modelviewStack.top = IDENTITY_MATRIX;
|
||||
m_projectionStack.Clear();
|
||||
|
@ -94,25 +88,21 @@ void ViewContext::OnNewContext()
|
|||
|
||||
void ViewContext::OnLostContext()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void ViewContext::OnResize(const Rect &size, SCREEN_ORIENTATION_ANGLE screenOrientation)
|
||||
{
|
||||
STACK_TRACE;
|
||||
SetupViewport(size, screenOrientation);
|
||||
}
|
||||
|
||||
void ViewContext::OnRender()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_camera != NULL)
|
||||
m_camera->OnRender();
|
||||
}
|
||||
|
||||
void ViewContext::OnApply(const Rect &size, SCREEN_ORIENTATION_ANGLE screenOrientation)
|
||||
{
|
||||
STACK_TRACE;
|
||||
SetupViewport(size, screenOrientation);
|
||||
|
||||
// ensures it's set up for rendering immediately when this call returns
|
||||
|
@ -124,7 +114,6 @@ void ViewContext::OnApply(const Rect &size, SCREEN_ORIENTATION_ANGLE screenOrien
|
|||
|
||||
void ViewContext::SetProjectionMatrix(const Matrix4x4 &m)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!IgnoringScreenRotation() && m_screenOrientation != SCREEN_ANGLE_0)
|
||||
{
|
||||
// apply a rotation immediately _after_ the projection matrix transform
|
||||
|
@ -138,7 +127,6 @@ void ViewContext::SetProjectionMatrix(const Matrix4x4 &m)
|
|||
|
||||
void ViewContext::PushProjectionMatrix()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_projectionStack.Push();
|
||||
// with MatrixStack, pushing does not change the top matrix, so
|
||||
// we don't need to re-set the projection matrix with OpenGL
|
||||
|
@ -146,13 +134,11 @@ void ViewContext::PushProjectionMatrix()
|
|||
|
||||
void ViewContext::PopProjectionMatrix()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_projectionStack.Pop();
|
||||
}
|
||||
|
||||
Matrix4x4 ViewContext::GetOrthographicProjectionMatrix()
|
||||
{
|
||||
STACK_TRACE;
|
||||
Matrix4x4 ortho = Matrix4x4::CreateOrthographic((float)m_viewport.left, (float)m_viewport.right, (float)m_viewport.top, (float)m_viewport.bottom, 0.0f, 1.0f);
|
||||
|
||||
if (!IgnoringScreenRotation() && m_screenOrientation != SCREEN_ANGLE_0)
|
||||
|
@ -168,13 +154,11 @@ Matrix4x4 ViewContext::GetOrthographicProjectionMatrix()
|
|||
|
||||
void ViewContext::SetModelViewMatrix(const Matrix4x4 &m)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_modelviewStack.top = m;
|
||||
}
|
||||
|
||||
void ViewContext::PushModelViewMatrix()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_modelviewStack.Push();
|
||||
// with MatrixStack, pushing does not change the top matrix, so
|
||||
// we don't need to re-set the modelview matrix with OpenGL
|
||||
|
@ -182,13 +166,11 @@ void ViewContext::PushModelViewMatrix()
|
|||
|
||||
void ViewContext::PopModelViewMatrix()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_modelviewStack.Pop();
|
||||
}
|
||||
|
||||
void ViewContext::SetCamera(Camera *camera)
|
||||
{
|
||||
STACK_TRACE;
|
||||
// using the default camera but a new camera is being provided?
|
||||
if (m_usingDefaultCamera && camera != NULL)
|
||||
{
|
||||
|
@ -214,7 +196,6 @@ void ViewContext::SetCamera(Camera *camera)
|
|||
|
||||
void ViewContext::SetupViewport(const Rect &size, SCREEN_ORIENTATION_ANGLE screenOrientation)
|
||||
{
|
||||
STACK_TRACE;
|
||||
Rect viewport;
|
||||
|
||||
if (m_viewportIsFixedSize)
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#include "../debug.h"
|
||||
|
||||
#include "gwen_inputprocessor.h"
|
||||
#include <controls/gwen_canvas.h>
|
||||
#include "../basegameapp.h"
|
||||
|
@ -15,7 +13,6 @@ namespace Gwen
|
|||
{
|
||||
InputProcessor::InputProcessor(BaseGameApp *gameApp, Gwen::Controls::Canvas *canvas)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_gameApp = gameApp;
|
||||
m_canvas = canvas;
|
||||
m_enabled = FALSE;
|
||||
|
@ -25,7 +22,6 @@ namespace Gwen
|
|||
|
||||
InputProcessor::~InputProcessor()
|
||||
{
|
||||
STACK_TRACE;
|
||||
Enable(FALSE);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,34 +1,26 @@
|
|||
#ifdef __S3E__
|
||||
#include "../debug.h"
|
||||
|
||||
#include "marmaladekeyboard.h"
|
||||
#include "keyboardlistener.h"
|
||||
#include <string.h>
|
||||
|
||||
MarmaladeKeyboard::MarmaladeKeyboard(BOOL hasPhysicalKeysForGameControls)
|
||||
: Keyboard()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_hasPhysicalKeysForGameControls = hasPhysicalKeysForGameControls;
|
||||
|
||||
m_keys = new BOOL[KSYM_LAST];
|
||||
ASSERT(m_keys != NULL);
|
||||
m_lockedKeys = new BOOL[KSYM_LAST];
|
||||
ASSERT(m_lockedKeys != NULL);
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
MarmaladeKeyboard::~MarmaladeKeyboard()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE_ARRAY(m_keys);
|
||||
SAFE_DELETE_ARRAY(m_lockedKeys);
|
||||
}
|
||||
|
||||
BOOL MarmaladeKeyboard::OnKeyEvent(const s3eKeyboardEvent *eventArgs)
|
||||
{
|
||||
STACK_TRACE;
|
||||
int32_t keyCode = (int32_t)eventArgs->m_Key;
|
||||
BOOL isDown = (BOOL)eventArgs->m_Pressed;
|
||||
|
||||
|
@ -66,14 +58,12 @@ BOOL MarmaladeKeyboard::OnKeyEvent(const s3eKeyboardEvent *eventArgs)
|
|||
|
||||
BOOL MarmaladeKeyboard::OnKeyCharEvent(const s3eKeyboardCharEvent *eventArgs)
|
||||
{
|
||||
STACK_TRACE;
|
||||
// TODO: implementation
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL MarmaladeKeyboard::IsPressed(KEYS key)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_keys[key] && !m_lockedKeys[key])
|
||||
{
|
||||
m_lockedKeys[key] = TRUE;
|
||||
|
@ -85,20 +75,17 @@ BOOL MarmaladeKeyboard::IsPressed(KEYS key)
|
|||
|
||||
void MarmaladeKeyboard::Reset()
|
||||
{
|
||||
STACK_TRACE;
|
||||
memset(m_keys, FALSE, sizeof(BOOL) * KSYM_LAST);
|
||||
memset(m_lockedKeys, FALSE, sizeof(BOOL) * KSYM_LAST);
|
||||
}
|
||||
|
||||
void MarmaladeKeyboard::RegisterListener(KeyboardListener *listener)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_listeners.insert(listener);
|
||||
}
|
||||
|
||||
void MarmaladeKeyboard::UnregisterListener(KeyboardListener *listener)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_listeners.erase(listener);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,34 +8,27 @@
|
|||
const int32_t NUM_BUTTONS = S3E_POINTER_BUTTON_MAX;
|
||||
|
||||
MarmaladeMouse::MarmaladeMouse()
|
||||
: Mouse()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_buttons = new BOOL[NUM_BUTTONS];
|
||||
ASSERT(m_buttons != NULL);
|
||||
m_lockedButtons = new BOOL[NUM_BUTTONS];
|
||||
ASSERT(m_lockedButtons != NULL);
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
MarmaladeMouse::~MarmaladeMouse()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE_ARRAY(m_buttons);
|
||||
SAFE_DELETE_ARRAY(m_lockedButtons);
|
||||
}
|
||||
|
||||
void MarmaladeMouse::ResetDeltas()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_deltaX = 0;
|
||||
m_deltaY = 0;
|
||||
}
|
||||
|
||||
BOOL MarmaladeMouse::OnButtonEvent(const s3ePointerEvent *eventArgs)
|
||||
{
|
||||
STACK_TRACE;
|
||||
int32_t button = (int32_t)eventArgs->m_Button;
|
||||
BOOL isDown = (BOOL)eventArgs->m_Pressed;
|
||||
int32_t x = eventArgs->m_x;
|
||||
|
@ -76,7 +69,6 @@ BOOL MarmaladeMouse::OnButtonEvent(const s3ePointerEvent *eventArgs)
|
|||
|
||||
BOOL MarmaladeMouse::OnMotionEvent(const s3ePointerMotionEvent *eventArgs)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_deltaX = eventArgs->m_x - m_x;
|
||||
m_deltaY = eventArgs->m_y - m_y;
|
||||
|
||||
|
@ -98,7 +90,6 @@ BOOL MarmaladeMouse::OnMotionEvent(const s3ePointerMotionEvent *eventArgs)
|
|||
|
||||
BOOL MarmaladeMouse::IsPressed(MOUSE_BUTTONS button)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_buttons[button] && !m_lockedButtons[button])
|
||||
{
|
||||
m_lockedButtons[button] = TRUE;
|
||||
|
@ -110,7 +101,6 @@ BOOL MarmaladeMouse::IsPressed(MOUSE_BUTTONS button)
|
|||
|
||||
void MarmaladeMouse::Reset()
|
||||
{
|
||||
STACK_TRACE;
|
||||
memset(m_buttons, FALSE, sizeof(BOOL) * NUM_BUTTONS);
|
||||
memset(m_lockedButtons, FALSE, sizeof(BOOL) * NUM_BUTTONS);
|
||||
m_x = 0;
|
||||
|
@ -121,13 +111,11 @@ void MarmaladeMouse::Reset()
|
|||
|
||||
void MarmaladeMouse::RegisterListener(MouseListener *listener)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_listeners.insert(listener);
|
||||
}
|
||||
|
||||
void MarmaladeMouse::UnregisterListener(MouseListener *listener)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_listeners.erase(listener);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
MarmaladeTouchPointer::MarmaladeTouchPointer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_id = INVALID_TOUCH_POINTER;
|
||||
m_x = 0;
|
||||
m_y = 0;
|
||||
|
@ -20,19 +19,16 @@ MarmaladeTouchPointer::MarmaladeTouchPointer()
|
|||
|
||||
MarmaladeTouchPointer::~MarmaladeTouchPointer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
}
|
||||
|
||||
void MarmaladeTouchPointer::ResetDeltas()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_deltaX = 0;
|
||||
m_deltaY = 0;
|
||||
}
|
||||
|
||||
BOOL MarmaladeTouchPointer::IsTouchingWithinArea(uint16_t left, uint16_t top, uint16_t right, uint16_t bottom) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isTouching && m_x >= left && m_y >= top && m_x <= right && m_y <= bottom)
|
||||
return TRUE;
|
||||
else
|
||||
|
@ -41,7 +37,6 @@ BOOL MarmaladeTouchPointer::IsTouchingWithinArea(uint16_t left, uint16_t top, ui
|
|||
|
||||
BOOL MarmaladeTouchPointer::IsTouchingWithinArea(const Rect &area) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isTouching && m_x >= area.left && m_y >= area.top && m_x <= area.right && m_y <= area.bottom)
|
||||
return TRUE;
|
||||
else
|
||||
|
@ -50,7 +45,6 @@ BOOL MarmaladeTouchPointer::IsTouchingWithinArea(const Rect &area) const
|
|||
|
||||
BOOL MarmaladeTouchPointer::IsTouchingWithinArea(uint16_t centerX, uint16_t centerY, uint16_t radius) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isTouching)
|
||||
{
|
||||
uint32_t squaredDistance = ((centerX - m_x) * (centerX - m_x)) + ((centerY - m_y) * (centerY - m_y));
|
||||
|
@ -64,7 +58,6 @@ BOOL MarmaladeTouchPointer::IsTouchingWithinArea(uint16_t centerX, uint16_t cent
|
|||
|
||||
BOOL MarmaladeTouchPointer::IsTouchingWithinArea(const Circle &area) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isTouching)
|
||||
{
|
||||
uint32_t squaredDistance = ((area.x - m_x) * (area.x - m_x)) + ((area.y - m_y) * (area.y - m_y));
|
||||
|
@ -78,7 +71,6 @@ BOOL MarmaladeTouchPointer::IsTouchingWithinArea(const Circle &area) const
|
|||
|
||||
void MarmaladeTouchPointer::OnDown(int32_t id, uint16_t x, uint16_t y)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_isTouching = TRUE;
|
||||
m_x = x;
|
||||
m_y = y;
|
||||
|
@ -89,7 +81,6 @@ void MarmaladeTouchPointer::OnDown(int32_t id, uint16_t x, uint16_t y)
|
|||
|
||||
void MarmaladeTouchPointer::OnMove(int32_t id, uint16_t x, uint16_t y)
|
||||
{
|
||||
STACK_TRACE;
|
||||
// calculate the amount moved since the last time first...
|
||||
m_deltaX = x - m_x;
|
||||
m_deltaY = y - m_y;
|
||||
|
@ -101,7 +92,6 @@ void MarmaladeTouchPointer::OnMove(int32_t id, uint16_t x, uint16_t y)
|
|||
|
||||
void MarmaladeTouchPointer::OnUp()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_id = INVALID_TOUCH_POINTER;
|
||||
m_x = 0;
|
||||
m_y = 0;
|
||||
|
@ -112,7 +102,6 @@ void MarmaladeTouchPointer::OnUp()
|
|||
|
||||
MarmaladeTouchscreen::MarmaladeTouchscreen(MarmaladeSystem *system, BOOL isMultitouchAvailable)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_system = system;
|
||||
|
||||
m_isMultitouchAvailable = isMultitouchAvailable;
|
||||
|
@ -129,13 +118,11 @@ MarmaladeTouchscreen::MarmaladeTouchscreen(MarmaladeSystem *system, BOOL isMulti
|
|||
|
||||
MarmaladeTouchscreen::~MarmaladeTouchscreen()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE_ARRAY(m_pointers);
|
||||
}
|
||||
|
||||
void MarmaladeTouchscreen::ResetDeltas()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (uint32_t i = 0; i < m_maxTouchPoints; ++i)
|
||||
{
|
||||
if (m_pointers[i].GetId() != INVALID_TOUCH_POINTER)
|
||||
|
@ -145,27 +132,23 @@ void MarmaladeTouchscreen::ResetDeltas()
|
|||
|
||||
void MarmaladeTouchscreen::ResetViewBounds(const Rect &viewBounds)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_viewBounds = viewBounds;
|
||||
}
|
||||
|
||||
BOOL MarmaladeTouchscreen::OnSingleTouchTapEvent(const s3ePointerEvent *eventArgs)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_maxTouchPoints == 1);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL MarmaladeTouchscreen::OnSingleTouchMotionEvent(const s3ePointerMotionEvent *eventArgs)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_maxTouchPoints == 1);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL MarmaladeTouchscreen::OnMultiTouchTapEvent(const s3ePointerTouchEvent *eventArgs)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_maxTouchPoints > 1);
|
||||
BOOL isDown = (BOOL)eventArgs->m_Pressed;
|
||||
if (isDown)
|
||||
|
@ -238,7 +221,6 @@ BOOL MarmaladeTouchscreen::OnMultiTouchTapEvent(const s3ePointerTouchEvent *even
|
|||
|
||||
BOOL MarmaladeTouchscreen::OnMultiTouchMotionEvent(const s3ePointerTouchMotionEvent *eventArgs)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_maxTouchPoints > 1);
|
||||
MarmaladeTouchPointer *pointer = GetPointerById_internal(eventArgs->m_TouchID);
|
||||
if (pointer != NULL)
|
||||
|
@ -269,7 +251,6 @@ BOOL MarmaladeTouchscreen::OnMultiTouchMotionEvent(const s3ePointerTouchMotionEv
|
|||
|
||||
BOOL MarmaladeTouchscreen::WasTapped()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_isTouching && !m_isLocked)
|
||||
{
|
||||
m_isLocked = TRUE;
|
||||
|
@ -285,7 +266,6 @@ BOOL MarmaladeTouchscreen::WasTapped()
|
|||
|
||||
const TouchPointer* MarmaladeTouchscreen::GetPointerById(int32_t id) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (uint32_t i = 0; i < m_maxTouchPoints; ++i)
|
||||
{
|
||||
if (m_pointers[i].GetId() == id)
|
||||
|
@ -297,7 +277,6 @@ const TouchPointer* MarmaladeTouchscreen::GetPointerById(int32_t id) const
|
|||
|
||||
MarmaladeTouchPointer* MarmaladeTouchscreen::GetPointerById_internal(int32_t id)
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (uint32_t i = 0; i < m_maxTouchPoints; ++i)
|
||||
{
|
||||
if (m_pointers[i].GetId() == id)
|
||||
|
@ -309,7 +288,6 @@ MarmaladeTouchPointer* MarmaladeTouchscreen::GetPointerById_internal(int32_t id)
|
|||
|
||||
MarmaladeTouchPointer* MarmaladeTouchscreen::GetFirstAvailablePointer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (uint32_t i = 0; i < m_maxTouchPoints; ++i)
|
||||
{
|
||||
if (m_pointers[i].GetId() == INVALID_TOUCH_POINTER)
|
||||
|
@ -321,7 +299,6 @@ MarmaladeTouchPointer* MarmaladeTouchscreen::GetFirstAvailablePointer()
|
|||
|
||||
MarmaladeTouchPointer* MarmaladeTouchscreen::GetPointerByIdOrFirstAvailable(int32_t id)
|
||||
{
|
||||
STACK_TRACE;
|
||||
MarmaladeTouchPointer *result = GetPointerById_internal(id);
|
||||
if (result == NULL)
|
||||
result = GetFirstAvailablePointer();
|
||||
|
@ -331,7 +308,6 @@ MarmaladeTouchPointer* MarmaladeTouchscreen::GetPointerByIdOrFirstAvailable(int3
|
|||
|
||||
MarmaladeTouchPointer* MarmaladeTouchscreen::GetNextDownPointer()
|
||||
{
|
||||
STACK_TRACE;
|
||||
for (uint32_t i = 0; i < m_maxTouchPoints; ++i)
|
||||
{
|
||||
if (m_pointers[i].IsTouching())
|
||||
|
@ -346,7 +322,6 @@ MarmaladeTouchPointer* MarmaladeTouchscreen::GetNextDownPointer()
|
|||
|
||||
void MarmaladeTouchscreen::Reset()
|
||||
{
|
||||
STACK_TRACE;
|
||||
MarmaladeTouchPointer *oldPrimaryPointer = m_primaryPointer;
|
||||
|
||||
m_primaryPointer = &m_pointers[0];
|
||||
|
@ -373,13 +348,11 @@ void MarmaladeTouchscreen::Reset()
|
|||
|
||||
void MarmaladeTouchscreen::RegisterListener(TouchscreenListener *listener)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_listeners.insert(listener);
|
||||
}
|
||||
|
||||
void MarmaladeTouchscreen::UnregisterListener(TouchscreenListener *listener)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_listeners.erase(listener);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
#ifdef SDL
|
||||
#include "../debug.h"
|
||||
|
||||
#include "sdlkeyboard.h"
|
||||
#include "keyboardlistener.h"
|
||||
#include "../sdlincludes.h"
|
||||
|
@ -9,28 +7,23 @@
|
|||
|
||||
SDLKeyboard::SDLKeyboard(SDLSystem *system, BOOL hasPhysicalKeysForGameControls)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_system = system;
|
||||
m_hasPhysicalKeysForGameControls = hasPhysicalKeysForGameControls;
|
||||
|
||||
m_keys = new BOOL[KSYM_LAST];
|
||||
ASSERT(m_keys != NULL);
|
||||
m_lockedKeys = new BOOL[KSYM_LAST];
|
||||
ASSERT(m_lockedKeys != NULL);
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
SDLKeyboard::~SDLKeyboard()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE_ARRAY(m_keys);
|
||||
SAFE_DELETE_ARRAY(m_lockedKeys);
|
||||
}
|
||||
|
||||
BOOL SDLKeyboard::OnKeyEvent(const SDL_KeyboardEvent *eventArgs)
|
||||
{
|
||||
STACK_TRACE;
|
||||
int32_t keyCode = (int32_t)eventArgs->keysym.sym;
|
||||
|
||||
if (eventArgs->state == SDL_PRESSED)
|
||||
|
@ -67,7 +60,6 @@ BOOL SDLKeyboard::OnKeyEvent(const SDL_KeyboardEvent *eventArgs)
|
|||
|
||||
BOOL SDLKeyboard::IsPressed(KEYS key)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_keys[key] && !m_lockedKeys[key])
|
||||
{
|
||||
m_lockedKeys[key] = TRUE;
|
||||
|
@ -79,7 +71,6 @@ BOOL SDLKeyboard::IsPressed(KEYS key)
|
|||
|
||||
void SDLKeyboard::Reset()
|
||||
{
|
||||
STACK_TRACE;
|
||||
memset(m_keys, FALSE, sizeof(BOOL) * KSYM_LAST);
|
||||
memset(m_lockedKeys, FALSE, sizeof(BOOL) * KSYM_LAST);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
#ifdef SDL
|
||||
#include "../debug.h"
|
||||
|
||||
#include "sdlmouse.h"
|
||||
#include "mouselistener.h"
|
||||
#include "../sdlincludes.h"
|
||||
|
@ -12,34 +10,28 @@ const int32_t NUM_BUTTONS = 5;
|
|||
|
||||
SDLMouse::SDLMouse(SDLSystem *system)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_system = system;
|
||||
|
||||
m_buttons = new BOOL[NUM_BUTTONS];
|
||||
ASSERT(m_buttons != NULL);
|
||||
m_lockedButtons = new BOOL[NUM_BUTTONS];
|
||||
ASSERT(m_lockedButtons != NULL);
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
SDLMouse::~SDLMouse()
|
||||
{
|
||||
STACK_TRACE;
|
||||
SAFE_DELETE_ARRAY(m_buttons);
|
||||
SAFE_DELETE_ARRAY(m_lockedButtons);
|
||||
}
|
||||
|
||||
void SDLMouse::ResetDeltas()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_deltaX = 0;
|
||||
m_deltaY = 0;
|
||||
}
|
||||
|
||||
BOOL SDLMouse::OnButtonEvent(const SDL_MouseButtonEvent *eventArgs)
|
||||
{
|
||||
STACK_TRACE;
|
||||
// translate from SDL's button values to our own MOUSE_BUTTONS enum
|
||||
int32_t button = (int32_t)eventArgs->button - 1;
|
||||
|
||||
|
@ -84,7 +76,6 @@ BOOL SDLMouse::OnButtonEvent(const SDL_MouseButtonEvent *eventArgs)
|
|||
|
||||
BOOL SDLMouse::OnMotionEvent(const SDL_MouseMotionEvent *eventArgs)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_deltaX = eventArgs->x - m_x;
|
||||
m_deltaY = eventArgs->y - m_y;
|
||||
|
||||
|
@ -106,7 +97,6 @@ BOOL SDLMouse::OnMotionEvent(const SDL_MouseMotionEvent *eventArgs)
|
|||
|
||||
BOOL SDLMouse::IsPressed(MOUSE_BUTTONS button)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_buttons[button] && !m_lockedButtons[button])
|
||||
{
|
||||
m_lockedButtons[button] = TRUE;
|
||||
|
@ -118,7 +108,6 @@ BOOL SDLMouse::IsPressed(MOUSE_BUTTONS button)
|
|||
|
||||
void SDLMouse::Reset()
|
||||
{
|
||||
STACK_TRACE;
|
||||
memset(m_buttons, FALSE, sizeof(BOOL) * NUM_BUTTONS);
|
||||
memset(m_lockedButtons, FALSE, sizeof(BOOL) * NUM_BUTTONS);
|
||||
m_x = 0;
|
||||
|
@ -138,4 +127,3 @@ void SDLMouse::UnregisterListener(MouseListener *listener)
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
MarmaladeGameWindow::MarmaladeGameWindow(BaseGameApp *gameApp, MarmaladeSystem *system)
|
||||
: GameWindow(gameApp)
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_system = system;
|
||||
m_active = FALSE;
|
||||
m_focused = FALSE;
|
||||
|
@ -31,7 +30,6 @@ MarmaladeGameWindow::MarmaladeGameWindow(BaseGameApp *gameApp, MarmaladeSystem *
|
|||
|
||||
MarmaladeGameWindow::~MarmaladeGameWindow()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_WINDOW, "Releasing.\n");
|
||||
if (!DestroyWindow())
|
||||
LOG_ERROR(LOGCAT_WINDOW, "Failed to destroy the EGL context.\n");
|
||||
|
@ -39,7 +37,6 @@ MarmaladeGameWindow::~MarmaladeGameWindow()
|
|||
|
||||
BOOL MarmaladeGameWindow::Create(GameWindowParams *params)
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_WINDOW, "Creating a window.\n");
|
||||
|
||||
LOG_INFO(LOGCAT_WINDOW, "Received window creation parameters:\n");
|
||||
|
@ -62,7 +59,6 @@ BOOL MarmaladeGameWindow::Create(GameWindowParams *params)
|
|||
|
||||
BOOL MarmaladeGameWindow::Resize(uint16_t width, uint16_t height)
|
||||
{
|
||||
STACK_TRACE;
|
||||
// note that the parameters are ignored completely because they don't really
|
||||
// make sense for our primary/only usage of Marmalade (mobile devices)
|
||||
// the parameters need to be there obviously because of the GameWindow parent
|
||||
|
@ -101,14 +97,12 @@ BOOL MarmaladeGameWindow::Resize(uint16_t width, uint16_t height)
|
|||
|
||||
BOOL MarmaladeGameWindow::ToggleFullscreen()
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(!"Not implemented.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL MarmaladeGameWindow::SetUpWindow()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!SetUpEGL())
|
||||
{
|
||||
LOG_ERROR(LOGCAT_WINDOW, "EGL setup not completed successfully.\n");
|
||||
|
@ -120,7 +114,6 @@ BOOL MarmaladeGameWindow::SetUpWindow()
|
|||
|
||||
BOOL MarmaladeGameWindow::DestroyWindow()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (!DestroyEGL())
|
||||
{
|
||||
LOG_ERROR(LOGCAT_WINDOW, "EGL destroy not completed successfully.\n");
|
||||
|
@ -132,7 +125,6 @@ BOOL MarmaladeGameWindow::DestroyWindow()
|
|||
|
||||
BOOL MarmaladeGameWindow::SetUpEGL()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_WINDOW, "Connecting to EGL display server.\n");
|
||||
EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
if (display == EGL_NO_DISPLAY)
|
||||
|
@ -321,7 +313,6 @@ BOOL MarmaladeGameWindow::SetUpEGL()
|
|||
|
||||
BOOL MarmaladeGameWindow::DestroyEGL()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_eglDisplay != EGL_NO_DISPLAY)
|
||||
{
|
||||
LOG_INFO(LOGCAT_WINDOW, "Destroying EGL context.\n");
|
||||
|
@ -362,7 +353,6 @@ BOOL MarmaladeGameWindow::DestroyEGL()
|
|||
|
||||
SCREEN_ORIENTATION_ANGLE MarmaladeGameWindow::GetCurrentScreenOrientationAngle()
|
||||
{
|
||||
STACK_TRACE;
|
||||
s3eSurfaceBlitDirection direction = (s3eSurfaceBlitDirection)s3eSurfaceGetInt(S3E_SURFACE_DEVICE_BLIT_DIRECTION);
|
||||
|
||||
SCREEN_ORIENTATION_ANGLE angle = SCREEN_ANGLE_0;
|
||||
|
@ -388,7 +378,6 @@ SCREEN_ORIENTATION_ANGLE MarmaladeGameWindow::GetCurrentScreenOrientationAngle()
|
|||
|
||||
void MarmaladeGameWindow::Close()
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (m_active)
|
||||
{
|
||||
LOG_INFO(LOGCAT_WINDOW, "Window marked inactive.\n");
|
||||
|
@ -404,7 +393,6 @@ void MarmaladeGameWindow::Close()
|
|||
|
||||
void MarmaladeGameWindow::ProcessEvent(const OSEvent *event)
|
||||
{
|
||||
STACK_TRACE;
|
||||
if (IsClosing())
|
||||
return;
|
||||
|
||||
|
|
|
@ -36,9 +36,7 @@ int32 _MarmaladeEventCallback_PointerMultitouchMotion(void *systemData, void *us
|
|||
int32_t _MarmaladeEvent_PassToSystem(MARMALADE_EVENT event, void *systemData, void *userData);
|
||||
|
||||
MarmaladeSystem::MarmaladeSystem()
|
||||
: OperatingSystem()
|
||||
{
|
||||
STACK_TRACE;
|
||||
m_isQuitting = FALSE;
|
||||
m_window = NULL;
|
||||
m_filesystem = NULL;
|
||||
|
@ -51,7 +49,6 @@ MarmaladeSystem::MarmaladeSystem()
|
|||
|
||||
MarmaladeSystem::~MarmaladeSystem()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_SYSTEM, "Releasing.\n");
|
||||
|
||||
if (!m_isQuitting)
|
||||
|
@ -70,7 +67,6 @@ MarmaladeSystem::~MarmaladeSystem()
|
|||
|
||||
BOOL MarmaladeSystem::Initialize()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_SYSTEM, "MarmaladeSystem initialization starting.\n");
|
||||
|
||||
const char* marmaladeRuntimeVersion = s3eDeviceGetString(S3E_DEVICE_SDK_VERSION);
|
||||
|
@ -227,7 +223,6 @@ BOOL MarmaladeSystem::Initialize()
|
|||
|
||||
BOOL MarmaladeSystem::CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *params)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(m_window == NULL);
|
||||
|
||||
MarmaladeGameWindow *window = new MarmaladeGameWindow(gameApp, this);
|
||||
|
@ -289,7 +284,6 @@ BOOL MarmaladeSystem::CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *p
|
|||
|
||||
void MarmaladeSystem::ProcessEvents()
|
||||
{
|
||||
STACK_TRACE;
|
||||
// need to manually reset deltas for the Mouse/Touchscreen device objects
|
||||
// since we use callbacks to get state updates. as a result of using
|
||||
// callbacks, the deltas won't ever get reset to zero when motion of these
|
||||
|
@ -310,7 +304,6 @@ void MarmaladeSystem::ProcessEvents()
|
|||
|
||||
int32_t MarmaladeSystem::OnEvent(const MarmaladeSystemEvent *eventArgs)
|
||||
{
|
||||
STACK_TRACE;
|
||||
switch (eventArgs->event)
|
||||
{
|
||||
case MARMALADE_EVENT_PAUSE:
|
||||
|
@ -391,7 +384,6 @@ int32_t MarmaladeSystem::OnEvent(const MarmaladeSystemEvent *eventArgs)
|
|||
|
||||
void MarmaladeSystem::Quit()
|
||||
{
|
||||
STACK_TRACE;
|
||||
LOG_INFO(LOGCAT_SYSTEM, "Quit requested.\n");
|
||||
m_isQuitting = TRUE;
|
||||
|
||||
|
@ -404,7 +396,6 @@ void MarmaladeSystem::Quit()
|
|||
|
||||
void MarmaladeSystem::Delay(uint32_t milliseconds) const
|
||||
{
|
||||
STACK_TRACE;
|
||||
unsigned int start = GetTicks();
|
||||
unsigned int elapsed = 0;
|
||||
|
||||
|
@ -477,7 +468,6 @@ int32 _MarmaladeEventCallback_PointerMultitouchMotion(void *systemData, void *us
|
|||
|
||||
int32_t _MarmaladeEvent_PassToSystem(MARMALADE_EVENT event, void *systemData, void *userData)
|
||||
{
|
||||
STACK_TRACE;
|
||||
MarmaladeSystemEvent eventArgs;
|
||||
eventArgs.event = event;
|
||||
eventArgs.data = systemData;
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
BoundingBox::BoundingBox(const Vector3 *vertices, int numVertices)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(vertices != NULL);
|
||||
ASSERT(numVertices > 0);
|
||||
float minX = 0.0f;
|
||||
|
@ -32,7 +31,6 @@ BoundingBox::BoundingBox(const Vector3 *vertices, int numVertices)
|
|||
|
||||
float BoundingBox::GetSquaredDistanceFromPointToBox(const Vector3 &point, const BoundingBox &box)
|
||||
{
|
||||
STACK_TRACE;
|
||||
float distanceSq = 0.0f;
|
||||
float v;
|
||||
|
||||
|
@ -59,6 +57,5 @@ float BoundingBox::GetSquaredDistanceFromPointToBox(const Vector3 &point, const
|
|||
|
||||
float BoundingBox::GetDistanceFromPointToBox(const Vector3 &point, const BoundingBox &box)
|
||||
{
|
||||
STACK_TRACE;
|
||||
return sqrtf(GetSquaredDistanceFromPointToBox(point, box));
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
BoundingSphere::BoundingSphere(const Vector3 *vertices, int numVertices)
|
||||
{
|
||||
STACK_TRACE;
|
||||
ASSERT(vertices != NULL);
|
||||
ASSERT(numVertices > 0);
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue