4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program 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
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21 * All rights reserved.
23 * The Original Code is: all of this file.
25 * Contributor(s): none yet.
27 * ***** END GPL LICENSE BLOCK *****
31 /** \file SG_ParentRelation.h
33 * @page SG_ParentRelationPage SG_ParentRelation
35 * @section SG_ParentRelationSection SG_ParentRelation
37 * This is an abstract interface class to the Scene Graph library.
38 * It allows you to specify how child nodes react to parent nodes.
39 * Normally a child will use it's parent's transforms to compute
40 * it's own global transforms. How this is performed depends on
41 * the type of relation. For example if the parent is a vertex
42 * parent to this child then the child should not inherit any
43 * rotation information from the parent. Or if the parent is a
44 * 'slow parent' to this child then the child should react
45 * slowly to changes in the parent's position. The exact relation
46 * is left for you to implement by filling out this interface
47 * with concrete examples.
49 * There is exactly one SG_ParentRelation per SG_Node. Subclasses
50 * should not be value types and should be allocated on the heap.
54 #ifndef __SG_ParentRelation_h
55 #define __SG_ParentRelation_h
59 class SG_ParentRelation {
63 * Update the childs local and global coordinates
64 * based upon the parents global coordinates.
65 * You must also handle the case when this node has no
66 * parent (parent == NULL). Usually you should just
67 * copy the local coordinates of the child to the
73 UpdateChildCoordinates(
75 const SG_Spatial * parent,
85 * You must provide a way of duplicating an
86 * instance of an SG_ParentRelation. This should
87 * return a pointer to a new duplicate allocated
88 * on the heap. Responsibilty for deleting the
89 * duplicate resides with the caller of this method.
98 * Vertex Parent Relation are special: they don't propagate rotation
108 * Need this to see if we are able to adjust time-offset from the python api
119 * Protected constructors
120 * this class is not meant to be instantiated.
128 * Copy construction should not be implemented
132 const SG_ParentRelation &
136 #ifdef WITH_CXX_GUARDEDALLOC
138 void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SG_ParentRelation"); }
139 void operator delete( void *mem ) { MEM_freeN(mem); }