[Plib-cvs] plib/examples/src/ssg/viewer pview.dsp,NONE,1.1 pview.cxx,1.1,1.2
Brought to you by:
sjbaker
From: John F. F. <fa...@us...> - 2005-09-30 18:25:48
|
Update of /cvsroot/plib/plib/examples/src/ssg/viewer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26047 Modified Files: pview.cxx Added Files: pview.dsp Log Message: Implementing \"pview\" in the MSVC examples --- NEW FILE: pview.dsp --- # Microsoft Developer Studio Project File - Name="pview" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=pview - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "pview.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "pview.mak" CFG="pview - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE [...63 lines suppressed...] # Name "pview - Win32 Release" # Name "pview - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\pview.cxx # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # End Target # End Project Index: pview.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/viewer/pview.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pview.cxx 21 Aug 2005 08:47:14 -0000 1.1 +++ pview.cxx 30 Sep 2005 18:14:09 -0000 1.2 @@ -34,6 +34,10 @@ #include <plib/ssg.h> +#ifndef M_PI +#define M_PI 3.14159265358979323846264338327950f +#endif + static float aspectratio=1.0; static int winw, winh; static ssgRoot *scene=0; @@ -91,14 +95,14 @@ if (prevbutton==1) { float curdist = sgLengthVec3(camtrf[3]); - sgAddScaledVec3(camtrf[3], camtrf[2], dy*curdist/200.0); - sgAddScaledVec3(camtrf[3], camtrf[0], -dx*curdist/200.0); + sgAddScaledVec3(camtrf[3], camtrf[2], dy*curdist/200.0f); + sgAddScaledVec3(camtrf[3], camtrf[0], -dx*curdist/200.0f); return; } if (prevbutton==2) { float curdist = sgLengthVec3(camtrf[3]); - sgAddScaledVec3(camtrf[3], camtrf[1], -dy*curdist/80.0); + sgAddScaledVec3(camtrf[3], camtrf[1], -dy*curdist/80.0f); return; } } @@ -110,10 +114,10 @@ aspectratio = w / (float) h; winw=w; winh=h; - float fovy = 60.0 * M_PI / 180.0; - float nearPlaneDistance = 0.4; + float fovy = 60.0f * M_PI / 180.0f; + float nearPlaneDistance = 0.4f; float farPlaneDistance = 2500.0; - float y = tan(0.5 * fovy) * nearPlaneDistance; + float y = (float)tan(0.5 * fovy) * nearPlaneDistance; float x = aspectratio * y; context->setFrustum(-x,x,-y,y,nearPlaneDistance,farPlaneDistance); } @@ -148,12 +152,12 @@ ssgInit(); - glClearColor(0.3,0.3,0.55,1); + glClearColor(0.3f,0.3f,0.55f,1.0f); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); scene = new ssgRoot(); - float amb[4]={0.2, 0.2, 0.2, 1}; + float amb[4]={0.2f, 0.2f, 0.2f, 1.0f}; glLightModelfv(GL_LIGHT_MODEL_AMBIENT, amb); ssgTransform *trf = new ssgTransform(); @@ -171,7 +175,7 @@ trf->setTransform(off); SGfloat radius = scene->getBSphere()->getRadius(); - float d = 1.8*radius; + float d = 1.8f*radius; if (d<0.5) d=0.5; // avoid placing near-plane beyond model sgMakeTransMat4(camtrf, 0, -d, 0); @@ -181,5 +185,7 @@ light->on(); glutMainLoop(); + + return 0; } |