Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages | Examples

3DPublish/3DPublish.cpp

This sample program demonstates uuid generation with the DWFCore::DWFUUID class and was used as a smoke test for algorithm implementation and duplicate detection.

Also shown in the sample:

ÿþ/ /   S i m p l e E n u m R e a d e r . c p p   :   D e f i n e s   t h e   e n t r y   p o i n t   f o r   t h e   c o n s o l e   a p p l i c a t i o n . 
 
 / / 
 
 
 
 # i n c l u d e   " s t d a f x . h " 
 
 
 
 u s i n g   n a m e s p a c e   s t d ; 
 
 u s i n g   n a m e s p a c e   D W F C o r e ; 
 
 u s i n g   n a m e s p a c e   D W F T o o l k i t ; 
 
 
 
 
 
 / / 
 
 / / 
 
 / /   S o m e   o f   t h i s   s a m p l e   c o d e   i s   t a k e n   f r o m   t h e   H O O P S / S t r e a m   t o o l k i t   ( v . 1 0 . 0 0 )   s a m p l e s 
 
 / / 
 
 / / 
 
 
 
 
 
 v o i d   C r e a t e S p h e r e (   f l o a t   * c e n t e r ,   
 
                                       f l o a t   r a d i u s ,   
 
                                       i n t   n u m s i d e s ,   
 
                                       i n t   * p c o u n t _ o u t ,   
 
                                       f l o a t   * * p o i n t s _ o u t ,   
 
                                       i n t   * f l i s t l e n _ o u t ,   
 
                                       i n t   * * f a c e s _ o u t   ) ; 
 
 
 
 v o i d   d o _ m o d e l (   D W F M o d e l &   r M o d e l , 
 
                               b o o l   b I n c l u d e N o r m a l s   ) ; 
 
 
 
 
 
 
 
 i n t   m a i n ( i n t   a r g c ,   c h a r *   a r g v [ ] ) 
 
 { 
 
 
 
         i f   ( a r g c   <   2 ) 
 
         { 
 
                 w c o u t   < <   L " U s a g e : "   < <   a r g v [ 0 ]   < <   L "   f i l e . d w f "   < <   e n d l ; 
 
                 r e t u r n   (   0   ) ; 
 
         } 
 
 
 
         t r y 
 
         { 
 
                 / / 
 
                 / /   
 
                 / / 
 
                 D W F F i l e   o D W F (   a r g v [ 1 ]   ) ; 
 
                 D W F P a c k a g e P u b l i s h e r   o P u b l i s h e r (   o D W F   ) ; 
 
 
 
                 / / 
 
                 / /   s t a r t   w i t h   a   n e w   m o d e l 
 
                 / / 
 
                 D W F M o d e l   o M o d e l (   L " 3 D   P u b l i s h   M o d e l   T e s t " ,   L " 3 D P u b l i s h . c p p "   ) ; 
 
                 
 
                 o M o d e l . o p e n (   D W F M o d e l : : e H a n d e d n e s s N o n e , 
 
                                           D W F U n i t s : : e C e n t i m e t e r s , 
 
                                           N U L L ,                                             / /   t r a n s f o r m 
 
                                           t r u e ,                                             / /   d e f a u l t   l i g h t s 
 
                                           f a l s e ,                                           / /   p u b l i s h e d   e d g e s 
 
                                           t r u e   ) ;                                         / /   s i l h o u e t t e s 
 
 
 
 
 
                 W 3 D C a m e r a   o D e f a u l t ; 
 
                 o D e f a u l t . s e t P r o j e c t i o n (   W 3 D C a m e r a : : e O r t h o g r a p h i c   ) ; 
 
                 o D e f a u l t . s e t P o s i t i o n (   0 . 0 f ,   0 . 0 f ,   - 1 5 . 0 f   ) ; 
 
                 o D e f a u l t . s e t T a r g e t (   1 . 0 f ,   1 . 4 f ,   - 0 . 1 f   ) ; 
 
                 o D e f a u l t . s e t U p V e c t o r (   1 . 0 f ,   1 . 0 f   ,   0 . 1 f   ) ; 
 
                 o D e f a u l t . s e t F i e l d (   1 5 . 0 f ,   1 5 . 0 f   ) ; 
 
 
 
                 o M o d e l . c r e a t e V i e w (   " d e f a u l t " ,   o D e f a u l t   ) ; 
 
 
 
                 / / 
 
                 / /   c r e a t e   t h e   g r a p h i c s ,   e t c . 
 
                 / / 
 
                 d o _ m o d e l (   o M o d e l ,   t r u e   ) ; 
 
 
 
 
 
                 / / 
 
                 / /   a d d   s o m e   p r o p e r t i e s   t h a t   a p p l y   t o   t h e   m o d e l   a s   a   w h o l e 
 
                 / / 
 
                 o M o d e l . a d d P r o p e r t y (   D W F C O R E _ A L L O C _ O B J E C T ( D W F P r o p e r t y ( L " C u t t i n g   P l a n e " ,   L " H i d e " ,   L " V i e w   M o d i f i e r " ) ) ,   t r u e   ) ; 
 
                 o M o d e l . a d d P r o p e r t y (   D W F C O R E _ A L L O C _ O B J E C T ( D W F P r o p e r t y ( L " O r i g i n " ,   L " D W F T o o l k i t   S a m p l e   A p p l i c a t i o n s " ,   L " G e n e r a l " ) ) ,   t r u e   ) ; 
 
                 o M o d e l . a d d P r o p e r t y (   D W F C O R E _ A L L O C _ O B J E C T ( D W F P r o p e r t y ( L " P r o j e c t " ,   L " B i a n c h i " ,   L " G e n e r a l " ) ) ,   t r u e   ) ; 
 
 
 
                 / / 
 
                 / /   c l o s e   t h e   m o d e l 
 
                 / / 
 
                 o M o d e l . c l o s e ( ) ; 
 
 
 
                 / / 
 
                 / /   p u b l i s h   t h e   m o d e l   " i n t o "   t h e   p u b l i s h e r 
 
                 / / 
 
                 o M o d e l . p u b l i s h (   o P u b l i s h e r   ) ; 
 
 
 
                 / / 
 
                 / /   c r e a t e   t h e   D W F 
 
                 / / 
 
                 o P u b l i s h e r . p u b l i s h ( ) ; 
 
         } 
 
         c a t c h   ( D W F E x c e p t i o n &   e x ) 
 
         { 
 
                 w c o u t   < <   e x . t y p e ( )   < <   L " :   "   < <   e x . m e s s a g e ( )   < <   e n d l ; 
 
                 w c o u t   < <   L " ( f u n c t i o n )   "   < <   e x . f u n c t i o n ( )   < <   e n d l ; 
 
                 w c o u t   < <   L " ( f i l e )   "   < <   e x . f i l e ( )   < <   e n d l ; 
 
                 w c o u t   < <   L " ( l i n e )   "   < <   e x . l i n e ( )   < <   e n d l ; 
 
         } 
 
 
 
         r e t u r n   0 ; 
 
 } 
 
 
 
 
 
 # d e f i n e   c o u n t o f ( x )   ( i n t ) ( s i z e o f ( x ) / s i z e o f ( x [ 0 ] ) ) 
 
 
 
 
 
 c l a s s   H P o i n t   
 
 {   
 
 p u b l i c : 
 
         f l o a t                 x ;   
 
         f l o a t                 y ;   
 
         f l o a t                 z ;   
 
         i n l i n e   v o i d   S e t ( f l o a t   X , f l o a t   Y , f l o a t   Z = 0 . 0 )   {   x = X , y = Y , z = Z ;   } 
 
 
 
 } ;   
 
 
 
 c o n s t   f l o a t   P I = 3 . 1 4 1 5 9 2 6 f ; 
 
 
 
 
 
 v o i d   C r e a t e S p h e r e (   f l o a t   * c e n t e r ,   
 
                                       f l o a t   r a d i u s ,   
 
                                       i n t   n u m s i d e s ,   
 
                                       i n t   * p c o u n t _ o u t ,   
 
                                       f l o a t   * * p o i n t s _ o u t ,   
 
                                       i n t   * f l i s t l e n _ o u t ,   
 
                                       i n t   * * f a c e s _ o u t   ) 
 
 { 
 
         i n t   i ,   j ,   h t i l e ,   w t i l e ,   p t s _ c n t ,   f l i s t _ c n t ; 
 
         f l o a t   t h e t a ,   p h i ,   d t ,   d p ,   x ,   y ,   z ; 
 
         H P o i n t   * p o i n t s ; 
 
         i n t   * f a c e s ; 
 
 
 
         h t i l e   =   n u m s i d e s / 2 ; 
 
         w t i l e   =   n u m s i d e s ; 
 
         p t s _ c n t   =   h t i l e * w t i l e ; 
 
         p o i n t s   =   n e w   H P o i n t [   p t s _ c n t   ] ; 
 
         / /   f a c e s   n e e d   w t i l e   +   1   n u m b e r s   t o   s p e c i f y   e a c h   s p h e r e   e n d   c a p 
 
         / /   a n d   5 * n u m s i d e s   n u m b e r s   f o r   e a c h   s t r i p   b e t w e e n   t h e   e n d   c a p s . 
 
         / /   T h e r e   w i l l   b e   n u m s i d e s / 2 - 1   o f   t h e s e   s t r i p s . 
 
         f l i s t _ c n t   =   ( w t i l e + 1 ) * 2   +   5 * ( h t i l e - 1 ) * w t i l e ; 
 
         f a c e s   =   n e w   i n t [   f l i s t _ c n t   ] ; 
 
 
 
         d t   =   2 . 0 f   *   P I   /   w t i l e ; 
 
         d p   =   1 . 0 f   *   P I   /   ( h t i l e + 1 ) ; 
 
         p h i   =   d p ; 
 
         f o r (   i   =   0   ;   i   <   h t i l e   ;   i + +   )   { 
 
                 t h e t a   =   0 ; 
 
                 f o r (   j   =   0   ;   j   <   w t i l e   ;   j + +   )   { 
 
                         x   =   r a d i u s   *   ( f l o a t ) c o s ( t h e t a )   *   ( f l o a t ) s i n ( p h i ) ; 
 
                         y   =   r a d i u s   *   ( f l o a t ) c o s ( p h i ) ; 
 
                         z   =   r a d i u s   *   ( f l o a t ) s i n ( t h e t a )   *   ( f l o a t ) s i n ( p h i ) ; 
 
                         p o i n t s [   i * w t i l e   +   j   ] . S e t (   c e n t e r [ 0 ]   +   x ,   c e n t e r [ 1 ]   +   y ,   c e n t e r [ 2 ]   +   z   ) ; 
 
                         t h e t a   + =   d t ; 
 
                 } 
 
                 p h i   + =   d p ; 
 
         } 
 
 
 
         / /   s e t   t h e   n u m b e r   o f   p o i n t s   i n   t h e   e n d   c a p s   o f   t h e   s p h e r e   i n   t h e   c o n n e c t i v i t y   l i s t 
 
         f a c e s [ 5 * ( h t i l e - 1 ) * w t i l e ]   =   w t i l e ; 
 
         f a c e s [ 5 * ( h t i l e - 1 ) * w t i l e + w t i l e + 1 ]   =   w t i l e ; 
 
         f o r   ( i   =   0 ;   i   <   ( h t i l e - 1 ) ;   i + + ) 
 
         { 
 
                 f o r   ( j   =   0 ;   j   <   w t i l e ;   j + + ) 
 
                 { 
 
                         / /   g e n e r a t e   t h e   c o n n e c t i v i t y   l i s t   f o r   t h e   s i d e   q u a d s   o f   t h e   c y l i n d e r 
 
                         f a c e s [ ( i * w t i l e   +   j ) * 5 ]   =   4 ;   / /   n u m b e r   o f   p o i n t s   i n   t h i s   p o l y g o n 
 
                         f a c e s [ ( i * w t i l e   +   j ) * 5 + 1 ] = i * w t i l e   +   j ; 
 
                         f a c e s [ ( i * w t i l e   +   j ) * 5 + 2 ] = i * w t i l e   +   ( j + 1 ) % w t i l e ;   / / n e x t   p o i n t   a l o n g   c i r c l e ;   w r a p   a t   n u m s i d e s 
 
                         f a c e s [ ( i * w t i l e   +   j ) * 5 + 3 ] = ( i + 1 ) * w t i l e   +   ( j + 1 ) % w t i l e ;     / /   c o r r e c s p o n d i n g   p o i n t   a t   t o p   o f   c y l i n d e r 
 
                         f a c e s [ ( i * w t i l e   +   j ) * 5 + 4 ] = ( i + 1 ) * w t i l e   +   j ;   / / n e x t   p o i n t   a l o n g   c i r c l e ;   w r a p   a t   n u m s i d e s 
 
                 } 
 
         } 
 
         f o r   ( j   =   0 ;   j   <   w t i l e ;   j + + ) 
 
         { 
 
                 / /   g e n e r a t e   t h e   c o n n e c t i v i t y   l i s t   f o r   t h e   e n d s   o f   t h e   c y l i n d e r 
 
                 f a c e s [ ( h t i l e - 1 ) * w t i l e * 5   +   j   +   1 ] =   ( w t i l e   -   j   -   1 ) ; 
 
                 f a c e s [ ( h t i l e - 1 ) * w t i l e * 5   +   j   +   1   +   w t i l e   +   1 ] =   w t i l e * ( h t i l e - 1 )   +   j ; 
 
         } 
 
         * p c o u n t _ o u t   =   p t s _ c n t ; 
 
         * p o i n t s _ o u t   =   ( f l o a t   * ) p o i n t s ; 
 
         * f l i s t l e n _ o u t   =   f l i s t _ c n t ; 
 
         * f a c e s _ o u t   =   ( i n t   * ) f a c e s ; 
 
 } 
 
 
 
 
 
 v o i d   d o _ m o d e l (   D W F M o d e l &   r M o d e l , 
 
                               b o o l   b I n c l u d e N o r m a l s   ) 
 
 { 
 
         / / 
 
         / /   
 
         / / 
 
         D W F P r o p e r t y   o P r o p e r t y (   L " " ,   L " "   ) ; 
 
 
 
         H P o i n t   c e n t e r ;   c e n t e r . S e t (   0 . 0 ,   0 . 0 ,   0 . 0   ) ; 
 
 
 
         f l o a t   r a d i u s   =   1 . 0 f ; 
 
         f l o a t   b b o x [ 6 ] ; 
 
         f l o a t   * p o i n t s ,   * n o r m a l s ; 
 
         i n t   p _ c o u n t ,   f l i s t _ l e n g t h ,   * f l i s t ,   i ; 
 
 
 
         / / 
 
         / /   t h e   f i r s t   t h i n g   t o   d o   i s   c r e a t e   a n   i n c l u d e   s e g m e n t 
 
         / /   t h a t   d e f i n e s   a   c o l l e c t i o n   o f   g r a p h i c s   t h a t   w i l l   b e 
 
         / /   r e u s e d   t h r o u g h o u t   t h e   m o d e l 
 
         / / 
 
         D W F I n c l u d e S e g m e n t   o S p h e r e _ i n c l u d e   =   r M o d e l . o p e n I n c l u d e S e g m e n t ( ) ; 
 
 
 
         / / 
 
         / /   s e g m e n t s   a r e   a l w a y s   f i r s t   a c q u i r e d   f r o m   t h e i r   a g g r e g a t i n g   c o m p o n e n t   ( i . e .   M o d e l   o r   a n o t h e r   S e g m e n t ) 
 
         / /   a n d   t h e n   o p e n e d .     I n c l u d e   s e g m e n t s   m u s t   b e   o p e n e d   w i t h   a   n a m e .   
 
         / / 
 
         o S p h e r e _ i n c l u d e . o p e n (   " S p h e r e "   ) ; 
 
         { 
 
                 / / 
 
                 / /   w e   w i l l   d e f i n e   o u r   s p h e r e   a s   a   s h e l l 
 
                 / /   n o t i c e   t h a t   t h e   h a n d l e r   i s   r e t u r n e d   a s   a   r e f e r e n c e 
 
                 / /   b e   s u r e   t o   o b t a i n   i t   t h i s   w a y ;   i f   y o u   t r y   a n d   c o p y 
 
                 / /   i t ,   y o u   w i l l   g e t   a   c o m p i l e   t i m e   e r r o r   s i n c e   t h e r e 
 
                 / /   i s   n o   c o p y   c o n s t r u c t o r   d e f i n e d   f o r   t h e s e   o b j e c t s 
 
                 / / 
 
                 T K _ S h e l l &   r S p h e r e   =   o S p h e r e _ i n c l u d e . g e t S h e l l H a n d l e r ( ) ; 
 
                 { 
 
                         / / 
 
                         / /   i t ' s   a l w a y s   a   g o o d   i d e a   t o   s e t   t h e   b o u n d i n g   v o l u m e   o n   y o u r   s h e l l s . 
 
                         / / 
 
                         b b o x [ 0 ]   =   c e n t e r . x   -   r a d i u s ; 
 
                         b b o x [ 1 ]   =   c e n t e r . y   -   r a d i u s ; 
 
                         b b o x [ 2 ]   =   c e n t e r . z   -   r a d i u s ; 
 
                         b b o x [ 3 ]   =   c e n t e r . x   +   r a d i u s ; 
 
                         b b o x [ 4 ]   =   c e n t e r . y   +   r a d i u s ; 
 
                         b b o x [ 5 ]   =   c e n t e r . z   +   r a d i u s ; 
 
                         r S p h e r e . S e t B o u n d i n g (   b b o x   ) ; 
 
 
 
                         / / 
 
                         / /   O r i g i n a l   H O O P S / S t r e a m   c o m m e n t : 
 
                         / /   T h i s   i s   w h e r e   y o u   w i l l   g o   o u t   t o   y o u r   g f x   d a t a b a s e   a n d   g e t   t h e   d a t a   d e f i n i n g   t h e   s h e l l . 
 
                         / /   W e ' r e   u s i n g   a   s i m p l e   s p h e r e   g e n e r a t o r   t o   c r e a t e   a   p o i n t   c l o u d   a n d   s o m e   c o n n e c t i v i t y 
 
                         / / 
 
                         C r e a t e S p h e r e (   ( f l o a t   * ) & c e n t e r ,   r a d i u s ,   3 0 ,   & p _ c o u n t ,   & p o i n t s ,   & f l i s t _ l e n g t h ,   & f l i s t   ) ; 
 
                         
 
                         / / 
 
                         / /   s e t   t h e   v e r t e x   l i s t   f o r   t h e   s h e l l 
 
                         / / 
 
                         r S p h e r e . S e t P o i n t s (   p _ c o u n t ,   p o i n t s   ) ; 
 
 
 
                         / / 
 
                         / /   s e t   t h e   f a c e   l i s t   f o r   t h e   s h e l l 
 
                         / / 
 
                         r S p h e r e . S e t F a c e s (   f l i s t _ l e n g t h ,   f l i s t   ) ; 
 
 
 
                                 / / 
 
                                 / /   H O O P S   3 D G S   w i l l   c a l c u l a t e   s i m p l e   a v e r a g e   n o r m a l s   f r o m   t h e   f a c e s 
 
                                 / /   u s u a l l y   t h i s   a d e q u a t e   a n d   s a v e s   s p a c e   i f   w e   d o n ' t   n e e d   t o   s t o r e 
 
                                 / /   n o r m a l s   d a t a   i n   t h e   f i l e .     E d g e   n o r m a l s   s h o u l d   a l w a y s   b e   d e f i n e d 
 
                                 / /   w i t h   o r i g i n a l   d a t a .     A l s o ,   n o r m a l s   a r e   q u a n t i z e d   b y   d e f a u l t   t o   s a v e 
 
                                 / /   s p a c e   w h i l e   p r e s e r v i n g   v i s u a l   f i d e l i t y .     A   s p h e r e   i s   g o i n g   t o   b e 
 
                                 / /   t h e   w o r s t   c a s e   s c e n a r i o   f o r   t h i s   c o m p r e s s i o n   m e c h a n i s m   b u t   i t   i s 
 
                                 / /   w o r t h   a d j u s t i n g   t h i s   p a r a m e t e r   a s   m u c h   a s   p o s s i b l e   t o   a c h e i v e   t h e 
 
                                 / /   b e s t   v i s u a l   r e s u l t s   i n   t h e   s m a l l e s t   f i l e . 
 
                                 / / 
 
                         i f   ( b I n c l u d e N o r m a l s ) 
 
                         { 
 
                                 n o r m a l s   =   n e w   f l o a t [   3   *   p _ c o u n t   ] ; 
 
                                 f o r   (   i   =   0   ;   i   <   p _ c o u n t   *   3   ;   i   + =   3 )   
 
                                 { 
 
                                         n o r m a l s [   i   +   0   ]   =   p o i n t s [   i   +   0   ]   -   c e n t e r . x ; 
 
                                         n o r m a l s [   i   +   1   ]   =   p o i n t s [   i   +   1   ]   -   c e n t e r . y ; 
 
                                         n o r m a l s [   i   +   2   ]   =   p o i n t s [   i   +   2   ]   -   c e n t e r . z ; 
 
                                 } 
 
                           
 
                                 r S p h e r e . S e t V e r t e x N o r m a l s (   n o r m a l s   ) ; 
 
 
 
                                 / / 
 
                                 / /   N O T E   h e r e   t h a t   t h e   o p c o d e   h a n d l e r s   w i l l   a l w a y s 
 
                                 / /   c o p y   t h e   d a t a   t h a t   t h e y   a r e   g i v e n 
 
                                 / / 
 
                                 d e l e t e   [ ]   n o r m a l s ; 
 
                         } 
 
 
 
                         / / 
 
                         / /   c l e a n   u p 
 
                         / / 
 
                         / / d e l e t e   [ ]   i n d i c e s ; 
 
                         d e l e t e   [ ]   p o i n t s ; 
 
                         d e l e t e   [ ]   f l i s t ; 
 
                 } 
 
                 
 
                 / / 
 
                 / /   o n c e   w e   a r e   c o m p l e t e l y   f i n i s h e d   w i t h   a   h a n d l e r , 
 
                 / /   w e   m u s t   c a l l   s e r i a l i z e ( ) .     t h i s   w i l l   w r i t e   a l l 
 
                 / /   o f   o u r   g r a p h i c s   i n t o   t h e   s t r e a m   a n d   r e s e t   t h e   h a n d l e r 
 
                 / /   f o r   f u t u r e   u s e 
 
                 / / 
 
                 r S p h e r e . s e r i a l i z e ( ) ; 
 
 
 
                 / / 
 
                 / /   l e t ' s   c r e a t e   a   p r o p e r t y   o n   t h i s   s e g m e n t 
 
                 / / 
 
                 o P r o p e r t y . s e t N a m e (   L " M a t e r i a l "   ) ; 
 
                 o P r o p e r t y . s e t V a l u e (   L " P l a s t i c "   ) ; 
 
 
 
                 / / 
 
                 / /   a d d   t h e   p r o p e r t y   t o   t h e   s e g m e n t 
 
                 / / 
 
                 o S p h e r e _ i n c l u d e . a d d P r o p e r t y (   o P r o p e r t y   ) ; 
 
 
 
                 / / 
 
                 / /   a l s o   a d d   a   s e t   o f   p r o p e r t i e s   
 
                 / / 
 
                 D W F P r o p e r t y C o n t a i n e r *   p P r o p e r t i e s   =   D W F C O R E _ A L L O C _ O B J E C T (   D W F P r o p e r t y C o n t a i n e r   ) ; 
 
 
 
                 o P r o p e r t y . s e t N a m e (   L " C o s t "   ) ; 
 
                 o P r o p e r t y . s e t V a l u e (   L " $ 4 . 4 4 "   ) ; 
 
                 o P r o p e r t y . s e t C a t e g o r y (   L " S p h e r e   P r o p e r t i e s "   ) ; 
 
                 p P r o p e r t i e s - > a d d P r o p e r t y (   & o P r o p e r t y ,   f a l s e   ) ; 
 
 
 
                 o P r o p e r t y . s e t N a m e (   L " V e n d o r "   ) ; 
 
                 o P r o p e r t y . s e t V a l u e (   L " F o o   B a l l "   ) ; 
 
                 p P r o p e r t i e s - > a d d P r o p e r t y (   & o P r o p e r t y ,   f a l s e   ) ; 
 
 
 
                 o P r o p e r t y . s e t N a m e (   L " M a n u f a c t u r e r "   ) ; 
 
                 o P r o p e r t y . s e t V a l u e (   L " B a l l   C o . "   ) ; 
 
                 p P r o p e r t i e s - > a d d P r o p e r t y (   & o P r o p e r t y ,   f a l s e   ) ; 
 
 
 
                 / / 
 
                 / /   a d d   t h e   p r o p e r t y   s e t   t o   t h e   s e g m e n t 
 
                 / / 
 
                 o S p h e r e _ i n c l u d e . a d d P r o p e r t y C o n t a i n e r (   p P r o p e r t i e s   ) ; 
 
         } 
 
 
 
         / / 
 
         / /   c l o s e   t h e   s e g m e n t   -   t h i s   w i l l   s e r i a l i z e   e v e r y t h i n g   a b o u t   t h e   s e g m e n t 
 
         / /   i n t o   t h e   g r a p h i c s   s t r e a m .   w e   c a n   n o w   u s e   t h i s   s e g m e n t   a s   a   r e f e r e n c e 
 
         / /   p a r t   i n   o u r   s c e n e   g r a p h 
 
         / / 
 
         o S p h e r e _ i n c l u d e . c l o s e ( ) ; 
 
 
 
 
 
         / / 
 
         / /   i t   i s   p r e f e r r a b l e   t o   " s i d e - s t r e a m "   t e x t u r e   i m a g e s 
 
         / /   i n   t h e   D W F   p a c k a g e   r a t h e r   t h a n   e m b e d d e d   t h e m   d i r e c t l y 
 
         / /   i n   t h e   g r a p h i c s   c h a n n e l 
 
         / /   s o   l e t ' s   a d d   o u r   t e x t u r e   i m a g e s   u p   h e r e 
 
         / / 
 
 
 
         / / 
 
         / /   f i r s t ,   c r e a t e   t h e   t e x t u r e   r e s o u r c e   a n d   a d d   i t   t o   t h e   m o d e l 
 
         / /   h e r e   w e   l o a d   a n   i m a g e   f r o m   d i s k . . . 
 
         / / 
 
         D W F S t r e a m F i l e D e s c r i p t o r *   p T e x t u r e F i l e   =   D W F C O R E _ A L L O C _ O B J E C T (   D W F S t r e a m F i l e D e s c r i p t o r ( " h a n k . j p g " ,   " r b " )   ) ; 
 
         p T e x t u r e F i l e - > o p e n ( ) ; 
 
 
 
         D W F F i l e I n p u t S t r e a m *   p T e x t u r e S t r e a m   =   D W F C O R E _ A L L O C _ O B J E C T (   D W F F i l e I n p u t S t r e a m   ) ; 
 
         p T e x t u r e S t r e a m - > a t t a c h (   p T e x t u r e F i l e ,   t r u e   ) ; 
 
 
 
         D W F T e x t u r e *   p T e x t u r e   =   D W F C O R E _ A L L O C _ O B J E C T (   D W F T e x t u r e ( " h a n k " , 
 
                                                                                                                           D W F M I M E : : k z M I M E T y p e _ J P G , 
 
                                                                                                                           2 4 ,   3 2 0 ,   2 4 0 )   ) ; 
 
 
 
         p T e x t u r e - > a t t a c h (   p T e x t u r e S t r e a m ,   t r u e   ) ; 
 
         r M o d e l . a d d R e s o u r c e (   p T e x t u r e   ) ; 
 
 
 
         / / / 
 
         / / / 
 
 
 
         / / 
 
         / /   c r e a t e   a   s i m p l e   s c e n e 
 
         / / 
 
         D W F S e g m e n t   o R o o t S e g m e n t   =   r M o d e l . o p e n S e g m e n t ( ) ; 
 
         
 
         / / 
 
         / /   s e g m e n t s   d o n ' t   h a v e   t o   b e   n a m e d   -   i n   t h i s   c a s e 
 
         / /   w e   w i l l   s e t   u p   s o m e   a t t r i b u t e s   t h a t   w i l l   a f f e c t 
 
         / /   t h e   e n t i r e   s c e n e   u n l e s s   o v e r r i d d e n   i n   s u b s e g m e n t s 
 
         / / 
 
         o R o o t S e g m e n t . o p e n ( ) ; 
 
         { 
 
                 T K _ C o l o r _ R G B &   r C o l o r   =   o R o o t S e g m e n t . g e t C o l o r R G B H a n d l e r ( ) ; 
 
                 
 
                 / / 
 
                 / /   r e d   l i n e s 
 
                 / / 
 
                 r C o l o r . S e t G e o m e t r y (   T K O _ G e o _ L i n e   ) ; 
 
                 r C o l o r . S e t R G B (   1 . 0 f ,   0 . 0 f ,   0 . 0 f   ) ; 
 
                 r C o l o r . s e r i a l i z e ( ) ; 
 
 
 
                 / / 
 
                 / /   w e   c a n   r e u s e   t h e   h a n d l e r   
 
                 / /   g r e e n   t e x t 
 
                 / / 
 
                 r C o l o r . S e t G e o m e t r y (   T K O _ G e o _ T e x t   ) ; 
 
                 r C o l o r . S e t R G B (   0 . 0 f ,   0 . 8 f ,   0 . 1 f   ) ; 
 
                 r C o l o r . s e r i a l i z e ( ) ; 
 
 
 
                 / / 
 
                 / /   w e   c a n   r e u s e   t h e   h a n d l e r   
 
                 / /   b l u e   f a c e s 
 
                 / / 
 
                 r C o l o r . S e t G e o m e t r y (   T K O _ G e o _ F a c e   ) ; 
 
                 r C o l o r . S e t R G B (   0 . 0 f ,   0 . 0 f ,   0 . 7 5 f   ) ; 
 
                 r C o l o r . s e r i a l i z e ( ) ; 
 
 
 
                 / / 
 
                 / /   a   s i m p l e   s e t   o f   p r o p e r t i e s 
 
                 / / 
 
                 D W F P r o p e r t y C o n t a i n e r *   p P a r t P r o p e r t i e s   =   D W F C O R E _ A L L O C _ O B J E C T (   D W F P r o p e r t y C o n t a i n e r   ) ; 
 
 
 
                 o P r o p e r t y . s e t N a m e (   L " C o s t "   ) ; 
 
                 o P r o p e r t y . s e t V a l u e (   L " $ 2 3 . 5 5 "   ) ; 
 
                 o P r o p e r t y . s e t C a t e g o r y (   L " P a r t   P r o p e r t i e s "   ) ; 
 
                 p P a r t P r o p e r t i e s - > a d d P r o p e r t y (   & o P r o p e r t y ,   f a l s e   ) ; 
 
 
 
 
 
                 / / 
 
                 / /   n o w   l e t ' s   c r e a t e   a   s e g m e n t   t h a t   w i l l   s h o w   u p   i n   t h e   n a v   t r e e 
 
                 / /   n o t e   t h a t   t h i s   i s   b u i l t   o f f   t h e   r o o t   s e g m e n t   n o t   t h e   m o d e l 
 
                 / / 
 
                 D W F S e g m e n t   o P a r t 1   =   o R o o t S e g m e n t . o p e n S e g m e n t ( ) ; 
 
 
 
                 / / 
 
                 / /   o p e n   w i t h   a   n a m e ,   t h i s   w i l l   s h o w   i n   t h e   n a v   t r e e 
 
                 / / 
 
                 o P a r t 1 . o p e n (   L " F i r s t   P a r t "   ) ; 
 
                 { 
 
                         / / 
 
                         / /   a d d   t h e   s p h e r e   f r o m   o u r   i n c l u d e   l i b r a r y 
 
                         / /   s i n c e   t h e   s e g m e n t   t h a t   w e   a r e   i n c l u d i n g   t h e   s p e h e r e   i n 
 
                         / /   i s   a l r e a d y   n a m e d ,   i t   w i l l   " b e c o m e "   a   p a r t   o f   t h i s   s e g m e n t . 
 
                         / /   t h a t   i s ,   s e l e c t i n g   " F i r s t   P a r t "   i n   t h e   t r e e   w i l l   h i g h l i g h t   t h e 
 
                         / /   s p h e r e   a n d   v i c e - v e r s a   -   t h e r e   w i l l   b e   n o   t r e e   n o d e   c a l l e d   " S p h e r e " 
 
                         / / 
 
                         o P a r t 1 . i n c l u d e (   o S p h e r e _ i n c l u d e   ) ; 
 
 
 
                         / / 
 
                         / /   l e t ' s   d r a w   s o m e   l i n e s 
 
                         / /   t h e s e   l i n e s   w i l l   f i n i s h   t h e   e l e m e n t   n a m e d   " F i r s t   P a r t " 
 
                         / /   a l l   o f   t h e   g e o m e t r y   b u i l t   i n t o   t h i s   s e g m e n t   w i l l   b e 
 
                         / /   t r e a t e d   a s   a   s i n g l e   s e l e c t e d   p a r t 
 
                         / / 
 
                         T K _ L i n e &   r L i n e   =   o P a r t 1 . g e t L i n e H a n d l e r ( ) ; 
 
 
 
                         r L i n e . S e t P o i n t s (   0 . 0 f , 
 
                                                           0 . 0 f , 
 
                                                           0 . 0 f , 
 
                                                           c e n t e r . x   +   2 . 0 f * r a d i u s , 
 
                                                           c e n t e r . y   +   2 . 0 f * r a d i u s , 
 
                                                           c e n t e r . z   +   2 . 0 f * r a d i u s   ) ; 
 
 
 
                         r L i n e . s e r i a l i z e ( ) ; 
 
 
 
                         r L i n e . S e t P o i n t s (   c e n t e r . x   -   2 . 0 f * r a d i u s , 
 
                                                           c e n t e r . y   -   2 . 0 f * r a d i u s , 
 
                                                           c e n t e r . z   -   2 . 0 f * r a d i u s , 
 
                                                           0 . 0 f , 
 
                                                           0 . 0 f , 
 
                                                           0 . 0 f   ) ; 
 
 
 
                         r L i n e . s e r i a l i z e ( ) ; 
 
 
 
                         o P a r t 1 . a d d P r o p e r t y C o n t a i n e r (   p P a r t P r o p e r t i e s   ) ; 
 
 
 
                         / / 
 
                         / /   t e s t   t e x t u r e s 
 
                         / / 
 
                         D W F S e g m e n t   o T e x t u r e P a r t   =   o P a r t 1 . o p e n S e g m e n t ( ) ; 
 
                         o T e x t u r e P a r t . o p e n (   L " H a n k   B o x "   ) ; 
 
                         { 
 
                                 / / 
 
                                 / /   m a k e   a   c u b e 
 
                                 / / 
 
                                 f l o a t   a n P o i n t s [ 2 4 ]   =   {     0 . 0 f ,   0 . 0 f ,   6 . 6 7 f , 
 
                                                                                 0 . 0 f ,   6 . 6 7 f ,   6 . 6 7 f , 
 
                                                                                 6 . 6 7 f ,   6 . 6 7 f ,   6 . 6 7 f , 
 
                                                                                 6 . 6 7 f ,   0 . 0 f ,   6 . 6 7 f , 
 
                                                                                 0 . 0 f ,   0 . 0 f ,   1 3 . 3 4 f , 
 
                                                                                 0 . 0 f ,   6 . 6 7 f ,   1 3 . 3 4 f , 
 
                                                                                 6 . 6 7 f ,   6 . 6 7 f ,   1 3 . 3 4 f , 
 
                                                                                 6 . 6 7 f ,   0 . 0 f ,   1 3 . 3 4 f   } ; 
 
 
 
                                 i n t   a n F a c e s [ 3 0 ]   =   {   4 ,   0 ,   1 ,   2 ,   3 , 
 
                                                                         4 ,   1 ,   5 ,   6 ,   2 , 
 
                                                                         4 ,   5 ,   4 ,   7 ,   6 , 
 
                                                                         4 ,   4 ,   0 ,   3 ,   7 , 
 
                                                                         4 ,   3 ,   5 ,   6 ,   7 , 
 
                                                                         4 ,   1 ,   0 ,   4 ,   5   } ; 
 
 
 
                                 T K _ S h e l l &   r C u b e   =   o T e x t u r e P a r t . g e t S h e l l H a n d l e r ( ) ; 
 
                                 r C u b e . S e t P o i n t s (   8 ,   a n P o i n t s   ) ; 
 
                                 r C u b e . S e t F a c e s (   3 0 ,   a n F a c e s   ) ; 
 
                                 r C u b e . S e t V e r t e x P a r a m e t e r s (   a n P o i n t s   ) ; 
 
                                 r C u b e . s e r i a l i z e ( ) ; 
 
 
 
                                 / / 
 
                                 / /   t e x t u r e   t h e   c u b e 
 
                                 / / 
 
                                 T K _ T e x t u r e &   r S h e l l T e x t u r e   =   o T e x t u r e P a r t . g e t T e x t u r e H a n d l e r ( ) ; 
 
 
 
                                 / / 
 
                                 / /   t h i s   c r e a t e s   a   t e x t u r e   f r o m   o u r   e a r l i e r   i m a g e 
 
                                 / /   N O T E :   t h e   i m a g e   i s   r e q u i r e d   t o   e x i s t   a l r e a d y 
 
                                 / / 
 
                                 r S h e l l T e x t u r e . S e t F l a g s (   0   ) ; 
 
                                 r S h e l l T e x t u r e . S e t I m a g e (   " h a n k "   ) ; 
 
                                 r S h e l l T e x t u r e . S e t N a m e (   " h a n k   t e x t u r e "   ) ; 
 
                                 r S h e l l T e x t u r e . s e r i a l i z e ( ) ; 
 
 
 
                                 T K _ C o l o r &   r T e x t u r e C o l o r   =   o T e x t u r e P a r t . g e t C o l o r H a n d l e r ( ) ; 
 
 
 
                                 / / 
 
                                 / /   s e t   t h e   a t t r i b u t e   f o r   t h i s   D W F S e g m e n t   s u c h   t h a t 
 
                                 / /   f a c e s   a r e   " c o l o r e d "   w i t h   o u r   n e w   ( n a m e d )   t e x t u r e 
 
                                 / /   N O T E :   t h e   t e x t u r e   i s   r e q u i r e d   t o   e x i s t   a l r e a d y 
 
                                 / / 
 
                                 r T e x t u r e C o l o r . S e t G e o m e t r y (   T K O _ G e o _ F a c e   ) ; 
 
                                 r T e x t u r e C o l o r . S e t C h a n n e l s (   1   < <   T K O _ C h a n n e l _ D i f f u s e   ) ; 
 
                                 r T e x t u r e C o l o r . S e t D i f f u s e N a m e (   " h a n k   t e x t u r e "   ) ; 
 
                                 r T e x t u r e C o l o r . s e r i a l i z e ( ) ; 
 
                         } 
 
                         o T e x t u r e P a r t . c l o s e ( ) ; 
 
 
 
                 } 
 
                 o P a r t 1 . c l o s e ( ) ; 
 
 
 
                 / / 
 
                 / /   c r e a t e   a n o t h e r   p a r t 
 
                 / / 
 
                 D W F S e g m e n t   o P a r t 2   =   o R o o t S e g m e n t . o p e n S e g m e n t ( ) ; 
 
 
 
                 o P a r t 2 . o p e n (   L " S e c o n d   P a r t "   ) ; 
 
                 { 
 
                         / / 
 
                         / /   l e t ' s   f i r s t   r e p o s i t i o n   e v e r y t h i n g   i n   t h i s   s e g m e n t 
 
                         / / 
 
                         f l o a t   a n T r a n s f o r m [ 1 6 ]   =   {   1 . 0 f ,   0 . 0 f ,   0 . 0 f ,   0 . 0 f , 
 
                                                                             0 . 0 f ,   1 . 0 f ,   0 . 0 f ,   0 . 0 f , 
 
                                                                             0 . 0 f ,   0 . 0 f ,   1 . 0 f ,   0 . 0 f , 
 
                                                                             2 . 3 3 f ,   0 . 6 7 f ,   0 . 0 f ,   1 . 0 f   } ; 
 
 
 
                         T K _ M a t r i x &   r M a t r i x   =   o P a r t 2 . g e t M o d e l l i n g M a t r i x H a n d l e r ( ) ; 
 
                         r M a t r i x . S e t M a t r i x (   a n T r a n s f o r m   ) ; 
 
                         r M a t r i x . s e r i a l i z e ( ) ; 
 
 
 
                         / / 
 
                         / /   o p e n   a n   u n n a m e d   s e g m e n t 
 
                         / / 
 
                         D W F S e g m e n t   o S u b p a r t   =   o P a r t 2 . o p e n S e g m e n t ( ) ; 
 
                         o S u b p a r t . o p e n ( ) ; 
 
                         { 
 
                                 / / 
 
                                 / /   a d d   o u r   s p h e r e   -   t h i s   t i m e ,   t h e   s p h e r e   w i l l   a p p e a r 
 
                                 / /   a s   i t ' s   o w n   e l e m e n t   i n   t h e   n a v   t r e e .     t h i s   i s   d u e 
 
                                 / /   t o   t h e   f a c t   t h a t   w e   a r e   r e f e r e n c i n g   t h e   s p h e r e 
 
                                 / /   i n   a n   u n n a m e d   s e g m e n t .     w e   c o u l d   r e n a m e   t h i s   e l e m e n t 
 
                                 / /   i f   w e   w a n t e d   t o .   r e g a r d l e s s ,   t h e   b e h a v i o r   h e r e   i s   t h a t 
 
                                 / /   w e   a r e   u s i n g   a   n a m e d   p a r t   t o   b u i l d   u p   t h e   h i g h e r   l e v e l 
 
                                 / /   e l e m e n t ,   i . e .   " S e c o n d   P a r t " 
 
                                 / / 
 
                                 o S u b p a r t . i n c l u d e (   o S p h e r e _ i n c l u d e   ) ; 
 
 
 
                                 / / 
 
                                 / /   n o t e   t h a t   s i n c e   w e   d i d n ' t   n a m e   t h e   s e g m e n t   i n t o   w h i c h   t h i s 
 
                                 / /   p a r t   w a s   i n c l u d e d ,   w e   c a n n o t   m o d i f y   t h e   p r o p e r t i e s   o n   J U S T 
 
                                 / /   t h e   s p h e r e ,   s i n c e   t h e   n e x t   n a m e d   n o d e   u p   t h e   t r e e   i s   " S e c o n d   P a r t " 
 
                                 / /   a n y   p r o p e r t i e s   w e   a d d   w o u l d   e n d   u p   t h e r e .   
 
                                 / / 
 
                         } 
 
                         o S u b p a r t . c l o s e ( ) ; 
 
 
 
                         / / 
 
                         / /   l e t ' s   a d d   a   t e x t   b o x   -   u s e   i t ' s   o w n   s e g m e n t   o r   e l s e 
 
                         / /   w e   w i l l   a f f e c t   t h e   i n c l u d e d   s p h e r e   -   w e l l   i t ' s   n o t   r e a l l y 
 
                         / /   a   t e x t   b o x   b u t   r a t h e r   a   p o l y g o n   w i t h   s o m e   t e x t   i n   f r o n t   o f   i t 
 
                         / / 
 
                         o S u b p a r t   =   o S u b p a r t . o p e n S e g m e n t ( ) ; 
 
                         o S u b p a r t . o p e n ( ) ; 
 
                         { 
 
                                 / / 
 
                                 / /   f a c e 
 
                                 / / 
 
                                 r C o l o r . S e t G e o m e t r y (   T K O _ G e o _ F a c e   ) ; 
 
                                 r C o l o r . S e t R G B (   0 . 1 1 f ,   0 . 8 8 f ,   0 . 4 4 f   ) ; 
 
                                 r C o l o r . s e r i a l i z e ( ) ; 
 
 
 
                                 / / 
 
                                 / /   s o l i d   f a c e 
 
                                 / / 
 
                                 T K _ E n u m e r a t e d &   r P a t t e r n E n u m   =   o S u b p a r t . g e t F a c e P a t t e r n H a n d l e r ( ) ; 
 
                                 r P a t t e r n E n u m . S e t I n d e x (   T K O _ F i l l _ P a t t e r n _ S o l i d   ) ; 
 
                                 r P a t t e r n E n u m . s e r i a l i z e ( ) ; 
 
 
 
                                 / / 
 
                                 / /   s o l i d   e d g e s 
 
                                 / /   b y   t h e   w a y ,   b e   s u r e   t o   t u r n   o n   e d g e s   i n   t h e   v i e w e r   - 
 
                                 / /   " S h a d e d   w i t h   E d g e s "   s i n c e   t h e y   a r e   o f f   b y   d e f a u l t 
 
                                 / / 
 
                                 T K _ L i n e a r _ P a t t e r n &   r L i n e P a t t e r n   =   o S u b p a r t . g e t E d g e P a t t e r n H a n d l e r ( ) ; 
 
                                 r L i n e P a t t e r n . S e t P a t t e r n (   T K O _ L i n e _ P a t t e r n _ S o l i d   ) ; 
 
                                 r L i n e P a t t e r n . s e r i a l i z e ( ) ; 
 
 
 
                                 / / 
 
                                 / /   e d g e   w e i g h t 
 
                                 / /   b y   t h e   w a y ,   b e   s u r e   t o   t u r n   o n   e d g e s   i n   t h e   v i e w e r   - 
 
                                 / /   " S h a d e d   w i t h   E d g e s "   s i n c e   t h e y   a r e   o f f   b y   d e f a u l t 
 
                                 / / 
 
                                 T K _ S i z e &   r P a t t e r n S i z e   =   o S u b p a r t . g e t E d g e W e i g h t H a n d l e r ( ) ; 
 
                                 r P a t t e r n S i z e . S e t S i z e (   5 . 0 f ,   T K O _ G e n e r i c _ S i z e _ P o i n t s   ) ; 
 
                                 r P a t t e r n S i z e . s e r i a l i z e ( ) ; 
 
 
 
                                 / / 
 
                                 / /   t h e   p o l y g o n 
 
                                 / / 
 
                                 T K _ P o l y p o i n t &   r P o l y g o n   =   o S u b p a r t . g e t P o l y g o n H a n d l e r ( ) ; 
 
 
 
                                 f l o a t   a n B o x [ 1 5 ]   =   {   2 . 0 ,   2 . 0 ,   2 . 0 , 
 
                                                                         2 . 0 ,   1 . 0 ,   2 . 0 , 
 
                                                                         1 . 0 ,   1 . 0 ,   2 . 0 , 
 
                                                                         1 . 0 ,   2 . 0 ,   2 . 0 , 
 
                                                                         2 . 0 ,   2 . 0 ,   2 . 0   } ; 
 
 
 
                                 r P o l y g o n . S e t P o i n t s (   5 ,   a n B o x   ) ; 
 
                                 r P o l y g o n . s e r i a l i z e ( ) ; 
 
 
 
                                 / / 
 
                                 / /   o v e r r i d e   t h e   g r e e n   t e x t   w i t h   b l a c k 
 
                                 / / 
 
                                 r C o l o r . S e t G e o m e t r y (   T K O _ G e o _ T e x t   ) ; 
 
                                 r C o l o r . S e t R G B (   0 . 0 f ,   0 . 0 f ,   0 . 0 f   ) ; 
 
                                 r C o l o r . s e r i a l i z e ( ) ; 
 
 
 
                                 / / 
 
                                 / /   d r a w   s o m e   t e x t   o n   t h e   p o l y g o n 
 
                                 / / 
 
                                 T K _ T e x t &   r T e x t   =   o S u b p a r t . g e t T e x t W i t h E n c o d i n g H a n d l e r ( ) ; 
 
                                 r T e x t . S e t E n c o d i n g (   T K O _ E n c _ U n i c o d e   ) ; 
 
                                 r T e x t . S e t P o s i t i o n (   1 . 5 f ,   1 . 5 f ,   1 . 5 f   ) ; 
 
                                 r T e x t . S e t S t r i n g (   L " 3 D   D W F "   ) ; 
 
                                 r T e x t . s e r i a l i z e ( ) ; 
 
 
 
                                 / / 
 
                                 / /   b y   d e f a u l t ,   H O O P S   d r a w s   t e x t   i n   ' a n n o t a t i o n '   m o d e   o n l y 
 
                                 / /   w e   c a n   t u r n   t h i s   o f f   a n d   m a k e   o u r   t e x t   p a r t   o f   t h e   s c e n e : 
 
                                 / / 
 
                                 T K _ T e x t _ F o n t &   r F o n t   =   o S u b p a r t . g e t T e x t F o n t H a n d l e r ( ) ; 
 
                                 r F o n t . S e t T r a n s f o r m s (   T K O _ F o n t _ T r a n s f o r m _ F u l l   ) ; 
 
                                 
 
                                 r F o n t . S e t M a s k (   T K O _ F o n t _ T r a n s f o r m s   ) ; 
 
                                 r F o n t . s e r i a l i z e ( ) ; 
 
                         } 
 
                         o S u b p a r t . c l o s e ( ) ; 
 
 
 
                         / / 
 
                         / /   l e t ' s   m a k e   t h i s   k i n d   o f   l o o k   l i k e   o u r   f i r s t   p a r t   a n d   a d d   s o m e   l i n e s 
 
                         / /   t h i s   t i m e   w e   w i l l   m a k e   t h e m   a   s e l e c t a b l e   u n i t 
 
                         / / 
 
                         D W F S e g m e n t   o L i n e s P a r t   =   o P a r t 2 . o p e n S e g m e n t ( ) ; 
 
                         
 
                         o L i n e s P a r t . o p e n (   L " L i n e s "   ) ; 
 
                         { 
 
                                 T K _ L i n e &   r L i n e   =   o L i n e s P a r t . g e t L i n e H a n d l e r ( ) ; 
 
 
 
                                 r L i n e . S e t P o i n t s (   0 . 0 f , 
 
                                                                   0 . 0 f , 
 
                                                                   0 . 0 f , 
 
                                                                   c e n t e r . x   +   2 . 0 f * r a d i u s , 
 
                                                                   c e n t e r . y   +   2 . 0 f * r a d i u s , 
 
                                                                   c e n t e r . z   +   2 . 0 f * r a d i u s   ) ; 
 
 
 
                                 r L i n e . s e r i a l i z e ( ) ; 
 
 
 
                                 r L i n e . S e t P o i n t s (   c e n t e r . x   -   2 . 0 f * r a d i u s , 
 
                                                                   c e n t e r . y   -   2 . 0 f * r a d i u s , 
 
                                                                   c e n t e r . z   -   2 . 0 f * r a d i u s , 
 
                                                                   0 . 0 f , 
 
                                                                   0 . 0 f , 
 
                                                                   0 . 0 f   ) ; 
 
 
 
                                 r L i n e . s e r i a l i z e ( ) ; 
 
                         } 
 
                         o L i n e s P a r t . c l o s e ( ) ; 
 
 
 
                         / / 
 
                         / /   a d d   t h e   p r o p e r t y   s e t   t o   t h e   p a r t   ( b y   r e f e r e n c e   -   p a r t   1   o w n s   i t ) 
 
                         / / 
 
                         o P a r t 2 . r e f e r e n c e P r o p e r t y C o n t a i n e r (   * p P a r t P r o p e r t i e s   ) ; 
 
 
 
                 } 
 
                 o P a r t 2 . c l o s e ( ) ; 
 
 
 
                 / / 
 
                 / /   c r e a t e   a n o t h e r   p a r t 
 
                 / / 
 
                 D W F S e g m e n t   o P a r t 3   =   o R o o t S e g m e n t . o p e n S e g m e n t ( ) ; 
 
 
 
                 o P a r t 3 . o p e n (   L " T h i r d   P a r t "   ) ; 
 
                 { 
 
                         / / 
 
                         / /   r e d   f a c e s 
 
                         / / 
 
                         r C o l o r . S e t G e o m e t r y (   T K O _ G e o _ F a c e   ) ; 
 
                         r C o l o r . S e t R G B (   0 . 6 7 f ,   0 . 0 f ,   0 . 0 5 f   ) ; 
 
                         r C o l o r . s e r i a l i z e ( ) ; 
 
 
 
                         / / 
 
                         / /   l e t ' s   f i r s t   r e p o s i t i o n   e v e r y t h i n g   i n   t h i s   s e g m e n t 
 
                         / / 
 
                         f l o a t   a n T r a n s f o r m [ 1 6 ]   =   {   1 . 0 f ,   0 . 0 f ,   0 . 0 f ,   0 . 0 f , 
 
                                                                             0 . 0 f ,   1 . 0 f ,   0 . 0 f ,   0 . 0 f , 
 
                                                                             0 . 0 f ,   0 . 0 f ,   1 . 0 f ,   0 . 0 f , 
 
                                                                             - 4 . 3 3 f ,   - 1 . 3 4 f ,   - 0 . 1 3 4 f ,   1 . 0 f   } ; 
 
 
 
                         T K _ M a t r i x &   r M a t r i x   =   o P a r t 3 . g e t M o d e l l i n g M a t r i x H a n d l e r ( ) ; 
 
                         r M a t r i x . S e t M a t r i x (   a n T r a n s f o r m   ) ; 
 
                         r M a t r i x . s e r i a l i z e ( ) ; 
 
 
 
                         / / 
 
                         / /   e x p l i c i t i n g   n a m i n g   t h e   s e g m e n t 
 
                         / / 
 
                         D W F S e g m e n t   o S u b p a r t 1   =   o P a r t 3 . o p e n S e g m e n t ( ) ; 
 
                         o S u b p a r t 1 . o p e n (   L " B a l l   1 "   ) ; 
 
                         { 
 
                                 / / 
 
                                 / /   a d d   o u r   s p h e r e   
 
                                 / / 
 
                                 o S u b p a r t 1 . i n c l u d e (   o S p h e r e _ i n c l u d e   ) ; 
 
 
 
                                 / / 
 
                                 / /   o v e r r i d e   t h e   s p h e r e   p r o p e r t i e s 
 
                                 / / 
 
                                 / / o P r o p e r t y . s e t N a m e (   L " C o s t "   ) ; 
 
                                 / / o P r o p e r t y . s e t V a l u e (   L " $ 3 . 0 0 "   ) ; 
 
                                 / / o P r o p e r t y . s e t C a t e g o r y (   L " S p h e r e   P r o p e r t i e s "   ) ; 
 
                                 o P r o p e r t y . s e t N a m e (   L " D0O0‰0g0Y0K0ÿ"   ) ; 
 
                                 o P r o p e r t y . s e t V a l u e (   L " U0“0\0“0†Q"   ) ; 
 
                                 o P r o p e r t y . s e t C a t e g o r y (   L " ×0í0×0ë0Á0º0"   ) ; 
 
                                 o S u b p a r t 1 . a d d P r o p e r t y (   o P r o p e r t y   ) ; 
 
 
 
                                 o P r o p e r t y . s e t N a m e (   L " V e n d o r "   ) ; 
 
                                 o P r o p e r t y . s e t V a l u e (   L " D u n   &   B r o a d s t r e e t "   ) ; 
 
                                 o S u b p a r t 1 . a d d P r o p e r t y (   o P r o p e r t y   ) ; 
 
                         } 
 
                         o S u b p a r t 1 . c l o s e ( ) ; 
 
 
 
                         / / 
 
                         / /   u n n a m e d   s e g m e n t 
 
                         / / 
 
                         D W F S e g m e n t   o S u b p a r t 2   =   o P a r t 3 . o p e n S e g m e n t ( ) ; 
 
                         o S u b p a r t 2 . o p e n ( ) ; 
 
                         { 
 
                                 f l o a t   a n T r a n s f o r m [ 1 6 ]   =   {   1 . 0 f ,   0 . 0 f ,   0 . 0 f ,   0 . 0 f , 
 
                                                                                     0 . 0 f ,   1 . 0 f ,   0 . 0 f ,   0 . 0 f , 
 
                                                                                     0 . 0 f ,   0 . 0 f ,   1 . 0 f ,   0 . 0 f , 
 
                                                                                     1 . 0 f ,   1 . 0 f ,   1 . 0 f ,   1 . 0 f   } ; 
 
 
 
                                 T K _ M a t r i x &   r M a t r i x   =   o P a r t 3 . g e t M o d e l l i n g M a t r i x H a n d l e r ( ) ; 
 
                                 r M a t r i x . S e t M a t r i x (   a n T r a n s f o r m   ) ; 
 
                                 r M a t r i x . s e r i a l i z e ( ) ; 
 
 
 
                                 / / 
 
                                 / /   i n c l u d i n g   w i t h   a   d i f f e r e n t   n a m e 
 
                                 / / 
 
                                 o S u b p a r t 2 . i n c l u d e (   o S p h e r e _ i n c l u d e ,   L " B a l l   2 "   ) ; 
 
                         } 
 
                         o S u b p a r t 2 . c l o s e ( ) ; 
 
 
 
                         D W F S e g m e n t   o S u b p a r t 3   =   o P a r t 3 . o p e n S e g m e n t ( ) ; 
 
                         o S u b p a r t 3 . o p e n (   L " B a l l   3 "   ) ; 
 
                         { 
 
                                 f l o a t   a n T r a n s f o r m [ 1 6 ]   =   {   1 . 0 f ,   0 . 0 f ,   0 . 0 f ,   0 . 0 f , 
 
                                                                                     0 . 0 f ,   1 . 0 f ,   0 . 0 f ,   0 . 0 f , 
 
                                                                                     0 . 0 f ,   0 . 0 f ,   1 . 0 f ,   0 . 0 f , 
 
                                                                                     1 . 0 f ,   - 1 . 0 f ,   - 1 . 0 f ,   1 . 0 f   } ; 
 
 
 
                                 T K _ M a t r i x &   r M a t r i x   =   o P a r t 3 . g e t M o d e l l i n g M a t r i x H a n d l e r ( ) ; 
 
                                 r M a t r i x . S e t M a t r i x (   a n T r a n s f o r m   ) ; 
 
                                 r M a t r i x . s e r i a l i z e ( ) ; 
 
 
 
                                 / / 
 
                                 / /   i n c l u d i n g   w i t h   a   d i f f e r e n t   n a m e 
 
                                 / / 
 
                                 o S u b p a r t 3 . i n c l u d e (   o S p h e r e _ i n c l u d e   ) ; 
 
                         } 
 
                         o S u b p a r t 3 . c l o s e ( ) ; 
 
 
 
                         / / 
 
                         / /   
 
                         / / 
 
                         D W F S e g m e n t   o C u t   =   o P a r t 3 . o p e n S e g m e n t ( ) ; 
 
                         o C u t . o p e n (   L " C u t t i n g   P l a n e "   ) ; 
 
                         { 
 
                                 T K _ C u t t i n g _ P l a n e &   r C u t   =   o C u t . g e t C u t t i n g P l a n e H a n d l e r ( ) ; 
 
                                 r C u t . S e t P l a n e (   - 1 . 0 f ,   - 1 . 0 f ,   0 . 0 f ,   0 . 0 f   ) ; 
 
                                 r C u t . s e r i a l i z e ( ) ; 
 
                         } 
 
                         o C u t . c l o s e ( ) ; 
 
 
 
                 } 
 
                 o P a r t 3 . c l o s e ( ) ; 
 
 
 
                 / / 
 
                 / /   t e s t   e m b e d d e d   f o n t s   
 
                 / / 
 
                 D W F S e g m e n t   o P a r t 4   =   o R o o t S e g m e n t . o p e n S e g m e n t ( ) ; 
 
                 o P a r t 4 . o p e n ( ) ; 
 
                 { 
 
                         / / 
 
                         / /   w e ' l l   a d d   s o m e   j a p a n e s e   t e x t   i n   M S   P G o t h i c 
 
                         / /   w e   a r e n ' t   m o d i f y i n g   t h e   t r a n s f o r m   m a s k   s o   t h i s   t e x t   w i l l   b e   b i l l b o a r d e d 
 
                         / / 
 
                         T K _ T e x t _ F o n t &   r F o n t   =   o P a r t 4 . g e t T e x t F o n t H a n d l e r ( ) ; 
 
                         r F o n t . S e t N a m e s (   " M S   P G o t h i c "   ) ; 
 
                         r F o n t . S e t M a s k (   T K O _ F o n t _ N a m e s   ) ; 
 
                         r F o n t . s e r i a l i z e ( ) ; 
 
 
 
                         / / 
 
                         / /   t h e   t e x t 
 
                         / / 
 
                         T K _ T e x t &   r T e x t   =   o P a r t 4 . g e t T e x t W i t h E n c o d i n g H a n d l e r ( ) ; 
 
                         r T e x t . S e t E n c o d i n g (   T K O _ E n c _ U n i c o d e   ) ; 
 
                         r T e x t . S e t P o s i t i o n (   - 2 . 0 f ,   4 . 0 f ,   0 . 0 f   ) ; 
 
                         r T e x t . S e t S t r i n g (   L " åe,gžŠn0Æ0­0¹0È0"   ) ; 
 
                         r T e x t . s e r i a l i z e ( ) ; 
 
 
 
                         / / 
 
                         / /   f o n t   h a n d l i n g   i s   a   p l a t f o r m   s p e c i f i c   i s s u e 
 
                         / /   u n f o r t u n a t e l y   r i g h t   n o w 
 
                         / / 
 
 # i f d e f     _ D W F C O R E _ W I N 3 2 _ S Y S T E M 
 
 
 
                         / / 
 
                         / /   n o w   e m b e d   t h e   f o n t   i n   t h e   D W F   p a c k a g e 
 
                         / /   n o t i c e   t h a t   t h i s   i s   w i n 3 2   s p e c i f i c   c o d e 
 
                         / / 
 
                         H F O N T   h F o n t   =   C r e a t e F o n t W ( 1 0 0 ,   0 ,   0 ,   0 ,   F W _ N O R M A L ,   0 ,   0 ,   0 ,   0 ,   0 ,   0 ,   0 ,   0 ,   L " M S   P G o t h i c " ) ; 
 
 
 
                         D W F E m b e d d e d F o n t I m p l _ W i n 3 2 *   p I m p l 2   =   n e w   D W F E m b e d d e d F o n t I m p l _ W i n 3 2 (   h F o n t   ) ; 
 
                         D W F E m b e d d e d F o n t *   p F o n t   =   n e w   D W F E m b e d d e d F o n t (   p I m p l 2   ) ; 
 
 
 
                         / / 
 
                         / /   a d d   j u s t   t h e   c h a r a c t e r s   t h a t   w e r e   u s e d 
 
                         / / 
 
                         p F o n t - > a d d C h a r a c t e r s (   L " åe,gžŠn0Æ0­0¹0È0"   ) ; 
 
 
 
                         r M o d e l . e m b e d F o n t (   p F o n t   ) ; 
 
 # e n d i f 
 
 
 
                 } 
 
                 o P a r t 4 . c l o s e ( ) ; 
 
 
 
 
 
                 / / 
 
                 / /   a d d   a   s p o t l i g h t   t h a t   c a n   b e   t u r n e d   o n   a n d   o f f   i n   t h e   v i e w e r 
 
                 / / 
 
                 D W F S e g m e n t   o L i g h t S e g m e n t   =   o R o o t S e g m e n t . o p e n S e g m e n t ( ) ; 
 
                 o L i g h t S e g m e n t . o p e n (   L " P u r p l e   S p o t l i g h t "   ) ; 
 
                 { 
 
                         / / 
 
                         / /   t h e   l i g h t 
 
                         / / 
 
                         T K _ S p o t _ L i g h t &   r S p o t L i g h t   =   o L i g h t S e g m e n t . g e t S p o t L i g h t H a n d l e r ( ) ; 
 
                         r S p o t L i g h t . S e t O p t i o n s (   T K O _ S p o t _ C o n c e n t r a t i o n   ) ; 
 
                         r S p o t L i g h t . S e t P o s i t i o n (   1 0 . 0 ,   1 0 . 0 ,   1 0 . 0   ) ; 
 
                         r S p o t L i g h t . S e t T a r g e t (   0 . 0 ,   0 . 0 ,   0 . 0   ) ; 
 
                         r S p o t L i g h t . S e t C o n c e n t r a t i o n (   1 . 0   ) ; 
 
                         r S p o t L i g h t . s e r i a l i z e ( ) ; 
 
 
 
                         / / 
 
                         / /   a d d   c o l o r 
 
                         / / 
 
                         T K _ C o l o r _ R G B &   r C o l o r   =   o L i g h t S e g m e n t . g e t C o l o r R G B H a n d l e r ( ) ; 
 
                         r C o l o r . S e t R G B (   1 . 0 ,   0 . 0 ,   1 . 0   ) ; 
 
                         r C o l o r . S e t G e o m e t r y (   T K O _ G e o _ L i g h t   ) ; 
 
                         r C o l o r . s e r i a l i z e ( ) ; 
 
                 } 
 
                 o L i g h t S e g m e n t . c l o s e ( ) ; 
 
         } 
 
         o R o o t S e g m e n t . c l o s e ( ) ; 
 
 
 
         r M o d e l . s e t B o u n d i n g S p h e r e (   0 . 0 f ,   0 . 0 f ,   0 . 0 f ,   1 5 . 0 f   ) ; 
 
 
 
         / / 
 
         / /   w e   c a n   a l s o   a d d   a   t h u m b n a i l   i m a g e   f o r   D W F   C o m p o s e r   R 2 
 
         / / 
 
 
 
         / / 
 
         / /   o p e n   a s   a   s t r e a m i n g   b i n a r y   f i l e 
 
         / / 
 
         D W F S t r e a m F i l e D e s c r i p t o r *   p T h u m b n a i l F i l e   =   n e w   D W F S t r e a m F i l e D e s c r i p t o r (   " t h u m b n a i l . p n g " ,   " r b "   ) ; 
 
         p T h u m b n a i l F i l e - > o p e n ( ) ; 
 
 
 
         / / 
 
         / /   c r e a t e   a   s t r e a m   a n d   a t t a c h   t h e   f i l e   d e s c r i p t o r 
 
         / / 
 
         D W F F i l e I n p u t S t r e a m *   p T h u m b n a i l S t r e a m   =   n e w   D W F F i l e I n p u t S t r e a m ; 
 
         p T h u m b n a i l S t r e a m - > a t t a c h (   p T h u m b n a i l F i l e ,   f a l s e   ) ; 
 
 
 
         / / 
 
         / /   c r e a t e   a   t h u m b n a i l   i m a g e   a n d   a t t a c h   t h e   f i l e   s t r e a m 
 
         / / 
 
         D W F I m a g e *   p T h u m b n a i l   =   D W F C O R E _ A L L O C _ O B J E C T (   D W F I m a g e ( D W F M I M E : : k z M I M E T y p e _ P N G ,   
 
                                                                                                                     D W F I m a g e : : e T h u m b n a i l ,   
 
                                                                                                                     2 4 ,   
 
                                                                                                                     2 1 8 ,   
 
                                                                                                                     2 1 3 )   ) ; 
 
 
 
         i f   ( p T h u m b n a i l ) 
 
         { 
 
                 p T h u m b n a i l - > a t t a c h (   p T h u m b n a i l S t r e a m ,   t r u e   ) ; 
 
 
 
                 / / 
 
                 / /   a d d   t o   t h e   m o d e l 
 
                 / / 
 
                 r M o d e l . a d d R e s o u r c e (   p T h u m b n a i l   ) ; 
 
         } 
 
 } 
 
 
 
 

Generated on Mon May 9 10:56:55 2005 for Autodesk DWF Toolkit by  doxygen 1.4.1