Update of /cvsroot/plib/plib/src/ssg
In directory usw-pr-cvs1:/tmp/cvs-serv20968/plib/src/ssg
Modified Files:
ssg.h ssgContext.cxx ssgTween.cxx ssgVTable.cxx
ssgVtxTable.cxx
Log Message:
Added ability to override current rendering state.
Index: ssg.h
===================================================================
RCS file: /cvsroot/plib/plib/src/ssg/ssg.h,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -d -r1.156 -r1.157
--- ssg.h 8 Nov 2002 18:35:07 -0000 1.156
+++ ssg.h 10 Nov 2002 17:12:13 -0000 1.157
@@ -2271,10 +2271,11 @@
ssgSimpleState *basicState ;
sgFrustum *frustum ;
- sgMat4 cameraMatrix ;
- int cullFace ;
- int ovTexture ;
- int ovCullface ;
+ sgMat4 cameraMatrix ;
+ int cullFace ;
+ int ovTexture ;
+ int ovCullface ;
+ ssgState *ovState ;
public:
@@ -2311,6 +2312,7 @@
return ((i<0)||(i>=6)) ? NULL : clipPlane [i] ;
}
+ void overrideState ( ssgState *s ) ;
void overrideTexture ( int on_off ) ;
void overrideCullface ( int on_off ) ;
@@ -2325,6 +2327,8 @@
else glDisable ( GL_CULL_FACE ) ;
}
+ ssgState *overriddenState () { return ovState ; }
+ int stateOverridden () { return ovState != NULL ; }
int textureOverridden () { return ovTexture ; }
int cullfaceOverridden () { return ovCullface ; }
int cullfaceIsEnabled () { return cullFace ; }
@@ -2379,6 +2383,11 @@
inline void ssgGetCameraPosition ( sgVec3 pos )
{
_ssgCurrentContext -> getCameraPosition ( pos ) ;
+}
+
+inline void ssgOverrideState ( ssgState *s )
+{
+ _ssgCurrentContext->overrideState ( s ) ;
}
inline void ssgOverrideTexture ( int on_off )
Index: ssgContext.cxx
===================================================================
RCS file: /cvsroot/plib/plib/src/ssg/ssgContext.cxx,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- ssgContext.cxx 28 Oct 2002 09:31:51 -0000 1.18
+++ ssgContext.cxx 10 Nov 2002 17:12:13 -0000 1.19
@@ -96,7 +96,11 @@
glEnable ( GL_CULL_FACE ) ;
cullFace = TRUE ;
- basicState -> force () ;
+
+ if ( ovState != NULL )
+ ovState -> force () ;
+ else
+ basicState -> force () ;
}
@@ -108,6 +112,11 @@
void ssgContext::getCameraPosition ( sgVec3 pos )
{
sgCopyVec3 ( pos, cameraMatrix [ 3 ] ) ;
+}
+
+void ssgContext::overrideState ( ssgState *s )
+{
+ ovState = s ;
}
void ssgContext::overrideTexture ( int on_off )
Index: ssgTween.cxx
===================================================================
RCS file: /cvsroot/plib/plib/src/ssg/ssgTween.cxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- ssgTween.cxx 4 Nov 2002 05:11:22 -0000 1.10
+++ ssgTween.cxx 10 Nov 2002 17:12:13 -0000 1.11
@@ -254,7 +254,11 @@
if ( ! preDraw () )
return ;
- if ( hasState () ) getState () -> apply () ;
+ if ( _ssgCurrentContext-> stateOverridden () )
+ _ssgCurrentContext -> overriddenState () -> apply () ;
+ else
+ if ( hasState () )
+ getState () -> apply () ;
stats_num_leaves++ ;
stats_num_vertices += getNumVertices() ;
Index: ssgVTable.cxx
===================================================================
RCS file: /cvsroot/plib/plib/src/ssg/ssgVTable.cxx,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- ssgVTable.cxx 2 Sep 2002 06:05:49 -0000 1.16
+++ ssgVTable.cxx 10 Nov 2002 17:12:13 -0000 1.17
@@ -289,7 +289,11 @@
if ( ! preDraw () )
return ;
- if ( hasState () ) getState () -> apply () ;
+ if ( _ssgCurrentContext-> stateOverridden () )
+ _ssgCurrentContext -> overriddenState () -> apply () ;
+ else
+ if ( hasState () )
+ getState () -> apply () ;
stats_num_leaves++ ;
stats_num_vertices += num_vertices ;
Index: ssgVtxTable.cxx
===================================================================
RCS file: /cvsroot/plib/plib/src/ssg/ssgVtxTable.cxx,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- ssgVtxTable.cxx 2 Sep 2002 06:05:49 -0000 1.30
+++ ssgVtxTable.cxx 10 Nov 2002 17:12:13 -0000 1.31
@@ -439,7 +439,11 @@
if ( ! preDraw () )
return ;
- if ( hasState () ) getState () -> apply () ;
+ if ( _ssgCurrentContext-> stateOverridden () )
+ _ssgCurrentContext -> overriddenState () -> apply () ;
+ else
+ if ( hasState () )
+ getState () -> apply () ;
stats_num_leaves++ ;
stats_num_vertices += getNumVertices() ;
|