just use the built in bool type instead of a typedef around int32_t
I'd rather use this explicitly and then convert to a specific size data type when the size of the variable really matters (which is rare)
This commit is contained in:
parent
ac3f30e3db
commit
4ce9c3c53a
|
@ -19,20 +19,20 @@ ContentCache::ContentCache(ContentManager *contentManager)
|
|||
|
||||
ContentCache::~ContentCache()
|
||||
{
|
||||
m_contentManager->Free<Texture>(m_uiSkin, TRUE);
|
||||
m_contentManager->Free<Image>(m_uiSkinImage, TRUE);
|
||||
m_contentManager->Free<SpriteFont>(m_standardFont, TRUE);
|
||||
m_contentManager->Free<SpriteFont>(m_uiFont, TRUE);
|
||||
m_contentManager->Free<Texture>(m_uiSkin, true);
|
||||
m_contentManager->Free<Image>(m_uiSkinImage, true);
|
||||
m_contentManager->Free<SpriteFont>(m_standardFont, true);
|
||||
m_contentManager->Free<SpriteFont>(m_uiFont, true);
|
||||
}
|
||||
|
||||
void ContentCache::OnLoadGame()
|
||||
{
|
||||
m_uiSkinFilename = "assets://ui_skin.png";
|
||||
m_uiSkinImage = m_contentManager->Get<Image>(m_uiSkinFilename, TRUE);
|
||||
m_uiSkin = m_contentManager->Get<Texture>(m_uiSkinFilename, TRUE);
|
||||
m_standardFont = m_contentManager->Get<SpriteFont>("assets://fonts/dlxfont.ttf", SpriteFontParam(8), TRUE);
|
||||
m_uiSkinImage = m_contentManager->Get<Image>(m_uiSkinFilename, true);
|
||||
m_uiSkin = m_contentManager->Get<Texture>(m_uiSkinFilename, true);
|
||||
m_standardFont = m_contentManager->Get<SpriteFont>("assets://fonts/dlxfont.ttf", SpriteFontParam(8), true);
|
||||
m_uiFontFilename = "assets://fonts/dlxfont.ttf";
|
||||
m_uiFontSize = 8;
|
||||
m_uiFont = m_contentManager->Get<SpriteFont>(m_uiFontFilename, SpriteFontParam(m_uiFontSize), TRUE);
|
||||
m_uiFont = m_contentManager->Get<SpriteFont>(m_uiFontFilename, SpriteFontParam(m_uiFontSize), true);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,16 +28,16 @@ public:
|
|||
virtual void OnResize() {};
|
||||
virtual void OnUpdate(float delta) {};
|
||||
|
||||
BOOL IsActive() const { return m_isActive; }
|
||||
bool IsActive() const { return m_isActive; }
|
||||
void MarkInactive();
|
||||
|
||||
private:
|
||||
BOOL m_isActive;
|
||||
bool m_isActive;
|
||||
};
|
||||
|
||||
inline Effect::Effect()
|
||||
{
|
||||
m_isActive = TRUE;
|
||||
m_isActive = true;
|
||||
}
|
||||
|
||||
inline Effect::~Effect()
|
||||
|
@ -46,7 +46,7 @@ inline Effect::~Effect()
|
|||
|
||||
inline void Effect::MarkInactive()
|
||||
{
|
||||
m_isActive = FALSE;
|
||||
m_isActive = false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "effectinfo.h"
|
||||
#include "effect.h"
|
||||
|
||||
EffectInfo::EffectInfo(Effect *effect, BOOL isLocal)
|
||||
EffectInfo::EffectInfo(Effect *effect, bool isLocal)
|
||||
{
|
||||
ASSERT(effect != NULL);
|
||||
m_effect = effect;
|
||||
|
|
|
@ -8,15 +8,15 @@ class Effect;
|
|||
class EffectInfo
|
||||
{
|
||||
public:
|
||||
EffectInfo(Effect *effect, BOOL isLocal);
|
||||
EffectInfo(Effect *effect, bool isLocal);
|
||||
virtual ~EffectInfo();
|
||||
|
||||
Effect* GetEffect() const { return m_effect; }
|
||||
BOOL IsLocal() const { return m_isLocal; }
|
||||
bool IsLocal() const { return m_isLocal; }
|
||||
|
||||
private:
|
||||
Effect *m_effect;
|
||||
BOOL m_isLocal;
|
||||
bool m_isLocal;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
virtual ~EffectManager();
|
||||
|
||||
template<class T> T* Get() const;
|
||||
template<class T> T* Add(BOOL isLocalEffect = TRUE);
|
||||
template<class T> T* Add(bool isLocalEffect = true);
|
||||
template<class T> void Remove();
|
||||
void RemoveAll();
|
||||
|
||||
|
@ -56,7 +56,7 @@ T* EffectManager::Get() const
|
|||
}
|
||||
|
||||
template<class T>
|
||||
T* EffectManager::Add(BOOL isLocalEffect)
|
||||
T* EffectManager::Add(bool isLocalEffect)
|
||||
{
|
||||
if (Get<T>() != NULL)
|
||||
return NULL;
|
||||
|
|
|
@ -11,9 +11,9 @@ const Color DEFAULT_FADE_COLOR = COLOR_BLACK;
|
|||
|
||||
FadeEffect::FadeEffect()
|
||||
{
|
||||
m_doneFading = FALSE;
|
||||
m_doneFading = false;
|
||||
m_fadeSpeed = DEFAULT_FADE_SPEED;
|
||||
m_fadingOut = TRUE;
|
||||
m_fadingOut = true;
|
||||
m_alpha = 0.0f;
|
||||
m_color = DEFAULT_FADE_COLOR;
|
||||
m_fadeToAlpha = 0.0f;
|
||||
|
@ -48,7 +48,7 @@ void FadeEffect::OnUpdate(float delta)
|
|||
if (m_alpha >= m_fadeToAlpha)
|
||||
{
|
||||
m_alpha = m_fadeToAlpha;
|
||||
m_doneFading = TRUE;
|
||||
m_doneFading = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -57,7 +57,7 @@ void FadeEffect::OnUpdate(float delta)
|
|||
if (m_alpha < m_fadeToAlpha)
|
||||
{
|
||||
m_alpha = m_fadeToAlpha;
|
||||
m_doneFading = TRUE;
|
||||
m_doneFading = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,12 +24,12 @@ public:
|
|||
FadeEffect* SetFadeOut(float toAlpha = COLOR_ALPHA_OPAQUE);
|
||||
FadeEffect* SetFadeIn(float toAlpha = COLOR_ALPHA_TRANSPARENT);
|
||||
|
||||
BOOL IsDoneFading() const { return m_doneFading; }
|
||||
bool IsDoneFading() const { return m_doneFading; }
|
||||
|
||||
private:
|
||||
BOOL m_doneFading;
|
||||
bool m_doneFading;
|
||||
float m_fadeSpeed;
|
||||
BOOL m_fadingOut;
|
||||
bool m_fadingOut;
|
||||
float m_alpha;
|
||||
Color m_color;
|
||||
float m_fadeToAlpha;
|
||||
|
@ -49,7 +49,7 @@ inline FadeEffect* FadeEffect::SetFadeSpeed(float speed)
|
|||
|
||||
inline FadeEffect* FadeEffect::SetFadeOut(float toAlpha)
|
||||
{
|
||||
m_fadingOut = TRUE;
|
||||
m_fadingOut = true;
|
||||
m_alpha = COLOR_ALPHA_TRANSPARENT;
|
||||
m_fadeToAlpha = toAlpha;
|
||||
return this;
|
||||
|
@ -57,7 +57,7 @@ inline FadeEffect* FadeEffect::SetFadeOut(float toAlpha)
|
|||
|
||||
inline FadeEffect* FadeEffect::SetFadeIn(float toAlpha)
|
||||
{
|
||||
m_fadingOut = FALSE;
|
||||
m_fadingOut = false;
|
||||
m_alpha = COLOR_ALPHA_OPAQUE;
|
||||
m_fadeToAlpha = toAlpha;
|
||||
return this;
|
||||
|
|
|
@ -11,7 +11,7 @@ const float DEFAULT_MAX_INTENSITY = 1.0f;
|
|||
|
||||
FlashEffect::FlashEffect()
|
||||
{
|
||||
m_flashingIn = TRUE;
|
||||
m_flashingIn = true;
|
||||
m_flashInSpeed = DEFAULT_FLASH_SPEED;
|
||||
m_flashOutSpeed = DEFAULT_FLASH_SPEED;
|
||||
m_maximumIntensity = DEFAULT_MAX_INTENSITY;
|
||||
|
@ -45,7 +45,7 @@ void FlashEffect::OnUpdate(float delta)
|
|||
if (m_alpha >= m_maximumIntensity)
|
||||
{
|
||||
m_alpha = m_maximumIntensity;
|
||||
m_flashingIn = FALSE;
|
||||
m_flashingIn = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -55,7 +55,7 @@ void FlashEffect::OnUpdate(float delta)
|
|||
m_alpha = 0.0f;
|
||||
}
|
||||
|
||||
if (m_alpha == 0.0f && m_flashingIn == FALSE)
|
||||
if (m_alpha == 0.0f && m_flashingIn == false)
|
||||
MarkInactive();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
FlashEffect* SetMaximumIntensity(float maxIntensity);
|
||||
|
||||
private:
|
||||
BOOL m_flashingIn;
|
||||
bool m_flashingIn;
|
||||
float m_flashInSpeed;
|
||||
float m_flashOutSpeed;
|
||||
float m_maximumIntensity;
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
virtual void OnResize() {}
|
||||
virtual void OnUpdate(float delta) {}
|
||||
|
||||
virtual BOOL Handle(const Event *event);
|
||||
virtual bool Handle(const Event *event);
|
||||
|
||||
protected:
|
||||
ComponentSystem(EntityManager *entityManager, EventManager *eventManager);
|
||||
|
@ -46,9 +46,9 @@ inline ComponentSystem::~ComponentSystem()
|
|||
{
|
||||
}
|
||||
|
||||
inline BOOL ComponentSystem::Handle(const Event *event)
|
||||
inline bool ComponentSystem::Handle(const Event *event)
|
||||
{
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -15,10 +15,10 @@ public:
|
|||
template<class T> T* Get() const;
|
||||
template<class T> T* Add();
|
||||
template<class T> void Remove();
|
||||
template<class T> BOOL Has() const;
|
||||
template<class T> bool Has() const;
|
||||
|
||||
template<class T> BOOL WasCreatedUsingPreset() const;
|
||||
BOOL WasCreatedUsingPreset(ENTITYPRESET_TYPE type) const;
|
||||
template<class T> bool WasCreatedUsingPreset() const;
|
||||
bool WasCreatedUsingPreset(ENTITYPRESET_TYPE type) const;
|
||||
|
||||
protected:
|
||||
EntityManager *m_entityManager;
|
||||
|
@ -43,18 +43,18 @@ inline void Entity::Remove()
|
|||
}
|
||||
|
||||
template<class T>
|
||||
inline BOOL Entity::Has() const
|
||||
inline bool Entity::Has() const
|
||||
{
|
||||
return m_entityManager->HasComponent<T>(this);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline BOOL Entity::WasCreatedUsingPreset() const
|
||||
inline bool Entity::WasCreatedUsingPreset() const
|
||||
{
|
||||
return m_entityManager->WasCreatedUsingPreset<T>(this);
|
||||
}
|
||||
|
||||
inline BOOL Entity::WasCreatedUsingPreset(ENTITYPRESET_TYPE type) const
|
||||
inline bool Entity::WasCreatedUsingPreset(ENTITYPRESET_TYPE type) const
|
||||
{
|
||||
return m_entityManager->WasCreatedUsingPreset(this, type);
|
||||
}
|
||||
|
|
|
@ -65,15 +65,15 @@ Entity* EntityManager::AddUsingPreset(ENTITYPRESET_TYPE preset, EntityPresetArgs
|
|||
return entity;
|
||||
}
|
||||
|
||||
BOOL EntityManager::WasCreatedUsingPreset(const Entity *entity, ENTITYPRESET_TYPE type) const
|
||||
bool EntityManager::WasCreatedUsingPreset(const Entity *entity, ENTITYPRESET_TYPE type) const
|
||||
{
|
||||
ASSERT(entity != NULL);
|
||||
ASSERT(type != NULL);
|
||||
EntityPresetComponent *preset = entity->Get<EntityPresetComponent>();
|
||||
if (preset != NULL && preset->preset == type)
|
||||
return TRUE;
|
||||
return true;
|
||||
else
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void EntityManager::Remove(Entity *entity)
|
||||
|
@ -118,17 +118,17 @@ void EntityManager::RemoveAllComponentsFrom(Entity *entity)
|
|||
}
|
||||
}
|
||||
|
||||
BOOL EntityManager::IsValid(const Entity *entity) const
|
||||
bool EntityManager::IsValid(const Entity *entity) const
|
||||
{
|
||||
if (entity == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// HACK: lol, this cast is aboslutely terrible and I shouldn't be doing this
|
||||
EntitySet::const_iterator i = m_entities.find((Entity*)entity);
|
||||
if (i == m_entities.end())
|
||||
return FALSE;
|
||||
return false;
|
||||
else
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void EntityManager::GetAllComponentsFor(const Entity *entity, ComponentList &list) const
|
||||
|
|
|
@ -47,23 +47,23 @@ public:
|
|||
Entity* AddUsingPreset(ENTITYPRESET_TYPE type, EntityPresetArgs *args = NULL);
|
||||
template<class T> Entity* GetWith() const;
|
||||
template<class T> void GetAllWith(EntityList &matches) const;
|
||||
template<class T> BOOL WasCreatedUsingPreset(Entity *entity) const;
|
||||
BOOL WasCreatedUsingPreset(const Entity *entity, ENTITYPRESET_TYPE type) const;
|
||||
template<class T> bool WasCreatedUsingPreset(Entity *entity) const;
|
||||
bool WasCreatedUsingPreset(const Entity *entity, ENTITYPRESET_TYPE type) const;
|
||||
void Remove(Entity *entity);
|
||||
void RemoveAll();
|
||||
BOOL IsValid(const Entity *entity) const;
|
||||
bool IsValid(const Entity *entity) const;
|
||||
uint GetNumEntities() const { return m_entities.size(); }
|
||||
|
||||
template<class T> T* AddComponent(Entity *entity);
|
||||
template<class T> T* GetComponent(const Entity *entity) const;
|
||||
template<class T> void RemoveComponent(Entity *entity);
|
||||
template<class T> BOOL HasComponent(const Entity *entity) const;
|
||||
template<class T> bool HasComponent(const Entity *entity) const;
|
||||
void GetAllComponentsFor(const Entity *entity, ComponentList &list) const;
|
||||
|
||||
template<class T> T* AddGlobalComponent();
|
||||
template<class T> T* GetGlobalComponent() const;
|
||||
template<class T> void RemoveGlobalComponent();
|
||||
template<class T> BOOL HasGlobalComponent() const;
|
||||
template<class T> bool HasGlobalComponent() const;
|
||||
void RemoveAllGlobalComponents();
|
||||
|
||||
void OnLostContext();
|
||||
|
@ -201,18 +201,18 @@ void EntityManager::RemoveComponent(Entity *entity)
|
|||
}
|
||||
|
||||
template<class T>
|
||||
BOOL EntityManager::HasComponent(const Entity *entity) const
|
||||
bool EntityManager::HasComponent(const Entity *entity) const
|
||||
{
|
||||
ComponentStore::const_iterator i = m_components.find(T::GetType());
|
||||
if (i == m_components.end())
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
const EntityComponentsMap &entitiesWithComponent = i->second;
|
||||
EntityComponentsMap::const_iterator j = entitiesWithComponent.find(entity);
|
||||
if (j == entitiesWithComponent.end())
|
||||
return FALSE;
|
||||
return false;
|
||||
else
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
@ -246,13 +246,13 @@ void EntityManager::RemoveGlobalComponent()
|
|||
}
|
||||
|
||||
template<class T>
|
||||
BOOL EntityManager::HasGlobalComponent() const
|
||||
bool EntityManager::HasGlobalComponent() const
|
||||
{
|
||||
GlobalComponentStore::const_iterator i = m_globalComponents.find(T::GetType());
|
||||
if (i == m_globalComponents.end())
|
||||
return FALSE;
|
||||
return false;
|
||||
else
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
@ -282,7 +282,7 @@ void EntityManager::GetAllWith(EntityList &matches) const
|
|||
}
|
||||
|
||||
template<class T>
|
||||
BOOL EntityManager::WasCreatedUsingPreset(Entity *entity) const
|
||||
bool EntityManager::WasCreatedUsingPreset(Entity *entity) const
|
||||
{
|
||||
return WasCreatedUsingPreset(entity, T::GetType());
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ struct Event;
|
|||
class EventListener
|
||||
{
|
||||
public:
|
||||
virtual BOOL Handle(const Event *event) = 0;
|
||||
virtual bool Handle(const Event *event) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,12 +13,12 @@ public:
|
|||
EventListenerEx(EventManager *eventManager);
|
||||
virtual ~EventListenerEx();
|
||||
|
||||
template<class T> BOOL ListenFor();
|
||||
template<class T> BOOL StopListeningFor();
|
||||
BOOL ListenFor(EVENT_TYPE type);
|
||||
BOOL StopListeningFor(EVENT_TYPE type);
|
||||
template<class T> bool ListenFor();
|
||||
template<class T> bool StopListeningFor();
|
||||
bool ListenFor(EVENT_TYPE type);
|
||||
bool StopListeningFor(EVENT_TYPE type);
|
||||
|
||||
virtual BOOL Handle(const Event *event) = 0;
|
||||
virtual bool Handle(const Event *event) = 0;
|
||||
|
||||
EventManager* GetEventManager() const { return m_eventManager; }
|
||||
|
||||
|
@ -36,23 +36,23 @@ inline EventListenerEx::~EventListenerEx()
|
|||
}
|
||||
|
||||
template<class T>
|
||||
inline BOOL EventListenerEx::ListenFor()
|
||||
inline bool EventListenerEx::ListenFor()
|
||||
{
|
||||
return m_eventManager->AddListener<T>(this);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline BOOL EventListenerEx::StopListeningFor()
|
||||
inline bool EventListenerEx::StopListeningFor()
|
||||
{
|
||||
return m_eventManager->RemoveListener<T>(this);
|
||||
}
|
||||
|
||||
inline BOOL EventListenerEx::ListenFor(EVENT_TYPE type)
|
||||
inline bool EventListenerEx::ListenFor(EVENT_TYPE type)
|
||||
{
|
||||
return m_eventManager->AddListener(this, type);
|
||||
}
|
||||
|
||||
inline BOOL EventListenerEx::StopListeningFor(EVENT_TYPE type)
|
||||
inline bool EventListenerEx::StopListeningFor(EVENT_TYPE type)
|
||||
{
|
||||
return m_eventManager->RemoveListener(this, type);
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ EventLogger::~EventLogger()
|
|||
{
|
||||
}
|
||||
|
||||
BOOL EventLogger::Handle(const Event *event)
|
||||
bool EventLogger::Handle(const Event *event)
|
||||
{
|
||||
LOG_INFO("EVENTLOGGER", "Event \"%s\" occurred.\n", event->GetTypeOf());
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public:
|
|||
EventLogger(EventManager *eventManager);
|
||||
virtual ~EventLogger();
|
||||
|
||||
BOOL Handle(const Event *event);
|
||||
bool Handle(const Event *event);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,7 +13,7 @@ EventManager::~EventManager()
|
|||
{
|
||||
}
|
||||
|
||||
BOOL EventManager::AddListener(EventListener *listener, EVENT_TYPE type)
|
||||
bool EventManager::AddListener(EventListener *listener, EVENT_TYPE type)
|
||||
{
|
||||
// TODO: validate type
|
||||
|
||||
|
@ -22,7 +22,7 @@ BOOL EventManager::AddListener(EventListener *listener, EVENT_TYPE type)
|
|||
{
|
||||
// need to register this listener for the given type
|
||||
EventListenerMapIRes result = m_registry.insert(EventListenerMapEnt(type, EventListenerTable()));
|
||||
ASSERT(result.second != FALSE);
|
||||
ASSERT(result.second != false);
|
||||
ASSERT(result.first != m_registry.end());
|
||||
|
||||
listenerItor = result.first;
|
||||
|
@ -40,19 +40,19 @@ BOOL EventManager::AddListener(EventListener *listener, EVENT_TYPE type)
|
|||
// also update the list of currently registered event types
|
||||
m_typeList.insert(type);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL EventManager::RemoveListener(EventListener *listener, EVENT_TYPE type)
|
||||
bool EventManager::RemoveListener(EventListener *listener, EVENT_TYPE type)
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
bool result = false;
|
||||
|
||||
// TODO: validate type
|
||||
|
||||
// get the list of listeners for the given event type
|
||||
EventListenerMap::iterator itor = m_registry.find(type);
|
||||
if (itor == m_registry.end())
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// check this list for the specified listener
|
||||
EventListenerTable &table = itor->second;
|
||||
|
@ -62,7 +62,7 @@ BOOL EventManager::RemoveListener(EventListener *listener, EVENT_TYPE type)
|
|||
{
|
||||
// found the listener
|
||||
table.erase(j);
|
||||
result = TRUE;
|
||||
result = true;
|
||||
|
||||
// if there are no more listeners for this type, remove the type from the list of registered event types
|
||||
if (table.size() == 0)
|
||||
|
@ -76,7 +76,7 @@ BOOL EventManager::RemoveListener(EventListener *listener, EVENT_TYPE type)
|
|||
return result;
|
||||
}
|
||||
|
||||
BOOL EventManager::Trigger(const Event *event) const
|
||||
bool EventManager::Trigger(const Event *event) const
|
||||
{
|
||||
// TODO: validate type
|
||||
|
||||
|
@ -95,9 +95,9 @@ BOOL EventManager::Trigger(const Event *event) const
|
|||
// find the listener list for the event type
|
||||
EventListenerMap::const_iterator itor = m_registry.find(event->GetTypeOf());
|
||||
if (itor == m_registry.end())
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
BOOL result = FALSE;
|
||||
bool result = false;
|
||||
|
||||
// trigger the event in each listener
|
||||
const EventListenerTable &table = itor->second;
|
||||
|
@ -106,15 +106,15 @@ BOOL EventManager::Trigger(const Event *event) const
|
|||
EventListener *listener = *i;
|
||||
if (listener->Handle(event))
|
||||
{
|
||||
// only return TRUE if a listener signals they handled the event
|
||||
result = TRUE;
|
||||
// only return true if a listener signals they handled the event
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL EventManager::Queue(const Event *event)
|
||||
bool EventManager::Queue(const Event *event)
|
||||
{
|
||||
ASSERT(m_activeQueue >= 0);
|
||||
ASSERT(m_activeQueue < NUM_EVENT_QUEUES);
|
||||
|
@ -129,15 +129,15 @@ BOOL EventManager::Queue(const Event *event)
|
|||
if (wildcardItor == m_registry.end())
|
||||
{
|
||||
// no wildcard listener either... useless event!
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
m_queues[m_activeQueue].push_back(event);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL EventManager::Abort(EVENT_TYPE type, BOOL allOfType)
|
||||
bool EventManager::Abort(EVENT_TYPE type, bool allOfType)
|
||||
{
|
||||
ASSERT(m_activeQueue >= 0);
|
||||
ASSERT(m_activeQueue < NUM_EVENT_QUEUES);
|
||||
|
@ -146,9 +146,9 @@ BOOL EventManager::Abort(EVENT_TYPE type, BOOL allOfType)
|
|||
|
||||
EventListenerMap::iterator itor = m_registry.find(type);
|
||||
if (itor == m_registry.end())
|
||||
return FALSE; // no listeners for this type
|
||||
return false; // no listeners for this type
|
||||
|
||||
BOOL result = FALSE;
|
||||
bool result = false;
|
||||
|
||||
EventQueue &queue = m_queues[m_activeQueue];
|
||||
for (EventQueue::iterator i = queue.begin(); i != queue.end(); ++i)
|
||||
|
@ -158,7 +158,7 @@ BOOL EventManager::Abort(EVENT_TYPE type, BOOL allOfType)
|
|||
{
|
||||
// found a match, remove it from the queue
|
||||
i = queue.erase(i);
|
||||
result = TRUE;
|
||||
result = true;
|
||||
|
||||
if (!allOfType)
|
||||
break;
|
||||
|
@ -170,7 +170,7 @@ BOOL EventManager::Abort(EVENT_TYPE type, BOOL allOfType)
|
|||
return result;
|
||||
}
|
||||
|
||||
BOOL EventManager::ProcessQueue()
|
||||
bool EventManager::ProcessQueue()
|
||||
{
|
||||
EventListenerMap::const_iterator wildcardItor = m_registry.find(EVENT_TYPE_WILDCARD);
|
||||
|
||||
|
@ -227,10 +227,10 @@ BOOL EventManager::ProcessQueue()
|
|||
m_queues[m_activeQueue].push_front(event);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
EventListenerList EventManager::GetListenerList(EVENT_TYPE type) const
|
||||
|
|
|
@ -23,17 +23,17 @@ public:
|
|||
EventManager();
|
||||
virtual ~EventManager();
|
||||
|
||||
template<class T> BOOL AddListener(EventListener *listener);
|
||||
template<class T> BOOL RemoveListener(EventListener *listener);
|
||||
BOOL AddListener(EventListener *listener, EVENT_TYPE type);
|
||||
BOOL RemoveListener(EventListener *listener, EVENT_TYPE type);
|
||||
template<class T> bool AddListener(EventListener *listener);
|
||||
template<class T> bool RemoveListener(EventListener *listener);
|
||||
bool AddListener(EventListener *listener, EVENT_TYPE type);
|
||||
bool RemoveListener(EventListener *listener, EVENT_TYPE type);
|
||||
|
||||
BOOL Trigger(const Event *event) const;
|
||||
BOOL Queue(const Event *event);
|
||||
template<class T> BOOL Abort(BOOL allOfType = FALSE);
|
||||
BOOL Abort(EVENT_TYPE type, BOOL allOfType = FALSE);
|
||||
bool Trigger(const Event *event) const;
|
||||
bool Queue(const Event *event);
|
||||
template<class T> bool Abort(bool allOfType = false);
|
||||
bool Abort(EVENT_TYPE type, bool allOfType = false);
|
||||
|
||||
BOOL ProcessQueue();
|
||||
bool ProcessQueue();
|
||||
|
||||
template<class T> EventListenerList GetListenerList() const;
|
||||
EventListenerList GetListenerList(EVENT_TYPE type) const;
|
||||
|
@ -41,11 +41,11 @@ public:
|
|||
|
||||
private:
|
||||
typedef stl::set<EVENT_TYPE> EventTypeSet;
|
||||
typedef stl::pair<EventTypeSet::iterator, BOOL> EventTypeSetIRes;
|
||||
typedef stl::pair<EventTypeSet::iterator, bool> EventTypeSetIRes;
|
||||
typedef stl::list<EventListener*> EventListenerTable;
|
||||
typedef stl::map<EVENT_TYPE, EventListenerTable> EventListenerMap;
|
||||
typedef stl::pair<EVENT_TYPE, EventListenerTable> EventListenerMapEnt;
|
||||
typedef stl::pair<EventListenerMap::iterator, BOOL> EventListenerMapIRes;
|
||||
typedef stl::pair<EventListenerMap::iterator, bool> EventListenerMapIRes;
|
||||
typedef stl::list<const Event*> EventQueue;
|
||||
|
||||
EventTypeSet m_typeList;
|
||||
|
@ -55,19 +55,19 @@ private:
|
|||
};
|
||||
|
||||
template<class T>
|
||||
BOOL EventManager::AddListener(EventListener *listener)
|
||||
bool EventManager::AddListener(EventListener *listener)
|
||||
{
|
||||
return AddListener(listener, T::GetType());
|
||||
}
|
||||
|
||||
template<class T>
|
||||
BOOL EventManager::RemoveListener(EventListener *listener)
|
||||
bool EventManager::RemoveListener(EventListener *listener)
|
||||
{
|
||||
return RemoveListener(listener, T::GetType());
|
||||
}
|
||||
|
||||
template<class T>
|
||||
BOOL EventManager::Abort(BOOL allOfType)
|
||||
bool EventManager::Abort(bool allOfType)
|
||||
{
|
||||
return Abort(T::GetType(), allOfType);
|
||||
}
|
||||
|
|
|
@ -18,12 +18,12 @@ KeyframeMeshInstance::KeyframeMeshInstance(KeyframeMesh *mesh)
|
|||
|
||||
m_currentSequenceStart = 0;
|
||||
m_currentSequenceEnd = 0;
|
||||
m_currentSequenceLoop = FALSE;
|
||||
m_currentSequenceLoop = false;
|
||||
m_thisFrame = 0;
|
||||
m_nextFrame = 0;
|
||||
m_interpolation = 0.0f;
|
||||
m_isRunningTempSequence = FALSE;
|
||||
m_oldSequenceLoop = FALSE;
|
||||
m_isRunningTempSequence = false;
|
||||
m_oldSequenceLoop = false;
|
||||
}
|
||||
|
||||
KeyframeMeshInstance::~KeyframeMeshInstance()
|
||||
|
@ -71,7 +71,7 @@ void KeyframeMeshInstance::OnUpdate(float delta)
|
|||
}
|
||||
}
|
||||
|
||||
void KeyframeMeshInstance::SetSequence(uint startFrame, uint endFrame, BOOL loop)
|
||||
void KeyframeMeshInstance::SetSequence(uint startFrame, uint endFrame, bool loop)
|
||||
{
|
||||
m_currentSequenceName.clear();
|
||||
m_currentSequenceStart = startFrame;
|
||||
|
@ -86,7 +86,7 @@ void KeyframeMeshInstance::SetSequence(uint startFrame, uint endFrame, BOOL loop
|
|||
m_interpolation = 0.0f;
|
||||
}
|
||||
|
||||
void KeyframeMeshInstance::SetSequence(const stl::string &name, BOOL loop)
|
||||
void KeyframeMeshInstance::SetSequence(const stl::string &name, bool loop)
|
||||
{
|
||||
if (m_currentSequenceName == name)
|
||||
return;
|
||||
|
@ -105,14 +105,14 @@ void KeyframeMeshInstance::RunSequenceOnce(const stl::string &name)
|
|||
m_oldSequenceName = m_currentSequenceName;
|
||||
m_oldSequenceLoop = m_currentSequenceLoop;
|
||||
|
||||
m_isRunningTempSequence = TRUE;
|
||||
m_isRunningTempSequence = true;
|
||||
|
||||
SetSequence(name, FALSE);
|
||||
SetSequence(name, false);
|
||||
}
|
||||
|
||||
void KeyframeMeshInstance::RecoverFromTempSequence()
|
||||
{
|
||||
m_isRunningTempSequence = FALSE;
|
||||
m_isRunningTempSequence = false;
|
||||
SetSequence(m_oldSequenceName, m_oldSequenceLoop);
|
||||
m_oldSequenceName.clear();
|
||||
m_oldSequenceLoop = false;
|
||||
|
|
|
@ -33,18 +33,18 @@ public:
|
|||
* Sets the current animation sequence.
|
||||
* @param startFrame the first frame of the sequence
|
||||
* @param endFrame the last frame of the sequence
|
||||
* @param loop TRUE to loop the sequence, FALSE to stop when done
|
||||
* @param loop true to loop the sequence, false to stop when done
|
||||
* and leave the current frame as the end frame
|
||||
*/
|
||||
void SetSequence(uint startFrame, uint endFrame, BOOL loop);
|
||||
void SetSequence(uint startFrame, uint endFrame, bool loop);
|
||||
|
||||
/**
|
||||
* Sets the current animation sequence.
|
||||
* @param name the name of the sequence from the mesh's list of sequences
|
||||
* @param loop TRUE to loop the sequence, FALSE to stop when done
|
||||
* @param loop true to loop the sequence, false to stop when done
|
||||
* and leave the current frame as the end frame
|
||||
*/
|
||||
void SetSequence(const stl::string &name, BOOL loop);
|
||||
void SetSequence(const stl::string &name, bool loop);
|
||||
|
||||
/**
|
||||
* Temporarily override the current animation sequence to run the specified
|
||||
|
@ -99,13 +99,13 @@ private:
|
|||
stl::string m_currentSequenceName;
|
||||
uint m_currentSequenceStart;
|
||||
uint m_currentSequenceEnd;
|
||||
BOOL m_currentSequenceLoop;
|
||||
bool m_currentSequenceLoop;
|
||||
uint m_thisFrame;
|
||||
uint m_nextFrame;
|
||||
float m_interpolation;
|
||||
BOOL m_isRunningTempSequence;
|
||||
bool m_isRunningTempSequence;
|
||||
stl::string m_oldSequenceName;
|
||||
BOOL m_oldSequenceLoop;
|
||||
bool m_oldSequenceLoop;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,34 +23,34 @@ KeyframeMeshRenderer::~KeyframeMeshRenderer()
|
|||
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, VertexLerpShader *shader)
|
||||
{
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
ASSERT(shader->IsBound() == true);
|
||||
instance->GetRenderState()->Apply();
|
||||
Render(graphicsDevice, instance->GetMesh(), instance->GetTexture(), instance->GetCurrentFrame(), instance->GetNextFrame(), instance->GetInterpolation(), shader);
|
||||
}
|
||||
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint frame, VertexLerpShader *shader)
|
||||
{
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
ASSERT(shader->IsBound() == true);
|
||||
instance->GetRenderState()->Apply();
|
||||
Render(graphicsDevice, instance->GetMesh(), instance->GetTexture(), frame, shader);
|
||||
}
|
||||
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint startFrame, uint endFrame, float interpolation, VertexLerpShader *shader)
|
||||
{
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
ASSERT(shader->IsBound() == true);
|
||||
instance->GetRenderState()->Apply();
|
||||
Render(graphicsDevice, instance->GetMesh(), instance->GetTexture(), instance->GetCurrentFrame(), instance->GetNextFrame(), instance->GetInterpolation(), shader);
|
||||
}
|
||||
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, VertexLerpShader *shader)
|
||||
{
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
ASSERT(shader->IsBound() == true);
|
||||
Render(graphicsDevice, mesh, texture, 0, shader);
|
||||
}
|
||||
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint frame, VertexLerpShader *shader)
|
||||
{
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
ASSERT(shader->IsBound() == true);
|
||||
SetFrameVertices(mesh, frame);
|
||||
|
||||
if (texture != NULL)
|
||||
|
@ -65,7 +65,7 @@ void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *
|
|||
|
||||
void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint startFrame, uint endFrame, float interpolation, VertexLerpShader *shader)
|
||||
{
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
ASSERT(shader->IsBound() == true);
|
||||
SetFrameVertices(mesh, startFrame, endFrame);
|
||||
|
||||
if (texture != NULL)
|
||||
|
|
|
@ -113,13 +113,13 @@ void SkeletalMesh::FindAndSetRootJointIndex()
|
|||
}
|
||||
|
||||
// ensure it has child joints
|
||||
BOOL hasChildJoints = FALSE;
|
||||
bool hasChildJoints = false;
|
||||
for (uint i = 0; i < m_numJoints; ++i)
|
||||
{
|
||||
int parentIndex = m_joints[i].parentIndex;
|
||||
if (parentIndex == parentlessJoint)
|
||||
{
|
||||
hasChildJoints = TRUE;
|
||||
hasChildJoints = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,12 +12,12 @@ SkeletalMeshAnimationInstance::SkeletalMeshAnimationInstance(SkeletalMesh *mesh)
|
|||
{
|
||||
m_currentSequenceStart = 0;
|
||||
m_currentSequenceEnd = 0;
|
||||
m_currentSequenceLoop = FALSE;
|
||||
m_currentSequenceLoop = false;
|
||||
m_thisFrame = 0;
|
||||
m_nextFrame = 0;
|
||||
m_interpolation = 0.0f;
|
||||
m_isRunningTempSequence = FALSE;
|
||||
m_oldSequenceLoop = FALSE;
|
||||
m_isRunningTempSequence = false;
|
||||
m_oldSequenceLoop = false;
|
||||
}
|
||||
|
||||
SkeletalMeshAnimationInstance::~SkeletalMeshAnimationInstance()
|
||||
|
@ -65,7 +65,7 @@ void SkeletalMeshAnimationInstance::OnUpdate(float delta)
|
|||
}
|
||||
}
|
||||
|
||||
void SkeletalMeshAnimationInstance::SetSequence(uint startFrame, uint endFrame, BOOL loop)
|
||||
void SkeletalMeshAnimationInstance::SetSequence(uint startFrame, uint endFrame, bool loop)
|
||||
{
|
||||
m_currentSequenceName.clear();
|
||||
m_currentSequenceStart = startFrame;
|
||||
|
@ -80,7 +80,7 @@ void SkeletalMeshAnimationInstance::SetSequence(uint startFrame, uint endFrame,
|
|||
m_interpolation = 0.0f;
|
||||
}
|
||||
|
||||
void SkeletalMeshAnimationInstance::SetSequence(const stl::string &name, BOOL loop)
|
||||
void SkeletalMeshAnimationInstance::SetSequence(const stl::string &name, bool loop)
|
||||
{
|
||||
if (m_currentSequenceName == name)
|
||||
return;
|
||||
|
@ -98,14 +98,14 @@ void SkeletalMeshAnimationInstance::RunSequenceOnce(const stl::string &name)
|
|||
m_oldSequenceName = m_currentSequenceName;
|
||||
m_oldSequenceLoop = m_currentSequenceLoop;
|
||||
|
||||
m_isRunningTempSequence = TRUE;
|
||||
m_isRunningTempSequence = true;
|
||||
|
||||
SetSequence(name, FALSE);
|
||||
SetSequence(name, false);
|
||||
}
|
||||
|
||||
void SkeletalMeshAnimationInstance::RecoverFromTempSequence()
|
||||
{
|
||||
m_isRunningTempSequence = FALSE;
|
||||
m_isRunningTempSequence = false;
|
||||
SetSequence(m_oldSequenceName, m_oldSequenceLoop);
|
||||
m_oldSequenceName.clear();
|
||||
m_oldSequenceLoop = false;
|
||||
|
|
|
@ -14,8 +14,8 @@ public:
|
|||
virtual ~SkeletalMeshAnimationInstance();
|
||||
|
||||
void OnUpdate(float delta);
|
||||
void SetSequence(uint startFrame, uint endFrame, BOOL loop);
|
||||
void SetSequence(const stl::string &name, BOOL loop);
|
||||
void SetSequence(uint startFrame, uint endFrame, bool loop);
|
||||
void SetSequence(const stl::string &name, bool loop);
|
||||
void RunSequenceOnce(const stl::string &name);
|
||||
|
||||
uint GetCurrentFrame() const { return m_thisFrame; }
|
||||
|
@ -28,13 +28,13 @@ private:
|
|||
stl::string m_currentSequenceName;
|
||||
uint m_currentSequenceStart;
|
||||
uint m_currentSequenceEnd;
|
||||
BOOL m_currentSequenceLoop;
|
||||
bool m_currentSequenceLoop;
|
||||
uint m_thisFrame;
|
||||
uint m_nextFrame;
|
||||
float m_interpolation;
|
||||
BOOL m_isRunningTempSequence;
|
||||
bool m_isRunningTempSequence;
|
||||
stl::string m_oldSequenceName;
|
||||
BOOL m_oldSequenceLoop;
|
||||
bool m_oldSequenceLoop;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -43,8 +43,8 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh()
|
|||
ASSERT(jointsDesc != NULL);
|
||||
ASSERT(jointsToVerticesDesc != NULL);
|
||||
|
||||
BOOL hasNormals = (normalsDesc != NULL ? TRUE : FALSE);
|
||||
BOOL hasTexCoords = (texCoordsDesc != NULL ? TRUE : FALSE);
|
||||
bool hasNormals = (normalsDesc != NULL ? true : false);
|
||||
bool hasTexCoords = (texCoordsDesc != NULL ? true : false);
|
||||
|
||||
File *file = GetFile();
|
||||
SkeletalMesh *mesh = new SkeletalMesh();
|
||||
|
@ -116,12 +116,12 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh()
|
|||
{
|
||||
stl::string name;
|
||||
stl::string texture;
|
||||
BOOL alpha;
|
||||
bool alpha;
|
||||
uint numTriangles;
|
||||
|
||||
file->ReadString(name);
|
||||
file->ReadString(texture);
|
||||
alpha = file->ReadChar() == 0 ? FALSE : TRUE;
|
||||
alpha = file->ReadChar() == 0 ? false : true;
|
||||
numTriangles = file->ReadUnsignedInt();
|
||||
|
||||
mesh->m_subsets[i].Create(name, numTriangles, alpha);
|
||||
|
|
|
@ -19,25 +19,25 @@ SkeletalMeshInstance::SkeletalMeshInstance(SkeletalMesh *mesh)
|
|||
|
||||
m_numSubsets = m_mesh->GetNumSubsets();
|
||||
|
||||
m_enabledSubsets = new BOOL[m_numSubsets];
|
||||
m_enabledSubsets = new bool[m_numSubsets];
|
||||
m_textures = new Texture*[m_numSubsets];
|
||||
|
||||
for (uint i = 0; i < m_numSubsets; ++i)
|
||||
{
|
||||
m_enabledSubsets[i] = TRUE;
|
||||
m_enabledSubsets[i] = true;
|
||||
m_textures[i] = NULL;
|
||||
}
|
||||
|
||||
m_renderState = new RENDERSTATE_DEFAULT;
|
||||
m_blendState = new BLENDSTATE_DEFAULT;
|
||||
m_alphaBlendState = new BLENDSTATE_ALPHABLEND;
|
||||
m_renderAllSubsetsAlphaBlended = FALSE;
|
||||
m_renderAllSubsetsAlphaBlended = false;
|
||||
|
||||
m_numJoints = mesh->GetNumJoints();
|
||||
m_jointTransformations = new Matrix4x4[m_numJoints];
|
||||
m_jointPositions = new Vector3[m_numJoints];
|
||||
m_jointRotations = new Quaternion[m_numJoints];
|
||||
m_rootJointHasFixedTransform = FALSE;
|
||||
m_rootJointHasFixedTransform = false;
|
||||
}
|
||||
|
||||
SkeletalMeshInstance::~SkeletalMeshInstance()
|
||||
|
@ -68,14 +68,14 @@ const Matrix4x4* SkeletalMeshInstance::GetJointTransformation(const stl::string
|
|||
void SkeletalMeshInstance::SetFixedRootJointTransformation(const Matrix4x4 &transform)
|
||||
{
|
||||
ASSERT(GetMesh()->GetRootJointIndex() != NO_JOINT);
|
||||
m_rootJointHasFixedTransform = TRUE;
|
||||
m_rootJointHasFixedTransform = true;
|
||||
m_jointTransformations[GetMesh()->GetRootJointIndex()] = transform;
|
||||
}
|
||||
|
||||
void SkeletalMeshInstance::ClearFixedRootJointTransformation()
|
||||
{
|
||||
ASSERT(GetMesh()->GetRootJointIndex() != NO_JOINT);
|
||||
m_rootJointHasFixedTransform = FALSE;
|
||||
m_rootJointHasFixedTransform = false;
|
||||
}
|
||||
|
||||
void SkeletalMeshInstance::CalculateJointTransformations(uint frame)
|
||||
|
@ -163,7 +163,7 @@ void SkeletalMeshInstance::BreakDownJointTransformationMatrix(uint jointMatrixIn
|
|||
m_jointRotations[jointMatrixIndex] = Quaternion::CreateFromRotationMatrix(*jointMatrix);
|
||||
}
|
||||
|
||||
void SkeletalMeshInstance::EnableSubset(const stl::string &subset, BOOL enable)
|
||||
void SkeletalMeshInstance::EnableSubset(const stl::string &subset, bool enable)
|
||||
{
|
||||
int index = m_mesh->GetIndexOfSubset(subset);
|
||||
ASSERT(index != -1);
|
||||
|
|
|
@ -23,9 +23,9 @@ public:
|
|||
void CalculateJointTransformations(uint startFrame, uint endFrame, float interpolation);
|
||||
|
||||
uint GetNumSubsets() const { return m_numSubsets; }
|
||||
BOOL IsSubsetEnabled(uint index) const { return m_enabledSubsets[index]; }
|
||||
void EnableSubset(const stl::string &subset, BOOL enable);
|
||||
void EnableSubset(uint index, BOOL enable) { m_enabledSubsets[index] = enable; }
|
||||
bool IsSubsetEnabled(uint index) const { return m_enabledSubsets[index]; }
|
||||
void EnableSubset(const stl::string &subset, bool enable);
|
||||
void EnableSubset(uint index, bool enable) { m_enabledSubsets[index] = enable; }
|
||||
|
||||
Texture** GetTextures() const { return m_textures; }
|
||||
void SetTexture(uint index, Texture *texture);
|
||||
|
@ -43,8 +43,8 @@ public:
|
|||
BlendState* GetBlendState() const { return m_blendState; }
|
||||
BlendState* GetAlphaBlendState() const { return m_alphaBlendState; }
|
||||
|
||||
BOOL GetRenderAllSubsetsAlphaBlended() const { return m_renderAllSubsetsAlphaBlended; }
|
||||
void SetRenderAllSubsetsAlphaBlended(BOOL enable) { m_renderAllSubsetsAlphaBlended = enable; }
|
||||
bool GetRenderAllSubsetsAlphaBlended() const { return m_renderAllSubsetsAlphaBlended; }
|
||||
void SetRenderAllSubsetsAlphaBlended(bool enable) { m_renderAllSubsetsAlphaBlended = enable; }
|
||||
|
||||
SkeletalMesh* GetMesh() const { return m_mesh; }
|
||||
|
||||
|
@ -53,18 +53,18 @@ private:
|
|||
|
||||
SkeletalMesh *m_mesh;
|
||||
uint m_numSubsets;
|
||||
BOOL *m_enabledSubsets;
|
||||
bool *m_enabledSubsets;
|
||||
Texture **m_textures;
|
||||
RenderState *m_renderState;
|
||||
BlendState *m_blendState;
|
||||
BlendState *m_alphaBlendState;
|
||||
BOOL m_renderAllSubsetsAlphaBlended;
|
||||
bool m_renderAllSubsetsAlphaBlended;
|
||||
|
||||
uint m_numJoints;
|
||||
Matrix4x4 *m_jointTransformations;
|
||||
Vector3 *m_jointPositions;
|
||||
Quaternion *m_jointRotations;
|
||||
BOOL m_rootJointHasFixedTransform;
|
||||
bool m_rootJointHasFixedTransform;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,13 +22,13 @@ SkeletalMeshRenderer::~SkeletalMeshRenderer()
|
|||
|
||||
void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, VertexSkinningShader *shader)
|
||||
{
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
ASSERT(shader->IsBound() == true);
|
||||
Render(graphicsDevice, instance, 0, shader);
|
||||
}
|
||||
|
||||
void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint frame, VertexSkinningShader *shader)
|
||||
{
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
ASSERT(shader->IsBound() == true);
|
||||
instance->CalculateJointTransformations(frame);
|
||||
shader->SetJointPositions(instance->GetJointPositions(), instance->GetNumJoints());
|
||||
shader->SetJointRotations(instance->GetJointRotations(), instance->GetNumJoints());
|
||||
|
@ -37,7 +37,7 @@ void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshIn
|
|||
|
||||
void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint startFrame, uint endFrame, float interpolation, VertexSkinningShader *shader)
|
||||
{
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
ASSERT(shader->IsBound() == true);
|
||||
instance->CalculateJointTransformations(startFrame, endFrame, interpolation);
|
||||
shader->SetJointPositions(instance->GetJointPositions(), instance->GetNumJoints());
|
||||
shader->SetJointRotations(instance->GetJointRotations(), instance->GetNumJoints());
|
||||
|
@ -46,7 +46,7 @@ void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshIn
|
|||
|
||||
void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshAnimationInstance *instance, VertexSkinningShader *shader)
|
||||
{
|
||||
ASSERT(shader->IsBound() == TRUE);
|
||||
ASSERT(shader->IsBound() == true);
|
||||
Render(graphicsDevice, instance, instance->GetCurrentFrame(), instance->GetNextFrame(), instance->GetInterpolation(), shader);
|
||||
}
|
||||
|
||||
|
@ -55,14 +55,14 @@ void SkeletalMeshRenderer::RenderAllSubsets(GraphicsDevice *graphicsDevice, Skel
|
|||
instance->GetRenderState()->Apply();
|
||||
graphicsDevice->BindVertexBuffer(instance->GetMesh()->GetVertexBuffer());
|
||||
|
||||
BOOL hasAlphaSubsets = FALSE;
|
||||
bool hasAlphaSubsets = false;
|
||||
|
||||
if (instance->GetRenderAllSubsetsAlphaBlended())
|
||||
{
|
||||
// this instance has been overridden to have all it's subsets rendered
|
||||
// with alpha blending enabled. don't bother with the first loop to find
|
||||
// non-alpha-enabled subsets...
|
||||
hasAlphaSubsets = TRUE;
|
||||
hasAlphaSubsets = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ void SkeletalMeshRenderer::RenderAllSubsets(GraphicsDevice *graphicsDevice, Skel
|
|||
const SkeletalMeshSubset *subset = &instance->GetMesh()->GetSubsets()[i];
|
||||
if (subset->IsAlphaBlended())
|
||||
// note we have an alpha subset, but don't render it quite yet
|
||||
hasAlphaSubsets = TRUE;
|
||||
hasAlphaSubsets = true;
|
||||
else
|
||||
RenderSubset(graphicsDevice, subset, instance->GetTextures()[i]);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
SkeletalMeshSubset::SkeletalMeshSubset()
|
||||
{
|
||||
m_indices = NULL;
|
||||
m_alpha = FALSE;
|
||||
m_alpha = false;
|
||||
}
|
||||
|
||||
SkeletalMeshSubset::~SkeletalMeshSubset()
|
||||
|
@ -16,7 +16,7 @@ SkeletalMeshSubset::~SkeletalMeshSubset()
|
|||
SAFE_DELETE(m_indices);
|
||||
}
|
||||
|
||||
void SkeletalMeshSubset::Create(const stl::string &name, uint numTriangles, BOOL alpha)
|
||||
void SkeletalMeshSubset::Create(const stl::string &name, uint numTriangles, bool alpha)
|
||||
{
|
||||
ASSERT(m_indices == NULL);
|
||||
ASSERT(numTriangles > 0);
|
||||
|
|
|
@ -12,16 +12,16 @@ public:
|
|||
SkeletalMeshSubset();
|
||||
virtual ~SkeletalMeshSubset();
|
||||
|
||||
void Create(const stl::string &name, uint numTriangles, BOOL alpha);
|
||||
void Create(const stl::string &name, uint numTriangles, bool alpha);
|
||||
|
||||
const stl::string& GetName() const { return m_name; }
|
||||
IndexBuffer* GetIndices() const { return m_indices; }
|
||||
BOOL IsAlphaBlended() const { return m_alpha; }
|
||||
bool IsAlphaBlended() const { return m_alpha; }
|
||||
|
||||
private:
|
||||
stl::string m_name;
|
||||
IndexBuffer *m_indices;
|
||||
BOOL m_alpha;
|
||||
bool m_alpha;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -18,8 +18,8 @@ const uint DEFAULT_MAX_FRAMESKIP = 10;
|
|||
|
||||
BaseGameApp::BaseGameApp()
|
||||
{
|
||||
m_stop = FALSE;
|
||||
m_isPaused = FALSE;
|
||||
m_stop = false;
|
||||
m_isPaused = false;
|
||||
m_fps = 0;
|
||||
m_frameTime = 0.0f;
|
||||
m_numRenders = 0;
|
||||
|
@ -29,8 +29,8 @@ BaseGameApp::BaseGameApp()
|
|||
m_renderTime = 0;
|
||||
m_updateTime = 0;
|
||||
m_nextUpdateAt = 0;
|
||||
m_isRunningSlowly = FALSE;
|
||||
m_isDirty = FALSE;
|
||||
m_isRunningSlowly = false;
|
||||
m_isDirty = false;
|
||||
m_system = NULL;
|
||||
m_window = NULL;
|
||||
m_graphics = NULL;
|
||||
|
@ -50,7 +50,7 @@ BaseGameApp::~BaseGameApp()
|
|||
SAFE_DELETE(m_graphics);
|
||||
}
|
||||
|
||||
BOOL BaseGameApp::Start(OperatingSystem *system)
|
||||
bool BaseGameApp::Start(OperatingSystem *system)
|
||||
{
|
||||
m_system = system;
|
||||
|
||||
|
@ -58,34 +58,34 @@ BOOL BaseGameApp::Start(OperatingSystem *system)
|
|||
if (!OnInit())
|
||||
{
|
||||
LOG_ERROR(LOGCAT_GAMEAPP, "Initialization failed.\n");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "Initialization succeeded.\n");
|
||||
OnNewContext();
|
||||
OnResize();
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL BaseGameApp::Initialize(GameWindowParams *windowParams)
|
||||
bool BaseGameApp::Initialize(GameWindowParams *windowParams)
|
||||
{
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "Starting initialization.\n");
|
||||
|
||||
if (!m_system->CreateGameWindow(this, windowParams))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "Verifying shader support present.\n");
|
||||
if (!m_system->HasShaderSupport())
|
||||
{
|
||||
LOG_ERROR(LOGCAT_GAMEAPP, "No support for shaders detected. Graphics framework requires hardware shader support. Aborting.\n");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_window = m_system->GetWindow();
|
||||
if (m_window == NULL)
|
||||
{
|
||||
LOG_ERROR(LOGCAT_GAMEAPP, "Not able to get a GameWindow instance.\n");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_graphics = new GraphicsDevice();
|
||||
|
@ -97,7 +97,7 @@ BOOL BaseGameApp::Initialize(GameWindowParams *windowParams)
|
|||
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "Initialization finished.\n");
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void BaseGameApp::Loop()
|
||||
|
@ -158,15 +158,15 @@ void BaseGameApp::Loop()
|
|||
|
||||
// we're "running slowly" if we're more than one update behind
|
||||
if (currentTime > m_nextUpdateAt + m_ticksPerUpdate)
|
||||
m_isRunningSlowly = TRUE;
|
||||
m_isRunningSlowly = true;
|
||||
else
|
||||
m_isRunningSlowly = FALSE;
|
||||
m_isRunningSlowly = false;
|
||||
|
||||
numUpdatesThisFrame = 0;
|
||||
while (GetTicks() >= m_nextUpdateAt && numUpdatesThisFrame < m_maxFrameSkip)
|
||||
{
|
||||
if (numUpdatesThisFrame > 0)
|
||||
m_isRunningSlowly = TRUE;
|
||||
m_isRunningSlowly = true;
|
||||
|
||||
uint before = GetTicks();
|
||||
OnUpdate(m_fixedUpdateInterval);
|
||||
|
@ -178,7 +178,7 @@ void BaseGameApp::Loop()
|
|||
++m_numUpdates;
|
||||
|
||||
// just updated, so we need to render the new game state
|
||||
m_isDirty = TRUE;
|
||||
m_isDirty = true;
|
||||
}
|
||||
|
||||
if (m_isDirty && m_window->IsActive() && m_window->HasGLContext())
|
||||
|
@ -191,7 +191,7 @@ void BaseGameApp::Loop()
|
|||
++m_numRenders;
|
||||
|
||||
// don't render again until we have something new to show
|
||||
m_isDirty = FALSE;
|
||||
m_isDirty = false;
|
||||
}
|
||||
|
||||
++numLoops;
|
||||
|
@ -206,7 +206,7 @@ void BaseGameApp::Quit()
|
|||
LOG_INFO(LOGCAT_GAMEAPP, "Quit requested.\n");
|
||||
if (!m_system->IsQuitting())
|
||||
m_system->Quit();
|
||||
m_stop = TRUE;
|
||||
m_stop = true;
|
||||
}
|
||||
|
||||
void BaseGameApp::OnAppGainFocus()
|
||||
|
@ -222,13 +222,13 @@ void BaseGameApp::OnAppLostFocus()
|
|||
void BaseGameApp::OnAppPause()
|
||||
{
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "Paused.\n");
|
||||
m_isPaused = TRUE;
|
||||
m_isPaused = true;
|
||||
}
|
||||
|
||||
void BaseGameApp::OnAppResume()
|
||||
{
|
||||
LOG_INFO(LOGCAT_GAMEAPP, "Resumed.\n");
|
||||
m_isPaused = FALSE;
|
||||
m_isPaused = false;
|
||||
|
||||
// this makes it so that the main loop won't try to "catch up" thinking that
|
||||
// it's really far behind with updates since m_nextUpdateAt won't have been
|
||||
|
@ -290,10 +290,10 @@ void BaseGameApp::SetUpdateFrequency(uint targetFrequency)
|
|||
m_fixedUpdateInterval = m_ticksPerUpdate / 1000.0f;
|
||||
}
|
||||
|
||||
BOOL BaseGameApp::IsAppFocused() const
|
||||
bool BaseGameApp::IsAppFocused() const
|
||||
{
|
||||
if (m_window != NULL)
|
||||
return m_window->IsFocused();
|
||||
else
|
||||
return FALSE; // if there's no window, it can't be focused!
|
||||
return false; // if there's no window, it can't be focused!
|
||||
}
|
||||
|
|
|
@ -27,9 +27,9 @@ public:
|
|||
* Begins application initialization in preparation for running the
|
||||
* main loop.
|
||||
* @param system pre-initialized operating system class
|
||||
* @return TRUE if successful, FALSE if not
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
BOOL Start(OperatingSystem *system);
|
||||
bool Start(OperatingSystem *system);
|
||||
|
||||
/**
|
||||
* Runs the main game loop.
|
||||
|
@ -98,10 +98,10 @@ public:
|
|||
uint GetUpdatesPerSecond() const { return m_updatesPerSecond; }
|
||||
|
||||
/**
|
||||
* @return TRUE if the main loop is running behind
|
||||
* @return true if the main loop is running behind
|
||||
* (has to update game logic more then once per frame)
|
||||
*/
|
||||
BOOL IsRunningSlowing() const { return m_isRunningSlowly; }
|
||||
bool IsRunningSlowing() const { return m_isRunningSlowly; }
|
||||
|
||||
/**
|
||||
* Sets the desired frames per second to run the main loop at.
|
||||
|
@ -126,23 +126,23 @@ public:
|
|||
* will render even if a game logic update has not been run since the last render
|
||||
* was performed.
|
||||
*/
|
||||
void Invalidate() { m_isDirty = TRUE; }
|
||||
void Invalidate() { m_isDirty = true; }
|
||||
|
||||
uint GetTicks() const { return m_system->GetTicks(); }
|
||||
|
||||
/**
|
||||
* @return TRUE if the app currently is active and has input focus
|
||||
* @return true if the app currently is active and has input focus
|
||||
*/
|
||||
BOOL IsAppFocused() const;
|
||||
bool IsAppFocused() const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Initializes the game window and the graphics and content management
|
||||
* sub-systems.
|
||||
* @param windowParams window creation parameters specific to the platform being run on
|
||||
* @return TRUE if successful, FALSE if not
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
BOOL Initialize(GameWindowParams *windowParams);
|
||||
bool Initialize(GameWindowParams *windowParams);
|
||||
|
||||
/**
|
||||
* Signals to the main loop that the application should quit as soon as possible.
|
||||
|
@ -173,7 +173,7 @@ public:
|
|||
/**
|
||||
* Game-specific initialization (before content loading) callback.
|
||||
*/
|
||||
virtual BOOL OnInit() = 0;
|
||||
virtual bool OnInit() = 0;
|
||||
|
||||
/**
|
||||
* Initial game load after initialization success callback.
|
||||
|
@ -211,8 +211,8 @@ private:
|
|||
|
||||
OperatingSystem *m_system;
|
||||
GameWindow *m_window;
|
||||
BOOL m_stop;
|
||||
BOOL m_isPaused;
|
||||
bool m_stop;
|
||||
bool m_isPaused;
|
||||
|
||||
uint m_fps;
|
||||
float m_frameTime;
|
||||
|
@ -228,9 +228,9 @@ private:
|
|||
uint m_maxFrameSkip;
|
||||
float m_fixedUpdateInterval;
|
||||
uint m_nextUpdateAt;
|
||||
BOOL m_isRunningSlowly;
|
||||
bool m_isRunningSlowly;
|
||||
|
||||
BOOL m_isDirty;
|
||||
bool m_isDirty;
|
||||
|
||||
GraphicsDevice *m_graphics;
|
||||
ContentManager *m_content;
|
||||
|
|
|
@ -4,12 +4,6 @@
|
|||
#include <stdint.h>
|
||||
#include <cstddef>
|
||||
|
||||
#if !defined(TRUE) && !defined(FALSE)
|
||||
typedef int32_t BOOL;
|
||||
const BOOL TRUE = 1;
|
||||
const BOOL FALSE = 0;
|
||||
#endif
|
||||
|
||||
typedef unsigned long ulong;
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned short ushort;
|
||||
|
@ -55,10 +49,10 @@ inline T Max(T a, T b)
|
|||
* Determines if a bit is set in the given bitfield.
|
||||
* @param bit the bit to check
|
||||
* @param bitfield the bit field to check the bit in
|
||||
* @return TRUE if set, FALSE if not
|
||||
* @return true if set, false if not
|
||||
*/
|
||||
template <class T1, class T2>
|
||||
inline BOOL IsBitSet(T1 bit, T2 bitfield)
|
||||
inline bool IsBitSet(T1 bit, T2 bitfield)
|
||||
{
|
||||
return (bitfield & bit) != 0;
|
||||
}
|
||||
|
|
|
@ -5,25 +5,25 @@
|
|||
Content::Content()
|
||||
{
|
||||
m_referenceCount = 0;
|
||||
m_isReferenceCounted = FALSE;
|
||||
m_wasLoadedByContentLoader = FALSE;
|
||||
m_isReferenceCounted = false;
|
||||
m_wasLoadedByContentLoader = false;
|
||||
}
|
||||
|
||||
Content::~Content()
|
||||
{
|
||||
ASSERT(m_isReferenceCounted == FALSE || m_referenceCount == 0);
|
||||
ASSERT(m_isReferenceCounted == false || m_referenceCount == 0);
|
||||
}
|
||||
|
||||
void Content::Reference()
|
||||
{
|
||||
m_isReferenceCounted = TRUE;
|
||||
m_isReferenceCounted = true;
|
||||
++m_referenceCount;
|
||||
}
|
||||
|
||||
void Content::ReleaseReference()
|
||||
{
|
||||
ASSERT(m_isReferenceCounted == TRUE);
|
||||
ASSERT(IsReferenced() == TRUE);
|
||||
ASSERT(m_isReferenceCounted == true);
|
||||
ASSERT(IsReferenced() == true);
|
||||
if (m_referenceCount > 0)
|
||||
--m_referenceCount;
|
||||
}
|
||||
|
|
|
@ -23,19 +23,19 @@ public:
|
|||
virtual ~Content();
|
||||
|
||||
/**
|
||||
* @return TRUE if this content object was created by a ContentLoader
|
||||
* @return true if this content object was created by a ContentLoader
|
||||
*/
|
||||
BOOL WasLoadedByContentLoader() const { return m_wasLoadedByContentLoader; }
|
||||
bool WasLoadedByContentLoader() const { return m_wasLoadedByContentLoader; }
|
||||
|
||||
/**
|
||||
* @return TRUE if something else is currently referencing this content
|
||||
* @return true if something else is currently referencing this content
|
||||
*/
|
||||
BOOL IsReferenced() const { return m_referenceCount > 0; }
|
||||
bool IsReferenced() const { return m_referenceCount > 0; }
|
||||
|
||||
/**
|
||||
* @return TRUE if this content is currently being reference counted
|
||||
* @return true if this content is currently being reference counted
|
||||
*/
|
||||
BOOL IsReferenceCounted() const { return m_isReferenceCounted; }
|
||||
bool IsReferenceCounted() const { return m_isReferenceCounted; }
|
||||
|
||||
/**
|
||||
* @return the number of references currently being held for this content
|
||||
|
@ -53,8 +53,8 @@ private:
|
|||
*/
|
||||
void ReleaseReference();
|
||||
|
||||
BOOL m_wasLoadedByContentLoader;
|
||||
BOOL m_isReferenceCounted;
|
||||
bool m_wasLoadedByContentLoader;
|
||||
bool m_isReferenceCounted;
|
||||
uint m_referenceCount;
|
||||
};
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ template <class T>
|
|||
struct ContentContainer
|
||||
{
|
||||
T *content;
|
||||
BOOL isPreLoaded;
|
||||
bool isPreLoaded;
|
||||
|
||||
ContentContainer();
|
||||
};
|
||||
|
@ -16,7 +16,7 @@ template<class T>
|
|||
inline ContentContainer<T>::ContentContainer()
|
||||
{
|
||||
content = NULL;
|
||||
isPreLoaded = FALSE;
|
||||
isPreLoaded = false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
void ContentLoaderBase::MarkLoadedByContentLoader(Content *content)
|
||||
{
|
||||
ASSERT(content != NULL);
|
||||
content->m_wasLoadedByContentLoader = TRUE;
|
||||
content->m_wasLoadedByContentLoader = true;
|
||||
}
|
||||
|
||||
void ContentLoaderBase::Reference(Content *content)
|
||||
|
|
|
@ -81,21 +81,21 @@ public:
|
|||
* platform's backing storage.
|
||||
* @param name the path and filename of the content to retrieve
|
||||
* @param params content-type-specified parameters used during loading or NULL
|
||||
* @param preload TRUE to mark the content as preloaded after loading it
|
||||
* @param preload true to mark the content as preloaded after loading it
|
||||
* @param <T> the type of content to load
|
||||
* @return the loaded content or NULL on failure
|
||||
*/
|
||||
virtual T* Get(const stl::string &name, const ContentParam *params, BOOL preload = FALSE) = 0;
|
||||
virtual T* Get(const stl::string &name, const ContentParam *params, bool preload = false) = 0;
|
||||
|
||||
/**
|
||||
* Frees the specified content object. Content is only actually freed
|
||||
* when it has no more references to it.
|
||||
* @param content the content object to be freed
|
||||
* @param preload TRUE to allow this content to be freed even if it has
|
||||
* @param preload true to allow this content to be freed even if it has
|
||||
* been preloaded
|
||||
* @param <T> the type of content to be freed
|
||||
*/
|
||||
virtual void Free(T *content, BOOL preload = FALSE) = 0;
|
||||
virtual void Free(T *content, bool preload = false) = 0;
|
||||
|
||||
/**
|
||||
* Frees the specified content if the content pointed to by the given path
|
||||
|
@ -104,11 +104,11 @@ public:
|
|||
* @param name the path and filename of the content to free
|
||||
* @param params content-type-specific parameters that further describe the
|
||||
* exact content object to be freed, or NULL
|
||||
* @param preload TRUE to allow this content to be freed even if it has
|
||||
* @param preload true to allow this content to be freed even if it has
|
||||
* been preloaded
|
||||
* @param <T> the type of content to be freed
|
||||
*/
|
||||
virtual void Free(const stl::string &name, const ContentParam *params, BOOL preload = FALSE) = 0;
|
||||
virtual void Free(const stl::string &name, const ContentParam *params, bool preload = false) = 0;
|
||||
|
||||
/**
|
||||
* Returns the path and filename that the given content object was
|
||||
|
|
|
@ -26,16 +26,16 @@ public:
|
|||
|
||||
void SetDefaultPath(const stl::string &path);
|
||||
|
||||
T* Get(const stl::string &name, const ContentParam *params, BOOL preload = FALSE);
|
||||
void Free(T *content, BOOL preload = FALSE);
|
||||
void Free(const stl::string &name, const ContentParam *params, BOOL preload = FALSE);
|
||||
T* Get(const stl::string &name, const ContentParam *params, bool preload = false);
|
||||
void Free(T *content, bool preload = false);
|
||||
void Free(const stl::string &name, const ContentParam *params, bool preload = false);
|
||||
|
||||
void RemoveAllContent();
|
||||
|
||||
stl::string GetNameOf(T *content) const;
|
||||
|
||||
protected:
|
||||
void Free(ContentStoreItor &itor, BOOL force, BOOL preload);
|
||||
void Free(ContentStoreItor &itor, bool force, bool preload);
|
||||
|
||||
virtual ContentStoreItor FindContent(const stl::string &file, const ContentParam *params);
|
||||
virtual T* LoadContent(const stl::string &file, const ContentParam *params) = 0;
|
||||
|
@ -70,7 +70,7 @@ ContentLoaderMapStoreBase<T>::~ContentLoaderMapStoreBase()
|
|||
}
|
||||
|
||||
template<class T>
|
||||
T* ContentLoaderMapStoreBase<T>::Get(const stl::string &name, const ContentParam *params, BOOL preload)
|
||||
T* ContentLoaderMapStoreBase<T>::Get(const stl::string &name, const ContentParam *params, bool preload)
|
||||
{
|
||||
ContentContainer<T> content;
|
||||
|
||||
|
@ -106,7 +106,7 @@ T* ContentLoaderMapStoreBase<T>::Get(const stl::string &name, const ContentParam
|
|||
}
|
||||
|
||||
template<class T>
|
||||
void ContentLoaderMapStoreBase<T>::Free(T *content, BOOL preload)
|
||||
void ContentLoaderMapStoreBase<T>::Free(T *content, bool preload)
|
||||
{
|
||||
ASSERT(content != NULL);
|
||||
|
||||
|
@ -114,27 +114,27 @@ void ContentLoaderMapStoreBase<T>::Free(T *content, BOOL preload)
|
|||
{
|
||||
if (itor->second.content == content)
|
||||
{
|
||||
Free(itor, FALSE, preload);
|
||||
Free(itor, false, preload);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void ContentLoaderMapStoreBase<T>::Free(const stl::string &name, const ContentParam *params, BOOL preload)
|
||||
void ContentLoaderMapStoreBase<T>::Free(const stl::string &name, const ContentParam *params, bool preload)
|
||||
{
|
||||
stl::string filename = AddDefaultPathIfNeeded(name);
|
||||
filename = ProcessFilename(filename, params);
|
||||
|
||||
ContentStoreItor itor = FindContent(filename, params);
|
||||
if (itor != m_content.end())
|
||||
Free(itor, FALSE, preload);
|
||||
Free(itor, false, preload);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void ContentLoaderMapStoreBase<T>::Free(ContentStoreItor &itor, BOOL force, BOOL preload)
|
||||
void ContentLoaderMapStoreBase<T>::Free(ContentStoreItor &itor, bool force, bool preload)
|
||||
{
|
||||
ASSERT(itor->second.content->WasLoadedByContentLoader() == TRUE);
|
||||
ASSERT(itor->second.content->WasLoadedByContentLoader() == true);
|
||||
|
||||
if (!itor->second.isPreLoaded)
|
||||
ContentLoaderBase::ReleaseReference(itor->second.content);
|
||||
|
@ -181,7 +181,7 @@ void ContentLoaderMapStoreBase<T>::RemoveAllContent()
|
|||
itor->second.content->GetNumReferences(),
|
||||
(itor->second.isPreLoaded ? ", preloaded" : "")
|
||||
);
|
||||
Free(itor, TRUE, itor->second.isPreLoaded);
|
||||
Free(itor, true, itor->second.isPreLoaded);
|
||||
}
|
||||
|
||||
m_content.clear();
|
||||
|
|
|
@ -53,22 +53,22 @@ public:
|
|||
* Retrieves the specified content either from a cache or from the
|
||||
* platform's backing storage.
|
||||
* @param name the path and filename of the content to retrieve
|
||||
* @param preload TRUE to mark the content as preloaded after loading it
|
||||
* @param preload true to mark the content as preloaded after loading it
|
||||
* @param <T> the type of content to load
|
||||
* @return the loaded content or NULL on failure
|
||||
*/
|
||||
template <class T> T* Get(const stl::string &name, BOOL preload = FALSE);
|
||||
template <class T> T* Get(const stl::string &name, bool preload = false);
|
||||
|
||||
/**
|
||||
* Retrieves the specified content either from a cache or from the
|
||||
* platform's backing storage.
|
||||
* @param name the path and filename of the content to retrieve
|
||||
* @param params content-type-specified parameters used during loading or NULL
|
||||
* @param preload TRUE to mark the content as preloaded after loading it
|
||||
* @param preload true to mark the content as preloaded after loading it
|
||||
* @param <T> the type of content to load
|
||||
* @return the loaded content or NULL on failure
|
||||
*/
|
||||
template <class T> T* Get(const stl::string &name, const ContentParam ¶ms, BOOL preload = FALSE);
|
||||
template <class T> T* Get(const stl::string &name, const ContentParam ¶ms, bool preload = false);
|
||||
|
||||
/**
|
||||
* Loads the content so that it is pre-loaded and subsequent calls to Get()
|
||||
|
@ -98,11 +98,11 @@ public:
|
|||
* and filename has been loaded. Content is only actually freed when it has
|
||||
* no more references to it.
|
||||
* @param name the path and filename of the content to free
|
||||
* @param preload TRUE to allow this content to be freed even if it has
|
||||
* @param preload true to allow this content to be freed even if it has
|
||||
* been preloaded
|
||||
* @param <T> the type of content to be freed
|
||||
*/
|
||||
template <class T> void Free(const stl::string &name, BOOL preload = FALSE);
|
||||
template <class T> void Free(const stl::string &name, bool preload = false);
|
||||
|
||||
/**
|
||||
* Frees the specified content if the content pointed to by the given path
|
||||
|
@ -111,21 +111,21 @@ public:
|
|||
* @param name the path and filename of the content to free
|
||||
* @param params content-type-specific parameters that further describe the
|
||||
* exact content object to be freed, or NULL
|
||||
* @param preload TRUE to allow this content to be freed even if it has
|
||||
* @param preload true to allow this content to be freed even if it has
|
||||
* been preloaded
|
||||
* @param <T> the type of content to be freed
|
||||
*/
|
||||
template <class T> void Free(const stl::string &name, const ContentParam ¶ms, BOOL preload = FALSE);
|
||||
template <class T> void Free(const stl::string &name, const ContentParam ¶ms, bool preload = false);
|
||||
|
||||
/**
|
||||
* Frees the specified content object. Content is only actually freed
|
||||
* when it has no more references to it.
|
||||
* @param content the content object to be freed
|
||||
* @param preload TRUE to allow this content to be freed even if it has
|
||||
* @param preload true to allow this content to be freed even if it has
|
||||
* been preloaded
|
||||
* @param <T> the type of content to be freed
|
||||
*/
|
||||
template <class T> void Free(T *content, BOOL preload = FALSE);
|
||||
template <class T> void Free(T *content, bool preload = false);
|
||||
|
||||
/**
|
||||
* Frees the specified pre-loaded content. This will free the content
|
||||
|
@ -187,7 +187,7 @@ private:
|
|||
};
|
||||
|
||||
template <class T>
|
||||
T* ContentManager::Get(const stl::string &name, BOOL preload)
|
||||
T* ContentManager::Get(const stl::string &name, bool preload)
|
||||
{
|
||||
ContentLoader<T> *loader = GetLoader<T>();
|
||||
T* content = loader->Get(name, NULL, preload);
|
||||
|
@ -195,7 +195,7 @@ T* ContentManager::Get(const stl::string &name, BOOL preload)
|
|||
}
|
||||
|
||||
template <class T>
|
||||
T* ContentManager::Get(const stl::string &name, const ContentParam ¶ms, BOOL preload)
|
||||
T* ContentManager::Get(const stl::string &name, const ContentParam ¶ms, bool preload)
|
||||
{
|
||||
ContentLoader<T> *loader = GetLoader<T>();
|
||||
T* content = loader->Get(name, ¶ms, preload);
|
||||
|
@ -205,31 +205,31 @@ T* ContentManager::Get(const stl::string &name, const ContentParam ¶ms, BOOL
|
|||
template<class T>
|
||||
T* ContentManager::Load(const stl::string &name)
|
||||
{
|
||||
return Get<T>(name, TRUE);
|
||||
return Get<T>(name, true);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T* ContentManager::Load(const stl::string &name, const ContentParam ¶ms)
|
||||
{
|
||||
return Get<T>(name, params, TRUE);
|
||||
return Get<T>(name, params, true);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void ContentManager::Free(const stl::string &name, BOOL preload)
|
||||
void ContentManager::Free(const stl::string &name, bool preload)
|
||||
{
|
||||
ContentLoader<T> *loader = GetLoader<T>();
|
||||
loader->Free(name, NULL, preload);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void ContentManager::Free(const stl::string &name, const ContentParam ¶ms, BOOL preload)
|
||||
void ContentManager::Free(const stl::string &name, const ContentParam ¶ms, bool preload)
|
||||
{
|
||||
ContentLoader<T> *loader = GetLoader<T>();
|
||||
loader->Free(name, ¶ms, preload);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void ContentManager::Free(T *content, BOOL preload)
|
||||
void ContentManager::Free(T *content, bool preload)
|
||||
{
|
||||
ContentLoader<T> *loader = GetLoader<T>();
|
||||
loader->Free(content, preload);
|
||||
|
@ -238,19 +238,19 @@ void ContentManager::Free(T *content, BOOL preload)
|
|||
template <class T>
|
||||
void ContentManager::Unload(const stl::string &name)
|
||||
{
|
||||
Free<T>(name, TRUE);
|
||||
Free<T>(name, true);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void ContentManager::Unload(const stl::string &name, const ContentParam ¶ms)
|
||||
{
|
||||
Free<T>(name, params, TRUE);
|
||||
Free<T>(name, params, true);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void ContentManager::Unload(T *content)
|
||||
{
|
||||
Free<T>(content, TRUE);
|
||||
Free<T>(content, true);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -38,7 +38,7 @@ Image* ImageLoader::LoadContent(const stl::string &file, const ContentParam *par
|
|||
ASSERT(imageFile != NULL);
|
||||
|
||||
Image *image = new Image();
|
||||
BOOL success = image->Create(imageFile);
|
||||
bool success = image->Create(imageFile);
|
||||
|
||||
SAFE_DELETE(imageFile);
|
||||
|
||||
|
|
|
@ -150,8 +150,8 @@ SpriteFont* SpriteFontLoader::Load(File *file, uint size, SpriteFont *existing)
|
|||
// general size of each glyph in this font. Uppercase 'W' seems to be a
|
||||
// pretty good glyph to represent this "maximum size".
|
||||
SpriteFontGlyphMetrics maxMetrics;
|
||||
BOOL maxMetricResult = GetGlyphMetrics(&fontinfo, 'W', size, &maxMetrics);
|
||||
ASSERT(maxMetricResult == TRUE);
|
||||
bool maxMetricResult = GetGlyphMetrics(&fontinfo, 'W', size, &maxMetrics);
|
||||
ASSERT(maxMetricResult == true);
|
||||
|
||||
// if we can't even get this glyph's metrics then stop now
|
||||
if (!maxMetricResult)
|
||||
|
@ -161,8 +161,8 @@ SpriteFont* SpriteFontLoader::Load(File *file, uint size, SpriteFont *existing)
|
|||
// that we're allowing as long as the font pixel size doesn't get too large
|
||||
// this bitmap is *only* going to contain alpha values (not any kind of rgb colour data)
|
||||
Image *bitmap = new Image();
|
||||
BOOL bitmapCreateSuccess = bitmap->Create(FONT_BITMAP_WIDTH, FONT_BITMAP_HEIGHT, IMAGE_FORMAT_ALPHA);
|
||||
ASSERT(bitmapCreateSuccess == TRUE);
|
||||
bool bitmapCreateSuccess = bitmap->Create(FONT_BITMAP_WIDTH, FONT_BITMAP_HEIGHT, IMAGE_FORMAT_ALPHA);
|
||||
ASSERT(bitmapCreateSuccess == true);
|
||||
bitmap->Clear();
|
||||
|
||||
// the texture atlas to store the position/texcoords of each glyph
|
||||
|
@ -186,8 +186,8 @@ SpriteFont* SpriteFontLoader::Load(File *file, uint size, SpriteFont *existing)
|
|||
// get metrics for the current glyph
|
||||
char c = (char)(i + LOW_GLYPH);
|
||||
SpriteFontGlyphMetrics glyphMetrics;
|
||||
BOOL metricResult = GetGlyphMetrics(&fontinfo, c, size, &glyphMetrics);
|
||||
ASSERT(metricResult == TRUE);
|
||||
bool metricResult = GetGlyphMetrics(&fontinfo, c, size, &glyphMetrics);
|
||||
ASSERT(metricResult == true);
|
||||
|
||||
// adjust each glyph's rect so that it has it's own space that doesn't
|
||||
// collide with any of it's neighbour glyphs (neighbour as seen on the
|
||||
|
@ -237,8 +237,8 @@ SpriteFont* SpriteFontLoader::Load(File *file, uint size, SpriteFont *existing)
|
|||
}
|
||||
|
||||
Texture *fontTexture = new Texture();
|
||||
BOOL textureCreated = fontTexture->Create(GetContentManager()->GetGameApp()->GetGraphicsDevice(), bitmap);
|
||||
ASSERT(textureCreated == TRUE);
|
||||
bool textureCreated = fontTexture->Create(GetContentManager()->GetGameApp()->GetGraphicsDevice(), bitmap);
|
||||
ASSERT(textureCreated == true);
|
||||
SAFE_DELETE(bitmap);
|
||||
if (!textureCreated)
|
||||
{
|
||||
|
@ -271,7 +271,7 @@ void SpriteFontLoader::FreeContent(SpriteFont *content)
|
|||
SAFE_DELETE(content);
|
||||
}
|
||||
|
||||
BOOL SpriteFontLoader::GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uint size, SpriteFontGlyphMetrics *metrics) const
|
||||
bool SpriteFontLoader::GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uint size, SpriteFontGlyphMetrics *metrics) const
|
||||
{
|
||||
ASSERT(metrics != NULL);
|
||||
|
||||
|
@ -284,7 +284,7 @@ BOOL SpriteFontLoader::GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uin
|
|||
|
||||
metrics->index = stbtt_FindGlyphIndex(fontInfo, glyph);
|
||||
if (metrics->index == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
stbtt_GetGlyphBox(fontInfo, metrics->index, &metrics->dimensions.left, &metrics->dimensions.top, &metrics->dimensions.right, &metrics->dimensions.bottom);
|
||||
stbtt_GetFontVMetrics(fontInfo, &metrics->ascent, &metrics->descent, &metrics->lineGap);
|
||||
|
@ -310,5 +310,5 @@ BOOL SpriteFontLoader::GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uin
|
|||
if (heightDifference != metrics->lineGap && metrics->lineGap == 0)
|
||||
metrics->lineGap = heightDifference;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ private:
|
|||
void DecomposeFilename(const stl::string &filename, stl::string &outFilename, uint &outSize) const;
|
||||
SpriteFont* Load(File *file, uint size, SpriteFont *existing) const;
|
||||
|
||||
BOOL GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uint size, SpriteFontGlyphMetrics *glyphMetrics) const;
|
||||
bool GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uint size, SpriteFontGlyphMetrics *glyphMetrics) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -84,7 +84,7 @@ Texture* TextureLoader::Load(const stl::string &file, Texture *existingTexture)
|
|||
texture = new Texture();
|
||||
|
||||
// load image into it
|
||||
BOOL success = texture->Create(GetContentManager()->GetGameApp()->GetGraphicsDevice(), image);
|
||||
bool success = texture->Create(GetContentManager()->GetGameApp()->GetGraphicsDevice(), image);
|
||||
|
||||
// don't need to keep the underlying image around if not being used elsewhere
|
||||
GetContentManager()->Free<Image>(image);
|
||||
|
|
|
@ -7,8 +7,8 @@ DiskFile::DiskFile()
|
|||
{
|
||||
m_fp = NULL;
|
||||
m_mode = 0;
|
||||
m_canRead = FALSE;
|
||||
m_canWrite = FALSE;
|
||||
m_canRead = false;
|
||||
m_canWrite = false;
|
||||
}
|
||||
|
||||
DiskFile::~DiskFile()
|
||||
|
@ -16,26 +16,26 @@ DiskFile::~DiskFile()
|
|||
Close();
|
||||
}
|
||||
|
||||
BOOL DiskFile::Open(const stl::string &filename, int mode)
|
||||
bool DiskFile::Open(const stl::string &filename, int mode)
|
||||
{
|
||||
ASSERT(IsOpen() == FALSE);
|
||||
ASSERT(IsOpen() == false);
|
||||
m_filename = filename;
|
||||
|
||||
char fopenMode[3] = { '\0', '\0', '\0' };
|
||||
if (mode & FILEMODE_READ)
|
||||
{
|
||||
fopenMode[0] = 'r';
|
||||
m_canRead = TRUE;
|
||||
m_canRead = true;
|
||||
}
|
||||
else if (mode & FILEMODE_WRITE)
|
||||
{
|
||||
fopenMode[0] = 'w';
|
||||
m_canWrite = TRUE;
|
||||
m_canWrite = true;
|
||||
}
|
||||
else if (mode & FILEMODE_APPEND)
|
||||
{
|
||||
fopenMode[0] = 'a';
|
||||
m_canWrite = TRUE;
|
||||
m_canWrite = true;
|
||||
}
|
||||
if (mode & FILEMODE_BINARY && fopenMode[0] != '\0')
|
||||
fopenMode[1] = 'b';
|
||||
|
@ -43,23 +43,23 @@ BOOL DiskFile::Open(const stl::string &filename, int mode)
|
|||
if (fopenMode[0] == '\0')
|
||||
{
|
||||
ASSERT(!"Unrecognized mode.");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(m_canRead == TRUE || m_canWrite == TRUE);
|
||||
ASSERT(m_canRead == true || m_canWrite == true);
|
||||
|
||||
m_fp = fopen(filename.c_str(), fopenMode);
|
||||
if (m_fp)
|
||||
{
|
||||
LOG_INFO(LOGCAT_FILEIO, "Opened DiskFile \"%s\", mode = %s\n", filename.c_str(), fopenMode);
|
||||
m_mode = mode;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_WARN(LOGCAT_FILEIO, "Failed to open DiskFile \"%s\", mode = %s\n", filename.c_str(), fopenMode);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,8 +74,8 @@ void DiskFile::Close()
|
|||
|
||||
m_fp = NULL;
|
||||
m_mode = 0;
|
||||
m_canRead = FALSE;
|
||||
m_canWrite = FALSE;
|
||||
m_canRead = false;
|
||||
m_canWrite = false;
|
||||
m_filename.clear();
|
||||
}
|
||||
|
||||
|
@ -328,7 +328,7 @@ void DiskFile::Seek(size_t offset, FileSeek from)
|
|||
fseek(m_fp, offset, origin);
|
||||
}
|
||||
|
||||
BOOL DiskFile::AtEOF()
|
||||
bool DiskFile::AtEOF()
|
||||
{
|
||||
ASSERT(IsOpen());
|
||||
return feof(m_fp) != 0;
|
||||
|
|
|
@ -17,12 +17,12 @@ public:
|
|||
DiskFile();
|
||||
virtual ~DiskFile();
|
||||
|
||||
BOOL Open(const stl::string &filename, int mode);
|
||||
bool Open(const stl::string &filename, int mode);
|
||||
void Close();
|
||||
|
||||
BOOL IsOpen() const { return m_fp != NULL; }
|
||||
BOOL CanRead() const { return m_canRead; }
|
||||
BOOL CanWrite() const { return m_canWrite; }
|
||||
bool IsOpen() const { return m_fp != NULL; }
|
||||
bool CanRead() const { return m_canRead; }
|
||||
bool CanWrite() const { return m_canWrite; }
|
||||
FileType GetFileType() const { return FILETYPE_IO; }
|
||||
|
||||
int8_t ReadChar();
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
|
||||
size_t Tell();
|
||||
void Seek(size_t offset, FileSeek from);
|
||||
BOOL AtEOF();
|
||||
bool AtEOF();
|
||||
size_t GetFileSize();
|
||||
|
||||
const stl::string& GetFilename() const { return m_filename; }
|
||||
|
@ -61,8 +61,8 @@ public:
|
|||
private:
|
||||
FILE *m_fp;
|
||||
int m_mode;
|
||||
BOOL m_canRead;
|
||||
BOOL m_canWrite;
|
||||
bool m_canRead;
|
||||
bool m_canWrite;
|
||||
stl::string m_filename;
|
||||
};
|
||||
|
||||
|
|
|
@ -41,19 +41,19 @@ public:
|
|||
virtual void Close() = 0;
|
||||
|
||||
/**
|
||||
* @return TRUE if the file is currently open
|
||||
* @return true if the file is currently open
|
||||
*/
|
||||
virtual BOOL IsOpen() const = 0;
|
||||
virtual bool IsOpen() const = 0;
|
||||
|
||||
/**
|
||||
* @return TRUE if this file supports reading
|
||||
* @return true if this file supports reading
|
||||
*/
|
||||
virtual BOOL CanRead() const = 0;
|
||||
virtual bool CanRead() const = 0;
|
||||
|
||||
/**
|
||||
* @return TRUE if this file supports writing
|
||||
* @return true if this file supports writing
|
||||
*/
|
||||
virtual BOOL CanWrite() const = 0;
|
||||
virtual bool CanWrite() const = 0;
|
||||
|
||||
/**
|
||||
* @return a type value representing the backing storage where this file's
|
||||
|
@ -250,9 +250,9 @@ public:
|
|||
virtual void Seek(size_t offset, FileSeek from) = 0;
|
||||
|
||||
/**
|
||||
* @return TRUE if the current file pointer is at the end of the file
|
||||
* @return true if the current file pointer is at the end of the file
|
||||
*/
|
||||
virtual BOOL AtEOF() = 0;
|
||||
virtual bool AtEOF() = 0;
|
||||
|
||||
/**
|
||||
* @return the size of this file in bytes
|
||||
|
|
|
@ -9,8 +9,8 @@ MarmaladeFile::MarmaladeFile()
|
|||
{
|
||||
m_fp = NULL;
|
||||
m_mode = 0;
|
||||
m_canRead = FALSE;
|
||||
m_canWrite = FALSE;
|
||||
m_canRead = false;
|
||||
m_canWrite = false;
|
||||
}
|
||||
|
||||
MarmaladeFile::~MarmaladeFile()
|
||||
|
@ -18,26 +18,26 @@ MarmaladeFile::~MarmaladeFile()
|
|||
Close();
|
||||
}
|
||||
|
||||
BOOL MarmaladeFile::Open(const stl::string &filename, int mode)
|
||||
bool MarmaladeFile::Open(const stl::string &filename, int mode)
|
||||
{
|
||||
ASSERT(IsOpen() == FALSE);
|
||||
ASSERT(IsOpen() == false);
|
||||
m_filename = filename;
|
||||
|
||||
char fopenMode[3] = { '\0', '\0', '\0' };
|
||||
if (mode & FILEMODE_READ)
|
||||
{
|
||||
fopenMode[0] = 'r';
|
||||
m_canRead = TRUE;
|
||||
m_canRead = true;
|
||||
}
|
||||
else if (mode & FILEMODE_WRITE)
|
||||
{
|
||||
fopenMode[0] = 'w';
|
||||
m_canWrite = TRUE;
|
||||
m_canWrite = true;
|
||||
}
|
||||
else if (mode & FILEMODE_APPEND)
|
||||
{
|
||||
fopenMode[0] = 'a';
|
||||
m_canWrite = TRUE;
|
||||
m_canWrite = true;
|
||||
}
|
||||
if (mode & FILEMODE_BINARY && fopenMode[0] != '\0')
|
||||
fopenMode[1] = 'b';
|
||||
|
@ -45,23 +45,23 @@ BOOL MarmaladeFile::Open(const stl::string &filename, int mode)
|
|||
if (fopenMode[0] == '\0')
|
||||
{
|
||||
ASSERT(!"Unrecognized mode.");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(m_canRead == TRUE || m_canWrite == TRUE);
|
||||
ASSERT(m_canRead == true || m_canWrite == true);
|
||||
|
||||
m_fp = s3eFileOpen(filename.c_str(), fopenMode);
|
||||
if (m_fp)
|
||||
{
|
||||
LOG_INFO(LOGCAT_FILEIO, "Opened MarmaladeFile \"%s\", mode = %s\n", filename.c_str(), fopenMode);
|
||||
m_mode = mode;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_WARN(LOGCAT_FILEIO, "Failed to open MarmaladeFile \"%s\", mode = %s. Error: %d, %s\n", filename.c_str(), fopenMode, s3eFileGetError(), s3eFileGetErrorString());
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,8 +76,8 @@ void MarmaladeFile::Close()
|
|||
|
||||
m_fp = NULL;
|
||||
m_mode = 0;
|
||||
m_canRead = FALSE;
|
||||
m_canWrite = FALSE;
|
||||
m_canRead = false;
|
||||
m_canWrite = false;
|
||||
m_filename.clear();
|
||||
}
|
||||
|
||||
|
@ -330,13 +330,13 @@ void MarmaladeFile::Seek(size_t offset, FileSeek from)
|
|||
s3eFileSeek(m_fp, offset, origin);
|
||||
}
|
||||
|
||||
BOOL MarmaladeFile::AtEOF()
|
||||
bool MarmaladeFile::AtEOF()
|
||||
{
|
||||
ASSERT(IsOpen());
|
||||
if (s3eFileEOF(m_fp) == S3E_TRUE)
|
||||
return TRUE;
|
||||
if (s3eFileEOF(m_fp) == S3E_true)
|
||||
return true;
|
||||
else
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t MarmaladeFile::GetFileSize()
|
||||
|
|
|
@ -13,12 +13,12 @@ public:
|
|||
MarmaladeFile();
|
||||
virtual ~MarmaladeFile();
|
||||
|
||||
BOOL Open(const stl::string &filename, int mode);
|
||||
bool Open(const stl::string &filename, int mode);
|
||||
void Close();
|
||||
|
||||
BOOL IsOpen() const { return m_fp != NULL; }
|
||||
BOOL CanRead() const { return m_canRead; }
|
||||
BOOL CanWrite() const { return m_canWrite; }
|
||||
bool IsOpen() const { return m_fp != NULL; }
|
||||
bool CanRead() const { return m_canRead; }
|
||||
bool CanWrite() const { return m_canWrite; }
|
||||
FileType GetFileType() const { return FILETYPE_IO; }
|
||||
|
||||
int8_t ReadChar();
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
|
||||
size_t Tell();
|
||||
void Seek(size_t offset, FileSeek from);
|
||||
BOOL AtEOF();
|
||||
bool AtEOF();
|
||||
size_t GetFileSize();
|
||||
|
||||
const stl::string& GetFilename() const { return m_filename; }
|
||||
|
@ -57,8 +57,8 @@ public:
|
|||
private:
|
||||
s3eFile *m_fp;
|
||||
int m_mode;
|
||||
BOOL m_canRead;
|
||||
BOOL m_canWrite;
|
||||
bool m_canRead;
|
||||
bool m_canWrite;
|
||||
stl::string m_filename;
|
||||
};
|
||||
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
MemoryFile::MemoryFile()
|
||||
{
|
||||
m_data = NULL;
|
||||
m_ownData = FALSE;
|
||||
m_ownData = false;
|
||||
m_length = 0;
|
||||
m_position = 0;
|
||||
m_canRead = FALSE;
|
||||
m_canWrite = FALSE;
|
||||
m_canRead = false;
|
||||
m_canWrite = false;
|
||||
}
|
||||
|
||||
MemoryFile::~MemoryFile()
|
||||
|
@ -20,14 +20,14 @@ MemoryFile::~MemoryFile()
|
|||
Close();
|
||||
}
|
||||
|
||||
BOOL MemoryFile::Open(File *srcFile)
|
||||
bool MemoryFile::Open(File *srcFile)
|
||||
{
|
||||
ASSERT(IsOpen() == FALSE);
|
||||
ASSERT(IsOpen() == false);
|
||||
ASSERT(srcFile->IsOpen());
|
||||
size_t filesize = srcFile->GetFileSize();
|
||||
m_data = new int8_t[filesize];
|
||||
ASSERT(m_data != NULL);
|
||||
m_ownData = TRUE;
|
||||
m_ownData = true;
|
||||
m_length = filesize;
|
||||
m_filename = srcFile->GetFilename();
|
||||
|
||||
|
@ -38,15 +38,15 @@ BOOL MemoryFile::Open(File *srcFile)
|
|||
|
||||
LOG_INFO(LOGCAT_FILEIO, "Create MemoryFile from source file \"%s\"\n", srcFile->GetFilename().c_str());
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL MemoryFile::Open(const void *memory, size_t numBytes, BOOL canRead, BOOL canWrite, BOOL assumeOwnershipOfMemory)
|
||||
bool MemoryFile::Open(const void *memory, size_t numBytes, bool canRead, bool canWrite, bool assumeOwnershipOfMemory)
|
||||
{
|
||||
ASSERT(IsOpen() == FALSE);
|
||||
ASSERT(IsOpen() == false);
|
||||
ASSERT(memory != NULL);
|
||||
ASSERT(numBytes > 0);
|
||||
ASSERT(canRead == TRUE || canWrite == TRUE);
|
||||
ASSERT(canRead == true || canWrite == true);
|
||||
|
||||
m_data = (int8_t*)memory;
|
||||
m_ownData = assumeOwnershipOfMemory;
|
||||
|
@ -56,7 +56,7 @@ BOOL MemoryFile::Open(const void *memory, size_t numBytes, BOOL canRead, BOOL ca
|
|||
m_canRead = canRead;
|
||||
m_canWrite = canWrite;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void MemoryFile::Close()
|
||||
|
@ -70,11 +70,11 @@ void MemoryFile::Close()
|
|||
LOG_INFO(LOGCAT_FILEIO, "Free MemoryFile \"%s\"\n", m_filename.c_str());
|
||||
}
|
||||
|
||||
m_ownData = FALSE;
|
||||
m_ownData = false;
|
||||
m_length = 0;
|
||||
m_position = 0;
|
||||
m_canRead = FALSE;
|
||||
m_canWrite = FALSE;
|
||||
m_canRead = false;
|
||||
m_canWrite = false;
|
||||
m_filename.clear();
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ void MemoryFile::Seek(size_t offset, FileSeek from)
|
|||
m_position += offset;
|
||||
}
|
||||
|
||||
BOOL MemoryFile::AtEOF()
|
||||
bool MemoryFile::AtEOF()
|
||||
{
|
||||
ASSERT(IsOpen());
|
||||
return m_position >= m_length;
|
||||
|
|
|
@ -14,13 +14,13 @@ public:
|
|||
MemoryFile();
|
||||
virtual ~MemoryFile();
|
||||
|
||||
BOOL Open(File *srcFile);
|
||||
BOOL Open(const void *memory, size_t numBytes, BOOL canRead, BOOL canWrite, BOOL assumeOwnershipOfMemory = FALSE);
|
||||
bool Open(File *srcFile);
|
||||
bool Open(const void *memory, size_t numBytes, bool canRead, bool canWrite, bool assumeOwnershipOfMemory = false);
|
||||
void Close();
|
||||
|
||||
BOOL IsOpen() const { return m_data != NULL; }
|
||||
BOOL CanRead() const { return m_canRead; }
|
||||
BOOL CanWrite() const { return m_canWrite; }
|
||||
bool IsOpen() const { return m_data != NULL; }
|
||||
bool CanRead() const { return m_canRead; }
|
||||
bool CanWrite() const { return m_canWrite; }
|
||||
FileType GetFileType() const { return FILETYPE_MEMORY; }
|
||||
|
||||
int8_t ReadChar();
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
|
||||
size_t Tell();
|
||||
void Seek(size_t offset, FileSeek from);
|
||||
BOOL AtEOF();
|
||||
bool AtEOF();
|
||||
size_t GetFileSize();
|
||||
|
||||
const stl::string& GetFilename() const { return m_filename; }
|
||||
|
@ -60,11 +60,11 @@ public:
|
|||
|
||||
private:
|
||||
int8_t *m_data;
|
||||
BOOL m_ownData;
|
||||
bool m_ownData;
|
||||
size_t m_length;
|
||||
size_t m_position;
|
||||
BOOL m_canRead;
|
||||
BOOL m_canWrite;
|
||||
bool m_canRead;
|
||||
bool m_canWrite;
|
||||
stl::string m_filename;
|
||||
};
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ SDLFile::SDLFile()
|
|||
{
|
||||
m_fp = NULL;
|
||||
m_mode = 0;
|
||||
m_canRead = FALSE;
|
||||
m_canWrite = FALSE;
|
||||
m_canRead = false;
|
||||
m_canWrite = false;
|
||||
}
|
||||
|
||||
SDLFile::~SDLFile()
|
||||
|
@ -17,26 +17,26 @@ SDLFile::~SDLFile()
|
|||
Close();
|
||||
}
|
||||
|
||||
BOOL SDLFile::Open(const stl::string &filename, int mode)
|
||||
bool SDLFile::Open(const stl::string &filename, int mode)
|
||||
{
|
||||
ASSERT(IsOpen() == FALSE);
|
||||
ASSERT(IsOpen() == false);
|
||||
m_filename = filename;
|
||||
|
||||
char fopenMode[3] = { '\0', '\0', '\0' };
|
||||
if (mode & FILEMODE_READ)
|
||||
{
|
||||
fopenMode[0] = 'r';
|
||||
m_canRead = TRUE;
|
||||
m_canRead = true;
|
||||
}
|
||||
else if (mode & FILEMODE_WRITE)
|
||||
{
|
||||
fopenMode[0] = 'w';
|
||||
m_canWrite = TRUE;
|
||||
m_canWrite = true;
|
||||
}
|
||||
else if (mode & FILEMODE_APPEND)
|
||||
{
|
||||
fopenMode[0] = 'a';
|
||||
m_canWrite = TRUE;
|
||||
m_canWrite = true;
|
||||
}
|
||||
if (mode & FILEMODE_BINARY && fopenMode[0] != '\0')
|
||||
fopenMode[1] = 'b';
|
||||
|
@ -44,23 +44,23 @@ BOOL SDLFile::Open(const stl::string &filename, int mode)
|
|||
if (fopenMode[0] == '\0')
|
||||
{
|
||||
ASSERT(!"Unrecognized mode.");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(m_canRead == TRUE || m_canWrite == TRUE);
|
||||
ASSERT(m_canRead == true || m_canWrite == true);
|
||||
|
||||
m_fp = SDL_RWFromFile(filename.c_str(), fopenMode);
|
||||
if (m_fp)
|
||||
{
|
||||
LOG_INFO(LOGCAT_FILEIO, "Opened SDLFile \"%s\", mode = %s\n", filename.c_str(), fopenMode);
|
||||
m_mode = mode;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_WARN(LOGCAT_FILEIO, "Failed to open SDLFile \"%s\", mode = %s\n", filename.c_str(), fopenMode);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,8 +75,8 @@ void SDLFile::Close()
|
|||
|
||||
m_fp = NULL;
|
||||
m_mode = 0;
|
||||
m_canRead = FALSE;
|
||||
m_canWrite = FALSE;
|
||||
m_canRead = false;
|
||||
m_canWrite = false;
|
||||
m_filename.clear();
|
||||
}
|
||||
|
||||
|
@ -329,15 +329,15 @@ void SDLFile::Seek(size_t offset, FileSeek from)
|
|||
SDL_RWseek(m_fp, offset, origin);
|
||||
}
|
||||
|
||||
BOOL SDLFile::AtEOF()
|
||||
bool SDLFile::AtEOF()
|
||||
{
|
||||
ASSERT(IsOpen());
|
||||
size_t filesize = GetFileSize();
|
||||
size_t currentPos = Tell();
|
||||
if (filesize == currentPos)
|
||||
return TRUE;
|
||||
return true;
|
||||
else
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t SDLFile::GetFileSize()
|
||||
|
|
|
@ -14,12 +14,12 @@ public:
|
|||
SDLFile();
|
||||
virtual ~SDLFile();
|
||||
|
||||
BOOL Open(const stl::string &filename, int mode);
|
||||
bool Open(const stl::string &filename, int mode);
|
||||
void Close();
|
||||
|
||||
BOOL IsOpen() const { return m_fp != NULL; }
|
||||
BOOL CanRead() const { return m_canRead; }
|
||||
BOOL CanWrite() const { return m_canWrite; }
|
||||
bool IsOpen() const { return m_fp != NULL; }
|
||||
bool CanRead() const { return m_canRead; }
|
||||
bool CanWrite() const { return m_canWrite; }
|
||||
FileType GetFileType() const { return FILETYPE_IO; }
|
||||
|
||||
int8_t ReadChar();
|
||||
|
@ -50,7 +50,7 @@ public:
|
|||
|
||||
size_t Tell();
|
||||
void Seek(size_t offset, FileSeek from);
|
||||
BOOL AtEOF();
|
||||
bool AtEOF();
|
||||
size_t GetFileSize();
|
||||
|
||||
const stl::string& GetFilename() const { return m_filename; }
|
||||
|
@ -58,8 +58,8 @@ public:
|
|||
private:
|
||||
SDL_RWops *m_fp;
|
||||
int m_mode;
|
||||
BOOL m_canRead;
|
||||
BOOL m_canWrite;
|
||||
bool m_canRead;
|
||||
bool m_canWrite;
|
||||
stl::string m_filename;
|
||||
};
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ struct OSEvent;
|
|||
|
||||
struct GameWindowParams
|
||||
{
|
||||
BOOL windowed;
|
||||
bool windowed;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -30,23 +30,23 @@ public:
|
|||
/**
|
||||
* Creates the game window.
|
||||
* @param params platform specific window creation parameters
|
||||
* @return TRUE if successful, FALSE if not
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
virtual BOOL Create(GameWindowParams *params) = 0;
|
||||
virtual bool Create(GameWindowParams *params) = 0;
|
||||
|
||||
/**
|
||||
* Resizes the window to the given dimensions.
|
||||
* @param width the new window width
|
||||
* @param height the new window height
|
||||
* @return TRUE if successful, FALSE if not
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
virtual BOOL Resize(uint width, uint height) = 0;
|
||||
virtual bool Resize(uint width, uint height) = 0;
|
||||
|
||||
/**
|
||||
* Toggles between fullscreen and windowed mode.
|
||||
* @return TRUE if successful, FALSE if not
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
virtual BOOL ToggleFullscreen() = 0;
|
||||
virtual bool ToggleFullscreen() = 0;
|
||||
|
||||
/**
|
||||
* Signals to the underlying system that the window should be closed
|
||||
|
@ -75,9 +75,9 @@ public:
|
|||
virtual uint GetBPP() const = 0;
|
||||
|
||||
/**
|
||||
* @return TRUE if the current window is windowed, FALSE if fullscreen
|
||||
* @return true if the current window is windowed, false if fullscreen
|
||||
*/
|
||||
virtual BOOL IsWindowed() const = 0;
|
||||
virtual bool IsWindowed() const = 0;
|
||||
|
||||
/**
|
||||
* @return the current display rotation angle
|
||||
|
@ -85,24 +85,24 @@ public:
|
|||
virtual SCREEN_ORIENTATION_ANGLE GetScreenOrientation() const = 0;
|
||||
|
||||
/**
|
||||
* @return TRUE if this window is the currently active one
|
||||
* @return true if this window is the currently active one
|
||||
*/
|
||||
virtual BOOL IsActive() const = 0;
|
||||
virtual bool IsActive() const = 0;
|
||||
|
||||
/**
|
||||
* @return TRUE if this window currently is active and has input focus
|
||||
* @return true if this window currently is active and has input focus
|
||||
*/
|
||||
virtual BOOL IsFocused() const = 0;
|
||||
virtual bool IsFocused() const = 0;
|
||||
|
||||
/**
|
||||
* @return TRUE if the window has been signaled that it should close
|
||||
* @return true if the window has been signaled that it should close
|
||||
*/
|
||||
virtual BOOL IsClosing() const = 0;
|
||||
virtual bool IsClosing() const = 0;
|
||||
|
||||
/**
|
||||
* @return TRUe if the window currently has an active and usable OpenGL context associated with it
|
||||
*/
|
||||
virtual BOOL HasGLContext() const = 0;
|
||||
virtual bool HasGLContext() const = 0;
|
||||
|
||||
/**
|
||||
* Performs platform specific processing for an event raised by the operating system.
|
||||
|
|
|
@ -54,10 +54,10 @@ BillboardSpriteBatch::BillboardSpriteBatch(GraphicsDevice *graphicsDevice)
|
|||
m_blendState = new BLENDSTATE_ALPHABLEND;
|
||||
ASSERT(m_blendState != NULL);
|
||||
|
||||
m_begunRendering = FALSE;
|
||||
m_begunRendering = false;
|
||||
|
||||
m_isRenderStateOverridden = FALSE;
|
||||
m_isBlendStateOverridden = FALSE;
|
||||
m_isRenderStateOverridden = false;
|
||||
m_isBlendStateOverridden = false;
|
||||
}
|
||||
|
||||
BillboardSpriteBatch::~BillboardSpriteBatch()
|
||||
|
@ -69,7 +69,7 @@ BillboardSpriteBatch::~BillboardSpriteBatch()
|
|||
|
||||
void BillboardSpriteBatch::InternalBegin(const RenderState *renderState, const BlendState *blendState, SpriteShader *shader)
|
||||
{
|
||||
ASSERT(m_begunRendering == FALSE);
|
||||
ASSERT(m_begunRendering == false);
|
||||
|
||||
m_cameraPosition = m_graphicsDevice->GetViewContext()->GetCamera()->GetPosition();
|
||||
m_cameraForward = m_graphicsDevice->GetViewContext()->GetCamera()->GetForward();
|
||||
|
@ -78,28 +78,28 @@ void BillboardSpriteBatch::InternalBegin(const RenderState *renderState, const B
|
|||
m_shader = m_graphicsDevice->GetSprite3DShader();
|
||||
else
|
||||
{
|
||||
ASSERT(shader->IsReadyForUse() == TRUE);
|
||||
ASSERT(shader->IsReadyForUse() == true);
|
||||
m_shader = shader;
|
||||
}
|
||||
|
||||
if (renderState != NULL)
|
||||
{
|
||||
m_isRenderStateOverridden = TRUE;
|
||||
m_isRenderStateOverridden = true;
|
||||
m_overrideRenderState = *renderState;
|
||||
}
|
||||
else
|
||||
m_isRenderStateOverridden = FALSE;
|
||||
m_isRenderStateOverridden = false;
|
||||
|
||||
if (blendState != NULL)
|
||||
{
|
||||
m_isBlendStateOverridden = TRUE;
|
||||
m_isBlendStateOverridden = true;
|
||||
m_overrideBlendState = *blendState;
|
||||
}
|
||||
else
|
||||
m_isBlendStateOverridden = FALSE;
|
||||
m_isBlendStateOverridden = false;
|
||||
|
||||
m_currentSpritePointer = 0;
|
||||
m_begunRendering = TRUE;
|
||||
m_begunRendering = true;
|
||||
}
|
||||
|
||||
void BillboardSpriteBatch::Begin(SpriteShader *shader)
|
||||
|
@ -224,7 +224,7 @@ 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, uint sourceLeft, uint sourceTop, uint sourceRight, uint sourceBottom, const Color &color)
|
||||
{
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
ASSERT(m_begunRendering == true);
|
||||
Matrix4x4 transform = GetTransformFor(type, position);
|
||||
|
||||
// zero vector offset as the transform will translate the billboard to
|
||||
|
@ -234,7 +234,7 @@ 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)
|
||||
{
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
ASSERT(m_begunRendering == true);
|
||||
Matrix4x4 transform = GetTransformFor(type, position);
|
||||
|
||||
// zero vector offset as the transform will translate the billboard to
|
||||
|
@ -244,7 +244,7 @@ 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, uint sourceLeft, uint sourceTop, uint sourceRight, uint sourceBottom, const Color &color)
|
||||
{
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
ASSERT(m_begunRendering == true);
|
||||
|
||||
uint sourceWidth = sourceRight - sourceLeft;
|
||||
ASSERT(sourceWidth > 0);
|
||||
|
@ -262,7 +262,7 @@ 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)
|
||||
{
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
ASSERT(m_begunRendering == true);
|
||||
CheckForNewSpriteSpace();
|
||||
SetSpriteInfo(m_currentSpritePointer, type, transform, texture, offset, width, height, texCoordLeft, texCoordTop, texCoordRight, texCoordBottom, color);
|
||||
++m_currentSpritePointer;
|
||||
|
@ -318,7 +318,7 @@ void BillboardSpriteBatch::SetSpriteInfo(uint spriteIndex, BILLBOARDSPRITE_TYPE
|
|||
|
||||
void BillboardSpriteBatch::End()
|
||||
{
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
ASSERT(m_begunRendering == true);
|
||||
|
||||
if (m_isRenderStateOverridden)
|
||||
m_overrideRenderState.Apply();
|
||||
|
@ -335,7 +335,7 @@ void BillboardSpriteBatch::End()
|
|||
RenderQueue();
|
||||
m_graphicsDevice->UnbindShader();
|
||||
|
||||
m_begunRendering = FALSE;
|
||||
m_begunRendering = false;
|
||||
}
|
||||
|
||||
void BillboardSpriteBatch::RenderQueue()
|
||||
|
|
|
@ -201,9 +201,9 @@ private:
|
|||
SpriteShader *m_shader;
|
||||
RenderState *m_renderState;
|
||||
BlendState *m_blendState;
|
||||
BOOL m_isRenderStateOverridden;
|
||||
bool m_isRenderStateOverridden;
|
||||
RenderState m_overrideRenderState;
|
||||
BOOL m_isBlendStateOverridden;
|
||||
bool m_isBlendStateOverridden;
|
||||
BlendState m_overrideBlendState;
|
||||
VertexBuffer *m_vertices;
|
||||
stl::vector<const Texture*> m_textures;
|
||||
|
@ -212,7 +212,7 @@ private:
|
|||
Vector3 m_cameraPosition;
|
||||
Vector3 m_cameraForward;
|
||||
|
||||
BOOL m_begunRendering;
|
||||
bool m_begunRendering;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -12,7 +12,7 @@ BlendState::BlendState(BLEND_FACTOR sourceFactor, BLEND_FACTOR destinationFactor
|
|||
{
|
||||
Initialize();
|
||||
|
||||
m_blending = TRUE;
|
||||
m_blending = true;
|
||||
m_sourceBlendFactor = sourceFactor;
|
||||
m_destBlendFactor = destinationFactor;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ BlendState::~BlendState()
|
|||
|
||||
void BlendState::Initialize()
|
||||
{
|
||||
m_blending = FALSE;
|
||||
m_blending = false;
|
||||
m_sourceBlendFactor = ONE;
|
||||
m_destBlendFactor = ZERO;
|
||||
}
|
||||
|
|
|
@ -47,9 +47,9 @@ public:
|
|||
void Apply() const;
|
||||
|
||||
/**
|
||||
* @return TRUE if blending is enabled
|
||||
* @return true if blending is enabled
|
||||
*/
|
||||
BOOL GetBlending() const { return m_blending; }
|
||||
bool GetBlending() const { return m_blending; }
|
||||
|
||||
/**
|
||||
* @return the source blending factor
|
||||
|
@ -64,7 +64,7 @@ public:
|
|||
/**
|
||||
* Toggles blending on/off.
|
||||
*/
|
||||
void SetBlending(BOOL enable) { m_blending = enable; }
|
||||
void SetBlending(bool enable) { m_blending = enable; }
|
||||
|
||||
/**
|
||||
* Sets the source blending factor.
|
||||
|
@ -80,7 +80,7 @@ private:
|
|||
void Initialize();
|
||||
int FindBlendFactorValue(BLEND_FACTOR factor) const;
|
||||
|
||||
BOOL m_blending;
|
||||
bool m_blending;
|
||||
BLEND_FACTOR m_sourceBlendFactor;
|
||||
BLEND_FACTOR m_destBlendFactor;
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@ BufferObject::BufferObject()
|
|||
m_type = BUFFEROBJECT_TYPE_VERTEX;
|
||||
m_usage = BUFFEROBJECT_USAGE_STATIC;
|
||||
m_bufferId = 0;
|
||||
m_isDirty = FALSE;
|
||||
m_isDirty = false;
|
||||
m_sizeInBytes = 0;
|
||||
}
|
||||
|
||||
|
@ -21,15 +21,15 @@ void BufferObject::Release()
|
|||
m_type = BUFFEROBJECT_TYPE_VERTEX;
|
||||
m_usage = BUFFEROBJECT_USAGE_STATIC;
|
||||
m_bufferId = 0;
|
||||
m_isDirty = FALSE;
|
||||
m_isDirty = false;
|
||||
m_sizeInBytes = 0;
|
||||
|
||||
GraphicsContextResource::Release();
|
||||
}
|
||||
|
||||
BOOL BufferObject::Initialize(GraphicsDevice *graphicsDevice, BUFFEROBJECT_TYPE type, BUFFEROBJECT_USAGE usage)
|
||||
bool BufferObject::Initialize(GraphicsDevice *graphicsDevice, BUFFEROBJECT_TYPE type, BUFFEROBJECT_USAGE usage)
|
||||
{
|
||||
BOOL success = TRUE;
|
||||
bool success = true;
|
||||
if (graphicsDevice != NULL)
|
||||
success = GraphicsContextResource::Initialize(graphicsDevice);
|
||||
else
|
||||
|
@ -43,20 +43,20 @@ BOOL BufferObject::Initialize(GraphicsDevice *graphicsDevice, BUFFEROBJECT_TYPE
|
|||
|
||||
void BufferObject::CreateOnGpu()
|
||||
{
|
||||
ASSERT(IsClientSideBuffer() == TRUE);
|
||||
ASSERT(IsClientSideBuffer() == true);
|
||||
CreateBufferObject();
|
||||
}
|
||||
|
||||
void BufferObject::RecreateOnGpu()
|
||||
{
|
||||
ASSERT(IsClientSideBuffer() == FALSE);
|
||||
ASSERT(IsClientSideBuffer() == false);
|
||||
FreeBufferObject();
|
||||
CreateBufferObject();
|
||||
}
|
||||
|
||||
void BufferObject::FreeFromGpu()
|
||||
{
|
||||
ASSERT(IsClientSideBuffer() == FALSE);
|
||||
ASSERT(IsClientSideBuffer() == false);
|
||||
FreeBufferObject();
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ void BufferObject::CreateBufferObject()
|
|||
GL_CALL(glGenBuffers(1, &m_bufferId));
|
||||
SizeBufferObject();
|
||||
|
||||
m_isDirty = TRUE;
|
||||
m_isDirty = true;
|
||||
}
|
||||
|
||||
void BufferObject::FreeBufferObject()
|
||||
|
@ -74,14 +74,14 @@ void BufferObject::FreeBufferObject()
|
|||
GL_CALL(glDeleteBuffers(1, &m_bufferId));
|
||||
|
||||
m_bufferId = 0;
|
||||
m_isDirty = FALSE;
|
||||
m_isDirty = false;
|
||||
m_sizeInBytes = 0;
|
||||
}
|
||||
|
||||
void BufferObject::Update()
|
||||
{
|
||||
ASSERT(IsClientSideBuffer() == FALSE);
|
||||
ASSERT(IsDirty() == TRUE);
|
||||
ASSERT(IsClientSideBuffer() == false);
|
||||
ASSERT(IsDirty() == true);
|
||||
ASSERT(GetNumElements() > 0);
|
||||
ASSERT(GetElementWidthInBytes() > 0);
|
||||
|
||||
|
@ -128,12 +128,12 @@ void BufferObject::Update()
|
|||
|
||||
GL_CALL(glBindBuffer(target, 0));
|
||||
|
||||
m_isDirty = FALSE;
|
||||
m_isDirty = false;
|
||||
}
|
||||
|
||||
void BufferObject::SizeBufferObject()
|
||||
{
|
||||
ASSERT(IsClientSideBuffer() == FALSE);
|
||||
ASSERT(IsClientSideBuffer() == false);
|
||||
ASSERT(GetNumElements() > 0);
|
||||
ASSERT(GetElementWidthInBytes() > 0);
|
||||
|
||||
|
@ -160,7 +160,7 @@ void BufferObject::SizeBufferObject()
|
|||
GL_CALL(glBufferData(target, m_sizeInBytes, NULL, usage));
|
||||
GL_CALL(glBindBuffer(target, 0));
|
||||
|
||||
m_isDirty = TRUE;
|
||||
m_isDirty = true;
|
||||
}
|
||||
|
||||
void BufferObject::OnNewContext()
|
||||
|
|
|
@ -32,10 +32,10 @@ public:
|
|||
virtual void Release();
|
||||
|
||||
/**
|
||||
* @return TRUE if this buffer object is holding client side data only
|
||||
* @return true if this buffer object is holding client side data only
|
||||
* (hasn't been created as a buffer object in video memory)
|
||||
*/
|
||||
BOOL IsClientSideBuffer() const { return m_bufferId == 0; }
|
||||
bool IsClientSideBuffer() const { return m_bufferId == 0; }
|
||||
|
||||
/**
|
||||
* @return the type of data this buffer holds
|
||||
|
@ -63,10 +63,10 @@ public:
|
|||
virtual size_t GetElementWidthInBytes() const = 0;
|
||||
|
||||
/**
|
||||
* @return TRUE if some or all of the buffer data has been changed since
|
||||
* @return true if some or all of the buffer data has been changed since
|
||||
* the last Update() call
|
||||
*/
|
||||
BOOL IsDirty() const { return m_isDirty; }
|
||||
bool IsDirty() const { return m_isDirty; }
|
||||
|
||||
/**
|
||||
* Uploads the current buffer data to video memory.
|
||||
|
@ -94,7 +94,7 @@ protected:
|
|||
* will be stored in it
|
||||
* @param usage the expected usage pattern of this buffer object
|
||||
*/
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, BUFFEROBJECT_TYPE type, BUFFEROBJECT_USAGE usage);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice, BUFFEROBJECT_TYPE type, BUFFEROBJECT_USAGE usage);
|
||||
|
||||
/**
|
||||
* Creates a buffer object on the GPU but does not upload this
|
||||
|
@ -118,14 +118,14 @@ protected:
|
|||
void CreateBufferObject();
|
||||
void FreeBufferObject();
|
||||
void SizeBufferObject();
|
||||
void SetDirty() { m_isDirty = TRUE; }
|
||||
void SetDirty() { m_isDirty = true; }
|
||||
|
||||
private:
|
||||
|
||||
BUFFEROBJECT_TYPE m_type;
|
||||
BUFFEROBJECT_USAGE m_usage;
|
||||
uint m_bufferId;
|
||||
BOOL m_isDirty;
|
||||
bool m_isDirty;
|
||||
size_t m_sizeInBytes;
|
||||
};
|
||||
|
||||
|
|
|
@ -10,27 +10,27 @@ CustomSpriteShader::~CustomSpriteShader()
|
|||
{
|
||||
}
|
||||
|
||||
BOOL CustomSpriteShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
bool CustomSpriteShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
{
|
||||
if (!SpriteShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(HasUniform(GetModelViewMatrixUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetProjectionMatrixUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetTextureHasAlphaOnlyUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetModelViewMatrixUniform()) == true);
|
||||
ASSERT(HasUniform(GetProjectionMatrixUniform()) == true);
|
||||
ASSERT(HasUniform(GetTextureHasAlphaOnlyUniform()) == true);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL CustomSpriteShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource)
|
||||
bool CustomSpriteShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource)
|
||||
{
|
||||
if (!SpriteShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(HasUniform(GetModelViewMatrixUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetProjectionMatrixUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetTextureHasAlphaOnlyUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetModelViewMatrixUniform()) == true);
|
||||
ASSERT(HasUniform(GetProjectionMatrixUniform()) == true);
|
||||
ASSERT(HasUniform(GetTextureHasAlphaOnlyUniform()) == true);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ public:
|
|||
* @param graphicsDevice the graphics device to associate this shader with
|
||||
* @param vertexShaderSource GLSL source for a vertex shader
|
||||
* @param fragmentShaderSource GLSL source for a vertex shader
|
||||
* @return TRUE if successful, FALSE if not
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource);
|
||||
|
||||
/**
|
||||
* Initializes the shader object for rendering sprites using the given vertex
|
||||
|
@ -32,9 +32,9 @@ public:
|
|||
* @param graphicsDevice the graphics device to associate this shader with
|
||||
* @param vertexShaderSource GLSL source for a vertex shader
|
||||
* @param fragmentShaderSource GLSL source for a vertex shader
|
||||
* @return TRUE if successful, FALSE if not
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -10,24 +10,24 @@ CustomStandardShader::~CustomStandardShader()
|
|||
{
|
||||
}
|
||||
|
||||
BOOL CustomStandardShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
bool CustomStandardShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
{
|
||||
if (!StandardShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(HasUniform(GetModelViewMatrixUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetProjectionMatrixUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetModelViewMatrixUniform()) == true);
|
||||
ASSERT(HasUniform(GetProjectionMatrixUniform()) == true);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL CustomStandardShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource)
|
||||
bool CustomStandardShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource)
|
||||
{
|
||||
if (!StandardShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(HasUniform(GetModelViewMatrixUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetProjectionMatrixUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetModelViewMatrixUniform()) == true);
|
||||
ASSERT(HasUniform(GetProjectionMatrixUniform()) == true);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -21,9 +21,9 @@ public:
|
|||
* @param graphicsDevice the graphics device to associate this shader with
|
||||
* @param vertexShaderSource GLSL source for a vertex shader
|
||||
* @param fragmentShaderSource GLSL source for a vertex shader
|
||||
* @return TRUE if successful, FALSE if not
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource);
|
||||
|
||||
/**
|
||||
* Initializes the shader object using the given vertex and fragment shader
|
||||
|
@ -31,9 +31,9 @@ public:
|
|||
* @param graphicsDevice the graphics device to associate this shader with
|
||||
* @param vertexShaderSource GLSL source for a vertex shader
|
||||
* @param fragmentShaderSource GLSL source for a vertex shader
|
||||
* @return TRUE if successful, FALSE if not
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -10,26 +10,26 @@ CustomVertexLerpShader::~CustomVertexLerpShader()
|
|||
{
|
||||
}
|
||||
|
||||
BOOL CustomVertexLerpShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
bool CustomVertexLerpShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
{
|
||||
if (!VertexLerpShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(HasUniform(GetModelViewMatrixUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetProjectionMatrixUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetLerpUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetModelViewMatrixUniform()) == true);
|
||||
ASSERT(HasUniform(GetProjectionMatrixUniform()) == true);
|
||||
ASSERT(HasUniform(GetLerpUniform()) == true);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL CustomVertexLerpShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource)
|
||||
bool CustomVertexLerpShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource)
|
||||
{
|
||||
if (!VertexLerpShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(HasUniform(GetModelViewMatrixUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetProjectionMatrixUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetLerpUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetModelViewMatrixUniform()) == true);
|
||||
ASSERT(HasUniform(GetProjectionMatrixUniform()) == true);
|
||||
ASSERT(HasUniform(GetLerpUniform()) == true);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ public:
|
|||
CustomVertexLerpShader();
|
||||
virtual ~CustomVertexLerpShader();
|
||||
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource);
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,28 +11,28 @@ CustomVertexSkinningShader::~CustomVertexSkinningShader()
|
|||
{
|
||||
}
|
||||
|
||||
BOOL CustomVertexSkinningShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
bool CustomVertexSkinningShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
{
|
||||
if (!VertexSkinningShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(HasUniform(GetModelViewMatrixUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetProjectionMatrixUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetJointPositionsUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetJointRotationsUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetModelViewMatrixUniform()) == true);
|
||||
ASSERT(HasUniform(GetProjectionMatrixUniform()) == true);
|
||||
ASSERT(HasUniform(GetJointPositionsUniform()) == true);
|
||||
ASSERT(HasUniform(GetJointRotationsUniform()) == true);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL CustomVertexSkinningShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource)
|
||||
bool CustomVertexSkinningShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource)
|
||||
{
|
||||
if (!VertexSkinningShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(HasUniform(GetModelViewMatrixUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetProjectionMatrixUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetJointPositionsUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetJointRotationsUniform()) == TRUE);
|
||||
ASSERT(HasUniform(GetModelViewMatrixUniform()) == true);
|
||||
ASSERT(HasUniform(GetProjectionMatrixUniform()) == true);
|
||||
ASSERT(HasUniform(GetJointPositionsUniform()) == true);
|
||||
ASSERT(HasUniform(GetJointRotationsUniform()) == true);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ public:
|
|||
CustomVertexSkinningShader();
|
||||
virtual ~CustomVertexSkinningShader();
|
||||
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource);
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -38,16 +38,16 @@ DebugShader::~DebugShader()
|
|||
{
|
||||
}
|
||||
|
||||
BOOL DebugShader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
bool DebugShader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
if (!StandardShader::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
BOOL result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource);
|
||||
ASSERT(result == TRUE);
|
||||
bool result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource);
|
||||
ASSERT(result == true);
|
||||
|
||||
MapAttributeToStandardAttribType("a_position", VERTEX_STD_POS_3D);
|
||||
MapAttributeToStandardAttribType("a_color", VERTEX_STD_COLOR);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ public:
|
|||
DebugShader();
|
||||
virtual ~DebugShader();
|
||||
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice);
|
||||
|
||||
private:
|
||||
static const char *m_vertexShaderSource;
|
||||
|
|
|
@ -21,14 +21,14 @@ Framebuffer::Framebuffer()
|
|||
m_fixedHeight = 0;
|
||||
}
|
||||
|
||||
BOOL Framebuffer::Initialize(GraphicsDevice *graphicsDevice)
|
||||
bool Framebuffer::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
ASSERT(m_framebufferName == 0);
|
||||
if (m_framebufferName != 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
if (!GraphicsContextResource::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
CreateFramebuffer();
|
||||
|
||||
|
@ -36,24 +36,24 @@ BOOL Framebuffer::Initialize(GraphicsDevice *graphicsDevice)
|
|||
m_fixedWidth = 0;
|
||||
m_fixedHeight = 0;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL Framebuffer::Initialize(GraphicsDevice *graphicsDevice, uint fixedWidth, uint fixedHeight)
|
||||
bool Framebuffer::Initialize(GraphicsDevice *graphicsDevice, uint fixedWidth, uint fixedHeight)
|
||||
{
|
||||
ASSERT(fixedWidth != 0);
|
||||
ASSERT(fixedHeight != 0);
|
||||
if (fixedWidth == 0 || fixedHeight == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
BOOL createSuccess = Initialize(graphicsDevice);
|
||||
bool createSuccess = Initialize(graphicsDevice);
|
||||
if (!createSuccess)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
m_fixedWidth = fixedWidth;
|
||||
m_fixedHeight = fixedHeight;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Framebuffer::Release()
|
||||
|
@ -98,18 +98,18 @@ void Framebuffer::CreateFramebuffer()
|
|||
GL_CALL(glGenFramebuffers(1, &m_framebufferName));
|
||||
}
|
||||
|
||||
BOOL Framebuffer::AttachViewContext()
|
||||
bool Framebuffer::AttachViewContext()
|
||||
{
|
||||
ASSERT(m_framebufferName != 0);
|
||||
if (m_framebufferName == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(m_viewContext == NULL);
|
||||
if (m_viewContext != NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
m_viewContext = new ViewContext();
|
||||
BOOL success;
|
||||
bool success;
|
||||
if (IsUsingFixedDimensions())
|
||||
success = m_viewContext->Create(GetGraphicsDevice(), Rect(0, 0, m_fixedWidth, m_fixedHeight));
|
||||
else
|
||||
|
@ -117,36 +117,36 @@ BOOL Framebuffer::AttachViewContext()
|
|||
if (!success)
|
||||
{
|
||||
SAFE_DELETE(m_viewContext);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL Framebuffer::AttachTexture(FRAMEBUFFER_DATA_TYPE type)
|
||||
bool Framebuffer::AttachTexture(FRAMEBUFFER_DATA_TYPE type)
|
||||
{
|
||||
ASSERT(m_framebufferName != 0);
|
||||
if (m_framebufferName == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
Texture *existing = GetTexture(type);
|
||||
ASSERT(existing == NULL);
|
||||
if (existing != NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// also need to make sure a renderbuffer isn't already attached to this type!
|
||||
Renderbuffer *existingRenderbuffer = GetRenderbuffer(type);
|
||||
ASSERT(existingRenderbuffer == NULL);
|
||||
if (existingRenderbuffer != NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// don't allow unsupported types!
|
||||
if (type == FRAMEBUFFER_DATA_NONE)
|
||||
return FALSE;
|
||||
return false;
|
||||
if (type == FRAMEBUFFER_DATA_DEPTH && !GetGraphicsDevice()->IsDepthTextureSupported())
|
||||
return FALSE;
|
||||
return false;
|
||||
if (type == FRAMEBUFFER_DATA_STENCIL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// determine texture format and framebuffer attachment type
|
||||
TEXTURE_FORMAT textureFormat;
|
||||
|
@ -171,19 +171,19 @@ BOOL Framebuffer::AttachTexture(FRAMEBUFFER_DATA_TYPE type)
|
|||
}
|
||||
ASSERT(attachmentType != 0);
|
||||
if (attachmentType == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
uint width = 0;
|
||||
uint height = 0;
|
||||
GetDimensionsForAttachment(width, height);
|
||||
|
||||
Texture *attach = new Texture();
|
||||
BOOL textureSuccess = attach->Create(GetGraphicsDevice(), width, height, textureFormat);
|
||||
ASSERT(textureSuccess == TRUE);
|
||||
bool textureSuccess = attach->Create(GetGraphicsDevice(), width, height, textureFormat);
|
||||
ASSERT(textureSuccess == true);
|
||||
if (!textureSuccess)
|
||||
{
|
||||
SAFE_DELETE(attach);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
GetGraphicsDevice()->BindFramebuffer(this);
|
||||
|
@ -192,10 +192,10 @@ BOOL Framebuffer::AttachTexture(FRAMEBUFFER_DATA_TYPE type)
|
|||
|
||||
m_textures[type] = attach;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL Framebuffer::ReCreateAndAttach(FramebufferTextureMap::iterator &itor, BOOL releaseFirst)
|
||||
bool Framebuffer::ReCreateAndAttach(FramebufferTextureMap::iterator &itor, bool releaseFirst)
|
||||
{
|
||||
Texture *existing = itor->second;
|
||||
|
||||
|
@ -210,7 +210,7 @@ BOOL Framebuffer::ReCreateAndAttach(FramebufferTextureMap::iterator &itor, BOOL
|
|||
}
|
||||
ASSERT(attachmentType != 0);
|
||||
if (attachmentType == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
uint width = 0;
|
||||
uint height = 0;
|
||||
|
@ -221,38 +221,38 @@ BOOL Framebuffer::ReCreateAndAttach(FramebufferTextureMap::iterator &itor, BOOL
|
|||
if (releaseFirst)
|
||||
existing->Release();
|
||||
|
||||
BOOL textureSuccess = existing->Create(GetGraphicsDevice(), width, height, existingFormat);
|
||||
ASSERT(textureSuccess == TRUE);
|
||||
bool textureSuccess = existing->Create(GetGraphicsDevice(), width, height, existingFormat);
|
||||
ASSERT(textureSuccess == true);
|
||||
if (!textureSuccess)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
GetGraphicsDevice()->BindFramebuffer(this);
|
||||
GL_CALL(glFramebufferTexture2D(GL_FRAMEBUFFER, attachmentType, GL_TEXTURE_2D, existing->GetTextureName(), 0));
|
||||
GetGraphicsDevice()->UnbindFramebuffer(this);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL Framebuffer::AttachRenderbuffer(FRAMEBUFFER_DATA_TYPE type)
|
||||
bool Framebuffer::AttachRenderbuffer(FRAMEBUFFER_DATA_TYPE type)
|
||||
{
|
||||
ASSERT(m_framebufferName != 0);
|
||||
if (m_framebufferName == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
Renderbuffer *existing = GetRenderbuffer(type);
|
||||
ASSERT(existing == NULL);
|
||||
if (existing != NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// also need to make sure a texture isn't already attached to this type!
|
||||
Texture *existingTexture = GetTexture(type);
|
||||
ASSERT(existingTexture == NULL);
|
||||
if (existingTexture != NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// don't allow unsupported types!
|
||||
if (type == FRAMEBUFFER_DATA_NONE)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// determine framebuffer attachment type
|
||||
GLenum attachmentType;
|
||||
|
@ -266,19 +266,19 @@ BOOL Framebuffer::AttachRenderbuffer(FRAMEBUFFER_DATA_TYPE type)
|
|||
}
|
||||
ASSERT(attachmentType != 0);
|
||||
if (attachmentType == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
uint width = 0;
|
||||
uint height = 0;
|
||||
GetDimensionsForAttachment(width, height);
|
||||
|
||||
Renderbuffer *attach = new Renderbuffer();
|
||||
BOOL renderbufferSuccess = attach->Initialize(GetGraphicsDevice(), width, height, type);
|
||||
ASSERT(renderbufferSuccess == TRUE);
|
||||
bool renderbufferSuccess = attach->Initialize(GetGraphicsDevice(), width, height, type);
|
||||
ASSERT(renderbufferSuccess == true);
|
||||
if (!renderbufferSuccess)
|
||||
{
|
||||
SAFE_DELETE(attach);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
GetGraphicsDevice()->BindFramebuffer(this);
|
||||
|
@ -287,10 +287,10 @@ BOOL Framebuffer::AttachRenderbuffer(FRAMEBUFFER_DATA_TYPE type)
|
|||
|
||||
m_renderbuffers[type] = attach;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL Framebuffer::ReCreateAndAttach(FramebufferRenderbufferMap::iterator &itor, BOOL releaseFirst)
|
||||
bool Framebuffer::ReCreateAndAttach(FramebufferRenderbufferMap::iterator &itor, bool releaseFirst)
|
||||
{
|
||||
Renderbuffer *existing = itor->second;
|
||||
|
||||
|
@ -306,7 +306,7 @@ BOOL Framebuffer::ReCreateAndAttach(FramebufferRenderbufferMap::iterator &itor,
|
|||
}
|
||||
ASSERT(attachmentType != 0);
|
||||
if (attachmentType == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
uint width = 0;
|
||||
uint height = 0;
|
||||
|
@ -317,46 +317,46 @@ BOOL Framebuffer::ReCreateAndAttach(FramebufferRenderbufferMap::iterator &itor,
|
|||
if (releaseFirst)
|
||||
existing->Release();
|
||||
|
||||
BOOL renderbufferSuccess = existing->Initialize(GetGraphicsDevice(), width, height, existingType);
|
||||
ASSERT(renderbufferSuccess == TRUE);
|
||||
bool renderbufferSuccess = existing->Initialize(GetGraphicsDevice(), width, height, existingType);
|
||||
ASSERT(renderbufferSuccess == true);
|
||||
if (!renderbufferSuccess)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
GetGraphicsDevice()->BindFramebuffer(this);
|
||||
GL_CALL(glFramebufferRenderbuffer(GL_FRAMEBUFFER, attachmentType, GL_RENDERBUFFER, existing->GetRenderbufferName()));
|
||||
GetGraphicsDevice()->UnbindFramebuffer(this);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL Framebuffer::ReleaseViewContext()
|
||||
bool Framebuffer::ReleaseViewContext()
|
||||
{
|
||||
ASSERT(m_framebufferName != 0);
|
||||
if (m_framebufferName == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(m_viewContext != NULL);
|
||||
if (m_viewContext == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
if (GetGraphicsDevice()->GetViewContext() == m_viewContext)
|
||||
GetGraphicsDevice()->SetViewContext(NULL);
|
||||
|
||||
SAFE_DELETE(m_viewContext);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL Framebuffer::ReleaseTexture(FRAMEBUFFER_DATA_TYPE type)
|
||||
bool Framebuffer::ReleaseTexture(FRAMEBUFFER_DATA_TYPE type)
|
||||
{
|
||||
ASSERT(m_framebufferName != 0);
|
||||
if (m_framebufferName == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
Texture *existing = GetTexture(type);
|
||||
ASSERT(existing != NULL);
|
||||
if (existing == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// determine attachment type
|
||||
GLenum attachmentType;
|
||||
|
@ -376,30 +376,30 @@ BOOL Framebuffer::ReleaseTexture(FRAMEBUFFER_DATA_TYPE type)
|
|||
}
|
||||
ASSERT(attachmentType != 0);
|
||||
if (attachmentType == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
GetGraphicsDevice()->BindFramebuffer(this);
|
||||
GL_CALL(glFramebufferTexture2D(GL_FRAMEBUFFER, attachmentType, GL_TEXTURE_2D, 0, 0));
|
||||
GetGraphicsDevice()->UnbindFramebuffer(this);
|
||||
|
||||
BOOL removeSuccess = RemoveTexture(existing);
|
||||
ASSERT(removeSuccess == TRUE);
|
||||
bool removeSuccess = RemoveTexture(existing);
|
||||
ASSERT(removeSuccess == true);
|
||||
if (!removeSuccess)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL Framebuffer::ReleaseRenderbuffer(FRAMEBUFFER_DATA_TYPE type)
|
||||
bool Framebuffer::ReleaseRenderbuffer(FRAMEBUFFER_DATA_TYPE type)
|
||||
{
|
||||
ASSERT(m_framebufferName != 0);
|
||||
if (m_framebufferName == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
Renderbuffer *existing = GetRenderbuffer(type);
|
||||
ASSERT(existing != NULL);
|
||||
if (existing == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// determine attachment type
|
||||
GLenum attachmentType;
|
||||
|
@ -419,18 +419,18 @@ BOOL Framebuffer::ReleaseRenderbuffer(FRAMEBUFFER_DATA_TYPE type)
|
|||
}
|
||||
ASSERT(attachmentType != 0);
|
||||
if (attachmentType == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
GetGraphicsDevice()->BindFramebuffer(this);
|
||||
GL_CALL(glFramebufferRenderbuffer(GL_FRAMEBUFFER, attachmentType, GL_RENDERBUFFER, 0));
|
||||
GetGraphicsDevice()->UnbindFramebuffer(this);
|
||||
|
||||
BOOL removeSuccess = RemoveRenderbuffer(existing);
|
||||
ASSERT(removeSuccess == TRUE);
|
||||
bool removeSuccess = RemoveRenderbuffer(existing);
|
||||
ASSERT(removeSuccess == true);
|
||||
if (!removeSuccess)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
Texture* Framebuffer::GetTexture(FRAMEBUFFER_DATA_TYPE type) const
|
||||
|
@ -497,8 +497,8 @@ void Framebuffer::OnNewContext()
|
|||
|
||||
for (FramebufferTextureMap::iterator i = m_textures.begin(); i != m_textures.end(); ++i)
|
||||
{
|
||||
BOOL success = ReCreateAndAttach(i, FALSE);
|
||||
ASSERT(success == TRUE);
|
||||
bool success = ReCreateAndAttach(i, false);
|
||||
ASSERT(success == true);
|
||||
if (!success)
|
||||
{
|
||||
Release();
|
||||
|
@ -508,8 +508,8 @@ void Framebuffer::OnNewContext()
|
|||
|
||||
for (FramebufferRenderbufferMap::iterator i = m_renderbuffers.begin(); i != m_renderbuffers.end(); ++i)
|
||||
{
|
||||
BOOL success = ReCreateAndAttach(i, FALSE);
|
||||
ASSERT(success == TRUE);
|
||||
bool success = ReCreateAndAttach(i, false);
|
||||
ASSERT(success == true);
|
||||
if (!success)
|
||||
{
|
||||
Release();
|
||||
|
@ -544,8 +544,8 @@ void Framebuffer::OnResize()
|
|||
|
||||
for (FramebufferTextureMap::iterator i = m_textures.begin(); i != m_textures.end(); ++i)
|
||||
{
|
||||
BOOL success = ReCreateAndAttach(i, TRUE);
|
||||
ASSERT(success == TRUE);
|
||||
bool success = ReCreateAndAttach(i, true);
|
||||
ASSERT(success == true);
|
||||
if (!success)
|
||||
{
|
||||
Release();
|
||||
|
@ -555,8 +555,8 @@ void Framebuffer::OnResize()
|
|||
|
||||
for (FramebufferRenderbufferMap::iterator i = m_renderbuffers.begin(); i != m_renderbuffers.end(); ++i)
|
||||
{
|
||||
BOOL success = ReCreateAndAttach(i, TRUE);
|
||||
ASSERT(success == TRUE);
|
||||
bool success = ReCreateAndAttach(i, true);
|
||||
ASSERT(success == true);
|
||||
if (!success)
|
||||
{
|
||||
Release();
|
||||
|
@ -574,7 +574,7 @@ void Framebuffer::OnUnBind()
|
|||
{
|
||||
}
|
||||
|
||||
BOOL Framebuffer::RemoveTexture(Texture *texture)
|
||||
bool Framebuffer::RemoveTexture(Texture *texture)
|
||||
{
|
||||
for (FramebufferTextureMap::iterator i = m_textures.begin(); i != m_textures.end(); ++i)
|
||||
{
|
||||
|
@ -582,14 +582,14 @@ BOOL Framebuffer::RemoveTexture(Texture *texture)
|
|||
{
|
||||
SAFE_DELETE(texture);
|
||||
m_textures.erase(i);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL Framebuffer::RemoveRenderbuffer(Renderbuffer *renderbuffer)
|
||||
bool Framebuffer::RemoveRenderbuffer(Renderbuffer *renderbuffer)
|
||||
{
|
||||
for (FramebufferRenderbufferMap::iterator i = m_renderbuffers.begin(); i != m_renderbuffers.end(); ++i)
|
||||
{
|
||||
|
@ -597,11 +597,11 @@ BOOL Framebuffer::RemoveRenderbuffer(Renderbuffer *renderbuffer)
|
|||
{
|
||||
SAFE_DELETE(renderbuffer);
|
||||
m_renderbuffers.erase(i);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void Framebuffer::GetDimensionsForAttachment(uint &width, uint &height) const
|
||||
|
|
|
@ -24,19 +24,19 @@ public:
|
|||
|
||||
void Release();
|
||||
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice);
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, uint fixedWidth, uint fixedHeight);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice, uint fixedWidth, uint fixedHeight);
|
||||
|
||||
uint GetFramebufferName() const { return m_framebufferName; }
|
||||
BOOL IsInvalidated() const { return m_framebufferName == 0; }
|
||||
BOOL IsUsingFixedDimensions() const { return (m_fixedWidth != 0 && m_fixedHeight != 0); }
|
||||
bool IsInvalidated() const { return m_framebufferName == 0; }
|
||||
bool IsUsingFixedDimensions() const { return (m_fixedWidth != 0 && m_fixedHeight != 0); }
|
||||
|
||||
BOOL AttachViewContext();
|
||||
BOOL AttachTexture(FRAMEBUFFER_DATA_TYPE type);
|
||||
BOOL AttachRenderbuffer(FRAMEBUFFER_DATA_TYPE type);
|
||||
BOOL ReleaseViewContext();
|
||||
BOOL ReleaseTexture(FRAMEBUFFER_DATA_TYPE type);
|
||||
BOOL ReleaseRenderbuffer(FRAMEBUFFER_DATA_TYPE type);
|
||||
bool AttachViewContext();
|
||||
bool AttachTexture(FRAMEBUFFER_DATA_TYPE type);
|
||||
bool AttachRenderbuffer(FRAMEBUFFER_DATA_TYPE type);
|
||||
bool ReleaseViewContext();
|
||||
bool ReleaseTexture(FRAMEBUFFER_DATA_TYPE type);
|
||||
bool ReleaseRenderbuffer(FRAMEBUFFER_DATA_TYPE type);
|
||||
|
||||
ViewContext* GetViewContext() const { return m_viewContext; }
|
||||
Texture* GetTexture(FRAMEBUFFER_DATA_TYPE type) const;
|
||||
|
@ -52,10 +52,10 @@ private:
|
|||
|
||||
void CreateFramebuffer();
|
||||
|
||||
BOOL ReCreateAndAttach(FramebufferTextureMap::iterator &itor, BOOL releaseFirst);
|
||||
BOOL ReCreateAndAttach(FramebufferRenderbufferMap::iterator &itor, BOOL releaseFirst);
|
||||
BOOL RemoveTexture(Texture *texture);
|
||||
BOOL RemoveRenderbuffer(Renderbuffer *renderbuffer);
|
||||
bool ReCreateAndAttach(FramebufferTextureMap::iterator &itor, bool releaseFirst);
|
||||
bool ReCreateAndAttach(FramebufferRenderbufferMap::iterator &itor, bool releaseFirst);
|
||||
bool RemoveTexture(Texture *texture);
|
||||
bool RemoveRenderbuffer(Renderbuffer *renderbuffer);
|
||||
|
||||
void GetDimensionsForAttachment(uint &width, uint &height) const;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "../math/point3.h"
|
||||
#include "../math/ray.h"
|
||||
|
||||
GeometryDebugRenderer::GeometryDebugRenderer(GraphicsDevice *graphicsDevice, BOOL depthTesting)
|
||||
GeometryDebugRenderer::GeometryDebugRenderer(GraphicsDevice *graphicsDevice, bool depthTesting)
|
||||
{
|
||||
m_graphicsDevice = graphicsDevice;
|
||||
m_color1 = Color(1.0f, 1.0f, 0.0f);
|
||||
|
@ -37,7 +37,7 @@ GeometryDebugRenderer::GeometryDebugRenderer(GraphicsDevice *graphicsDevice, BOO
|
|||
m_vertices->Initialize(attribs, 2, 16384, BUFFEROBJECT_USAGE_STREAM);
|
||||
m_currentVertex = 0;
|
||||
|
||||
m_begunRendering = FALSE;
|
||||
m_begunRendering = false;
|
||||
}
|
||||
|
||||
GeometryDebugRenderer::~GeometryDebugRenderer()
|
||||
|
@ -49,12 +49,12 @@ GeometryDebugRenderer::~GeometryDebugRenderer()
|
|||
void GeometryDebugRenderer::Begin()
|
||||
{
|
||||
m_currentVertex = 0;
|
||||
m_begunRendering = TRUE;
|
||||
m_begunRendering = true;
|
||||
}
|
||||
|
||||
void GeometryDebugRenderer::Render(const BoundingBox &box, const Color &color)
|
||||
{
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
ASSERT(m_begunRendering == true);
|
||||
ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 24));
|
||||
|
||||
uint i = m_currentVertex;
|
||||
|
@ -117,7 +117,7 @@ void GeometryDebugRenderer::Render(const Point3 &boxMin, const Point3 &boxMax, c
|
|||
|
||||
void GeometryDebugRenderer::Render(const BoundingSphere &sphere, const Color &color)
|
||||
{
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
ASSERT(m_begunRendering == true);
|
||||
ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 615));
|
||||
|
||||
uint p = m_currentVertex;
|
||||
|
@ -178,7 +178,7 @@ void GeometryDebugRenderer::Render(const BoundingSphere &sphere, const Color &co
|
|||
|
||||
void GeometryDebugRenderer::Render(const Ray &ray, float length, const Color &color1, const Color &color2)
|
||||
{
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
ASSERT(m_begunRendering == true);
|
||||
ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 2));
|
||||
|
||||
Vector3 temp = ray.GetPositionAt(length);
|
||||
|
@ -193,7 +193,7 @@ void GeometryDebugRenderer::Render(const Ray &ray, float length, const Color &co
|
|||
|
||||
void GeometryDebugRenderer::Render(const LineSegment &line, const Color &color)
|
||||
{
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
ASSERT(m_begunRendering == true);
|
||||
ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 2));
|
||||
|
||||
m_vertices->SetPosition3(m_currentVertex, line.a);
|
||||
|
@ -206,7 +206,7 @@ void GeometryDebugRenderer::Render(const LineSegment &line, const Color &color)
|
|||
|
||||
void GeometryDebugRenderer::Render(const Vector3 &a, const Vector3 &b, const Vector3 &c, const Color &color)
|
||||
{
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
ASSERT(m_begunRendering == true);
|
||||
ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 6));
|
||||
|
||||
m_vertices->SetPosition3(m_currentVertex, a);
|
||||
|
@ -227,7 +227,7 @@ void GeometryDebugRenderer::Render(const Vector3 &a, const Vector3 &b, const Vec
|
|||
|
||||
void GeometryDebugRenderer::End()
|
||||
{
|
||||
ASSERT(m_begunRendering == TRUE);
|
||||
ASSERT(m_begunRendering == true);
|
||||
|
||||
if (m_currentVertex > 0)
|
||||
{
|
||||
|
@ -247,5 +247,5 @@ void GeometryDebugRenderer::End()
|
|||
m_graphicsDevice->UnbindShader();
|
||||
}
|
||||
|
||||
m_begunRendering = FALSE;
|
||||
m_begunRendering = false;
|
||||
}
|
||||
|
|
|
@ -25,9 +25,9 @@ public:
|
|||
/**
|
||||
* Creates a geometry debug renderer.
|
||||
* @param graphicsDevice the graphics device to use for rendering
|
||||
* @param depthTesting TRUE to enable depth testing for all geometry rendering
|
||||
* @param depthTesting true to enable depth testing for all geometry rendering
|
||||
*/
|
||||
GeometryDebugRenderer(GraphicsDevice *graphicsDevice, BOOL depthTesting = FALSE);
|
||||
GeometryDebugRenderer(GraphicsDevice *graphicsDevice, bool depthTesting = false);
|
||||
|
||||
virtual ~GeometryDebugRenderer();
|
||||
|
||||
|
@ -126,7 +126,7 @@ private:
|
|||
VertexBuffer *m_vertices;
|
||||
uint m_currentVertex;
|
||||
|
||||
BOOL m_begunRendering;
|
||||
bool m_begunRendering;
|
||||
};
|
||||
|
||||
inline void GeometryDebugRenderer::Render(const BoundingBox &box)
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
#include "glutils.h"
|
||||
#include <string.h>
|
||||
|
||||
BOOL IsGLExtensionPresent(const char* extension)
|
||||
bool IsGLExtensionPresent(const char* extension)
|
||||
{
|
||||
ASSERT(extension != NULL);
|
||||
ASSERT(strlen(extension) > 0);
|
||||
|
||||
const char* extensionsList = (const char*)glGetString(GL_EXTENSIONS);
|
||||
|
||||
return (strstr(extensionsList, extension) != NULL ? TRUE : FALSE);
|
||||
return (strstr(extensionsList, extension) != NULL ? true : false);
|
||||
}
|
||||
|
||||
const char* GetGLErrorString(GLenum error)
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
* Checks if an OpenGL extension is present in the current
|
||||
* implementation. This performs a case-sensitive string match.
|
||||
* @param extension the name of the extension to check for.
|
||||
* @return TRUE if the extension is present, FALSE if not
|
||||
* @return true if the extension is present, false if not
|
||||
*/
|
||||
BOOL IsGLExtensionPresent(const char* extension);
|
||||
bool IsGLExtensionPresent(const char* extension);
|
||||
|
||||
/**
|
||||
* Converts a OpenGL error code to a string equivalent.
|
||||
|
|
|
@ -16,27 +16,27 @@ void GraphicsContextResource::Release()
|
|||
m_graphicsDevice = NULL;
|
||||
}
|
||||
|
||||
BOOL GraphicsContextResource::Initialize()
|
||||
bool GraphicsContextResource::Initialize()
|
||||
{
|
||||
ASSERT(m_graphicsDevice == NULL);
|
||||
if (m_graphicsDevice != NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL GraphicsContextResource::Initialize(GraphicsDevice *graphicsDevice)
|
||||
bool GraphicsContextResource::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
ASSERT(m_graphicsDevice == NULL);
|
||||
if (m_graphicsDevice != NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(graphicsDevice != NULL);
|
||||
if (graphicsDevice == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
m_graphicsDevice = graphicsDevice;
|
||||
m_graphicsDevice->RegisterManagedResource(this);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -31,8 +31,8 @@ public:
|
|||
GraphicsDevice* GetGraphicsDevice() const { return m_graphicsDevice; }
|
||||
|
||||
protected:
|
||||
BOOL Initialize();
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice);
|
||||
bool Initialize();
|
||||
bool Initialize(GraphicsDevice *graphicsDevice);
|
||||
|
||||
private:
|
||||
GraphicsDevice *m_graphicsDevice;
|
||||
|
|
|
@ -44,11 +44,11 @@ const unsigned int MAX_GPU_ATTRIB_SLOTS = 8;
|
|||
|
||||
GraphicsDevice::GraphicsDevice()
|
||||
{
|
||||
m_hasNewContextRunYet = FALSE;
|
||||
m_hasNewContextRunYet = false;
|
||||
m_boundVertexBuffer = NULL;
|
||||
m_boundIndexBuffer = NULL;
|
||||
m_boundShader = NULL;
|
||||
m_shaderVertexAttribsSet = FALSE;
|
||||
m_shaderVertexAttribsSet = false;
|
||||
m_boundTextures = NULL;
|
||||
m_boundFramebuffer = NULL;
|
||||
m_boundRenderbuffer = NULL;
|
||||
|
@ -64,22 +64,22 @@ GraphicsDevice::GraphicsDevice()
|
|||
m_sprite2dShader = NULL;
|
||||
m_sprite3dShader = NULL;
|
||||
m_debugShader = NULL;
|
||||
m_isDepthTextureSupported = FALSE;
|
||||
m_isNonPowerOfTwoTextureSupported = FALSE;
|
||||
m_isDepthTextureSupported = false;
|
||||
m_isNonPowerOfTwoTextureSupported = false;
|
||||
m_window = NULL;
|
||||
}
|
||||
|
||||
BOOL GraphicsDevice::Initialize(GameWindow *window)
|
||||
bool GraphicsDevice::Initialize(GameWindow *window)
|
||||
{
|
||||
ASSERT(m_window == NULL);
|
||||
if (m_window != NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(window != NULL);
|
||||
if (window == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
m_hasNewContextRunYet = FALSE;
|
||||
m_hasNewContextRunYet = false;
|
||||
m_boundTextures = new const Texture*[MAX_BOUND_TEXTURES];
|
||||
m_enabledVertexAttribIndices.reserve(MAX_GPU_ATTRIB_SLOTS);
|
||||
|
||||
|
@ -106,7 +106,7 @@ BOOL GraphicsDevice::Initialize(GameWindow *window)
|
|||
|
||||
m_solidColorTextures = new SolidColorTextureCache(this);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void GraphicsDevice::Release()
|
||||
|
@ -126,16 +126,16 @@ void GraphicsDevice::Release()
|
|||
m_enabledVertexAttribIndices.clear();
|
||||
m_managedResources.clear();
|
||||
|
||||
m_hasNewContextRunYet = FALSE;
|
||||
m_hasNewContextRunYet = false;
|
||||
m_boundVertexBuffer = NULL;
|
||||
m_boundIndexBuffer = NULL;
|
||||
m_boundShader = NULL;
|
||||
m_shaderVertexAttribsSet = FALSE;
|
||||
m_shaderVertexAttribsSet = false;
|
||||
m_boundFramebuffer = NULL;
|
||||
m_boundRenderbuffer = NULL;
|
||||
m_activeViewContext = NULL;
|
||||
m_isDepthTextureSupported = FALSE;
|
||||
m_isNonPowerOfTwoTextureSupported = FALSE;
|
||||
m_isDepthTextureSupported = false;
|
||||
m_isNonPowerOfTwoTextureSupported = false;
|
||||
m_window = NULL;
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ void GraphicsDevice::OnNewContext()
|
|||
(*i)->OnNewContext();
|
||||
}
|
||||
|
||||
m_hasNewContextRunYet = TRUE;
|
||||
m_hasNewContextRunYet = true;
|
||||
}
|
||||
|
||||
void GraphicsDevice::OnLostContext()
|
||||
|
@ -317,7 +317,7 @@ void GraphicsDevice::BindTexture(const Texture *texture, uint unit)
|
|||
{
|
||||
ASSERT(unit < MAX_BOUND_TEXTURES);
|
||||
ASSERT(texture != NULL);
|
||||
ASSERT(texture->IsInvalidated() == FALSE);
|
||||
ASSERT(texture->IsInvalidated() == false);
|
||||
if (texture != m_boundTextures[unit])
|
||||
{
|
||||
GL_CALL(glActiveTexture(GL_TEXTURE0 + unit));
|
||||
|
@ -356,7 +356,7 @@ void GraphicsDevice::UnbindTexture(const Texture *texture)
|
|||
void GraphicsDevice::BindRenderbuffer(Renderbuffer *renderbuffer)
|
||||
{
|
||||
ASSERT(renderbuffer != NULL);
|
||||
ASSERT(renderbuffer->IsInvalidated() == FALSE);
|
||||
ASSERT(renderbuffer->IsInvalidated() == false);
|
||||
if (m_boundRenderbuffer != renderbuffer)
|
||||
{
|
||||
GL_CALL(glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer->GetRenderbufferName()));
|
||||
|
@ -383,7 +383,7 @@ void GraphicsDevice::UnbindRenderBuffer(Renderbuffer *renderBuffer)
|
|||
void GraphicsDevice::BindFramebuffer(Framebuffer *framebuffer)
|
||||
{
|
||||
ASSERT(framebuffer != NULL);
|
||||
ASSERT(framebuffer->IsInvalidated() == FALSE);
|
||||
ASSERT(framebuffer->IsInvalidated() == false);
|
||||
if (m_boundFramebuffer != framebuffer)
|
||||
{
|
||||
GL_CALL(glBindFramebuffer(GL_FRAMEBUFFER, framebuffer->GetFramebufferName()));
|
||||
|
@ -505,7 +505,7 @@ void GraphicsDevice::UnbindIndexBuffer()
|
|||
void GraphicsDevice::BindShader(Shader *shader)
|
||||
{
|
||||
ASSERT(shader != NULL);
|
||||
ASSERT(shader->IsReadyForUse() == TRUE);
|
||||
ASSERT(shader->IsReadyForUse() == true);
|
||||
GL_CALL(glUseProgram(shader->GetProgramId()));
|
||||
|
||||
m_boundShader = shader;
|
||||
|
@ -557,7 +557,7 @@ void GraphicsDevice::SetShaderVertexAttributes()
|
|||
{
|
||||
ASSERT(m_boundVertexBuffer != NULL);
|
||||
ASSERT(m_boundShader != NULL);
|
||||
ASSERT(m_enabledVertexAttribIndices.empty() == TRUE);
|
||||
ASSERT(m_enabledVertexAttribIndices.empty() == true);
|
||||
ASSERT(m_boundVertexBuffer->GetNumAttributes() >= m_boundShader->GetNumAttributes());
|
||||
|
||||
uint numAttributes = m_boundShader->GetNumAttributes();
|
||||
|
@ -593,12 +593,12 @@ void GraphicsDevice::SetShaderVertexAttributes()
|
|||
buffer = (int8_t*)NULL + (offset * sizeof(float));
|
||||
|
||||
GL_CALL(glEnableVertexAttribArray(i));
|
||||
GL_CALL(glVertexAttribPointer(i, size, GL_FLOAT, FALSE, m_boundVertexBuffer->GetElementWidthInBytes(), buffer));
|
||||
GL_CALL(glVertexAttribPointer(i, size, GL_FLOAT, false, m_boundVertexBuffer->GetElementWidthInBytes(), buffer));
|
||||
|
||||
m_enabledVertexAttribIndices.push_back(i);
|
||||
}
|
||||
|
||||
m_shaderVertexAttribsSet = TRUE;
|
||||
m_shaderVertexAttribsSet = true;
|
||||
}
|
||||
|
||||
void GraphicsDevice::ClearSetShaderVertexAttributes()
|
||||
|
@ -610,13 +610,13 @@ void GraphicsDevice::ClearSetShaderVertexAttributes()
|
|||
GL_CALL(glDisableVertexAttribArray(index));
|
||||
}
|
||||
|
||||
m_shaderVertexAttribsSet = FALSE;
|
||||
m_shaderVertexAttribsSet = false;
|
||||
}
|
||||
|
||||
void GraphicsDevice::RenderTriangles(const IndexBuffer *buffer)
|
||||
{
|
||||
ASSERT(buffer != NULL);
|
||||
ASSERT(buffer->IsClientSideBuffer() == TRUE);
|
||||
ASSERT(buffer->IsClientSideBuffer() == true);
|
||||
ASSERT(m_boundVertexBuffer != NULL);
|
||||
ASSERT(m_boundIndexBuffer == NULL);
|
||||
if (!m_shaderVertexAttribsSet)
|
||||
|
@ -692,7 +692,7 @@ void GraphicsDevice::RenderTriangles(uint startVertex, uint numTriangles)
|
|||
void GraphicsDevice::RenderLines(const IndexBuffer *buffer)
|
||||
{
|
||||
ASSERT(buffer != NULL);
|
||||
ASSERT(buffer->IsClientSideBuffer() == TRUE);
|
||||
ASSERT(buffer->IsClientSideBuffer() == true);
|
||||
ASSERT(m_boundVertexBuffer != NULL);
|
||||
ASSERT(m_boundIndexBuffer == NULL);
|
||||
if (!m_shaderVertexAttribsSet)
|
||||
|
@ -768,7 +768,7 @@ void GraphicsDevice::RenderLines(uint startVertex, uint numLines)
|
|||
void GraphicsDevice::RenderPoints(const IndexBuffer *buffer)
|
||||
{
|
||||
ASSERT(buffer != NULL);
|
||||
ASSERT(buffer->IsClientSideBuffer() == TRUE);
|
||||
ASSERT(buffer->IsClientSideBuffer() == true);
|
||||
ASSERT(m_boundVertexBuffer != NULL);
|
||||
ASSERT(m_boundIndexBuffer == NULL);
|
||||
if (!m_shaderVertexAttribsSet)
|
||||
|
|
|
@ -55,9 +55,9 @@ public:
|
|||
* Initializes the graphics device object based on a parent window that is
|
||||
* hosting the OpenGL context.
|
||||
* @param window a window with an active OpenGL context associated with it
|
||||
* @return TRUE if successful, FALSE if not
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
BOOL Initialize(GameWindow *window);
|
||||
bool Initialize(GameWindow *window);
|
||||
|
||||
/**
|
||||
* New OpenGL graphics context creation callback.
|
||||
|
@ -345,15 +345,15 @@ public:
|
|||
DebugShader* GetDebugShader();
|
||||
|
||||
/**
|
||||
* @return TRUE if depth textures are supported
|
||||
* @return true if depth textures are supported
|
||||
*/
|
||||
BOOL IsDepthTextureSupported() const { return m_isDepthTextureSupported; }
|
||||
bool IsDepthTextureSupported() const { return m_isDepthTextureSupported; }
|
||||
|
||||
/**
|
||||
* @return TRUE if textures with dimensions that are not a power of two
|
||||
* @return true if textures with dimensions that are not a power of two
|
||||
* are supported
|
||||
*/
|
||||
BOOL IsNonPowerOfTwoTextureSupported() const { return m_isNonPowerOfTwoTextureSupported; }
|
||||
bool IsNonPowerOfTwoTextureSupported() const { return m_isNonPowerOfTwoTextureSupported; }
|
||||
|
||||
/**
|
||||
* @return the parent window object that this graphics device is for
|
||||
|
@ -366,7 +366,7 @@ private:
|
|||
void BindIBO(IndexBuffer *buffer);
|
||||
void BindClientBuffer(IndexBuffer *buffer);
|
||||
|
||||
BOOL IsReadyToRender() const;
|
||||
bool IsReadyToRender() const;
|
||||
|
||||
void SetShaderVertexAttributes();
|
||||
void ClearSetShaderVertexAttributes();
|
||||
|
@ -379,10 +379,10 @@ private:
|
|||
const IndexBuffer *m_boundIndexBuffer;
|
||||
const Texture **m_boundTextures;
|
||||
Shader *m_boundShader;
|
||||
BOOL m_shaderVertexAttribsSet;
|
||||
bool m_shaderVertexAttribsSet;
|
||||
EnabledVertexAttribList m_enabledVertexAttribIndices;
|
||||
BOOL m_isDepthTextureSupported;
|
||||
BOOL m_isNonPowerOfTwoTextureSupported;
|
||||
bool m_isDepthTextureSupported;
|
||||
bool m_isNonPowerOfTwoTextureSupported;
|
||||
|
||||
GameWindow *m_window;
|
||||
ViewContext *m_defaultViewContext;
|
||||
|
@ -401,7 +401,7 @@ private:
|
|||
Sprite3DShader *m_sprite3dShader;
|
||||
DebugShader *m_debugShader;
|
||||
|
||||
BOOL m_hasNewContextRunYet;
|
||||
bool m_hasNewContextRunYet;
|
||||
};
|
||||
|
||||
inline void GraphicsDevice::SetTextureParameters(const TextureParameters ¶ms)
|
||||
|
@ -409,12 +409,12 @@ inline void GraphicsDevice::SetTextureParameters(const TextureParameters ¶ms
|
|||
m_currentTextureParams = params;
|
||||
}
|
||||
|
||||
inline BOOL GraphicsDevice::IsReadyToRender() const
|
||||
inline bool GraphicsDevice::IsReadyToRender() const
|
||||
{
|
||||
if (m_boundShader != NULL && m_boundVertexBuffer != NULL && m_shaderVertexAttribsSet)
|
||||
return TRUE;
|
||||
return true;
|
||||
else
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -32,16 +32,16 @@ void Image::Release()
|
|||
}
|
||||
|
||||
|
||||
BOOL Image::Create(uint width, uint height, IMAGE_FORMAT format)
|
||||
bool Image::Create(uint width, uint height, IMAGE_FORMAT format)
|
||||
{
|
||||
ASSERT(m_pixels == NULL);
|
||||
if (m_pixels != NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(width != 0);
|
||||
ASSERT(height != 0);
|
||||
if (width == 0 || height == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
int bpp = 0;
|
||||
if (format == IMAGE_FORMAT_RGB)
|
||||
|
@ -53,7 +53,7 @@ BOOL Image::Create(uint width, uint height, IMAGE_FORMAT format)
|
|||
|
||||
ASSERT(bpp != 0);
|
||||
if (bpp == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
uint pixelsLength = (width * height) * (bpp / 8);
|
||||
m_pixels = new uint8_t[pixelsLength];
|
||||
|
@ -65,59 +65,59 @@ BOOL Image::Create(uint width, uint height, IMAGE_FORMAT format)
|
|||
m_format = format;
|
||||
m_pitch = width * (bpp / 8);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL Image::Create(const Image *source)
|
||||
bool Image::Create(const Image *source)
|
||||
{
|
||||
ASSERT(source != NULL);
|
||||
if (source == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
else
|
||||
return Create(source, 0, 0, source->GetWidth(), source->GetHeight());
|
||||
}
|
||||
|
||||
BOOL Image::Create(const Image *source, uint x, uint y, uint width, uint height)
|
||||
bool Image::Create(const Image *source, uint x, uint y, uint width, uint height)
|
||||
{
|
||||
ASSERT(m_pixels == NULL);
|
||||
if (m_pixels != NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(source != NULL);
|
||||
if (source == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(source->GetPixels() != NULL);
|
||||
if (source->GetPixels() == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(x < source->GetWidth());
|
||||
ASSERT(y < source->GetHeight());
|
||||
ASSERT((x + width) <= source->GetWidth());
|
||||
ASSERT((y + height) <= source->GetHeight());
|
||||
|
||||
BOOL baseCreateSuccess = Create(width, height, source->GetFormat());
|
||||
bool baseCreateSuccess = Create(width, height, source->GetFormat());
|
||||
if (!baseCreateSuccess)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
Copy(source, x, y, width, height, 0, 0);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL Image::Create(File *file)
|
||||
bool Image::Create(File *file)
|
||||
{
|
||||
ASSERT(m_pixels == NULL);
|
||||
if (m_pixels != NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(file != NULL);
|
||||
if (file == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(file->IsOpen());
|
||||
if (!file->IsOpen())
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
uint8_t *imageFileBytes = NULL;
|
||||
size_t imageFileSize = file->GetFileSize();
|
||||
|
@ -147,7 +147,7 @@ BOOL Image::Create(File *file)
|
|||
if (file->GetFileType() != FILETYPE_MEMORY)
|
||||
SAFE_DELETE_ARRAY(imageFileBytes);
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -166,7 +166,7 @@ BOOL Image::Create(File *file)
|
|||
{
|
||||
ASSERT(!"Unrecognized componentsPerPixel value.");
|
||||
stbi_image_free(pixels);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// copy from STB "owned" memory to our own, then free up the STB stuff
|
||||
|
@ -183,7 +183,7 @@ BOOL Image::Create(File *file)
|
|||
m_format = format;
|
||||
m_pitch = width * componentsPerPixel;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,16 +26,16 @@ public:
|
|||
* @param width the width of the image
|
||||
* @param height the height of the image
|
||||
* @param format the pixel format of the image
|
||||
* @return TRUE if successful
|
||||
* @return true if successful
|
||||
*/
|
||||
BOOL Create(uint width, uint height, IMAGE_FORMAT format);
|
||||
bool Create(uint width, uint height, IMAGE_FORMAT format);
|
||||
|
||||
/**
|
||||
* Creates a copy of an image from another image object.
|
||||
* @param source the source image object to copy
|
||||
* @return TRUE if successful
|
||||
* @return true if successful
|
||||
*/
|
||||
BOOL Create(const Image *source);
|
||||
bool Create(const Image *source);
|
||||
|
||||
/**
|
||||
* Creates a copy of a subsection of an image.
|
||||
|
@ -44,16 +44,16 @@ public:
|
|||
* @param y top Y coordinate of the source region to copy
|
||||
* @param width the width of the source region to copy
|
||||
* @param height the height of the source region to copy
|
||||
* @return TRUE if successful
|
||||
* @return true if successful
|
||||
*/
|
||||
BOOL Create(const Image *source, uint x, uint y, uint width, uint height);
|
||||
bool Create(const Image *source, uint x, uint y, uint width, uint height);
|
||||
|
||||
/**
|
||||
* Creates an image from an image file.
|
||||
* @param file the file to load as an image
|
||||
* @return TRUE if successful
|
||||
* @return true if successful
|
||||
*/
|
||||
BOOL Create(File *file);
|
||||
bool Create(File *file);
|
||||
|
||||
/**
|
||||
* Frees all image resources.
|
||||
|
|
|
@ -18,53 +18,53 @@ void IndexBuffer::Release()
|
|||
BufferObject::Release();
|
||||
}
|
||||
|
||||
BOOL IndexBuffer::Initialize(uint numIndices, BUFFEROBJECT_USAGE usage)
|
||||
bool IndexBuffer::Initialize(uint numIndices, BUFFEROBJECT_USAGE usage)
|
||||
{
|
||||
return Initialize(NULL, numIndices, usage);
|
||||
}
|
||||
|
||||
BOOL IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, uint numIndices, BUFFEROBJECT_USAGE usage)
|
||||
bool IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, uint numIndices, BUFFEROBJECT_USAGE usage)
|
||||
{
|
||||
ASSERT(m_buffer.size() == 0);
|
||||
if (m_buffer.size() > 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(numIndices > 0);
|
||||
if (numIndices == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
if (!BufferObject::Initialize(graphicsDevice, BUFFEROBJECT_TYPE_INDEX, usage))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
Resize(numIndices);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL IndexBuffer::Initialize(const IndexBuffer *source)
|
||||
bool IndexBuffer::Initialize(const IndexBuffer *source)
|
||||
{
|
||||
return Initialize(NULL, source);
|
||||
}
|
||||
|
||||
BOOL IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, const IndexBuffer *source)
|
||||
bool IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, const IndexBuffer *source)
|
||||
{
|
||||
ASSERT(m_buffer.size() == 0);
|
||||
if (m_buffer.size() > 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(source != NULL);
|
||||
if (source == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(source->GetNumElements() > 0);
|
||||
if (source->GetNumElements() == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
Resize(source->GetNumElements());
|
||||
|
||||
memcpy(&m_buffer[0], source->GetBuffer(), GetNumElements() * GetElementWidthInBytes());
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void IndexBuffer::Set(const uint16_t *indices, uint numIndices)
|
||||
|
|
|
@ -28,9 +28,9 @@ public:
|
|||
* Initializes the index buffer.
|
||||
* @param numIndices the initial number of indices the buffer should hold
|
||||
* @param usage the expected usage pattern of this index buffer
|
||||
* @return TRUE if successful, FALSE if not
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
BOOL Initialize(uint numIndices, BUFFEROBJECT_USAGE usage);
|
||||
bool Initialize(uint numIndices, BUFFEROBJECT_USAGE usage);
|
||||
|
||||
/**
|
||||
* Initializes the index buffer.
|
||||
|
@ -38,25 +38,25 @@ public:
|
|||
* on the GPU
|
||||
* @param numIndices the initial number of indices the buffer should hold
|
||||
* @param usage the expected usage pattern of this index buffer
|
||||
* @return TRUE if successful, FALSE if not
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, uint numIndices, BUFFEROBJECT_USAGE usage);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice, uint numIndices, BUFFEROBJECT_USAGE usage);
|
||||
|
||||
/**
|
||||
* Initializes the index buffer.
|
||||
* @param source the source buffer to copy during creation of this buffer
|
||||
* @return TRUE if successful, FALSE if not
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
BOOL Initialize(const IndexBuffer *source);
|
||||
bool Initialize(const IndexBuffer *source);
|
||||
|
||||
/**
|
||||
* Initializes the index buffer.
|
||||
* @param graphicsDevice the graphics device to use to create this buffer
|
||||
* on the GPU
|
||||
* @param source the source buffer to copy during creation of this buffer
|
||||
* @return TRUE if successful, FALSE if not
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, const IndexBuffer *source);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice, const IndexBuffer *source);
|
||||
|
||||
/**
|
||||
* Copies the source indices over top of this buffer's existing indices.
|
||||
|
@ -74,17 +74,17 @@ public:
|
|||
|
||||
/**
|
||||
* Moves the current index position to the next position.
|
||||
* @return TRUE if the move succeeded, FALSE if there is no more indices
|
||||
* @return true if the move succeeded, false if there is no more indices
|
||||
* to move to after this one
|
||||
*/
|
||||
BOOL MoveNext();
|
||||
bool MoveNext();
|
||||
|
||||
/**
|
||||
* Moves the current index position to the previous position.
|
||||
* @return TRUE if the move succeeded, FALSE if there is no more indices
|
||||
* @return true if the move succeeded, false if there is no more indices
|
||||
* to move to before the current one
|
||||
*/
|
||||
BOOL MovePrevious();
|
||||
bool MovePrevious();
|
||||
|
||||
/**
|
||||
* Moves the current index position by the specified amount relative
|
||||
|
@ -168,26 +168,26 @@ inline void IndexBuffer::SetIndex(uint index, uint16_t value)
|
|||
m_buffer[index] = value;
|
||||
}
|
||||
|
||||
inline BOOL IndexBuffer::MoveNext()
|
||||
inline bool IndexBuffer::MoveNext()
|
||||
{
|
||||
++m_currentIndex;
|
||||
if (m_currentIndex >= GetNumElements())
|
||||
{
|
||||
--m_currentIndex;
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline BOOL IndexBuffer::MovePrevious()
|
||||
inline bool IndexBuffer::MovePrevious()
|
||||
{
|
||||
if (m_currentIndex == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
else
|
||||
{
|
||||
--m_currentIndex;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,20 +15,20 @@ Renderbuffer::Renderbuffer()
|
|||
m_type = FRAMEBUFFER_DATA_NONE;
|
||||
}
|
||||
|
||||
BOOL Renderbuffer::Initialize(GraphicsDevice *graphicsDevice, uint width, uint height, FRAMEBUFFER_DATA_TYPE type)
|
||||
bool Renderbuffer::Initialize(GraphicsDevice *graphicsDevice, uint width, uint height, FRAMEBUFFER_DATA_TYPE type)
|
||||
{
|
||||
ASSERT(m_renderbufferName == 0);
|
||||
if (m_renderbufferName != 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
if (!GraphicsContextResource::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
m_type = type;
|
||||
|
||||
BOOL success = CreateRenderbuffer();
|
||||
bool success = CreateRenderbuffer();
|
||||
if (!success)
|
||||
{
|
||||
m_width = 0;
|
||||
|
@ -54,7 +54,7 @@ void Renderbuffer::Release()
|
|||
GraphicsContextResource::Release();
|
||||
}
|
||||
|
||||
BOOL Renderbuffer::CreateRenderbuffer()
|
||||
bool Renderbuffer::CreateRenderbuffer()
|
||||
{
|
||||
ASSERT(m_renderbufferName == 0);
|
||||
|
||||
|
@ -95,7 +95,7 @@ BOOL Renderbuffer::CreateRenderbuffer()
|
|||
#endif
|
||||
ASSERT(format != 0);
|
||||
if (format == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
GL_CALL(glGenRenderbuffers(1, &m_renderbufferName));
|
||||
|
||||
|
@ -108,15 +108,15 @@ BOOL Renderbuffer::CreateRenderbuffer()
|
|||
// object that this will get attached to manage that for itself...
|
||||
GetGraphicsDevice()->UnbindRenderbuffer();
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Renderbuffer::OnNewContext()
|
||||
{
|
||||
if (m_renderbufferName == 0 && GetGraphicsDevice() != NULL)
|
||||
{
|
||||
BOOL success = CreateRenderbuffer();
|
||||
ASSERT(success == TRUE);
|
||||
bool success = CreateRenderbuffer();
|
||||
ASSERT(success == true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ public:
|
|||
* @param width the width of the renderbuffer in pixels
|
||||
* @param height the height of the renderbuffer in pixels
|
||||
* @param format the type of data this renderbuffer contains
|
||||
* @return TRUE if the renderbuffer was created successfully
|
||||
* @return true if the renderbuffer was created successfully
|
||||
*/
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice, uint width, uint height, FRAMEBUFFER_DATA_TYPE type);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice, uint width, uint height, FRAMEBUFFER_DATA_TYPE type);
|
||||
|
||||
/**
|
||||
* @return the name or ID assigned to this renderbuffer by OpenGL
|
||||
|
@ -54,9 +54,9 @@ public:
|
|||
FRAMEBUFFER_DATA_TYPE GetType() const { return m_type; }
|
||||
|
||||
/**
|
||||
* @return TRUE if the renderbuffer has been marked as invalid and needs to be recreated
|
||||
* @return true if the renderbuffer has been marked as invalid and needs to be recreated
|
||||
*/
|
||||
BOOL IsInvalidated() const { return m_renderbufferName == 0; }
|
||||
bool IsInvalidated() const { return m_renderbufferName == 0; }
|
||||
|
||||
/**
|
||||
* New OpenGL graphics context creation callback.
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
void OnLostContext();
|
||||
|
||||
private:
|
||||
BOOL CreateRenderbuffer();
|
||||
bool CreateRenderbuffer();
|
||||
|
||||
uint m_renderbufferName;
|
||||
uint m_width;
|
||||
|
|
|
@ -14,9 +14,9 @@ RenderState::~RenderState()
|
|||
|
||||
void RenderState::Initialize()
|
||||
{
|
||||
m_depthTesting = TRUE;
|
||||
m_depthTesting = true;
|
||||
m_depthFunction = DEPTH_LESS;
|
||||
m_faceCulling = TRUE;
|
||||
m_faceCulling = true;
|
||||
m_faceCullingMode = BACK;
|
||||
m_lineWidth = 1.0f;
|
||||
}
|
||||
|
|
|
@ -43,9 +43,9 @@ public:
|
|||
void Apply() const;
|
||||
|
||||
/**
|
||||
* @return TRUE if depth testing is enabled
|
||||
* @return true if depth testing is enabled
|
||||
*/
|
||||
BOOL GetDepthTesting() const { return m_depthTesting; }
|
||||
bool GetDepthTesting() const { return m_depthTesting; }
|
||||
|
||||
/**
|
||||
* @return the depth testing function
|
||||
|
@ -53,9 +53,9 @@ public:
|
|||
DEPTH_FUNCTION GetDepthFunction() const { return m_depthFunction; }
|
||||
|
||||
/**
|
||||
* @return TRUE if polygons are being culled based on their vertices winding
|
||||
* @return true if polygons are being culled based on their vertices winding
|
||||
*/
|
||||
BOOL GetFaceCulling() const { return m_faceCulling; }
|
||||
bool GetFaceCulling() const { return m_faceCulling; }
|
||||
|
||||
/**
|
||||
* @return the polygon cull mode
|
||||
|
@ -70,7 +70,7 @@ public:
|
|||
/**
|
||||
* Toggles depth testing on/off.
|
||||
*/
|
||||
void SetDepthTesting(BOOL enable) { m_depthTesting = enable; }
|
||||
void SetDepthTesting(bool enable) { m_depthTesting = enable; }
|
||||
|
||||
/**
|
||||
* Sets the depth testing function.
|
||||
|
@ -80,7 +80,7 @@ public:
|
|||
/**
|
||||
* Toggles polygon culling based on their vertices winding on/off.
|
||||
*/
|
||||
void SetFaceCulling(BOOL enable) { m_faceCulling = enable; }
|
||||
void SetFaceCulling(bool enable) { m_faceCulling = enable; }
|
||||
|
||||
/**
|
||||
* Sets the polygon culling mode.
|
||||
|
@ -97,9 +97,9 @@ private:
|
|||
void SetFaceCulling() const;
|
||||
int FindDepthFunctionValue(DEPTH_FUNCTION function) const;
|
||||
|
||||
BOOL m_depthTesting;
|
||||
bool m_depthTesting;
|
||||
DEPTH_FUNCTION m_depthFunction;
|
||||
BOOL m_faceCulling;
|
||||
bool m_faceCulling;
|
||||
CULL_MODE m_faceCullingMode;
|
||||
float m_lineWidth;
|
||||
};
|
||||
|
|
|
@ -32,12 +32,12 @@ STATIC_ASSERT(sizeof(Point3) == 3 * sizeof(int));
|
|||
|
||||
Shader::Shader()
|
||||
{
|
||||
m_isBound = FALSE;
|
||||
m_isBound = false;
|
||||
m_cachedVertexShaderSource = NULL;
|
||||
m_cachedFragmentShaderSource = NULL;
|
||||
m_vertexShaderCompileStatus = FALSE;
|
||||
m_fragmentShaderCompileStatus = FALSE;
|
||||
m_linkStatus = FALSE;
|
||||
m_vertexShaderCompileStatus = 0;
|
||||
m_fragmentShaderCompileStatus = 0;
|
||||
m_linkStatus = 0;
|
||||
m_vertexShaderId = 0;
|
||||
m_fragmentShaderId = 0;
|
||||
m_programId = 0;
|
||||
|
@ -45,44 +45,44 @@ Shader::Shader()
|
|||
m_numAttributes = 0;
|
||||
}
|
||||
|
||||
BOOL Shader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
bool Shader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
if (!GraphicsContextResource::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL Shader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
bool Shader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
{
|
||||
if (!GraphicsContextResource::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(vertexShaderSource != NULL);
|
||||
if (vertexShaderSource == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(fragmentShaderSource != NULL);
|
||||
if (fragmentShaderSource == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
if (!LoadCompileAndLink(vertexShaderSource, fragmentShaderSource))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
CacheShaderSources(vertexShaderSource, fragmentShaderSource);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL Shader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource)
|
||||
bool Shader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource)
|
||||
{
|
||||
ASSERT(vertexShaderSource != NULL && vertexShaderSource->GetLength() > 0);
|
||||
if (vertexShaderSource == NULL || vertexShaderSource->GetLength() == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
ASSERT(fragmentShaderSource != NULL && fragmentShaderSource->GetLength() > 0);
|
||||
if (fragmentShaderSource == NULL && fragmentShaderSource->GetLength() == 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
return Initialize(graphicsDevice, vertexShaderSource->GetText(), fragmentShaderSource->GetText());
|
||||
}
|
||||
|
@ -117,12 +117,12 @@ void Shader::Release()
|
|||
SAFE_DELETE_ARRAY(m_cachedFragmentShaderSource);
|
||||
}
|
||||
|
||||
m_isBound = FALSE;
|
||||
m_isBound = false;
|
||||
m_cachedVertexShaderSource = NULL;
|
||||
m_cachedFragmentShaderSource = NULL;
|
||||
m_vertexShaderCompileStatus = FALSE;
|
||||
m_fragmentShaderCompileStatus = FALSE;
|
||||
m_linkStatus = FALSE;
|
||||
m_vertexShaderCompileStatus = 0;
|
||||
m_fragmentShaderCompileStatus = 0;
|
||||
m_linkStatus = 0;
|
||||
m_vertexShaderId = 0;
|
||||
m_fragmentShaderId = 0;
|
||||
m_programId = 0;
|
||||
|
@ -136,7 +136,7 @@ void Shader::Release()
|
|||
GraphicsContextResource::Release();
|
||||
}
|
||||
|
||||
BOOL Shader::LoadCompileAndLink(const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
bool Shader::LoadCompileAndLink(const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
{
|
||||
const char *vertexShaderToLoad = vertexShaderSource;
|
||||
const char *fragmentShaderToLoad = fragmentShaderSource;
|
||||
|
@ -152,24 +152,24 @@ BOOL Shader::LoadCompileAndLink(const char *vertexShaderSource, const char *frag
|
|||
ASSERT(fragmentShaderToLoad != NULL);
|
||||
|
||||
if (!Compile(vertexShaderToLoad, fragmentShaderToLoad))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
if (!Link())
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
LoadUniformInfo();
|
||||
LoadAttributeInfo();
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL Shader::ReloadCompileAndLink(const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
bool Shader::ReloadCompileAndLink(const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
{
|
||||
// clear out data that will be reset during the reload first
|
||||
m_isBound = FALSE;
|
||||
m_vertexShaderCompileStatus = FALSE;
|
||||
m_fragmentShaderCompileStatus = FALSE;
|
||||
m_linkStatus = FALSE;
|
||||
m_isBound = false;
|
||||
m_vertexShaderCompileStatus = 0;
|
||||
m_fragmentShaderCompileStatus = 0;
|
||||
m_linkStatus = 0;
|
||||
m_vertexShaderId = 0;
|
||||
m_fragmentShaderId = 0;
|
||||
m_programId = 0;
|
||||
|
@ -216,7 +216,7 @@ void Shader::CacheShaderSources(const char *vertexShaderSource, const char *frag
|
|||
}
|
||||
}
|
||||
|
||||
BOOL Shader::Compile(const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
bool Shader::Compile(const char *vertexShaderSource, const char *fragmentShaderSource)
|
||||
{
|
||||
ASSERT(m_vertexShaderId == 0);
|
||||
ASSERT(m_fragmentShaderId == 0);
|
||||
|
@ -292,12 +292,12 @@ BOOL Shader::Compile(const char *vertexShaderSource, const char *fragmentShaderS
|
|||
|
||||
// only return success if both compiled successfully
|
||||
if (m_fragmentShaderCompileStatus && m_vertexShaderCompileStatus)
|
||||
return TRUE;
|
||||
return true;
|
||||
else
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL Shader::Link()
|
||||
bool Shader::Link()
|
||||
{
|
||||
ASSERT(m_vertexShaderId != 0);
|
||||
ASSERT(m_fragmentShaderId != 0);
|
||||
|
@ -434,7 +434,7 @@ void Shader::LoadAttributeInfo()
|
|||
attribute.location = (uint)location;
|
||||
attribute.type = (uint)type;
|
||||
attribute.size = (uint)size;
|
||||
attribute.isTypeBound = FALSE;
|
||||
attribute.isTypeBound = false;
|
||||
stl::string name = attributeName;
|
||||
|
||||
m_attributes[name] = attribute;
|
||||
|
@ -443,13 +443,13 @@ void Shader::LoadAttributeInfo()
|
|||
SAFE_DELETE_ARRAY(attributeName);
|
||||
}
|
||||
|
||||
BOOL Shader::HasUniform(const stl::string &name) const
|
||||
bool Shader::HasUniform(const stl::string &name) const
|
||||
{
|
||||
ShaderUniformMap::const_iterator i = m_uniforms.find(name);
|
||||
if (i == m_uniforms.end())
|
||||
return FALSE;
|
||||
return false;
|
||||
else
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
const ShaderUniform* Shader::GetUniform(const stl::string &name) const
|
||||
|
@ -470,13 +470,13 @@ ShaderUniform* Shader::GetUniform(const stl::string &name)
|
|||
return &i->second;
|
||||
}
|
||||
|
||||
BOOL Shader::HasAttribute(const stl::string &name) const
|
||||
bool Shader::HasAttribute(const stl::string &name) const
|
||||
{
|
||||
ShaderAttributeMap::const_iterator i = m_attributes.find(name);
|
||||
if (i == m_attributes.end())
|
||||
return FALSE;
|
||||
return false;
|
||||
else
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
const ShaderAttribute* Shader::GetAttribute(const stl::string &name) const
|
||||
|
@ -516,7 +516,7 @@ CachedShaderUniform* Shader::GetCachedUniform(const stl::string &name)
|
|||
|
||||
void Shader::FlushCachedUniforms()
|
||||
{
|
||||
ASSERT(m_isBound == TRUE);
|
||||
ASSERT(m_isBound == true);
|
||||
if (m_cachedUniforms.empty())
|
||||
return;
|
||||
|
||||
|
@ -851,7 +851,7 @@ void Shader::SetUniform(const stl::string &name, const Matrix3x3 &m)
|
|||
const ShaderUniform *uniform = GetUniform(name);
|
||||
ASSERT(uniform != NULL);
|
||||
ASSERT(uniform->size == 1);
|
||||
GL_CALL(glUniformMatrix3fv(uniform->location, 1, FALSE, m.m));
|
||||
GL_CALL(glUniformMatrix3fv(uniform->location, 1, false, m.m));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -869,7 +869,7 @@ void Shader::SetUniform(const stl::string &name, const Matrix4x4 &m)
|
|||
const ShaderUniform *uniform = GetUniform(name);
|
||||
ASSERT(uniform != NULL);
|
||||
ASSERT(uniform->size == 1);
|
||||
GL_CALL(glUniformMatrix4fv(uniform->location, 1, FALSE, m.m));
|
||||
GL_CALL(glUniformMatrix4fv(uniform->location, 1, false, m.m));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -998,7 +998,7 @@ void Shader::SetUniform(const stl::string &name, const Matrix3x3 *m, uint count)
|
|||
ASSERT(uniform != NULL);
|
||||
ASSERT(uniform->size >= count);
|
||||
|
||||
GL_CALL(glUniformMatrix3fv(uniform->location, count, FALSE, values));
|
||||
GL_CALL(glUniformMatrix3fv(uniform->location, count, false, values));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1017,7 +1017,7 @@ void Shader::SetUniform(const stl::string &name, const Matrix4x4 *m, uint count)
|
|||
ASSERT(uniform != NULL);
|
||||
ASSERT(uniform->size >= count);
|
||||
|
||||
GL_CALL(glUniformMatrix4fv(uniform->location, count, FALSE, values));
|
||||
GL_CALL(glUniformMatrix4fv(uniform->location, count, false, values));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1032,10 +1032,10 @@ void Shader::MapAttributeToVboAttribIndex(const stl::string &name, uint vboAttri
|
|||
ASSERT(attribute->location < m_numAttributes);
|
||||
|
||||
ShaderAttributeMapInfo *mappingInfo = &m_attributeMapping[attribute->location];
|
||||
mappingInfo->usesStandardType = FALSE;
|
||||
mappingInfo->usesStandardType = false;
|
||||
mappingInfo->attribIndex = vboAttribIndex;
|
||||
|
||||
attribute->isTypeBound = TRUE;
|
||||
attribute->isTypeBound = true;
|
||||
}
|
||||
|
||||
void Shader::MapAttributeToStandardAttribType(const stl::string &name, VERTEX_STANDARD_ATTRIBS standardAttribType)
|
||||
|
@ -1045,10 +1045,10 @@ void Shader::MapAttributeToStandardAttribType(const stl::string &name, VERTEX_ST
|
|||
ASSERT(attribute->location < m_numAttributes);
|
||||
|
||||
ShaderAttributeMapInfo *mappingInfo = &m_attributeMapping[attribute->location];
|
||||
mappingInfo->usesStandardType = TRUE;
|
||||
mappingInfo->usesStandardType = true;
|
||||
mappingInfo->standardType = standardAttribType;
|
||||
|
||||
attribute->isTypeBound = TRUE;
|
||||
attribute->isTypeBound = true;
|
||||
}
|
||||
|
||||
void Shader::OnNewContext()
|
||||
|
@ -1062,14 +1062,14 @@ void Shader::OnLostContext()
|
|||
|
||||
void Shader::OnBind()
|
||||
{
|
||||
ASSERT(m_isBound == FALSE);
|
||||
m_isBound = TRUE;
|
||||
ASSERT(m_isBound == false);
|
||||
m_isBound = true;
|
||||
FlushCachedUniforms();
|
||||
}
|
||||
|
||||
void Shader::OnUnbind()
|
||||
{
|
||||
ASSERT(m_isBound == TRUE);
|
||||
m_isBound = FALSE;
|
||||
ASSERT(m_isBound == true);
|
||||
m_isBound = false;
|
||||
m_cachedUniforms.clear();
|
||||
}
|
||||
|
|
|
@ -41,9 +41,9 @@ public:
|
|||
* @param graphicsDevice the graphics device to associate this shader with
|
||||
* @param vertexShaderSource GLSL source for a vertex shader
|
||||
* @param fragmentShaderSource GLSL source for a vertex shader
|
||||
* @return TRUE if successful, FALSE if not
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
virtual BOOL Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource);
|
||||
virtual bool Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource);
|
||||
|
||||
/**
|
||||
* Initializes the shader object using the given vertex and fragment shader
|
||||
|
@ -51,36 +51,36 @@ public:
|
|||
* @param graphicsDevice the graphics device to associate this shader with
|
||||
* @param vertexShaderSource GLSL source for a vertex shader
|
||||
* @param fragmentShaderSource GLSL source for a vertex shader
|
||||
* @return TRUE if successful, FALSE if not
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
virtual BOOL Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource);
|
||||
virtual bool Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource);
|
||||
|
||||
/**
|
||||
* @return TRUE if this shader has been compiled and linked into a program
|
||||
* @return true if this shader has been compiled and linked into a program
|
||||
* that can be bound and rendered with
|
||||
*/
|
||||
BOOL IsReadyForUse() const;
|
||||
bool IsReadyForUse() const;
|
||||
|
||||
/**
|
||||
* @return TRUE if this shader is currently bound to the graphics device
|
||||
* @return true if this shader is currently bound to the graphics device
|
||||
*/
|
||||
BOOL IsBound() const { return m_isBound; }
|
||||
bool IsBound() const { return m_isBound; }
|
||||
|
||||
/**
|
||||
* @return TRUE if the vertex shader was compiled without errors
|
||||
* @return true if the vertex shader was compiled without errors
|
||||
*/
|
||||
BOOL GetVertexShaderCompileStatus() const { return m_vertexShaderCompileStatus; }
|
||||
bool GetVertexShaderCompileStatus() const { return m_vertexShaderCompileStatus; }
|
||||
|
||||
/**
|
||||
* @return TRUE if the fragment shader was compiled without errors
|
||||
* @return true if the fragment shader was compiled without errors
|
||||
*/
|
||||
BOOL GetFragmentShaderCompileStatus() const { return m_fragmentShaderCompileStatus; }
|
||||
bool GetFragmentShaderCompileStatus() const { return m_fragmentShaderCompileStatus; }
|
||||
|
||||
/**
|
||||
* @return TRUE if the compiled vertex and fragment shaders were linked
|
||||
* @return true if the compiled vertex and fragment shaders were linked
|
||||
* without errors
|
||||
*/
|
||||
BOOL GetLinkStatus() const { return m_linkStatus; }
|
||||
bool GetLinkStatus() const { return m_linkStatus; }
|
||||
|
||||
/**
|
||||
* @return the OpenGL program ID that can be bound
|
||||
|
@ -91,18 +91,18 @@ public:
|
|||
* Checks if this shader contains a uniform. Note that the GLSL compiler
|
||||
* could optimize out uniforms if they aren't used in the GLSL code.
|
||||
* @param name the name of the uniform to check for
|
||||
* @return TRUE if the uniform is present
|
||||
* @return true if the uniform is present
|
||||
*/
|
||||
BOOL HasUniform(const stl::string &name) const;
|
||||
bool HasUniform(const stl::string &name) const;
|
||||
|
||||
/**
|
||||
* Checks if this shader contains an attribute. Note that the GLSL
|
||||
* compiler could optimize out attributes if they aren't used in the
|
||||
* GLSL code.
|
||||
* @param name the name of the attribute to check for
|
||||
* @return TRUE if the attribute is present
|
||||
* @return true if the attribute is present
|
||||
*/
|
||||
BOOL HasAttribute(const stl::string &name) const;
|
||||
bool HasAttribute(const stl::string &name) const;
|
||||
|
||||
/**
|
||||
* Sets the value of a uniform.
|
||||
|
@ -225,10 +225,10 @@ public:
|
|||
* attribute type or not.
|
||||
* @param attribIndex the index of the shader attribute to check the
|
||||
* mapping of
|
||||
* @return TRUE if this shader attribute was mapped to a standard attribute
|
||||
* type or FALSE if it wasn't
|
||||
* @return true if this shader attribute was mapped to a standard attribute
|
||||
* type or false if it wasn't
|
||||
*/
|
||||
BOOL IsAttributeMappedToStandardType(uint attribIndex) const;
|
||||
bool IsAttributeMappedToStandardType(uint attribIndex) const;
|
||||
|
||||
/**
|
||||
* Gets a vertex buffer object attribute index that corresponds to the
|
||||
|
@ -289,19 +289,19 @@ protected:
|
|||
* for shader subclasses to begin initializing their own custom state
|
||||
* immediately afterward.
|
||||
* @param graphicsDevice the graphics device to associate this shader with
|
||||
* @return TRUE if successful, FALSE if not
|
||||
* @return true if successful, false if not
|
||||
*/
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice);
|
||||
|
||||
/**
|
||||
* Loads the provided shader sources, compiles and links them and
|
||||
* caches information about attributes and uniforms.
|
||||
* @param vertexShaderSource vertex shader source
|
||||
* @param fragmentShaderSource fragment shader source
|
||||
* @return TRUE if compilation and linking succeeded and the shader
|
||||
* @return true if compilation and linking succeeded and the shader
|
||||
* is now ready for use
|
||||
*/
|
||||
BOOL LoadCompileAndLink(const char *vertexShaderSource, const char *fragmentShaderSource);
|
||||
bool LoadCompileAndLink(const char *vertexShaderSource, const char *fragmentShaderSource);
|
||||
|
||||
/**
|
||||
* Reloads shader sources either from those provided or from the
|
||||
|
@ -311,10 +311,10 @@ protected:
|
|||
* the source from the cache
|
||||
* @param fragmentShaderSource fragment shader source, or NULL to load
|
||||
* the source from the cache
|
||||
* @return TRUE if compilation and linking succeeded and the shader
|
||||
* @return true if compilation and linking succeeded and the shader
|
||||
* is now ready for use
|
||||
*/
|
||||
BOOL ReloadCompileAndLink(const char *vertexShaderSource, const char *fragmentShaderSource);
|
||||
bool ReloadCompileAndLink(const char *vertexShaderSource, const char *fragmentShaderSource);
|
||||
|
||||
/**
|
||||
* Caches the provided shader sources. ReloadCompileAndLink() can
|
||||
|
@ -353,8 +353,8 @@ protected:
|
|||
ShaderAttribute* GetAttribute(const stl::string &name);
|
||||
|
||||
private:
|
||||
BOOL Compile(const char *vertexShaderSource, const char *fragmentShaderSource);
|
||||
BOOL Link();
|
||||
bool Compile(const char *vertexShaderSource, const char *fragmentShaderSource);
|
||||
bool Link();
|
||||
void LoadUniformInfo();
|
||||
void LoadAttributeInfo();
|
||||
|
||||
|
@ -367,13 +367,13 @@ private:
|
|||
|
||||
char *m_cachedVertexShaderSource;
|
||||
char *m_cachedFragmentShaderSource;
|
||||
BOOL m_vertexShaderCompileStatus;
|
||||
BOOL m_fragmentShaderCompileStatus;
|
||||
BOOL m_linkStatus;
|
||||
int m_vertexShaderCompileStatus;
|
||||
int m_fragmentShaderCompileStatus;
|
||||
int m_linkStatus;
|
||||
uint m_vertexShaderId;
|
||||
uint m_fragmentShaderId;
|
||||
uint m_programId;
|
||||
BOOL m_isBound;
|
||||
bool m_isBound;
|
||||
|
||||
ShaderUniformMap m_uniforms;
|
||||
ShaderAttributeMap m_attributes;
|
||||
|
@ -383,15 +383,15 @@ private:
|
|||
CachedShaderUniformMap m_cachedUniforms;
|
||||
};
|
||||
|
||||
inline BOOL Shader::IsReadyForUse() const
|
||||
inline bool Shader::IsReadyForUse() const
|
||||
{
|
||||
if (GetVertexShaderCompileStatus() && GetFragmentShaderCompileStatus() && GetLinkStatus())
|
||||
return TRUE;
|
||||
return true;
|
||||
else
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
inline BOOL Shader::IsAttributeMappedToStandardType(uint attribIndex) const
|
||||
inline bool Shader::IsAttributeMappedToStandardType(uint attribIndex) const
|
||||
{
|
||||
return m_attributeMapping[attribIndex].usesStandardType;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ struct ShaderAttribute
|
|||
uint location;
|
||||
uint type;
|
||||
uint size;
|
||||
BOOL isTypeBound;
|
||||
bool isTypeBound;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -33,7 +33,7 @@ struct ShaderAttribute
|
|||
*/
|
||||
struct ShaderAttributeMapInfo
|
||||
{
|
||||
BOOL usesStandardType;
|
||||
bool usesStandardType;
|
||||
VERTEX_STANDARD_ATTRIBS standardType;
|
||||
uint attribIndex;
|
||||
};
|
||||
|
|
|
@ -37,16 +37,16 @@ SimpleColorShader::~SimpleColorShader()
|
|||
{
|
||||
}
|
||||
|
||||
BOOL SimpleColorShader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
bool SimpleColorShader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
if (!StandardShader::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
BOOL result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource);
|
||||
ASSERT(result == TRUE);
|
||||
bool result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource);
|
||||
ASSERT(result == true);
|
||||
|
||||
MapAttributeToStandardAttribType("a_position", VERTEX_STD_POS_3D);
|
||||
MapAttributeToStandardAttribType("a_color", VERTEX_STD_COLOR);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
SimpleColorShader();
|
||||
virtual ~SimpleColorShader();
|
||||
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice);
|
||||
|
||||
private:
|
||||
static const char *m_vertexShaderSource;
|
||||
|
|
|
@ -42,17 +42,17 @@ SimpleColorTextureShader::~SimpleColorTextureShader()
|
|||
{
|
||||
}
|
||||
|
||||
BOOL SimpleColorTextureShader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
bool SimpleColorTextureShader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
if (!StandardShader::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
BOOL result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource);
|
||||
ASSERT(result == TRUE);
|
||||
bool result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource);
|
||||
ASSERT(result == true);
|
||||
|
||||
MapAttributeToStandardAttribType("a_position", VERTEX_STD_POS_3D);
|
||||
MapAttributeToStandardAttribType("a_color", VERTEX_STD_COLOR);
|
||||
MapAttributeToStandardAttribType("a_texcoord0", VERTEX_STD_TEXCOORD);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
SimpleColorTextureShader();
|
||||
virtual ~SimpleColorTextureShader();
|
||||
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice);
|
||||
|
||||
private:
|
||||
static const char *m_vertexShaderSource;
|
||||
|
|
|
@ -37,16 +37,16 @@ SimpleTextureShader::~SimpleTextureShader()
|
|||
{
|
||||
}
|
||||
|
||||
BOOL SimpleTextureShader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
bool SimpleTextureShader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
if (!StandardShader::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
BOOL result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource);
|
||||
ASSERT(result == TRUE);
|
||||
bool result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource);
|
||||
ASSERT(result == true);
|
||||
|
||||
MapAttributeToStandardAttribType("a_position", VERTEX_STD_POS_3D);
|
||||
MapAttributeToStandardAttribType("a_texcoord0", VERTEX_STD_TEXCOORD);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
SimpleTextureShader();
|
||||
virtual ~SimpleTextureShader();
|
||||
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice);
|
||||
|
||||
private:
|
||||
static const char *m_vertexShaderSource;
|
||||
|
|
|
@ -38,17 +38,17 @@ SimpleTextureVertexLerpShader::~SimpleTextureVertexLerpShader()
|
|||
{
|
||||
}
|
||||
|
||||
BOOL SimpleTextureVertexLerpShader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
bool SimpleTextureVertexLerpShader::Initialize(GraphicsDevice *graphicsDevice)
|
||||
{
|
||||
if (!VertexLerpShader::Initialize(graphicsDevice))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
BOOL result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource);
|
||||
ASSERT(result == TRUE);
|
||||
bool result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource);
|
||||
ASSERT(result == true);
|
||||
|
||||
MapAttributeToVboAttribIndex("a_position1", 0);
|
||||
MapAttributeToVboAttribIndex("a_position2", 1);
|
||||
MapAttributeToStandardAttribType("a_texcoord0", VERTEX_STD_TEXCOORD);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ public:
|
|||
SimpleTextureVertexLerpShader();
|
||||
virtual ~SimpleTextureVertexLerpShader();
|
||||
|
||||
BOOL Initialize(GraphicsDevice *graphicsDevice);
|
||||
bool Initialize(GraphicsDevice *graphicsDevice);
|
||||
|
||||
private:
|
||||
static const char *m_vertexShaderSource;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue