This commit is contained in:
Alexander Deynichenko
2013-02-25 07:23:44 +04:00
parent 35ff18a6a1
commit 03b62f3315
809 changed files with 211135 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
if BUILD_SSG
noinst_PROGRAMS = load save
load_SOURCES = load.cxx
save_SOURCES = save.cxx
load_LDADD = -lplibssg -lplibsg -lplibul $(GLUT_LIBS) $(OGL_LIBS)
save_LDADD = -lplibssg -lplibsg -lplibul $(GLUT_LIBS) $(OGL_LIBS)
endif
EXTRA_DIST = load.dsp save.dsp

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -0,0 +1,81 @@
AC3Db
MATERIAL "" rgb 1 1 1 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0
MATERIAL "" rgb 1 1 1 amb 0.2 0.2 0.2 emis 1 1 1 spec 0.502 0.502 0.502 shi 0 trans 0
OBJECT world
kids 2
OBJECT poly
name "box"
texture "wood.rgb"
texrep 5 5
numvert 8
-1.29615 -0.6 -1.29615
-1 0 -1
1 0 -1
1.3 -0.6 -1.29615
-1.29615 -0.6 1.3
-1 0 1
1 0 1
1.3 -0.6 1.3
numsurf 6
SURF 0x0
mat 0
refs 4
0 0 0
1 0.114074 0.114074
2 0.884445 0.114074
3 1 0
SURF 0x0
mat 0
refs 4
6 0.884445 0.884445
7 1 1
3 1 0
2 0.884445 0.114074
SURF 0x0
mat 0
refs 4
7 1 1
6 0.884445 0.884445
5 0.114074 0.884445
4 0 1
SURF 0x0
mat 0
refs 4
4 0 1
5 0.114074 0.884445
1 0.114074 0.114074
0 0 0
SURF 0x0
mat 0
refs 4
1 0.114074 0.114074
5 0.114074 0.884445
6 0.884445 0.884445
2 0.884445 0.114074
SURF 0x0
mat 0
refs 4
4 0 1
0 0 0
3 1 0
7 1 1
kids 0
OBJECT poly
name "rect"
loc -0.0500002 0 -2.5
texture "embossed_herring.bmp"
texrep 20 30
numvert 4
-17.95 -0.7 -18.6
17.95 -0.7 -18.6
17.95 -0.7 18.6
-17.95 -0.7 18.6
numsurf 1
SURF 0x0
mat 1
refs 4
3 0 0
2 1 0
1 1 1
0 0 1
kids 0

View File

@@ -0,0 +1,81 @@
AC3Db
MATERIAL "" rgb 1 1 1 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0
MATERIAL "" rgb 1 1 1 amb 0.2 0.2 0.2 emis 1 1 1 spec 0.502 0.502 0.502 shi 0 trans 0
OBJECT world
kids 2
OBJECT poly
name "box"
texture "wood.rgb"
texrep 5 5
numvert 8
-1.29615 -0.6 -1.29615
-1 0 -1
1 0 -1
1.3 -0.6 -1.29615
-1.29615 -0.6 1.3
-1 0 1
1 0 1
1.3 -0.6 1.3
numsurf 6
SURF 0x0
mat 0
refs 4
0 0 0
1 0.114074 0.114074
2 0.884445 0.114074
3 1 0
SURF 0x0
mat 0
refs 4
6 0.884445 0.884445
7 1 1
3 1 0
2 0.884445 0.114074
SURF 0x0
mat 0
refs 4
7 1 1
6 0.884445 0.884445
5 0.114074 0.884445
4 0 1
SURF 0x0
mat 0
refs 4
4 0 1
5 0.114074 0.884445
1 0.114074 0.114074
0 0 0
SURF 0x0
mat 0
refs 4
1 0.114074 0.114074
5 0.114074 0.884445
6 0.884445 0.884445
2 0.884445 0.114074
SURF 0x0
mat 0
refs 4
4 0 1
0 0 0
3 1 0
7 1 1
kids 0
OBJECT poly
name "rect"
loc -0.0500002 0 -2.5
texture "embossed_herring.rgb"
texrep 20 30
numvert 4
-17.95 -0.7 -18.6
17.95 -0.7 -18.6
17.95 -0.7 18.6
-17.95 -0.7 18.6
numsurf 1
SURF 0x0
mat 1
refs 4
3 0 0
2 1 0
1 1 1
0 0 1
kids 0

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -0,0 +1,234 @@
/*
PLIB - A Suite of Portable Game Libraries
Copyright (C) 2001 Steve Baker
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id: load.cxx 2099 2006-11-03 20:04:40Z fayjf $
*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#ifdef WIN32
# include <windows.h>
#else
# include <unistd.h>
#endif
#include <math.h>
#include <plib/ssg.h>
#ifdef FREEGLUT_IS_PRESENT
# include <GL/freeglut.h>
#else
# ifdef __APPLE__
# include <GLUT/glut.h>
# else
# include <GL/glut.h>
# endif
#endif
static ssgRoot *scene = NULL ;
static ssgTransform *penguin = NULL ;
static ssgTransform *pedestal = NULL ;
/*
Something to make some interesting motion
for both Tux and the camera.
*/
static void update_motion ()
{
static int frameno = 0 ;
frameno++ ;
sgCoord campos ;
sgCoord tuxpos ;
/*
Spin Tux, make the camera pan sinusoidally left and right
*/
sgSetCoord ( & campos, 0.0f, -5.0f, 1.0f, 25.0f * (float)sin(frameno/100.0), 0.0f, 0.0f ) ;
sgSetCoord ( & tuxpos, 0.0f, 0.0f, 0.0f, (float)frameno, 0.0f, 0.0f ) ;
ssgSetCamera ( & campos ) ;
penguin -> setTransform ( & tuxpos ) ;
}
/*
The GLUT window reshape event
*/
static void reshape ( int w, int h )
{
glViewport ( 0, 0, w, h ) ;
}
/*
The GLUT keyboard event
*/
static void keyboard ( unsigned char, int, int )
{
exit ( 0 ) ;
}
/*
The GLUT redraw event
*/
static void redraw ()
{
update_motion () ;
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;
ssgCullAndDraw ( scene ) ;
glutPostRedisplay () ;
glutSwapBuffers () ;
}
static void init_graphics ()
{
int fake_argc = 1 ;
char *fake_argv[3] ;
fake_argv[0] = "ssgExample" ;
fake_argv[1] = "Simple Scene Graph : Example Program." ;
fake_argv[2] = NULL ;
/*
Initialise GLUT
*/
glutInitWindowPosition ( 0, 0 ) ;
glutInitWindowSize ( 640, 480 ) ;
glutInit ( &fake_argc, fake_argv ) ;
glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ) ;
glutCreateWindow ( fake_argv[1] ) ;
glutDisplayFunc ( redraw ) ;
glutReshapeFunc ( reshape ) ;
glutKeyboardFunc ( keyboard ) ;
/*
Initialise SSG
*/
ssgInit () ;
/*
Some basic OpenGL setup
*/
glClearColor ( 0.2f, 0.7f, 1.0f, 1.0f ) ;
glEnable ( GL_DEPTH_TEST ) ;
/*
Set up the viewing parameters
*/
ssgSetFOV ( 60.0f, 0.0f ) ;
ssgSetNearFar ( 1.0f, 700.0f ) ;
/*
Set up the Sun.
*/
sgVec3 sunposn ;
sgSetVec3 ( sunposn, 0.2f, -0.5f, 0.5f ) ;
ssgGetLight ( 0 ) -> setPosition ( sunposn ) ;
}
/*
Load a simple database
*/
static void load_database ()
{
/*
Set up the path to the data files
*/
ssgModelPath ( "data" ) ;
ssgTexturePath ( "data" ) ;
/*
Create a root node - and a transform to position
the pedestal - and another to position the penguin
beneath that (in the tree that is).
*/
scene = new ssgRoot ;
pedestal = new ssgTransform ;
penguin = new ssgTransform ;
/*
Load the models - optimise them a bit
and then add them into the scene.
*/
ssgEntity *ped_obj = ssgLoadAC ( "pedestal.ac" ) ;
ssgEntity *tux_obj = ssgLoadSSG ( "tuxedo.ssg" ) ;
if ( ped_obj == NULL )
ulSetError ( UL_FATAL, "Cannot load pedastal.ac" ) ;
if ( tux_obj == NULL )
ulSetError ( UL_FATAL, "Cannot load tuxedo.ssg -- Please run 'save' first" ) ;
tux_obj->print();
penguin -> addKid ( tux_obj ) ;
pedestal -> addKid ( ped_obj ) ;
/*ssgFlatten ( tux_obj ) ;*/
ssgFlatten ( ped_obj ) ;
/*ssgStripify ( penguin ) ;*/
ssgStripify ( pedestal ) ;
pedestal -> addKid ( penguin ) ;
scene -> addKid ( pedestal ) ;
}
/*
The works.
*/
int main ( int, char ** )
{
init_graphics () ;
load_database () ;
glutMainLoop () ;
return 0 ;
}

View File

@@ -0,0 +1,88 @@
# Microsoft Developer Studio Project File - Name="load" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=load - 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 "load.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 "load.mak" CFG="load - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "load - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "load - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "load - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ssg.lib sg.lib ul.lib opengl32.lib glu32.lib glut32.lib /nologo /subsystem:console /machine:I386 /out:"load.exe" /libpath:"..\..\..\..\..\plib"
!ELSEIF "$(CFG)" == "load - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ssg_d.lib sg_d.lib ul_d.lib opengl32.lib glu32.lib glut32.lib /nologo /subsystem:console /debug /machine:I386 /out:"load.exe" /pdbtype:sept /libpath:"..\..\..\..\..\plib"
!ENDIF
# Begin Target
# Name "load - Win32 Release"
# Name "load - Win32 Debug"
# Begin Source File
SOURCE=.\load.cxx
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,131 @@
/*
PLIB - A Suite of Portable Game Libraries
Copyright (C) 2001 Steve Baker
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id: save.cxx 1551 2002-09-01 12:04:53Z ude $
*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#ifdef WIN32
# include <windows.h>
#else
# include <unistd.h>
#endif
#include <math.h>
#include <plib/ssg.h>
#ifdef FREEGLUT_IS_PRESENT
# include <GL/freeglut.h>
#else
# ifdef __APPLE__
# include <GLUT/glut.h>
# else
# include <GL/glut.h>
# endif
#endif
static ssgRoot *scene = NULL ;
static ssgTransform *object = NULL ;
static ssgEntity *obj_obj = NULL ;
static void redraw ()
{
return ;
}
static void init_graphics ()
{
int fake_argc = 1 ;
char *fake_argv[3] ;
fake_argv[0] = "ssgExample" ;
fake_argv[1] = "Simple Scene Graph : Example Program." ;
fake_argv[2] = NULL ;
/*
Initialise GLUT
*/
glutInitWindowPosition ( 0, 0 ) ;
glutInitWindowSize ( 640, 480 ) ;
glutInit ( &fake_argc, fake_argv ) ;
glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ) ;
glutCreateWindow ( fake_argv[1] ) ;
glutDisplayFunc ( redraw ) ;
/*
Initialise SSG
*/
ssgInit () ;
}
static void load_database ()
{
/*
Set up the path to the data files
*/
ssgModelPath ( "data" ) ;
ssgTexturePath ( "data" ) ;
/*
Create a root node - and a transform to position
the object beneath that (in the tree that is).
*/
scene = new ssgRoot ;
object = new ssgTransform ;
/*
Load the models - optimise them a bit
and then add them into the scene.
*/
obj_obj = ssgLoadAC ( "tuxedo.ac" ) ;
object -> addKid ( obj_obj ) ;
ssgFlatten ( obj_obj ) ;
ssgStripify ( object ) ;
scene -> addKid ( object ) ;
}
static void save_database ()
{
ssgSaveSSG ( "data/tuxedo.ssg", object ) ;
}
int main ( int, char ** )
{
init_graphics () ;
load_database () ;
save_database () ;
return 0 ;
}

View File

@@ -0,0 +1,88 @@
# Microsoft Developer Studio Project File - Name="save" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=save - 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 "save.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 "save.mak" CFG="save - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "save - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "save - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "save - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ssg.lib sg.lib ul.lib opengl32.lib glu32.lib glut32.lib /nologo /subsystem:console /machine:I386 /out:"save.exe" /libpath:"..\..\..\..\..\plib"
!ELSEIF "$(CFG)" == "save - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ssg_d.lib sg_d.lib ul_d.lib opengl32.lib glu32.lib glut32.lib /nologo /subsystem:console /debug /machine:I386 /out:"save.exe" /pdbtype:sept /libpath:"..\..\..\..\..\plib"
!ENDIF
# Begin Target
# Name "save - Win32 Release"
# Name "save - Win32 Debug"
# Begin Source File
SOURCE=.\save.cxx
# End Source File
# End Target
# End Project