native s3d implementation
This commit is contained in:
@@ -165,6 +165,8 @@ public:
|
||||
void setX(double inValue);
|
||||
double getY();
|
||||
void setY(double inValue);
|
||||
double getZ();
|
||||
void setZ(double inValue);
|
||||
virtual double getHeight();
|
||||
virtual void setHeight(double inValue);
|
||||
virtual double getWidth();
|
||||
@@ -314,6 +316,7 @@ protected:
|
||||
// Decomp
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
double scaleX;
|
||||
double scaleY;
|
||||
double rotation;
|
||||
@@ -447,6 +450,8 @@ public:
|
||||
Matrix GetFullMatrix(bool inStageScaling);
|
||||
bool FinishEditOnEnter();
|
||||
|
||||
void setAutoS3D(bool enabled) { autos3d = enabled; }
|
||||
bool getAutoS3D() const { return autos3d; }
|
||||
void setFocusRect(bool inVal) { focusRect = inVal; }
|
||||
bool getFocusRect() const { return focusRect; }
|
||||
UserPoint getMousePos() const { return mLastMousePos; }
|
||||
@@ -478,6 +483,7 @@ protected:
|
||||
EventHandler mHandler;
|
||||
void *mHandlerData;
|
||||
bool focusRect;
|
||||
bool autos3d;
|
||||
UserPoint mLastMousePos;
|
||||
StageScaleMode scaleMode;
|
||||
StageAlign align;
|
||||
|
||||
@@ -11,7 +11,7 @@ class Matrix
|
||||
public:
|
||||
Matrix(double inSX=1,double inSY=1, double inTX=0, double inTY=0) :
|
||||
m00(inSX), m01(0), mtx(inTX),
|
||||
m10(0), m11(inSY), mty(inTY)
|
||||
m10(0), m11(inSY), mty(inTY), mtz(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ public:
|
||||
|
||||
double m00, m01, mtx;
|
||||
double m10, m11, mty;
|
||||
double mtz;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,10 @@ namespace lime {
|
||||
virtual void SetViewport (const Rect &inRect) = 0;
|
||||
virtual void SetWindowSize (int inWidth, int inHeight) = 0;
|
||||
virtual int Width () const = 0;
|
||||
|
||||
|
||||
virtual void EndS3DRender () { };
|
||||
virtual void SetS3DEye (int eye) { };
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
21
project/include/renderer/common/S3D.h
Normal file
21
project/include/renderer/common/S3D.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef LIME_S3D_H
|
||||
#define LIME_S3D_H
|
||||
|
||||
namespace lime {
|
||||
|
||||
enum S3DOrientation {
|
||||
S3D_ORIENTATION_VERTICAL,
|
||||
S3D_ORIENTATION_HORIZONTAL
|
||||
};
|
||||
|
||||
namespace S3D {
|
||||
|
||||
void SetEnabled (bool enabled);
|
||||
void SetOrientation (S3DOrientation orientation);
|
||||
bool GetEnabled ();
|
||||
bool IsSupported ();
|
||||
|
||||
} // end namespace S3D
|
||||
} // end namespace lime
|
||||
|
||||
#endif
|
||||
14
project/include/renderer/common/S3DEye.h
Normal file
14
project/include/renderer/common/S3DEye.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef LIME_S3D_EYE_H
|
||||
#define LIME_S3D_EYE_H
|
||||
|
||||
namespace lime {
|
||||
|
||||
enum S3DEye {
|
||||
EYE_MIDDLE,
|
||||
EYE_LEFT,
|
||||
EYE_RIGHT
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <LimeThread.h>
|
||||
#include "renderer/opengl/OGL.h"
|
||||
#include "renderer/common/HardwareContext.h"
|
||||
#include "renderer/opengl/OpenGLProgram.h"
|
||||
#include "renderer/opengl/OpenGLS3D.h"
|
||||
|
||||
|
||||
namespace lime {
|
||||
@@ -35,6 +37,9 @@ namespace lime {
|
||||
void SetQuality (StageQuality inQ);
|
||||
void SetViewport (const Rect &inRect);
|
||||
void SetWindowSize (int inWidth, int inHeight);
|
||||
|
||||
void EndS3DRender ();
|
||||
void SetS3DEye (int eye);
|
||||
|
||||
int Height () const { return mHeight; }
|
||||
int Width () const { return mWidth; }
|
||||
@@ -62,7 +67,8 @@ namespace lime {
|
||||
int mWidth;
|
||||
QuickVec<GLuint> mZombieTextures;
|
||||
QuickVec<GLuint> mZombieVbos;
|
||||
|
||||
|
||||
OpenGLS3D mS3D;
|
||||
};
|
||||
|
||||
|
||||
|
||||
46
project/include/renderer/opengl/OpenGLS3D.h
Normal file
46
project/include/renderer/opengl/OpenGLS3D.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef LIME_RENDERER_OPENGL_S3D_H
|
||||
#define LIME_RENDERER_OPENGL_S3D_H
|
||||
|
||||
#include "renderer/opengl/OGL.h"
|
||||
#include "renderer/opengl/OpenGLProgram.h"
|
||||
|
||||
namespace lime {
|
||||
|
||||
class OpenGLS3D {
|
||||
public:
|
||||
OpenGLS3D ();
|
||||
~OpenGLS3D ();
|
||||
|
||||
void Init ();
|
||||
void EndS3DRender (int inWidth, int inHeight, const Trans4x4 &inTrans);
|
||||
void SetS3DEye (int eye);
|
||||
void Resize (int inWidth, int inHeight);
|
||||
void FocusEye (Trans4x4 &outTrans);
|
||||
double GetEyeOffset ();
|
||||
|
||||
double mFocalLength;
|
||||
double mEyeSeparation;
|
||||
|
||||
private:
|
||||
int mWidth;
|
||||
int mHeight;
|
||||
|
||||
int mCurrentEye;
|
||||
OpenGLProgram *mS3DProgram;
|
||||
GLuint mFramebuffer;
|
||||
GLuint mRenderbuffer;
|
||||
GLuint mLeftEyeTexture;
|
||||
GLuint mRightEyeTexture;
|
||||
GLuint mEyeMaskTexture;
|
||||
GLint mLeftImageUniform;
|
||||
GLint mRightImageUniform;
|
||||
GLint mMaskImageUniform;
|
||||
GLint mPixelSizeUniform;
|
||||
GLint mScreenUniform;
|
||||
GLuint mS3DVertexBuffer;
|
||||
GLuint mS3DTextureBuffer;
|
||||
};
|
||||
|
||||
}; // namespace lime
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user