Skip to content
Snippets Groups Projects
Commit ce04d9bc authored by Robert Menzel's avatar Robert Menzel
Browse files

acgl compiles on VS2010

parent a66f5cfb
No related branches found
No related tags found
No related merge requests found
......@@ -38,15 +38,21 @@
* namespace ptr = ACGL::Base;
*
*/
#if (__cplusplus >= 201103L)
// C++11:
# include <memory>
namespace ptr = std;
#else
// C++98 and TR1:
# ifdef _MSC_VER
# include <memory>
namespace ptr = std;
# else
# include <tr1/memory>
namespace ptr = std::tr1;
# endif
#endif
#include <ACGL/Base/CompileTimeSettings.hh>
#include <ACGL/Types.hh>
......
......@@ -86,7 +86,7 @@ public:
if(_progress < 0.5)
return 2.0f*_progress*_progress;
else
return 1.0f-2.0f*pow(_progress-1.0f,2.0);
return 1.0f-2.0f*pow(_progress-1.0f,2.0f);
}
};
......@@ -99,7 +99,7 @@ public:
virtual float value(const float _progress)
{
return sin(0.5f*M_PI*mFrequency*_progress);
return sin(0.5f*(float)M_PI*mFrequency*_progress);
}
float mFrequency;
......@@ -113,7 +113,7 @@ public:
virtual float value(const float _progress)
{
return 2*fmin(_progress, 1-_progress);
return 2.0f*Math::Functions::min(_progress, 1.0f-_progress);
}
};
class BlendSin : public EaseFunction
......@@ -124,7 +124,7 @@ public:
virtual float value(const float _progress)
{
return sin(20*M_PI*_progress);
return sin(20*(float)M_PI*_progress);
}
};
class BlendCos : public EaseFunction
......@@ -135,7 +135,7 @@ public:
virtual float value(const float _progress)
{
return cos(6*M_PI*_progress)-1.0f;
return cos(6*(float)M_PI*_progress)-1.0f;
}
};
class BlendSinDamped : public EaseFunction
......@@ -146,7 +146,7 @@ public:
virtual float value(const float _progress)
{
return 2*fmin(_progress, 1-_progress)*sin(10*M_PI*_progress);
return 2.0f*Math::Functions::min(_progress, 1.0f-_progress)*sin(10.0f*(float)M_PI*_progress);
}
};
class BlendCosDamped : public EaseFunction
......@@ -157,7 +157,7 @@ public:
virtual float value(const float _progress)
{
return 2*fmin(_progress, 1.0f-_progress)*cos(10.0f*M_PI*_progress);
return 2.0f*Math::Functions::min(_progress, 1.0f-_progress)*cos(10.0f*(float)M_PI*_progress);
}
};
......
......@@ -10,7 +10,11 @@
#include <vector>
#include <time.h>
#ifdef _MSC_VER
# include <sys/utime.h>
#else
# include <utime.h>
#endif
#include <sys/stat.h>
#include <ACGL/ACGL.hh>
......
......@@ -54,8 +54,8 @@ template<> inline float SQUARED_EPSILON<float> (void) { return SQUARED_EPSILON_
template<> inline double SQUARED_EPSILON<double>(void) { return SQUARED_EPSILON_DOUBLE; }
//Sine and Cosine stuff
const float PI_FLOAT = M_PI;
const double PI_DOUBLE = M_PI;
const float PI_FLOAT = (float) M_PI;
const double PI_DOUBLE = (double) M_PI;
template<typename T> inline T PI(void) { return T(); }
template<> inline float PI<float> (void) { return PI_FLOAT; }
......
......@@ -63,8 +63,8 @@ inline double atanDeg(double v) {return (::atan (v) * Constants::RAD_
inline double atan2Deg(double a, double b) {return (::atan2(a, b) * Constants::RAD_TO_DEG_DOUBLE);}
//Helpers
inline int32_t round(float a) {return (a < 0.5f)? ceil(a-0.5f) : floor(a+0.5f);}
inline int32_t round(double a) {return (a < 0.5 )? ceil(a-0.5 ) : floor(a+0.5 );}
inline int32_t round(float a) {return (int32_t) ( (a < 0.5f)? ceil(a-0.5f) : floor(a+0.5f) );}
inline int32_t round(double a) {return (int32_t) ( (a < 0.5 )? ceil(a-0.5 ) : floor(a+0.5 ) );}
inline float pow(float a, float b) { return ::powf(a, b); }
inline double pow(double a, double b) { return ::pow(a, b); }
......
......@@ -18,9 +18,21 @@
* this, you should never include glm yourself, but include always our ACGL/Math.hh!
*/
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning ( disable : 4201 )
#pragma warning ( disable : 4100 )
#pragma warning ( disable : 4996 )
#pragma warning ( disable : 4244 )
#endif
#include <glm/glm.hpp>
#include <glm/ext.hpp>
#ifdef _MSC_VER
#pragma warning( pop )
#endif
#include <ACGL/Math/Constants.hh>
#include <ACGL/Math/Functions.hh>
......
......@@ -123,22 +123,26 @@ public:
*/
inline bool attachColorRenderBuffer(const std::string &_name, const ConstSharedRenderBuffer& _renderBuffer)
{
return attachColorAttachment( (Attachment){_name, SharedTexture(), _renderBuffer, mColorAttachments.size()} );
Attachment a = {_name, SharedTexture(), _renderBuffer, mColorAttachments.size()};
return attachColorAttachment( a );
}
inline bool attachColorTexture(const std::string &_name, const ConstSharedTexture& _texture)
{
return attachColorAttachment( (Attachment){_name, _texture, SharedRenderBuffer(), mColorAttachments.size()} );
Attachment a = {_name, _texture, SharedRenderBuffer(), mColorAttachments.size()};
return attachColorAttachment( a );
}
inline bool attachColorRenderBuffer(const std::string &_name, const ConstSharedRenderBuffer& _renderBuffer, GLuint _location )
{
return attachColorAttachment( (Attachment){_name, SharedTexture(), _renderBuffer, _location} );
Attachment a = {_name, SharedTexture(), _renderBuffer, _location};
return attachColorAttachment( a );
}
inline bool attachColorTexture(const std::string &_name, const ConstSharedTexture& _texture, GLuint _location )
{
return attachColorAttachment( (Attachment){_name, _texture, SharedRenderBuffer(), _location} );
Attachment a = {_name, _texture, SharedRenderBuffer(), _location};
return attachColorAttachment( a );
}
bool attachColorAttachment( const Attachment &_attachment );
......
......@@ -98,7 +98,7 @@ bool AnimationWait::finished()
AnimationSequential::AnimationSequential(const int_t _loops) :
mLoops(_loops),
mCurrentPosition(0),
mCurrentPosition(),
mAnimations()
{
}
......
This diff is collapsed.
......@@ -105,10 +105,8 @@ bool doesSupportTessellationShader()
const GLubyte* acglErrorString( GLenum _errorCode )
{
#ifndef ACGL_USE_GLEW
// no gluErrorString on iOS
// this should only get used on OpenGL ES plattforms or if compiled without GLEW, so error strings from the compatibility profile
// are ignored. Only 3.2+ Core and ES 2.0+ errors belong here:
// no gluErrorString on iOS, problems on visual studio...
// Only 3.2+ Core and ES 2.0+ errors belong here:
if (_errorCode == GL_INVALID_ENUM) { return (GLubyte*) "GL_INVALID_ENUM"; }
else if (_errorCode == GL_INVALID_VALUE) { return (GLubyte*) "GL_INVALID_VALUE"; }
else if (_errorCode == GL_INVALID_OPERATION) { return (GLubyte*) "GL_INVALID_OPERATION"; }
......@@ -118,9 +116,6 @@ const GLubyte* acglErrorString( GLenum _errorCode )
else {
return (GLubyte*) "unknown error";
}
#else
return gluErrorString( _errorCode );
#endif
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment