mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-06-04 20:46:29 +03:00
Restore on context lost vertex buffers and frame buffers.
Fixed some compiler warnings.
This commit is contained in:
@@ -24,6 +24,7 @@ using namespace EE::Math;
|
||||
#include "../system/clog.hpp"
|
||||
#include "../system/cpack.hpp"
|
||||
#include "../system/tresourcemanager.hpp"
|
||||
#include "../system/tcontainer.hpp"
|
||||
using namespace EE::System;
|
||||
|
||||
#include "renders.hpp"
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
#include "../window/cengine.hpp"
|
||||
#include "cframebufferfbo.hpp"
|
||||
#include "cframebufferpbuffer.hpp"
|
||||
#include "cframebuffermanager.hpp"
|
||||
|
||||
using namespace EE::Graphics::Private;
|
||||
|
||||
namespace EE { namespace Graphics {
|
||||
|
||||
@@ -19,13 +22,18 @@ cFrameBuffer * cFrameBuffer::CreateNew( const Uint32& Width, const Uint32& Heigh
|
||||
cFrameBuffer::cFrameBuffer() :
|
||||
mWidth(0),
|
||||
mHeight(0),
|
||||
mHasDepthBuffer(false),
|
||||
mTexture(NULL),
|
||||
mClearColor(0,0,0,0)
|
||||
{}
|
||||
{
|
||||
cFrameBufferManager::instance()->Add( this );
|
||||
}
|
||||
|
||||
cFrameBuffer::~cFrameBuffer() {
|
||||
if ( NULL != mTexture )
|
||||
cTextureFactory::instance()->Remove( mTexture->Id() );
|
||||
|
||||
cFrameBufferManager::instance()->Remove( this );
|
||||
}
|
||||
|
||||
cTexture * cFrameBuffer::GetTexture() const {
|
||||
|
||||
@@ -23,6 +23,8 @@ class EE_API cFrameBuffer {
|
||||
|
||||
virtual void Unbind() = 0;
|
||||
|
||||
virtual void Reload() = 0;
|
||||
|
||||
cTexture * GetTexture() const;
|
||||
|
||||
void ClearColor( eeColorAf Color );
|
||||
@@ -31,6 +33,7 @@ class EE_API cFrameBuffer {
|
||||
protected:
|
||||
Int32 mWidth;
|
||||
Int32 mHeight;
|
||||
bool mHasDepthBuffer;
|
||||
cTexture * mTexture;
|
||||
eeColorAf mClearColor;
|
||||
cView mPrevView;
|
||||
|
||||
@@ -54,6 +54,10 @@ bool cFrameBufferFBO::Create( const Uint32& Width, const Uint32& Height, bool De
|
||||
if ( !IsSupported() )
|
||||
return false;
|
||||
|
||||
mWidth = Width;
|
||||
mHeight = Height;
|
||||
mHasDepthBuffer = DepthBuffer;
|
||||
|
||||
GLuint frameBuffer = 0;
|
||||
|
||||
glGenFramebuffersEXT( 1, &frameBuffer );
|
||||
@@ -82,12 +86,14 @@ bool cFrameBufferFBO::Create( const Uint32& Width, const Uint32& Height, bool De
|
||||
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, mDepthBuffer );
|
||||
}
|
||||
|
||||
Uint32 TexId = cTextureFactory::instance()->CreateEmptyTexture( Width, Height, eeColorA(0,0,0,0) );
|
||||
if ( NULL == mTexture ) {
|
||||
Uint32 TexId = cTextureFactory::instance()->CreateEmptyTexture( Width, Height, eeColorA(0,0,0,0) );
|
||||
|
||||
if ( cTextureFactory::instance()->TextureIdExists( TexId ) ) {
|
||||
mTexture = cTextureFactory::instance()->GetTexture( TexId );
|
||||
} else {
|
||||
return false;
|
||||
if ( cTextureFactory::instance()->TextureIdExists( TexId ) ) {
|
||||
mTexture = cTextureFactory::instance()->GetTexture( TexId );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, mTexture->Handle(), 0 );
|
||||
@@ -100,9 +106,6 @@ bool cFrameBufferFBO::Create( const Uint32& Width, const Uint32& Height, bool De
|
||||
|
||||
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
|
||||
|
||||
mWidth = Width;
|
||||
mHeight = Height;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -120,4 +123,8 @@ void cFrameBufferFBO::Unbind() {
|
||||
}
|
||||
}
|
||||
|
||||
void cFrameBufferFBO::Reload() {
|
||||
Create( mWidth, mHeight, mHasDepthBuffer );
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -23,6 +23,8 @@ class EE_API cFrameBufferFBO : public cFrameBuffer {
|
||||
|
||||
void Unbind();
|
||||
|
||||
void Reload();
|
||||
|
||||
static bool IsSupported();
|
||||
protected:
|
||||
Int32 mFrameBuffer;
|
||||
|
||||
20
src/graphics/cframebuffermanager.cpp
Normal file
20
src/graphics/cframebuffermanager.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "cframebuffermanager.hpp"
|
||||
|
||||
namespace EE { namespace Graphics { namespace Private {
|
||||
|
||||
cFrameBufferManager::cFrameBufferManager()
|
||||
{
|
||||
}
|
||||
|
||||
cFrameBufferManager::~cFrameBufferManager()
|
||||
{
|
||||
}
|
||||
|
||||
void cFrameBufferManager::Reload() {
|
||||
std::list<cFrameBuffer*>::iterator it;
|
||||
|
||||
for ( it = mResources.begin(); it != mResources.end(); it++ )
|
||||
(*it)->Reload();
|
||||
}
|
||||
|
||||
}}}
|
||||
22
src/graphics/cframebuffermanager.hpp
Normal file
22
src/graphics/cframebuffermanager.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef EE_GRAPHICSCFRAMEBUFFERMANAGER_HPP
|
||||
#define EE_GRAPHICSCFRAMEBUFFERMANAGER_HPP
|
||||
|
||||
#include "base.hpp"
|
||||
#include "cframebuffer.hpp"
|
||||
|
||||
namespace EE { namespace Graphics { namespace Private {
|
||||
|
||||
class EE_API cFrameBufferManager : public tContainer<cFrameBuffer>, public tSingleton<cFrameBufferManager> {
|
||||
friend class tSingleton<cFrameBufferManager>;
|
||||
public:
|
||||
cFrameBufferManager();
|
||||
|
||||
virtual ~cFrameBufferManager();
|
||||
|
||||
void Reload();
|
||||
protected:
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -83,8 +83,9 @@ bool cFrameBufferPBuffer::Create( const Uint32& Width, const Uint32& Height, boo
|
||||
if ( !IsSupported() )
|
||||
return false;
|
||||
|
||||
mWidth = Width;
|
||||
mHeight = Height;
|
||||
mWidth = Width;
|
||||
mHeight = Height;
|
||||
mHasDepthBuffer = DepthBuffer;
|
||||
|
||||
#if EE_PLATFORM == EE_PLATFORM_WIN32
|
||||
HDC currentDC = wglGetCurrentDC();
|
||||
@@ -193,12 +194,14 @@ bool cFrameBufferPBuffer::Create( const Uint32& Width, const Uint32& Height, boo
|
||||
XFree(visual);
|
||||
#endif
|
||||
|
||||
Uint32 TexId = cTextureFactory::instance()->CreateEmptyTexture( Width, Height, eeColorA(0,0,0,0) );
|
||||
if ( NULL == mTexture ) {
|
||||
Uint32 TexId = cTextureFactory::instance()->CreateEmptyTexture( Width, Height, eeColorA(0,0,0,0) );
|
||||
|
||||
if ( cTextureFactory::instance()->TextureIdExists( TexId ) ) {
|
||||
mTexture = cTextureFactory::instance()->GetTexture( TexId );
|
||||
} else {
|
||||
return false;
|
||||
if ( cTextureFactory::instance()->TextureIdExists( TexId ) ) {
|
||||
mTexture = cTextureFactory::instance()->GetTexture( TexId );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -242,4 +245,9 @@ void cFrameBufferPBuffer::Unbind() {
|
||||
RecoverView();
|
||||
}
|
||||
|
||||
|
||||
void cFrameBufferPBuffer::Reload() {
|
||||
Create( mWidth, mHeight, mHasDepthBuffer );
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -59,6 +59,8 @@ class EE_API cFrameBufferPBuffer : public cFrameBuffer {
|
||||
|
||||
void Unbind();
|
||||
|
||||
void Reload();
|
||||
|
||||
static bool IsSupported();
|
||||
protected:
|
||||
#if EE_PLATFORM == EE_PLATFORM_WIN32
|
||||
|
||||
@@ -7,14 +7,16 @@ using namespace EE::Graphics::Private;
|
||||
namespace EE { namespace Graphics {
|
||||
|
||||
cShaderProgram::cShaderProgram( const std::string& name ) :
|
||||
mGLId(0)
|
||||
mHandler(0),
|
||||
mId(0)
|
||||
{
|
||||
AddToManager( name );
|
||||
Init();
|
||||
}
|
||||
|
||||
cShaderProgram::cShaderProgram( const std::vector<cShader*>& Shaders, const std::string& name ) :
|
||||
mGLId(0)
|
||||
mHandler(0),
|
||||
mId(0)
|
||||
{
|
||||
AddToManager( name );
|
||||
Init();
|
||||
@@ -25,7 +27,8 @@ cShaderProgram::cShaderProgram( const std::vector<cShader*>& Shaders, const std:
|
||||
}
|
||||
|
||||
cShaderProgram::cShaderProgram( const std::string& VertexShaderFile, const std::string& FragmentShaderFile, const std::string& name ) :
|
||||
mGLId(0)
|
||||
mHandler(0),
|
||||
mId(0)
|
||||
{
|
||||
AddToManager( name );
|
||||
Init();
|
||||
@@ -46,7 +49,8 @@ cShaderProgram::cShaderProgram( const std::string& VertexShaderFile, const std::
|
||||
}
|
||||
|
||||
cShaderProgram::cShaderProgram( cPack * Pack, const std::string& VertexShaderPath, const std::string& FragmentShaderPath, const std::string& name ) :
|
||||
mGLId(0)
|
||||
mHandler(0),
|
||||
mId(0)
|
||||
{
|
||||
AddToManager( name );
|
||||
Init();
|
||||
@@ -69,7 +73,8 @@ cShaderProgram::cShaderProgram( cPack * Pack, const std::string& VertexShaderPat
|
||||
}
|
||||
|
||||
cShaderProgram::cShaderProgram( const Uint8 * VertexShaderData, const Uint32& VertexShaderDataSize, const Uint8 * FragmentShaderData, const Uint32& FragmentShaderDataSize, const std::string& name ) :
|
||||
mGLId(0)
|
||||
mHandler(0),
|
||||
mId(0)
|
||||
{
|
||||
AddToManager( name );
|
||||
Init();
|
||||
@@ -112,7 +117,7 @@ void cShaderProgram::RemoveFromManager() {
|
||||
|
||||
void cShaderProgram::Init() {
|
||||
if ( cGL::instance()->ShadersSupported() && 0 == Id() ) {
|
||||
mGLId = glCreateProgram();
|
||||
mHandler = glCreateProgram();
|
||||
mValid = false;
|
||||
mUniformLocations.clear();
|
||||
mAttributeLocations.clear();
|
||||
@@ -120,7 +125,7 @@ void cShaderProgram::Init() {
|
||||
}
|
||||
|
||||
void cShaderProgram::Reload() {
|
||||
mGLId = 0;
|
||||
mHandler = 0;
|
||||
|
||||
Init();
|
||||
|
||||
@@ -256,6 +261,7 @@ const std::string& cShaderProgram::Name() const {
|
||||
|
||||
void cShaderProgram::Name( const std::string& name ) {
|
||||
mName = name;
|
||||
mId = MakeHash( mName );
|
||||
|
||||
Uint32 NameCount = cShaderProgramManager::instance()->Exists( mName );
|
||||
|
||||
|
||||
@@ -73,7 +73,10 @@ class EE_API cShaderProgram {
|
||||
bool SetUniform( const std::string& Name, Int32 Value );
|
||||
|
||||
/** @return The id of the program (the handle) */
|
||||
const Uint32& Id() const { return mGLId; }
|
||||
const Uint32& Handler() const { return mHandler; }
|
||||
|
||||
/** @return The Id of the program ( hash of the program name ) */
|
||||
const Uint32& Id() const { return mId; }
|
||||
|
||||
/** Reloads the shaders */
|
||||
void Reload();
|
||||
@@ -85,7 +88,9 @@ class EE_API cShaderProgram {
|
||||
void Name( const std::string& name );
|
||||
protected:
|
||||
std::string mName;
|
||||
Uint32 mGLId;
|
||||
Uint32 mHandler;
|
||||
Uint32 mId;
|
||||
|
||||
bool mValid;
|
||||
std::string mLinkLog;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "cvertexbufferogl.hpp"
|
||||
#include "cvertexbuffervbo.hpp"
|
||||
#include "glhelper.hpp"
|
||||
#include "cvertexbuffermanager.hpp"
|
||||
|
||||
using namespace EE::Graphics::Private;
|
||||
|
||||
@@ -20,24 +21,28 @@ cVertexBuffer::cVertexBuffer( const Uint32& VertexFlags, EE_DRAW_MODE DrawType,
|
||||
mUsageType( UsageType ),
|
||||
mElemDraw(-1)
|
||||
{
|
||||
if( ReserveVertexSize > 0 ) {
|
||||
for( Int32 i = 0; i < VERTEX_FLAGS_COUNT; i++ ) {
|
||||
if( VERTEX_FLAG_QUERY( mVertexFlags, i ) ) {
|
||||
if ( i != VERTEX_FLAG_COLOR )
|
||||
mVertexArray[ i ].reserve( ReserveVertexSize * eeVertexElements[ i ] );
|
||||
else
|
||||
mColorArray.reserve( ReserveVertexSize * eeVertexElements[ i ] );
|
||||
}
|
||||
if( ReserveVertexSize > 0 ) {
|
||||
for( Int32 i = 0; i < VERTEX_FLAGS_COUNT; i++ ) {
|
||||
if( VERTEX_FLAG_QUERY( mVertexFlags, i ) ) {
|
||||
if ( i != VERTEX_FLAG_COLOR )
|
||||
mVertexArray[ i ].reserve( ReserveVertexSize * eeVertexElements[ i ] );
|
||||
else
|
||||
mColorArray.reserve( ReserveVertexSize * eeVertexElements[ i ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cVertexBufferManager::instance()->Add( this );
|
||||
}
|
||||
|
||||
cVertexBuffer::~cVertexBuffer() {
|
||||
for( Int32 i = 0; i < VERTEX_FLAGS_COUNT_ARR; i++ )
|
||||
mVertexArray[ i ].clear();
|
||||
for( Int32 i = 0; i < VERTEX_FLAGS_COUNT_ARR; i++ )
|
||||
mVertexArray[ i ].clear();
|
||||
|
||||
mColorArray.clear();
|
||||
mIndexArray.clear();
|
||||
mColorArray.clear();
|
||||
mIndexArray.clear();
|
||||
|
||||
cVertexBufferManager::instance()->Remove( this );
|
||||
}
|
||||
|
||||
void cVertexBuffer::AddVertex( const Uint32& Type, const eeVector2f& Vertex ) {
|
||||
|
||||
@@ -57,6 +57,8 @@ class cVertexBuffer {
|
||||
virtual bool Compile() = 0;
|
||||
|
||||
virtual void Update( const Uint32& Types, bool Indices ) = 0;
|
||||
|
||||
virtual void Reload() = 0;
|
||||
protected:
|
||||
Uint32 mVertexFlags;
|
||||
EE_DRAW_MODE mDrawType;
|
||||
|
||||
20
src/graphics/cvertexbuffermanager.cpp
Normal file
20
src/graphics/cvertexbuffermanager.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "cvertexbuffermanager.hpp"
|
||||
|
||||
namespace EE { namespace Graphics { namespace Private {
|
||||
|
||||
cVertexBufferManager::cVertexBufferManager()
|
||||
{
|
||||
}
|
||||
|
||||
cVertexBufferManager::~cVertexBufferManager()
|
||||
{
|
||||
}
|
||||
|
||||
void cVertexBufferManager::Reload() {
|
||||
std::list<cVertexBuffer*>::iterator it;
|
||||
|
||||
for ( it = mResources.begin(); it != mResources.end(); it++ )
|
||||
(*it)->Reload();
|
||||
}
|
||||
|
||||
}}}
|
||||
22
src/graphics/cvertexbuffermanager.hpp
Normal file
22
src/graphics/cvertexbuffermanager.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef EE_GRAPHICSCVERTEXBUFFERMANAGER_HPP
|
||||
#define EE_GRAPHICSCVERTEXBUFFERMANAGER_HPP
|
||||
|
||||
#include "base.hpp"
|
||||
#include "cvertexbuffer.hpp"
|
||||
|
||||
namespace EE { namespace Graphics { namespace Private {
|
||||
|
||||
class EE_API cVertexBufferManager : public tContainer<cVertexBuffer>, public tSingleton<cVertexBufferManager> {
|
||||
friend class tSingleton<cVertexBufferManager>;
|
||||
public:
|
||||
cVertexBufferManager();
|
||||
|
||||
virtual ~cVertexBufferManager();
|
||||
|
||||
void Reload();
|
||||
protected:
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -81,4 +81,7 @@ void cVertexBufferOGL::SetVertexStates() {
|
||||
void cVertexBufferOGL::Update( const Uint32& Types, bool Indices ) {
|
||||
}
|
||||
|
||||
void cVertexBufferOGL::Reload() {
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -18,6 +18,8 @@ class cVertexBufferOGL : public cVertexBuffer {
|
||||
bool Compile();
|
||||
|
||||
void Update( const Uint32& Types, bool Indices );
|
||||
|
||||
void Reload();
|
||||
protected:
|
||||
void SetVertexStates();
|
||||
|
||||
|
||||
@@ -177,4 +177,9 @@ void cVertexBufferVBO::Update( const Uint32& Types, bool Indices ) {
|
||||
}
|
||||
}
|
||||
|
||||
void cVertexBufferVBO::Reload() {
|
||||
mCompiled = false;
|
||||
Compile();
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -18,6 +18,8 @@ class cVertexBufferVBO : public cVertexBuffer {
|
||||
bool Compile();
|
||||
|
||||
void Update( const Uint32& Types, bool Indices );
|
||||
|
||||
void Reload();
|
||||
protected:
|
||||
void SetVertexStates();
|
||||
|
||||
|
||||
@@ -2,17 +2,18 @@
|
||||
#define HAD_CONFIG_H
|
||||
|
||||
#if !defined( __WIN32__ ) && !defined( _WIN32 )
|
||||
|
||||
#define HAVE_FSEEKO
|
||||
#define HAVE_FTELLO
|
||||
#define HAVE_UNISTD_H
|
||||
|
||||
#if (!defined (_MSCVER) && !defined (_MSC_VER))
|
||||
|
||||
#define HAVE_MKSTEMP
|
||||
#define HAVE_FSEEKO
|
||||
#define HAVE_FTELLO
|
||||
|
||||
#endif
|
||||
|
||||
#if (!defined (_MSCVER) && !defined (_MSC_VER))
|
||||
#define HAVE_UNISTD_H
|
||||
#endif
|
||||
|
||||
|
||||
#define PACKAGE "libzip"
|
||||
#define VERSION "0.9.3a"
|
||||
#endif /* HAD_CONFIG_H */
|
||||
|
||||
@@ -55,6 +55,11 @@ typedef int pid_t;
|
||||
#if !defined( __WIN32__ ) && !defined( _WIN32 )
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined( _WIN32 )
|
||||
#include <process.h>
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -72,7 +77,11 @@ _zip_mkstemp(char *path)
|
||||
static char xtra[2] = "aa";
|
||||
int xcnt = 0;
|
||||
|
||||
#if ( defined (_MSCVER) || defined (_MSC_VER) )
|
||||
pid = _getpid();
|
||||
#else
|
||||
pid = getpid();
|
||||
#endif
|
||||
|
||||
/* Move to end of path and count trailing X's. */
|
||||
for (trv = path; *trv; ++trv)
|
||||
|
||||
65
src/system/tcontainer.hpp
Normal file
65
src/system/tcontainer.hpp
Normal file
@@ -0,0 +1,65 @@
|
||||
#ifndef EE_SYSTEMTCONTAINER_HPP
|
||||
#define EE_SYSTEMTCONTAINER_HPP
|
||||
|
||||
#include "base.hpp"
|
||||
|
||||
namespace EE { namespace System {
|
||||
|
||||
template <class T>
|
||||
class tContainer {
|
||||
public:
|
||||
tContainer();
|
||||
|
||||
virtual ~tContainer();
|
||||
|
||||
T * Add( T * Resource );
|
||||
|
||||
bool Remove( T * Resource );
|
||||
|
||||
Uint32 Count();
|
||||
protected:
|
||||
std::list<T*> mResources;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
tContainer<T>::tContainer()
|
||||
{
|
||||
}
|
||||
|
||||
template <class T>
|
||||
tContainer<T>::~tContainer()
|
||||
{
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T * tContainer<T>::Add( T * Resource ) {
|
||||
if ( NULL != Resource ) {
|
||||
mResources.push_back( Resource );
|
||||
|
||||
return Resource;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool tContainer<T>::Remove( T * Resource ) {
|
||||
if ( NULL != Resource ) {
|
||||
mResources.remove( Resource );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Uint32 tContainer<T>::Count() {
|
||||
return mResources.size();
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -30,8 +30,6 @@ class tResourceManager {
|
||||
|
||||
Uint32 Count( const Uint32& Id );
|
||||
|
||||
void Reload();
|
||||
|
||||
Uint32 Exists( const std::string& Name );
|
||||
|
||||
Uint32 Exists( const Uint32& Id );
|
||||
|
||||
@@ -79,10 +79,10 @@ bool cInterpolation::EditWaypoint( const eeUint PointNum, const eeFloat NewPos,
|
||||
|
||||
if ( 0 == PointNum ) {
|
||||
if ( PointNum + (eeUint)1 < mPoints.size() )
|
||||
mTotDist += abs( mPoints[ PointNum ].p - mPoints[ PointNum + 1 ].p );
|
||||
mTotDist += std::abs( mPoints[ PointNum ].p - mPoints[ PointNum + 1 ].p );
|
||||
}
|
||||
else
|
||||
mTotDist += abs( mPoints[ PointNum ].p - mPoints[ PointNum - 1 ].p );
|
||||
mTotDist += std::abs( mPoints[ PointNum ].p - mPoints[ PointNum - 1 ].p );
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -170,7 +170,7 @@ void cInterpolation::SetTotalTime( const eeFloat TotTime ) {
|
||||
|
||||
if ( mLoop ) {
|
||||
tdist += fabs( mPoints[ mPoints.size() - 1 ].p - mPoints[0].p );
|
||||
mPoints[ mPoints.size() - 1 ].t = abs( mPoints[ mPoints.size() - 1 ].p - mPoints[0].p ) * TotTime / tdist;
|
||||
mPoints[ mPoints.size() - 1 ].t = std::abs( mPoints[ mPoints.size() - 1 ].p - mPoints[0].p ) * TotTime / tdist;
|
||||
}
|
||||
|
||||
for ( eeUint i = 0; i < mPoints.size() - 1; i++) {
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "../graphics/cglobalbatchrenderer.hpp"
|
||||
#include "../graphics/cshaderprogrammanager.hpp"
|
||||
#include "../graphics/cshapegroupmanager.hpp"
|
||||
#include "../graphics/cvertexbuffermanager.hpp"
|
||||
#include "../graphics/cframebuffermanager.hpp"
|
||||
#include "../ui/cuimanager.hpp"
|
||||
#include "../audio/caudiolistener.hpp"
|
||||
#include "../graphics/glhelper.hpp"
|
||||
@@ -89,6 +91,10 @@ cEngine::~cEngine() {
|
||||
if ( NULL != mCursor )
|
||||
SDL_FreeCursor(mCursor);
|
||||
|
||||
cFrameBufferManager::DestroySingleton();
|
||||
|
||||
cVertexBufferManager::DestroySingleton();
|
||||
|
||||
cGlobalBatchRenderer::DestroySingleton();
|
||||
|
||||
cTextureFactory::DestroySingleton();
|
||||
@@ -371,8 +377,10 @@ void cEngine::ChangeRes( const Uint16& width, const Uint16& height, const bool&
|
||||
|
||||
#if EE_PLATFORM == EE_PLATFORM_WIN32 || EE_PLATFORM == EE_PLATFORM_MACOSX
|
||||
if ( Reload ) {
|
||||
cTextureFactory::instance()->UngrabTextures(); // Reload all textures
|
||||
cShaderProgramManager::instance()->Reload(); // Reload all shaders
|
||||
cTextureFactory::instance()->UngrabTextures(); // Reload all textures
|
||||
cShaderProgramManager::instance()->Reload(); // Reload all shaders
|
||||
cFrameBufferManager::instance()->Reload(); // Reload all frame buffers
|
||||
cVertexBufferManager::instance()->Reload(); // Reload all vertex buffers
|
||||
GetMainContext(); // Recover the context
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user