Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2009-05-08 22:59:08 +0400
committerDalai Felinto <dfelinto@gmail.com>2009-05-08 22:59:08 +0400
commit1d11df17085bd4f1231a892089a0771887d155bb (patch)
tree5f69fc5035b006c08850deef047f18c045223c90 /source/gameengine/Ketsji/KX_Dome.cpp
parent57beadf40613b3c4ba6f20cbaddc1066c6800bbc (diff)
BGE Dome: Truncated Dome are back (Upright and Downright) + GLEW_EXT_framebuffer_object check before generating FBO
After last commit (20099) warping meshes got slower (more quality == less performance). Since we don't need an extra warping for truncated domes, It's better to handle them directly in openGL without the need of warping it. I'll talk with some Dome owners to see if we need both Upright and Downright modes. I may remove one of them by 2.49 them. *) also: a proper GLEW_EXT_framebuffer_object check before generating FBO (for warping meshes). **) next in line (maybe after RC2): tilt option to tilt the camera up to 90º upward.
Diffstat (limited to 'source/gameengine/Ketsji/KX_Dome.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_Dome.cpp75
1 files changed, 57 insertions, 18 deletions
diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp
index 4a6575ff412..a302bf98cb8 100644
--- a/source/gameengine/Ketsji/KX_Dome.cpp
+++ b/source/gameengine/Ketsji/KX_Dome.cpp
@@ -124,6 +124,16 @@ KX_Dome::KX_Dome (
CreateMeshPanorama();
m_numfaces = 6;
break;
+ default: //DOME_TRUNCATED_DOWN and DOME_TRUNCATED_UP
+ cubetop.resize(1);
+ cubebottom.resize(1);
+ cubeleft.resize(2);
+ cuberight.resize(2);
+
+ m_angle = 180;
+ CreateMeshDome180();
+ m_numfaces = 4;
+ break;
}
m_numimages =(warp.usemesh?m_numfaces+1:m_numfaces);
@@ -255,7 +265,7 @@ http://projects.blender.org/tracker/?func=detail&aid=18655&group_id=9&atid=125
bool KX_Dome::CreateDL(){
dlistId = glGenLists((GLsizei) m_numimages);
if (dlistId != 0) {
- if(m_mode == DOME_FISHEYE){
+ if(m_mode == DOME_FISHEYE || m_mode == DOME_TRUNCATED_UP || m_mode == DOME_TRUNCATED_DOWN){
glNewList(dlistId, GL_COMPILE);
GLDrawTriangles(cubetop, nfacestop);
glEndList();
@@ -329,6 +339,12 @@ bool KX_Dome::CreateDL(){
bool KX_Dome::CreateFBO(void)
{
+ if (!GLEW_EXT_framebuffer_object)
+ {
+ printf("Dome Error: FrameBuffer unsupported. Using low resolution warp image.");
+ return false;
+ }
+
glGenFramebuffersEXT(1, &warp.fboId);
if(warp.fboId==0)
{
@@ -345,7 +361,7 @@ bool KX_Dome::CreateFBO(void)
if(status == GL_FRAMEBUFFER_UNSUPPORTED_EXT)
{
- printf("Dome Error: FrameBuffer unsupported. Using low resolution warp image.");
+ printf("Dome Error: FrameBuffer settings unsupported. Using low resolution warp image.");
return false;
}
else if(status != GL_FRAMEBUFFER_COMPLETE_EXT)
@@ -1469,7 +1485,9 @@ Uses 6 cameras for angles up to 360º
MT_Scalar c = cos(deg45);
MT_Scalar s = sin(deg45);
- if ((m_mode == DOME_FISHEYE && m_angle <= 180)){
+ if ((m_mode == DOME_FISHEYE && m_angle <= 180)
+ || m_mode == DOME_TRUNCATED_UP
+ || m_mode == DOME_TRUNCATED_DOWN){
m_locRot[0] = MT_Matrix3x3( // 90º - Top
c, -s, 0.0,
@@ -1597,6 +1615,12 @@ void KX_Dome::Draw(void)
case DOME_PANORAM_SPH:
DrawPanorama();
break;
+ case DOME_TRUNCATED_UP:
+ DrawDomeFisheye();
+ break;
+ case DOME_TRUNCATED_DOWN:
+ DrawDomeFisheye();
+ break;
}
if(warp.usemesh)
@@ -1760,22 +1784,37 @@ void KX_Dome::DrawDomeFisheye(void)
float ortho_width, ortho_height;
- if (warp.usemesh)
- glOrtho((-1.0), 1.0, (-1.0), 1.0, -20.0, 10.0); //stretch the image to reduce resolution lost
-
- else {
- if (can_width < can_height){
- ortho_width = 1.0;
- ortho_height = (float)can_height/can_width;
- }else{
- ortho_width = (float)can_width/can_height;
- ortho_height = 1.0;
+ if(m_mode == DOME_FISHEYE) {
+ if (warp.usemesh)
+ glOrtho((-1.0), 1.0, (-1.0), 1.0, -20.0, 10.0); //stretch the image to reduce resolution lost
+
+ else {
+ if (can_width < can_height){
+ ortho_width = 1.0;
+ ortho_height = (float)can_height/can_width;
+ }else{
+ ortho_width = (float)can_width/can_height;
+ ortho_height = 1.0;
+ }
+
+ ortho_width /= m_size;
+ ortho_height /= m_size;
+
+ glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_height, -20.0, 10.0);
}
-
- ortho_width /= m_size;
- ortho_height /= m_size;
-
- glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_height, -20.0, 10.0);
+ }
+ else if(m_mode == DOME_TRUNCATED_UP)
+ {
+ ortho_width = 1.0;
+ ortho_height = 2 * ((float)can_height/can_width) - 1.0 ;
+
+ glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_width, -20.0, 10.0);
+ }
+ else { //m_mode == DOME_TRUNCATED_DOWN
+ ortho_width = 1.0;
+ ortho_height = 2 * ((float)can_height/can_width) - 1.0 ;
+
+ glOrtho((-ortho_width), ortho_width, (-ortho_width), ortho_height, -20.0, 10.0);
}
glMatrixMode(GL_TEXTURE);