G3d-cpp is an ideal (IMHO) library for working with when constructing 3d testbeds or demos: it doesn't aim to be an over-arching SDK that handles every last detail of OS/Game interaction (it delegates most of those tasks to the SDL), and it uses C++ very effectively in abstracting the render device, windows, geometry and all the things you normally have to deal with in finicky detail in C. If I have to deal with Bjarnes monster, this is the arena I'd chose to fight in :)
Here is the SConstruct. At present I'm supporting release build only: and my architecture optimisation flags are set for up an AMD64 and the resulting binary may not be happy on anything less than a P4/SSE2 capable - chip. It also assumes we are linking with a version of SDL & zlib built by the scripts in the two blog entries below.
#
# Sconstruct file for G3D
#
import sys
#
# microsoft tool kit environment
#
env = Environment(tools = [ 'mstoolkit' ])
env['CPPPATH'] = [ "#\\include\\", "#\\include\\G3D", "#\\include\\GLG3D", "#\\include\\glh", "#\\include\\zlib", "..\\SDL-1.2.7\\include" ]
env['LIBPATH'] = [ "#\\win32-lib", "..\\SDL-1.2.7", '..\\zlib' ]
env['LIBS'] = [ "kernel32.lib", "user32.lib", "gdi32.lib", "winspool.lib", "comdlg32.lib", "advapi32.lib", "shell32.lib", "ole32.lib", "oleaut32.lib", "uuid.lib", "winmm.lib", "opengl32.lib", "glu32.lib", "ddraw.lib", "dinput.lib", "dxguid.lib", "zlib.lib", "version.lib" ]
#if project_config == 'debug':
# env['LIBS'] = env['LIBS'] + [ "SDLd.lib", "SDLmaind.lib" ]
# program_name = [ "#\\demos\\GLG3D_DemoD.exe" ]
# library_name = [ "#\\win32-lib\GLG3D-debug.lib" ]
# graphics_library_name = [ "#\\win32-lib\G3D-debug.lib" ]
# env['CPPDEFINES'] = [ '_DEBUG', 'WIN32', '_WINDOWS', 'ENABLE_WINDIB', 'ENABLE_DIRECTX', '_WIN32_WINNT=0x0400', '_LIB' ]
# env['CCFLAGS'] = [ '/nologo', '/W3', '/Zi', '/Od', '/MTd' ]
# env['LINKFLAGS'] = [ '/subsystem:windows', '/machine:x86' ]
#if project_config == 'release':
# env['LIBS'] = env['LIBS'] + [ 'SDL.lib', 'SDLmain.lib' ] # [ "G3D", "GLG3D", "SDL.lib", "SDLmain.lib" ]
program_name = [ "#\demos\\GLG3D_Demo.exe" ]
library_name = [ "#\\win32-lib\GLG3D.lib" ]
graphics_library_name = [ "#\\win32-lib\G3D.lib" ]
jpeg_library_name = [ "#\\win32-lib\libjpeg.lib" ]
env['CPPDEFINES'] = [ 'NDEBUG', 'WIN32', '_WINDOWS', 'ENABLE_WINDIB', 'ENABLE_DIRECTX', '_WIN32_WINNT=0x0400' ]
env['CCFLAGS'] = [ '/nologo', '/W3', '/GF', '/G7', '/Ox', '/arch:SSE2', '/Gy', '/EHsc', '/MT' ]
env['LINKFLAGS'] = [ '/subsystem:windows', '/machine:x86' ]
#
# library
#
env.StaticLibrary( library_name, [
r".\GLG3Dcpp\Draw.cpp",
r".\GLG3Dcpp\edgeFeatures.cpp",
r".\GLG3Dcpp\G3DGameUnits.cpp",
r".\GLG3Dcpp\GApp.cpp",
r".\GLG3Dcpp\getOpenGLState.cpp",
r".\GLG3Dcpp\GFont.cpp",
r".\GLG3Dcpp\glcalls.cpp",
r".\GLG3Dcpp\GLCaps.cpp",
r".\GLG3Dcpp\glenumtostring.cpp",
r".\GLG3Dcpp\GPUProgram.cpp",
r".\GLG3Dcpp\IFSModel.cpp",
r".\GLG3Dcpp\LightingParameters.cpp",
r".\GLG3Dcpp\ManualCameraController.cpp",
r".\GLG3Dcpp\MD2Model.cpp",
r".\GLG3Dcpp\MD2Model_load.cpp",
r".\GLG3Dcpp\Milestone.cpp",
r".\GLG3Dcpp\PixelProgram.cpp",
r".\GLG3Dcpp\PosedModel.cpp",
r".\GLG3Dcpp\RenderDevice.cpp",
r".\GLG3Dcpp\SDLWindow.cpp",
r".\GLG3Dcpp\Shader.cpp",
r".\GLG3Dcpp\shadowVolume.cpp",
r".\GLG3Dcpp\Sky.cpp",
r".\GLG3Dcpp\tesselate.cpp",
r".\GLG3Dcpp\Texture.cpp",
r".\GLG3Dcpp\TextureFormat.cpp",
r".\GLG3Dcpp\TextureManager.cpp",
r".\GLG3Dcpp\UserInput.cpp",
r".\GLG3Dcpp\VAR.cpp",
r".\GLG3Dcpp\VARSystem.cpp"
])
env.StaticLibrary( graphics_library_name, [
r".\G3Dcpp\AABox.cpp",
r".\G3Dcpp\BinaryInput.cpp",
r".\G3Dcpp\BinaryOutput.cpp",
r".\G3Dcpp\Box.cpp",
r".\G3Dcpp\Capsule.cpp",
r".\G3Dcpp\CollisionDetection.cpp",
r".\G3Dcpp\Color3.cpp",
r".\G3Dcpp\Color3uint8.cpp",
r".\G3Dcpp\Color4.cpp",
r".\G3Dcpp\Color4uint8.cpp",
r".\G3Dcpp\Cone.cpp",
r".\G3Dcpp\ConvexPolyhedron.cpp",
r".\G3Dcpp\CoordinateFrame.cpp",
r".\G3Dcpp\debugAssert.cpp",
r".\G3Dcpp\Discovery.cpp",
r".\G3Dcpp\fileutils.cpp",
r".\G3Dcpp\format.cpp",
r".\G3Dcpp\g3derror.cpp",
r".\G3Dcpp\g3dmath.cpp",
r".\G3Dcpp\GCamera.cpp",
r".\G3Dcpp\GImage.cpp",
r".\G3Dcpp\GLight.cpp",
r".\G3Dcpp\license.cpp",
r".\G3Dcpp\Line.cpp",
r".\G3Dcpp\LineSegment.cpp",
r".\G3Dcpp\Log.cpp",
r".\G3Dcpp\Matrix3.cpp",
r".\G3Dcpp\Matrix4.cpp",
r".\G3Dcpp\MeshAlg.cpp",
r".\G3Dcpp\MeshAlgAdjacency.cpp",
r".\G3Dcpp\MeshAlgWeld.cpp",
r".\G3Dcpp\NetworkDevice.cpp",
r".\G3Dcpp\PhysicsFrame.cpp",
r".\G3Dcpp\Plane.cpp",
r".\G3Dcpp\prompt.cpp",
r".\G3Dcpp\Quat.cpp",
r".\G3Dcpp\Ray.cpp",
r".\G3Dcpp\Sphere.cpp",
r".\G3Dcpp\stringutils.cpp",
r".\G3Dcpp\System.cpp",
r".\G3Dcpp\TextInput.cpp",
r".\G3Dcpp\TextOutput.cpp",
r".\G3Dcpp\Triangle.cpp",
r".\G3Dcpp\Vector2.cpp",
r".\G3Dcpp\Vector2int16.cpp",
r".\G3Dcpp\Vector3.cpp",
r".\G3Dcpp\Vector3int16.cpp",
r".\G3Dcpp\Vector4.cpp"
])
env.StaticLibrary(jpeg_library_name,
[
r".\IJG\jcapimin.c",
r".\IJG\jcapistd.c",
r".\IJG\jccoefct.c",
r".\IJG\jccolor.c",
r".\IJG\jcdctmgr.c",
r".\IJG\jchuff.c",
r".\IJG\jcinit.c",
r".\IJG\jcmainct.c",
r".\IJG\jcmarker.c",
r".\IJG\jcmaster.c",
r".\IJG\jcomapi.c",
r".\IJG\jcparam.c",
r".\IJG\jcphuff.c",
r".\IJG\jcprepct.c",
r".\IJG\jcsample.c",
r".\IJG\jctrans.c",
r".\IJG\jdapimin.c",
r".\IJG\jdapistd.c",
r".\IJG\jdatadst.c",
r".\IJG\jdatasrc.c",
r".\IJG\jdcoefct.c",
r".\IJG\jdcolor.c",
r".\IJG\jddctmgr.c",
r".\IJG\jdhuff.c",
r".\IJG\jdinput.c",
r".\IJG\jdmainct.c",
r".\IJG\jdmarker.c",
r".\IJG\jdmaster.c",
r".\IJG\jdmerge.c",
r".\IJG\jdphuff.c",
r".\IJG\jdpostct.c",
r".\IJG\jdsample.c",
r".\IJG\jdtrans.c",
r".\IJG\jerror.c",
r".\IJG\jfdctflt.c",
r".\IJG\jfdctfst.c",
r".\IJG\jfdctint.c",
r".\IJG\jidctflt.c",
r".\IJG\jidctfst.c",
r".\IJG\jidctint.c",
r".\IJG\jidctred.c",
r".\IJG\jmemansi.c",
r".\IJG\jmemmgr.c",
r".\IJG\jquant1.c",
r".\IJG\jquant2.c",
r".\IJG\jutils.c"
])
env['LIBS'] = env['LIBS'] + [ "GLG3D.lib", "G3D.lib", "libjpeg.lib", "SDL.lib", "SDL_main.lib" ]
# demos
env.Program( program_name, [ r'#\demos\GLG3D_Demo\main.cpp' ] )
No comments:
Post a Comment