1 
2 /*
3      PLIB - A Suite of Portable Game Libraries
4      Copyright (C) 1998,2002  Steve Baker
5 
6      This library is free software; you can redistribute it and/or
7      modify it under the terms of the GNU Library General Public
8      License as published by the Free Software Foundation; either
9      version 2 of the License, or (at your option) any later version.
10 
11      This library is distributed in the hope that it will be useful,
12      but WITHOUT ANY WARRANTY; without even the implied warranty of
13      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14      Library General Public License for more details.
15 
16      You should have received a copy of the GNU Library General Public
17      License along with this library; if not, write to the Free Software
18      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 
20      For further information visit http://plib.sourceforge.net
21 
22      $Id: ssgTweenController.cxx 1996 2004-12-29 07:19:40Z sjbaker $
23 */
24 
25 
26 #include "ssgLocal.h"
27 
getTypeName(void)28 const char *ssgTweenController::getTypeName (void) { return "ssgTweenController" ; }
29 
copy_from(ssgTweenController * src,int clone_flags)30 void ssgTweenController::copy_from ( ssgTweenController *src, int clone_flags )
31 {
32   selectBank ( src->getCurrBank () ) ;
33   ssgBranch::copy_from ( src, clone_flags ) ;
34 }
35 
clone(int clone_flags)36 ssgBase *ssgTweenController::clone ( int clone_flags )
37 {
38   ssgTweenController *b = new ssgTweenController ;
39   b -> copy_from ( this, clone_flags ) ;
40   return b ;
41 }
42 
43 
44 
ssgTweenController(void)45 ssgTweenController::ssgTweenController (void)
46 {
47   type = ssgTypeTweenController () ;
48   curr_bank = 0.0f ;
49 }
50 
51 
~ssgTweenController(void)52 ssgTweenController::~ssgTweenController (void)
53 {
54   removeAllKids () ;
55 }
56 
57 
cull(sgFrustum * f,sgMat4 m,int test_needed)58 void ssgTweenController::cull ( sgFrustum *f, sgMat4 m, int test_needed )
59 {
60   float old_state = _ssgGetCurrentTweenState () ;
61   int   old_mode  = _ssgGetCurrentTweenMode  () ;
62 
63   _ssgSetCurrentTweenSettings ( curr_bank, mode ) ;
64 
65   ssgBranch::cull ( f, m, test_needed ) ;
66 
67   _ssgSetCurrentTweenSettings ( old_state, old_mode ) ;
68 }
69 
70 
71 
load(FILE * fd)72 int ssgTweenController::load ( FILE *fd )
73 {
74   _ssgReadFloat ( fd, & curr_bank ) ;
75 
76   return ssgBranch::load ( fd ) ;
77 }
78 
79 
save(FILE * fd)80 int ssgTweenController::save ( FILE *fd )
81 {
82   _ssgWriteFloat ( fd, curr_bank ) ;
83   return ssgBranch::save ( fd ) ;
84 }
85 
86 
87 
print(FILE * fd,char * indent,int how_much)88 void ssgTweenController::print ( FILE *fd, char *indent, int how_much )
89 {
90   if ( how_much == 0 )
91     return ;
92 
93   fprintf ( fd, "%sCurrent Bank = %f\n", indent, curr_bank );
94 
95   ssgBranch::print ( fd, indent, how_much ) ;
96 }
97 
98 
99