Permalink
Browse files

project can now be built with visual studio 2010

- fixes mostly are min and max using standard stuff
- update build files to statically build ptex headers to avoid missing symbols
  (this changes aselle hack to #define and puts it into build system)
- added win32 build instructions
- now ignore temporary build files
- fixed missing header when building with visual studio (io.h)
  • Loading branch information...
1 parent 42d2575 commit 394c222aa3f8e68a9d3c1d2a178dc5697a961bc5 @kayru kayru committed with aselle Aug 13, 2012
View
@@ -2,3 +2,16 @@
moc_*
Makefile
Linux-*
+*.dll
+*.exe
+*.filters
+*.ipch
+*.opensdf
+*.pdb
+*.sdf
+*.sln
+*.suo
+*.user
+*.vcxproj
+src/brdf/release
+src/brdf/debug
View
@@ -0,0 +1,13 @@
+How to compile BRDF Explorer for Windows
+========================================
+
+The following external dependencies are required (versions are ones that I used, other might also work):
+ - Qt 4.8.1
+ - GLEW 1.9.0
+ - ZLib 1.2.5
+ - GLUT 3.7
+
+Make sure that qmake is in your PATH. Also put GLEW, ZLib and GLUT include and library directories somewhere VC can find them.
+
+Open Visual Studio 2010 command prompt and navigate to brdf project root directory.
+Run "qmake -r -tp vc prefix=foo", this will generate the vcxproj and sln files.
View
@@ -1,13 +1,17 @@
+
+VERSION=1.0.0
+
make clean
qmake-qt4 -spec linux-mingw32-custom
make -j 8
-rm -rf brdf-win32
-mkdir brdf-win32
-pushd brdf-win32
+DIR=brdf-$VERSION-win32
+rm -rf $DIR
+mkdir $DIR
+pushd $DIR
cp -a ../src/{data,probes,images,brdfs,shaderTemplates} ./
cp /jobs2/soft/users/aselle/windows-build/QtSDK/Desktop/Qt/4.6.4/bin/{QtGui4.dll,QtCore4.dll,QtOpenGL4.dll,libgcc_s_dw2-1.dll,mingwm10.dll} ./
cp ../src/brdf/release/brdf.exe ./
-cp ../{LICENSE,LICENSE-BINARY} ./
+cp ../{LICENSE,LICENSE-BINARY,README} ./
popd
-zip -r brdf-win32.zip brdf-win32
+zip -r brdf-$VERSION-win32.zip brdf-$VERSION-win32
View
@@ -45,7 +45,6 @@ infringement.
#include <GL/glew.h>
#include <QtGui>
-#include <QtOpenGL>
#include <QString>
#include <math.h>
#include <stdlib.h>
@@ -446,8 +445,8 @@ void IBLWidget::mouseMoveEvent( QMouseEvent* event )
int d = abs(dx) > abs(dy) ? dx : dy;
lookZoom -= float(d) * lookZoom * 0.05;
- lookZoom = fmaxf( lookZoom, 0.01f );
- lookZoom = fminf( lookZoom, 100.0f );
+ lookZoom = std::max<float>( lookZoom, 0.01f );
+ lookZoom = std::min<float>( lookZoom, 100.0f );
}
@@ -45,7 +45,6 @@ infringement.
#include <GL/glew.h>
#include <QtGui>
-#include <QtOpenGL>
#include <QString>
#include <math.h>
#include "DGLShader.h"
@@ -218,17 +217,17 @@ void ImageSliceWidget::mouseMoveEvent(QMouseEvent *event)
{
int d = abs(dx) > abs(dy) ? dx : dy;
scaleX += float(d) * scaleX * 0.05;
- scaleX = fmaxf( scaleX, 0.01 );
- scaleX = fminf( scaleX, 50.0 );
+ scaleX = std::max<float>( scaleX, 0.01 );
+ scaleX = std::min<float>( scaleX, 50.0 );
}
// control+right adjusts the x-scale of the graph
else if( event->buttons() & Qt::RightButton && event->modifiers() & Qt::ControlModifier )
{
int d = abs(dx) > abs(dy) ? dx : dy;
scaleY += float(d) * scaleY * 0.05;
- scaleY = fmaxf( scaleY, 0.01 );
- scaleY = fminf( scaleY, 50.0 );
+ scaleY = std::max<float>( scaleY, 0.01 );
+ scaleY = std::min<float>( scaleY, 50.0 );
}
// left mouse button adjusts the viewing dir
@@ -248,8 +247,8 @@ void ImageSliceWidget::mouseMoveEvent(QMouseEvent *event)
int d = abs(dx) > abs(dy) ? dx : dy;
lookZoom -= float(d) * lookZoom * 0.05;
- lookZoom = fmaxf( lookZoom, 0.01f );
- lookZoom = fminf( lookZoom, 50.0f );
+ lookZoom = std::max<float>( lookZoom, 0.01f );
+ lookZoom = std::min<float>( lookZoom, 50.0f );
}
View
@@ -51,6 +51,9 @@ infringement.
#include "Plot3DWidget.h"
#include "geodesicHemisphere.h"
+#ifndef M_PI_2
+#define M_PI_2 1.57079632679489661923
+#endif //M_PI_2
Plot3DWidget::Plot3DWidget( QWidget *parent, std::vector<brdfPackage> bList )
: SharedContextGLWidget(parent)
@@ -163,8 +166,8 @@ void Plot3DWidget::paintGL()
// try and set some better viewing planes based on zoom factor... this only kinda works
- float nearPlane = fminf( lookZoom*0.1, 0.5 );
- float farPlane = fminf( lookZoom*10.0, 100.0 );
+ float nearPlane = std::min<float>( lookZoom*0.1, 0.5 );
+ float farPlane = std::min<float>( lookZoom*10.0, 100.0 );
glMatrixMode(GL_PROJECTION);
@@ -293,8 +296,8 @@ void Plot3DWidget::mouseMoveEvent(QMouseEvent *event)
int d = abs(dx) > abs(dy) ? dx : dy;
lookZoom -= float(d) * lookZoom * 0.05;
- lookZoom = fmaxf( lookZoom, 0.01f );
- lookZoom = fminf( lookZoom, 100.0f );
+ lookZoom = std::max<float>( lookZoom, 0.01f );
+ lookZoom = std::min<float>( lookZoom, 100.0f );
}
@@ -350,7 +353,7 @@ void Plot3DWidget::makeGeodesicHemisphereVBO()
int memIndex = 0;
// allocate enough memory for all the vertices in the hemisphere
- numTrianglesInHemisphere = 40 * int(pow(4.0, float(numSubdivisions)));
+ numTrianglesInHemisphere = 40 * int(powf(4.0, float(numSubdivisions)));
hemisphereVertices = new float[ numTrianglesInHemisphere * 3 * 3 ];
//printf( "numTrianglesInHemisphere: %d\n", numTrianglesInHemisphere );
@@ -45,7 +45,6 @@ infringement.
#include <GL/glew.h>
#include <QtGui>
-#include <QtOpenGL>
#include <QString>
#include <math.h>
#include "DGLShader.h"
@@ -362,17 +361,17 @@ void PlotCartesianWidget::mouseMoveEvent(QMouseEvent *event)
{
int d = abs(dx) > abs(dy) ? dx : dy;
scaleX += float(d) * scaleX * 0.05;
- scaleX = fmaxf( scaleX, 0.01 );
- scaleX = fminf( scaleX, 50.0 );
+ scaleX = std::max<float>( scaleX, 0.01 );
+ scaleX = std::min<float>( scaleX, 50.0 );
}
// control+right adjusts the x-scale of the graph
else if( event->buttons() & Qt::RightButton && event->modifiers() & Qt::ControlModifier )
{
int d = abs(dx) > abs(dy) ? dx : dy;
scaleY += float(d) * scaleY * 0.05;
- scaleY = fmaxf( scaleY, 0.01 );
- scaleY = fminf( scaleY, 50.0 );
+ scaleY = std::max<float>( scaleY, 0.01 );
+ scaleY = std::min<float>( scaleY, 50.0 );
}
// left mouse button adjusts the viewing dir
@@ -393,8 +392,8 @@ void PlotCartesianWidget::mouseMoveEvent(QMouseEvent *event)
int d = abs(dx) > abs(dy) ? dx : dy;
lookZoom -= float(d) * lookZoom * 0.05;
- lookZoom = fmaxf( lookZoom, 0.01f );
- lookZoom = fminf( lookZoom, 50.0f );
+ lookZoom = std::max<float>( lookZoom, 0.01f );
+ lookZoom = std::min<float>( lookZoom, 50.0f );
}
@@ -45,7 +45,6 @@ infringement.
#include <GL/glew.h>
#include <QtGui>
-#include <QtOpenGL>
#include <QString>
#include <math.h>
#include "DGLShader.h"
@@ -251,8 +250,8 @@ void PlotPolarWidget::mouseMoveEvent(QMouseEvent *event)
int d = abs(dx) > abs(dy) ? dx : dy;
lookZoom -= float(d) * lookZoom * 0.05;
- lookZoom = fmaxf( lookZoom, 0.01f );
- lookZoom = fminf( lookZoom, 50.0f );
+ lookZoom = std::max<float>( lookZoom, 0.01f );
+ lookZoom = std::min<float>( lookZoom, 50.0f );
}
View
@@ -142,12 +142,12 @@ bool SimpleModel::dataPass( FILE* file, std::vector<float3>& vertices, std::vect
if( line[0] == 'v' && line[1] == ' ' ) {
float3 data;
if( sscanf(line, "v %f %f %f", &data.x, &data.y, &data.z) == 3 ) {
- maxX = std::max( maxX, data.x );
- minX = std::min( minX, data.x );
- maxY = std::max( maxY, data.y );
- minY = std::min( minY, data.y );
- maxZ = std::max( maxZ, data.z );
- minZ = std::min( minZ, data.z );
+ maxX = std::max<float>( maxX, data.x );
+ minX = std::min<float>( minX, data.x );
+ maxY = std::max<float>( maxY, data.y );
+ minY = std::min<float>( minY, data.y );
+ maxZ = std::max<float>( maxZ, data.z );
+ minZ = std::min<float>( minZ, data.z );
vertices.push_back( data );
}
}
View
@@ -55,7 +55,7 @@ SOURCES = \
QT += opengl
-DEFINES += GLEW_STATIC
+DEFINES += PTEX_STATIC NOMINMAX
macx {
INCLUDEPATH += /usr/X11/include
@@ -88,6 +88,7 @@ INSTALLS = target brdfs data images probes shaderTemplates pkgconfig
# Windows cross compile at disney
linux-mingw32-custom{
+ DEFINES += GLEW_STATIC
WINDOWS_BUILD=/jobs2/soft/users/aselle/windows-build
INCLUDEPATH += $$WINDOWS_BUILD/glew-1.9.0/include/
INCLUDEPATH += $$WINDOWS_BUILD/glut-3.7.6-bin/
View
@@ -56,6 +56,7 @@ infringement.
#ifdef WIN32
#include <windows.h>
#include <fcntl.h>
+#include <io.h>
#endif
#define BRDF_VERSION "1.0.0"
View
@@ -41,9 +41,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
@brief Half-precision floating-point type.
*/
-// this is extracted from library, so it should be static always
-#define PTEX_STATIC
-
#ifndef PTEXAPI
# if defined(_WIN32) || defined(_WINDOWS) || defined(_MSC_VER)
# ifndef PTEX_STATIC
View
@@ -41,8 +41,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
@brief Public API classes for reading, writing, caching, and filtering Ptex files.
*/
-// ptex is static because we aren't building a library
-#define PTEX_STATIC
#if defined(_WIN32) || defined(_WINDOWS) || defined(_MSC_VER)
# ifndef PTEXAPI
# ifndef PTEX_STATIC
View
@@ -50,13 +50,13 @@ infringement.
// trim from start
static inline std::string &trimFromLeft(std::string &s) {
- s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
+ s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(::isspace))));
return s;
}
// trim from end
static inline std::string &trimFromRight(std::string &s) {
- s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
+ s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(::isspace))).base(), s.end());
return s;
}

0 comments on commit 394c222

Please sign in to comment.