~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: KX_SG_NodeRelationships.cpp,v 1.4 2004/03/22 22:01:52 jesterking Exp $
 
2
 * $Id: KX_SG_NodeRelationships.cpp,v 1.7 2005/03/25 10:33:37 kester Exp $
3
3
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
4
4
 *
5
5
 * This program is free software; you can redistribute it and/or
50
50
        return new KX_NormalParentRelation();
51
51
}               
52
52
 
53
 
        void
 
53
        bool
54
54
KX_NormalParentRelation::
55
55
UpdateChildCoordinates(
56
56
        SG_Spatial * child,
57
57
        const SG_Spatial * parent
58
58
){
59
 
        assert(child != NULL);
 
59
        MT_assert(child != NULL);
60
60
 
61
61
        // This way of accessing child coordinates is a bit cumbersome
62
62
        // be nice to have non constant reference access to these values.
82
82
 
83
83
                child_w_pos = p_world_pos + p_world_scale * 
84
84
                        (p_world_rotation * child_pos);
 
85
                
85
86
        } else {
86
87
 
87
88
                child_w_scale = child_scale;
92
93
        child->SetWorldScale(child_w_scale);
93
94
        child->SetWorldPosition(child_w_pos);
94
95
        child->SetWorldOrientation(child_w_rotation);
 
96
        
 
97
        return parent != NULL;
95
98
}
96
99
 
97
100
        SG_ParentRelation *
130
133
 * Method inherited from KX_ParentRelation
131
134
 */
132
135
 
133
 
        void
 
136
        bool
134
137
KX_VertexParentRelation::
135
138
UpdateChildCoordinates(
136
139
        SG_Spatial * child,
137
140
        const SG_Spatial * parent
138
141
){
139
142
 
140
 
        assert(child != NULL);
 
143
        MT_assert(child != NULL);
141
144
 
142
145
        const MT_Vector3 & child_scale = child->GetLocalScale();
143
146
        const MT_Point3 & child_pos = child->GetLocalPosition();
154
157
                // This is a vertex parent so we do not inherit orientation 
155
158
                // information.
156
159
 
157
 
                const MT_Vector3 & p_world_scale = parent->GetWorldScaling();
 
160
                // const MT_Vector3 & p_world_scale = parent->GetWorldScaling(); /*unused*/
158
161
                const MT_Point3 & p_world_pos = parent->GetWorldPosition();
159
 
                const MT_Matrix3x3 & p_world_rotation = parent->GetWorldOrientation();
 
162
                // const MT_Matrix3x3 & p_world_rotation = parent->GetWorldOrientation(); /*unused*/
160
163
 
161
164
                child_w_scale = child_scale;
162
165
                child_w_rotation = child_rotation;
163
166
                child_w_pos = p_world_pos + child_pos;
164
 
 
165
167
        } else {
166
168
 
167
169
                child_w_scale = child_scale;
172
174
        child->SetWorldScale(child_w_scale);
173
175
        child->SetWorldPosition(child_w_pos);
174
176
        child->SetWorldOrientation(child_w_rotation);
 
177
        
 
178
        return parent != NULL;
175
179
}
176
180
 
177
181
/** 
215
219
 * Method inherited from KX_ParentRelation
216
220
 */
217
221
 
218
 
        void
 
222
        bool
219
223
KX_SlowParentRelation::
220
224
UpdateChildCoordinates(
221
225
        SG_Spatial * child,
222
226
        const SG_Spatial * parent
223
227
){
224
 
        assert(child != NULL);
 
228
        MT_assert(child != NULL);
225
229
 
226
230
        const MT_Vector3 & child_scale = child->GetLocalScale();
227
231
        const MT_Point3 & child_pos = child->GetLocalPosition();
280
284
                                child_w_rotation[1][i] = (m_relax * child_w_rotation[1][i] + child_n_rotation[1][i]) * weight;
281
285
                                child_w_rotation[2][i] = (m_relax * child_w_rotation[2][i] + child_n_rotation[2][i]) * weight;
282
286
                        }
 
287
                        
 
288
                        //FIXME: update physics controller.
283
289
                } else {
284
290
                        child_w_scale = child_n_scale;
285
291
                        child_w_pos = child_n_pos;
297
303
        child->SetWorldScale(child_w_scale);
298
304
        child->SetWorldPosition(child_w_pos);
299
305
        child->SetWorldOrientation(child_w_rotation);
 
306
        
 
307
        return parent != NULL;
300
308
}
301
309
 
302
310
/**