[pkg-fgfs-crew] r129 - in /simgear/trunk/simgear: math/Makefile.am math/Makefile.in math/project.cxx math/project.hxx screen/tr.cxx
ovek at users.alioth.debian.org
ovek at users.alioth.debian.org
Thu Jul 21 02:50:51 UTC 2011
Author: ovek
Date: Thu Jul 21 02:50:50 2011
New Revision: 129
URL: http://svn.debian.org/wsvn/pkg-fgfs/?sc=1&rev=129
Log:
Backported upstream commit
bfe953c "replace glu functions with equivalents from OSG"
Added:
simgear/trunk/simgear/math/project.cxx
simgear/trunk/simgear/math/project.hxx
Modified:
simgear/trunk/simgear/math/Makefile.am
simgear/trunk/simgear/math/Makefile.in
simgear/trunk/simgear/screen/tr.cxx
Modified: simgear/trunk/simgear/math/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-fgfs/simgear/trunk/simgear/math/Makefile.am?rev=129&op=diff
==============================================================================
--- simgear/trunk/simgear/math/Makefile.am (original)
+++ simgear/trunk/simgear/math/Makefile.am Thu Jul 21 02:50:50 2011
@@ -43,7 +43,8 @@
SGVec2.hxx \
SGVec3.hxx \
SGVec4.hxx \
- beziercurve.hxx
+ beziercurve.hxx \
+ project.hxx
libsgmath_a_SOURCES = \
interpolater.cxx \
@@ -51,6 +52,7 @@
sg_random.c \
vector.cxx \
SGGeod.cxx \
- SGGeodesy.cxx
+ SGGeodesy.cxx \
+ project.cxx
INCLUDES = -I$(top_srcdir)
Modified: simgear/trunk/simgear/math/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-fgfs/simgear/trunk/simgear/math/Makefile.in?rev=129&op=diff
==============================================================================
--- simgear/trunk/simgear/math/Makefile.in (original)
+++ simgear/trunk/simgear/math/Makefile.in Thu Jul 21 02:50:50 2011
@@ -75,7 +75,7 @@
libsgmath_a_LIBADD =
am_libsgmath_a_OBJECTS = interpolater.$(OBJEXT) leastsqs.$(OBJEXT) \
sg_random.$(OBJEXT) vector.$(OBJEXT) SGGeod.$(OBJEXT) \
- SGGeodesy.$(OBJEXT)
+ SGGeodesy.$(OBJEXT) project.$(OBJEXT)
libsgmath_a_OBJECTS = $(am_libsgmath_a_OBJECTS)
am_SGGeometryTest_OBJECTS = SGGeometryTest.$(OBJEXT)
SGGeometryTest_OBJECTS = $(am_SGGeometryTest_OBJECTS)
@@ -264,7 +264,8 @@
SGVec2.hxx \
SGVec3.hxx \
SGVec4.hxx \
- beziercurve.hxx
+ beziercurve.hxx \
+ project.hxx
libsgmath_a_SOURCES = \
interpolater.cxx \
@@ -272,7 +273,8 @@
sg_random.c \
vector.cxx \
SGGeod.cxx \
- SGGeodesy.cxx
+ SGGeodesy.cxx \
+ project.cxx
INCLUDES = -I$(top_srcdir)
all: all-am
@@ -367,6 +369,7 @@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/SGMathTest.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/interpolater.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/leastsqs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/project.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sg_random.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vector.Po at am__quote@
Added: simgear/trunk/simgear/math/project.cxx
URL: http://svn.debian.org/wsvn/pkg-fgfs/simgear/trunk/simgear/math/project.cxx?rev=129&op=file
==============================================================================
--- simgear/trunk/simgear/math/project.cxx (added)
+++ simgear/trunk/simgear/math/project.cxx Thu Jul 21 02:50:50 2011
@@ -1,0 +1,43 @@
+// Copyright (C) 2010 Tim Moore moore at bricoworks.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+#include "project.hxx"
+
+#include <osg/Math>
+#include <osg/Matrixd>
+
+namespace simgear
+{
+GLint project(GLdouble objX, GLdouble objY, GLdouble objZ,
+ const GLdouble *model, const GLdouble *proj, const GLint *view,
+ GLdouble* winX, GLdouble* winY, GLdouble* winZ)
+{
+ using namespace osg;
+ Vec4d obj(objX, objY, objZ, 1.0);
+ Matrixd Mmodel(model), Mproj(proj);
+ Matrixd Mwin = (Matrixd::translate(1.0, 1.0, 1.0)
+ * Matrixd::scale(0.5 * view[2], 0.5 * view[3], 0.5)
+ * Matrixd::translate(view[0], view[1], 0.0));
+ Vec4d result = obj * Mmodel * Mproj * Mwin;
+ if (equivalent(result.w(), 0.0))
+ return GL_FALSE;
+ result = result / result.w();
+ *winX = result.x(); *winY = result.y(); *winZ = result.z();
+ return GL_TRUE;
+}
+
+}
Added: simgear/trunk/simgear/math/project.hxx
URL: http://svn.debian.org/wsvn/pkg-fgfs/simgear/trunk/simgear/math/project.hxx?rev=129&op=file
==============================================================================
--- simgear/trunk/simgear/math/project.hxx (added)
+++ simgear/trunk/simgear/math/project.hxx Thu Jul 21 02:50:50 2011
@@ -1,0 +1,29 @@
+// Copyright (C) 2010 Tim Moore moore at bricoworks.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+#ifndef SIMGEAR_PROJECT_HXX
+#define SIMGEAR_PROJECT_HXX 1
+#include <osg/GL>
+
+namespace simgear
+{
+// Replacement for gluProject. OSG doesn't link in GLU anymore.
+extern GLint project(GLdouble objX, GLdouble objY, GLdouble objZ,
+ const GLdouble *model, const GLdouble *proj,
+ const GLint *view,
+ GLdouble* winX, GLdouble* winY, GLdouble* winZ);
+}
+#endif
Modified: simgear/trunk/simgear/screen/tr.cxx
URL: http://svn.debian.org/wsvn/pkg-fgfs/simgear/trunk/simgear/screen/tr.cxx?rev=129&op=diff
==============================================================================
--- simgear/trunk/simgear/screen/tr.cxx (original)
+++ simgear/trunk/simgear/screen/tr.cxx Thu Jul 21 02:50:50 2011
@@ -144,7 +144,7 @@
#include <windows.h>
#endif
-#include <osg/GLU>
+#include <simgear/math/project.hxx>
#include "tr.h"
@@ -541,7 +541,6 @@
return 1;
}
-
/*
* Replacement for glRastePos3f() which avoids the problem with invalid
* raster pos.
@@ -566,7 +565,8 @@
viewport[3] = tr->CurrentTileHeight;
/* Project object coord to window coordinate */
- if (gluProject(x, y, z, modelview, proj, viewport, &winX, &winY, &winZ)){
+ if (simgear::project(x, y, z, modelview, proj, viewport,
+ &winX, &winY, &winZ)){
/* set raster pos to window coord (0,0) */
glMatrixMode(GL_MODELVIEW);
More information about the pkg-fgfs-crew
mailing list