2
// Copyright (C) 1997 - 2001, Paul C. Gregory
4
// Contact: pgregory@aqsis.org
6
// This library is free software; you can redistribute it and/or
7
// modify it under the terms of the GNU 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.
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
// General Public License for more details.
16
// You should have received a copy of the GNU 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
22
\brief Declares the RenderMan context classes.
23
\author Paul C. Gregory (pgregory@aqsis.org)
26
#ifndef CONTEXT_H_INCLUDED
27
#define CONTEXT_H_INCLUDED
29
#include <aqsis/aqsis.h>
34
#include <boost/enable_shared_from_this.hpp>
35
#include <boost/shared_ptr.hpp>
38
#include "attributes.h"
39
#include "transform.h"
46
class CqDeformingSurface;
62
//----------------------------------------------------------------------
63
/** Abstract base class to handle the current context of the renderer,
64
* stores information about the current scoping and previous contexts.
67
class CqModeBlock : public boost::enable_shared_from_this<CqModeBlock>
70
/** Default constructor
71
* \param pconParent a pointer to the previous context.
73
CqModeBlock( const boost::shared_ptr<CqModeBlock>& pconParent, EqModeBlock modetype = Outside);
74
virtual ~CqModeBlock();
76
virtual boost::shared_ptr<CqModeBlock> BeginMainModeBlock();
77
virtual boost::shared_ptr<CqModeBlock> BeginFrameModeBlock();
78
virtual boost::shared_ptr<CqModeBlock> BeginWorldModeBlock();
79
virtual boost::shared_ptr<CqModeBlock> BeginAttributeModeBlock();
80
virtual boost::shared_ptr<CqModeBlock> BeginTransformModeBlock();
81
virtual boost::shared_ptr<CqModeBlock> BeginSolidModeBlock( CqString& type );
82
virtual boost::shared_ptr<CqModeBlock> BeginObjectModeBlock();
83
virtual boost::shared_ptr<CqModeBlock> BeginMotionModeBlock( TqInt N, TqFloat times[] );
84
virtual boost::shared_ptr<CqModeBlock> BeginResourceModeBlock();
88
CqString className() const
90
return CqString("CqModeBlock");
94
/** Delete the main context, overridable per derived class.
95
* \warning If called at this level it is an error, as only the appropriate context can delete itself.
97
virtual void EndMainModeBlock()
101
/** Delete the main context, overridable per derived class.
102
* \warning If called at this level it is an error, as only the appropriate context can delete itself.
104
virtual void EndFrameModeBlock()
108
/** Delete the main context, overridable per derived class.
109
* \warning If caled at this level it is an error, as only the appropriate context can delete itself.
111
virtual void EndWorldModeBlock()
115
/** Delete the main context, overridable per derived class.
116
* \warning If called at this level it is an error, as only the appropriate context can delete itself.
118
virtual void EndAttributeModeBlock()
122
/** Delete the main context, overridable per derived class.
123
* \warning If called at this level it is an error, as only the appropriate context can delete itself.
125
virtual void EndTransformModeBlock()
129
/** Delete the main context, overridable per derived class.
130
* \warning If called at this level it is an error, as only the appropriate context can delete itself.
132
virtual void EndSolidModeBlock()
136
/** Delete the main context, overridable per derived class.
137
* \warning If called at this level it is an error, as only the appropriate context can delete itself.
139
virtual void EndObjectModeBlock()
143
/** Delete the main context, overridable per derived class.
144
* \warning If called at this level it is an error, as only the appropriate context can delete itself.
146
virtual void EndMotionModeBlock()
150
/** Delete the main context, overridable per derived class.
151
* \warning If called at this level it is an error, as only the appropriate context can delete itself.
153
virtual void EndResourceModeBlock()
157
virtual IqOptionsPtr poptCurrent() const
159
return( m_poptCurrent );
161
virtual IqOptionsPtr poptWriteCurrent()
163
if(!m_poptCurrent.unique())
164
m_poptCurrent = CqOptionsPtr(new CqOptions(*m_poptCurrent.get()));
165
return(m_poptCurrent);
167
/** Push the current options onto a stack, allowing modification of the options
168
* and recovery of the current state at a later point.
170
virtual IqOptionsPtr pushOptions() = 0;
171
/** Pop a previously pushed copy of the options from the stack.
173
virtual IqOptionsPtr popOptions() = 0;
174
/** Get a read only pointer to the current attributes.
175
* \return a pointer to the current attributes.
177
virtual CqAttributesPtr pattrCurrent() const
179
return ( m_pattrCurrent );
181
/** Set the current set of attributes
182
* \return a pointer to the old attributes.
184
virtual CqAttributesPtr pattrCurrent(CqAttributesPtr& newattrs)
186
CqAttributesPtr prev = m_pattrCurrent;
187
m_pattrCurrent = newattrs;
190
/** Get a pointer to the current attributes suitable for writing.
191
* \return an attribute pointer.
193
virtual CqAttributesPtr pattrWriteCurrent()
195
m_pattrCurrent = m_pattrCurrent->Write();
196
return ( m_pattrCurrent );
198
/** Get a read only pointer to the current transform.
199
* \return a pointer to the current transform.
201
virtual CqTransformPtr ptransCurrent() const
203
return ( m_ptransCurrent );
205
/** Set the current transform.
206
* \return a pointer to the old transform.
208
virtual CqTransformPtr ptransSetCurrent(const CqTransformPtr& NewTrans)
210
CqTransformPtr prev = m_ptransCurrent;
211
m_ptransCurrent = NewTrans;
214
/** Get the current time, used only within Motion blocks, all other contexts return 0.
215
* \return the current frame time as a float.
217
virtual TqFloat Time() const
221
/// Advance the current frame time to the next specified time.
222
virtual void AdvanceTime()
224
/// Get the current frame index if in a motion block.
225
virtual TqInt TimeIndex() const
229
/** Is this a motion block, should be overridden per derived class.
230
* \return boolean indicating whether this is a motion block.
232
virtual bool fMotionBlock() const
237
/** Get a pointer to the previuos context.
238
* \return a context pointer.
240
boost::shared_ptr<CqModeBlock> pconParent()
242
return ( m_pconParent );
244
const boost::shared_ptr<CqModeBlock> pconParent() const
246
return ( m_pconParent );
250
* \return a m_ModeType;
254
return ( m_modetype );
256
/** Get a reference to the current transformation matrix, the result of combining all transformations up to this point.
257
* \return a matrix reference.
259
const CqMatrix& matCurrent( TqFloat time ) const
261
return ( ptransCurrent() ->matObjectToWorld( time ) );
264
virtual void AddContextLightSource( const CqLightsourcePtr& pLS )
267
pconParent() ->AddContextLightSource( pLS );
270
virtual bool isSolid()
272
return ( ( pconParent() ) ? pconParent() ->isSolid() : false );
274
/** Get a pointer to the CSG tree node related to this context.
275
* \return an options reference.
277
virtual boost::shared_ptr<CqCSGTreeNode> pCSGNode()
279
return ( ( pconParent() ) ? pconParent() ->pCSGNode() : boost::shared_ptr<CqCSGTreeNode>() );
282
/** Log invalid context nesting
284
virtual void logInvalidNesting() const;
287
CqAttributesPtr m_pattrCurrent; ///< The current attributes.
288
CqTransformPtr m_ptransCurrent; ///< The current transformation.
289
CqOptionsPtr m_poptCurrent;
292
boost::shared_ptr<CqModeBlock> m_pconParent; ///< The previous context.
293
EqModeBlock m_modetype; ///< The current type of motionblock in order to double check the delete
298
//----------------------------------------------------------------------
299
/** Define the context that exists between calls to RiBegin/RiEnd.
302
class CqMainModeBlock : public CqModeBlock
305
CqMainModeBlock( const boost::shared_ptr<CqModeBlock>& pconParent );
306
virtual ~CqMainModeBlock();
308
/** Create a main context.
309
* \warning It is an error to call this within a main context block.
311
virtual boost::shared_ptr<CqModeBlock> BeginMainModeBlock()
313
return boost::shared_ptr<CqModeBlock>();
316
/** Delete the main context.
317
* \attention This is the only valid context deletion from within this block.
319
virtual void EndMainModeBlock()
322
virtual IqOptionsPtr poptCurrent() const
324
return( m_poptCurrent );
326
virtual IqOptionsPtr poptWriteCurrent()
328
if(!m_poptCurrent.unique())
329
m_poptCurrent = CqOptionsPtr(new CqOptions(*m_poptCurrent.get()));
330
return(m_poptCurrent);
332
virtual IqOptionsPtr pushOptions()
334
CqOptionsPtr opts = CqOptionsPtr(new CqOptions(*m_poptCurrent.get()));
335
m_optionsStack.push(m_poptCurrent);
336
m_poptCurrent = opts;
337
return(m_poptCurrent);
339
virtual IqOptionsPtr popOptions()
341
assert(!m_optionsStack.empty());
342
CqOptionsPtr opts = m_optionsStack.top();
343
m_poptCurrent = opts;
344
m_optionsStack.pop();
345
return(m_poptCurrent);
349
std::stack<CqOptionsPtr> m_optionsStack;
354
//----------------------------------------------------------------------
355
/** Define the context that exists between calls to RiFrameBegin/RiFrameEnd.
358
class CqFrameModeBlock : public CqModeBlock
361
CqFrameModeBlock( const boost::shared_ptr<CqModeBlock>& pconParent );
362
virtual ~CqFrameModeBlock();
364
/** Create a main context.
365
* \warning It is an error to call this within a frame context.
367
virtual boost::shared_ptr<CqModeBlock> BeginMainModeBlock()
369
return boost::shared_ptr<CqModeBlock>();
371
/** Create a frame context.
372
* \warning It is an error to call this within a frame context.
374
virtual boost::shared_ptr<CqModeBlock> BeginFrameModeBlock()
376
return boost::shared_ptr<CqModeBlock>();
378
/** Create a solid context.
379
* \warning It is an error to call this within a frame context
381
virtual boost::shared_ptr<CqModeBlock> BeginSolidModeBlock( CqString& /* type */ )
383
return boost::shared_ptr<CqModeBlock>();
386
/** Delete the frame context.
387
* \attention This is the only valid context deletion from within this block.
389
virtual void EndFrameModeBlock()
392
virtual IqOptionsPtr poptCurrent() const
394
return( m_poptCurrent );
396
virtual IqOptionsPtr poptWriteCurrent()
398
if(!m_poptCurrent.unique())
399
m_poptCurrent = CqOptionsPtr(new CqOptions(*m_poptCurrent.get()));
400
return(m_poptCurrent);
402
virtual IqOptionsPtr pushOptions()
404
CqOptionsPtr opts = CqOptionsPtr(new CqOptions(*m_poptCurrent.get()));
405
m_optionsStack.push(m_poptCurrent);
406
m_poptCurrent = opts;
407
return(m_poptCurrent);
409
virtual IqOptionsPtr popOptions()
411
assert(!m_optionsStack.empty());
412
CqOptionsPtr opts = m_optionsStack.top();
413
m_poptCurrent = opts;
414
m_optionsStack.pop();
415
return(m_poptCurrent);
419
std::stack<CqOptionsPtr> m_optionsStack;
424
//----------------------------------------------------------------------
425
/** Define the context that exists between calls to RiWorldBegin/RiWorldEnd.
428
class CqWorldModeBlock : public CqModeBlock
431
CqWorldModeBlock( const boost::shared_ptr<CqModeBlock>& pconParent );
432
virtual ~CqWorldModeBlock();
434
/** Create a main context.
435
* \warning It is an error to call this within a world context.
437
virtual boost::shared_ptr<CqModeBlock> BeginMainModeBlock()
439
return boost::shared_ptr<CqModeBlock>();
441
/** Create a frame context.
442
* \warning It is an error to call this within a world context.
444
virtual boost::shared_ptr<CqModeBlock> BeginFrameModeBlock()
446
return boost::shared_ptr<CqModeBlock>();
448
/** Create a world context.
449
* \warning It is an error to call this within a world context.
451
virtual boost::shared_ptr<CqModeBlock> BeginWorldModeBlock()
453
return boost::shared_ptr<CqModeBlock>();
456
/** Delete the world context.
457
* \attention This is the only valid context deletion from within this block.
459
virtual void EndWorldModeBlock()
462
virtual IqOptionsPtr poptCurrent() const
464
return( pconParent()->poptCurrent() );
466
virtual IqOptionsPtr poptWriteCurrent()
468
return( pconParent()->poptWriteCurrent() );
470
virtual IqOptionsPtr pushOptions()
472
return(pconParent()->pushOptions());
474
virtual IqOptionsPtr popOptions()
476
return(pconParent()->popOptions());
479
virtual void AddContextLightSource( const CqLightsourcePtr& pLS );
482
std::vector<CqLightsourcePtr> m_apWorldLights;
486
//----------------------------------------------------------------------
487
/** Define the context that exists between calls to RiAttributeBegin/RiAttributeEnd.
490
class CqAttributeModeBlock : public CqModeBlock
493
CqAttributeModeBlock( const boost::shared_ptr<CqModeBlock>& pconParent );
494
virtual ~CqAttributeModeBlock();
496
/** Create a main context.
497
* \warning It is an error to call this within a attribute context.
499
virtual boost::shared_ptr<CqModeBlock> BeginMainModeBlock()
501
return boost::shared_ptr<CqModeBlock>();
503
/** Create a frame context.
504
* \warning It is an error to call this within a attribute context.
506
virtual boost::shared_ptr<CqModeBlock> BeginFrameModeBlock()
508
return boost::shared_ptr<CqModeBlock>();
510
/** Create a world context.
511
* \warning It is an error to call this within a attribute context.
513
virtual boost::shared_ptr<CqModeBlock> BeginWorldModeBlock()
515
return boost::shared_ptr<CqModeBlock>();
518
/** Delete the attribute context.
519
* \attention This is the only valid context deletion from within this block.
521
virtual void EndAttributeModeBlock()
524
virtual IqOptionsPtr poptCurrent() const
526
return( pconParent()->poptCurrent() );
528
virtual IqOptionsPtr poptWriteCurrent()
530
return( pconParent()->poptWriteCurrent() );
532
virtual IqOptionsPtr pushOptions()
534
return(pconParent()->pushOptions());
536
virtual IqOptionsPtr popOptions()
538
return(pconParent()->popOptions());
545
//----------------------------------------------------------------------
546
/** Define the context that exists between calls to RiTransformBegin/RiTransformEnd.
549
class CqTransformModeBlock : public CqModeBlock
552
CqTransformModeBlock( const boost::shared_ptr<CqModeBlock>& pconParent );
553
virtual ~CqTransformModeBlock();
555
/** Create a main context.
556
* \warning It is an error to call this within a transform context.
558
virtual boost::shared_ptr<CqModeBlock> BeginMainModeBlock()
560
return boost::shared_ptr<CqModeBlock>();
562
/** Create a frame context.
563
* \warning It is an error to call this within a transform context.
565
virtual boost::shared_ptr<CqModeBlock> BeginFrameModeBlock()
567
return boost::shared_ptr<CqModeBlock>();
569
/** Create a world context.
570
* \warning It is an error to call this within a transform context.
572
virtual boost::shared_ptr<CqModeBlock> BeginWorldModeBlock()
574
return boost::shared_ptr<CqModeBlock>();
577
/** Delete the transform context.
578
* \attention This is the only valid context deletion from within this block.
580
virtual void EndTransformModeBlock()
583
virtual IqOptionsPtr poptCurrent() const
585
return( pconParent()->poptCurrent() );
587
virtual IqOptionsPtr poptWriteCurrent()
589
return( pconParent()->poptWriteCurrent() );
591
virtual IqOptionsPtr pushOptions()
593
return(pconParent()->pushOptions());
595
virtual IqOptionsPtr popOptions()
597
return(pconParent()->popOptions());
604
//----------------------------------------------------------------------
605
/** Define the context that exists between calls to RiSolidBegin/RiSolidEnd.
608
class CqSolidModeBlock : public CqModeBlock
611
CqSolidModeBlock( CqString& type, const boost::shared_ptr<CqModeBlock>& pconParent );
612
virtual ~CqSolidModeBlock();
614
/** Create a main context.
615
* \warning It is an error to call this within a solid context.
617
virtual boost::shared_ptr<CqModeBlock> BeginMainModeBlock()
619
return boost::shared_ptr<CqModeBlock>();
621
/** Create a frame context.
622
* \warning It is an error to call this within a solid context.
624
virtual boost::shared_ptr<CqModeBlock> BeginFrameModeBlock()
626
return boost::shared_ptr<CqModeBlock>();
628
/** Create a world context.
629
* \warning It is an error to call this within a solid context.
631
virtual boost::shared_ptr<CqModeBlock> BeginWorldModeBlock()
633
return boost::shared_ptr<CqModeBlock>();
636
/** Delete the solid context.
637
* \attention This is the only valid context deletion from within this block.
639
virtual void EndSolidModeBlock()
642
virtual IqOptionsPtr poptCurrent() const
644
return( pconParent()->poptCurrent() );
646
virtual IqOptionsPtr poptWriteCurrent()
648
return( pconParent()->poptWriteCurrent() );
650
virtual IqOptionsPtr pushOptions()
652
return(pconParent()->pushOptions());
654
virtual IqOptionsPtr popOptions()
656
return(pconParent()->popOptions());
660
virtual bool isSolid()
664
virtual boost::shared_ptr<CqCSGTreeNode> pCSGNode()
666
return ( m_pCSGNode );
670
boost::shared_ptr<CqCSGTreeNode> m_pCSGNode; ///< Pointer to the node in the CSG tree for this level in the solid definition.
676
//----------------------------------------------------------------------
677
/** Define the context that exists between calls to RiObjectBegin/RiObjectEnd.
680
class CqObjectModeBlock : public CqModeBlock
683
CqObjectModeBlock( const boost::shared_ptr<CqModeBlock>& pconParent );
684
virtual ~CqObjectModeBlock();
686
/** Create a main context.
687
* \warning It is an error to call this within an object context.
689
virtual boost::shared_ptr<CqModeBlock> BeginMainModeBlock()
691
return boost::shared_ptr<CqModeBlock>();
693
/** Create a frame context.
694
* \warning It is an error to call this within an object context.
696
virtual boost::shared_ptr<CqModeBlock> BeginFrameModeBlock()
698
return boost::shared_ptr<CqModeBlock>();
700
/** Create a world context.
701
* \warning It is an error to call this within an object context.
703
virtual boost::shared_ptr<CqModeBlock> BeginWorldModeBlock()
705
return boost::shared_ptr<CqModeBlock>();
708
/** Delete the object context.
709
* \attention This is the only valid context deletion from within this block.
711
virtual void EndObjectModeBlock()
714
virtual IqOptionsPtr poptCurrent() const
716
return( pconParent()->poptCurrent() );
718
virtual IqOptionsPtr poptWriteCurrent()
720
return( pconParent()->poptWriteCurrent() );
722
virtual IqOptionsPtr pushOptions()
724
return(pconParent()->pushOptions());
726
virtual IqOptionsPtr popOptions()
728
return(pconParent()->popOptions());
730
/** Get a pointer suitable for writing to the attributes at the parent context, as object context doesn't store attributes.
731
* \return an attributes pointer.
733
virtual CqAttributesPtr pattrCurrent() const
735
return ( pconParent() ->pattrCurrent() );
737
/** Get a pointer to the attributes at the parent context, as object context doesn't store attributes.
738
* \return an attributes pointer.
740
virtual CqAttributesPtr pattrWriteCurrent()
743
return CqAttributesPtr();
744
} // Illegal to change attributes here.
750
//----------------------------------------------------------------------
751
/** Define the context that exists between calls to RiMotionBegin/RiMotionEnd.
754
class CqMotionModeBlock : public CqModeBlock
757
CqMotionModeBlock( TqInt N, TqFloat times[], const boost::shared_ptr<CqModeBlock>& pconParent );
758
virtual ~CqMotionModeBlock();
760
/** Create a main context.
761
* \warning It is an error to call this within a motion context.
763
virtual boost::shared_ptr<CqModeBlock> BeginMainModeBlock()
765
return boost::shared_ptr<CqModeBlock>();
767
/** Create a frame context.
768
* \warning It is an error to call this within a motion context.
770
virtual boost::shared_ptr<CqModeBlock> BeginFrameModeBlock()
772
return boost::shared_ptr<CqModeBlock>();
774
/** Create a world context.
775
* \warning It is an error to call this within a motion context.
777
virtual boost::shared_ptr<CqModeBlock> BeginWorldModeBlock()
779
return boost::shared_ptr<CqModeBlock>();
781
/** Create a attribute context.
782
* \warning It is an error to call this within a motion context.
784
virtual boost::shared_ptr<CqModeBlock> BeginAttributeModeBlock()
786
return boost::shared_ptr<CqModeBlock>();
788
/** Create a transform context.
789
* \warning It is an error to call this within a motion context.
791
virtual boost::shared_ptr<CqModeBlock> BeginTransformModeBlock()
793
return boost::shared_ptr<CqModeBlock>();
795
/** Create a solid context.
796
* \warning It is an error to call this within a motion context.
798
virtual boost::shared_ptr<CqModeBlock> BeginSolidModeBlock( CqString& /* type */ )
800
return boost::shared_ptr<CqModeBlock>();
802
/** Create a object context.
803
* \warning It is an error to call this within a motion context.
805
virtual boost::shared_ptr<CqModeBlock> BeginObjectModeBlock()
807
return boost::shared_ptr<CqModeBlock>();
809
/** Create a motion context.
810
* \warning It is an error to call this within a motion context.
812
virtual boost::shared_ptr<CqModeBlock> BeginMotionModeBlock( TqInt /* N */, TqFloat /* times */[] )
814
return boost::shared_ptr<CqModeBlock>();
817
/** Delete the object context.
818
* \attention This is the only valid context deletion from within this block.
820
virtual void EndMotionModeBlock();
822
virtual IqOptionsPtr poptCurrent() const
824
return( pconParent()->poptCurrent() );
826
virtual IqOptionsPtr poptWriteCurrent()
828
return( pconParent()->poptWriteCurrent() );
830
virtual IqOptionsPtr pushOptions()
832
return(pconParent()->pushOptions());
834
virtual IqOptionsPtr popOptions()
836
return(pconParent()->popOptions());
839
/** Get the current time, as specified at initialisation of the block.
840
* \return the current time as a float, or if beyond the last time specified, 0.
842
virtual TqFloat Time() const
844
if ( m_iTime < m_aTimes.size() )
845
return ( m_aTimes[ m_iTime ] );
849
/// Advance the current time to the next specified time.
850
virtual void AdvanceTime()
854
/// Get the current frame index if in a motion block.
855
virtual TqInt TimeIndex() const
859
/** Indicate that this is a motion block.
860
* \return boolean indicating whether this is a motion block.
862
virtual bool fMotionBlock() const
866
/** Get the CqDeformingSurface, if generating a deformation motion blur sequence.
868
virtual boost::shared_ptr<CqDeformingSurface> GetDeformingSurface() const
870
return( m_pDeformingSurface );
872
/** Set the CqDeformingSurface, if generating a deformation motion blur sequence.
874
virtual void SetDeformingSurface( const boost::shared_ptr<CqDeformingSurface>& pMotionSurface);
877
TqUint m_iTime; ///< The index of the current frame time.
878
std::vector<TqFloat> m_aTimes; ///< An array of specified frame times.
879
boost::shared_ptr<CqDeformingSurface> m_pDeformingSurface;
883
//----------------------------------------------------------------------
884
/** Define the context that exists between calls to RiResourceBegin/RiResourceEnd.
887
class CqResourceModeBlock : public CqModeBlock
890
CqResourceModeBlock( const boost::shared_ptr<CqModeBlock>& pconParent );
891
virtual ~CqResourceModeBlock();
893
/** Create a main context.
894
* \warning It is an error to call this within a attribute context.
896
virtual boost::shared_ptr<CqModeBlock> BeginMainModeBlock()
898
return boost::shared_ptr<CqModeBlock>();
900
/** Create a frame context.
901
* \warning It is an error to call this within a attribute context.
903
virtual boost::shared_ptr<CqModeBlock> BeginFrameModeBlock()
905
return boost::shared_ptr<CqModeBlock>();
907
/** Create a world context.
908
* \warning It is an error to call this within a attribute context.
910
virtual boost::shared_ptr<CqModeBlock> BeginWorldModeBlock()
912
return boost::shared_ptr<CqModeBlock>();
915
/** Delete the attribute context.
916
* \attention This is the only valid context deletion from within this block.
918
virtual void EndResourceModeBlock()
921
virtual IqOptionsPtr poptCurrent() const
923
return( pconParent()->poptCurrent() );
925
virtual IqOptionsPtr poptWriteCurrent()
927
return( pconParent()->poptWriteCurrent() );
929
virtual IqOptionsPtr pushOptions()
931
return(pconParent()->pushOptions());
933
virtual IqOptionsPtr popOptions()
935
return(pconParent()->popOptions());
943
// Note: These inline functions are defined here to allow full definition of all
944
// required classes first.
947
//----------------------------------------------------------------------
948
/** Create a new main context, and link it to the current one.
949
* \return a pointer to the new context.
952
inline boost::shared_ptr<CqModeBlock> CqModeBlock::BeginMainModeBlock()
954
return boost::shared_ptr<CqModeBlock>( new CqMainModeBlock( shared_from_this() ) );
958
//----------------------------------------------------------------------
959
/** Create a new frame context, and link it to the current one.
960
* \return a pointer to the new context.
963
inline boost::shared_ptr<CqModeBlock> CqModeBlock::BeginFrameModeBlock()
965
return boost::shared_ptr<CqModeBlock>( new CqFrameModeBlock( shared_from_this() ) );
969
//----------------------------------------------------------------------
970
/** Create a new world context, and link it to the current one.
971
* \return a pointer to the new context.
974
inline boost::shared_ptr<CqModeBlock> CqModeBlock::BeginWorldModeBlock()
976
return boost::shared_ptr<CqModeBlock>( new CqWorldModeBlock( shared_from_this() ) );
980
//----------------------------------------------------------------------
981
/** Create a new attribute context, and link it to the current one.
982
* \return a pointer to the new context.
985
inline boost::shared_ptr<CqModeBlock> CqModeBlock::BeginAttributeModeBlock()
987
return boost::shared_ptr<CqModeBlock>( new CqAttributeModeBlock( shared_from_this() ) );
991
//----------------------------------------------------------------------
992
/** Create a new transform context, and link it to the current one.
993
* \return a pointer to the new context.
996
inline boost::shared_ptr<CqModeBlock> CqModeBlock::BeginTransformModeBlock()
998
return boost::shared_ptr<CqModeBlock>( new CqTransformModeBlock( shared_from_this() ) );
1002
//----------------------------------------------------------------------
1003
/** Create a new solid context, and link it to the current one.
1004
* \return a pointer to the new context.
1007
inline boost::shared_ptr<CqModeBlock> CqModeBlock::BeginSolidModeBlock( CqString& type )
1009
return boost::shared_ptr<CqModeBlock>( new CqSolidModeBlock( type, shared_from_this() ) );
1013
//----------------------------------------------------------------------
1014
/** Create a new object context, and link it to the current one.
1015
* \return a pointer to the new context.
1018
inline boost::shared_ptr<CqModeBlock> CqModeBlock::BeginObjectModeBlock()
1020
return boost::shared_ptr<CqModeBlock>( new CqObjectModeBlock( shared_from_this() ) );
1024
//----------------------------------------------------------------------
1025
/** Create a new motion context, and link it to the current one.
1026
* \return a pointer to the new context.
1029
inline boost::shared_ptr<CqModeBlock> CqModeBlock::BeginMotionModeBlock( TqInt N, TqFloat times[] )
1031
return boost::shared_ptr<CqModeBlock>( new CqMotionModeBlock( N, times, shared_from_this() ) );
1034
//----------------------------------------------------------------------
1035
/** Create a new resource context, and link it to the current one.
1036
* \return a pointer to the new context.
1039
inline boost::shared_ptr<CqModeBlock> CqModeBlock::BeginResourceModeBlock()
1041
return boost::shared_ptr<CqModeBlock>( new CqResourceModeBlock( shared_from_this() ) );
1043
//-----------------------------------------------------------------------
1045
} // namespace Aqsis