~ubuntu-branches/ubuntu/saucy/choreonoid/saucy-proposed

« back to all changes in this revision

Viewing changes to debian/patches/0008-Fix-OpenSceneGraph-compilation-issues.patch

  • Committer: Package Import Robot
  • Author(s): Thomas Moulard
  • Date: 2013-09-25 14:36:11 UTC
  • Revision ID: package-import@ubuntu.com-20130925143611-bmig0m50v8hrxo5s
Tags: 1.1.0+dfsg-6
* Remove debian/libcnoid1.symbols (Closes: #708991, #713355)
* Add patch to fix OpenScene Graph compilation issues
  (Closes: #719387, #719387)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From: Thomas Moulard <thomas.moulard@gmail.com>
 
2
Date: Wed, 25 Sep 2013 14:45:09 +0900
 
3
Subject: Fix OpenSceneGraph compilation issues
 
4
 
 
5
Fix OpenSceneGraph compilation issues
 
6
 
 
7
Forwarded: yes
 
8
Author: Thomas Moulard <thomas.moulard@gmail.com>
 
9
---
 
10
 src/Base/OsgNormalVisualizer.cpp | 60 +++++++++++++++++++++-------------------
 
11
 src/Base/ScenePieces.cpp         |  6 ++--
 
12
 src/Base/ScenePieces.h           |  2 +-
 
13
 src/Base/SceneView.cpp           |  8 +++---
 
14
 src/Base/VrmlToOsgConverter.cpp  | 38 ++++++++++++-------------
 
15
 5 files changed, 58 insertions(+), 56 deletions(-)
 
16
 
 
17
diff --git a/src/Base/OsgNormalVisualizer.cpp b/src/Base/OsgNormalVisualizer.cpp
 
18
index 2d84167..dd42e7a 100644
 
19
--- a/src/Base/OsgNormalVisualizer.cpp
 
20
+++ b/src/Base/OsgNormalVisualizer.cpp
 
21
@@ -7,16 +7,16 @@
 
22
 using namespace cnoid;
 
23
 
 
24
 namespace {
 
25
-    
 
26
+
 
27
     class NormalExtractor : public osg::NodeVisitor
 
28
     {
 
29
     public:
 
30
         NormalExtractor(float normalScale = 1.0, NormalVisualizer::Mode mode = NormalVisualizer::SURFACE);
 
31
-        
 
32
+
 
33
         void apply(osg::Geode& geode);
 
34
-        
 
35
+
 
36
         osg::Vec3Array* getNormalLines() { return normalLines.get(); }
 
37
-        
 
38
+
 
39
     private:
 
40
         NormalVisualizer::Mode mode;
 
41
         float scale;
 
42
@@ -29,14 +29,14 @@ namespace {
 
43
         osg::Vec3Array* normals;
 
44
         osg::Vec3Array::iterator normalIter;
 
45
         osg::UIntArray::iterator normalIndexIter;
 
46
-        
 
47
+
 
48
         void extractOverallNormal();
 
49
         void extractPrimitiveSetNormal(const osg::PrimitiveSet* primitiveSet);
 
50
         void extractPrimitiveNormals(
 
51
-            const osg::PrimitiveSet* primitiveSet, osg::Geometry::AttributeBinding binding, int numVertices);
 
52
+            const osg::PrimitiveSet* primitiveSet, deprecated_osg::Geometry::AttributeBinding binding, int numVertices);
 
53
         void extractPolygonNormals(const osg::PrimitiveSet* primitiveSet);
 
54
     };
 
55
-}    
 
56
+}
 
57
 
 
58
 
 
59
 NormalVisualizer::NormalVisualizer(Node *node, float scale, Mode mode)
 
60
@@ -44,7 +44,7 @@ NormalVisualizer::NormalVisualizer(Node *node, float scale, Mode mode)
 
61
     NormalExtractor extractor(scale, mode);
 
62
     node->accept(extractor);
 
63
 
 
64
-    osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
 
65
+    osg::ref_ptr<deprecated_osg::Geometry> geom = new deprecated_osg::Geometry;
 
66
 
 
67
     osg::ref_ptr<osg::Vec3Array> lines = extractor.getNormalLines();
 
68
     geom->setVertexArray(lines.get());
 
69
@@ -52,7 +52,7 @@ NormalVisualizer::NormalVisualizer(Node *node, float scale, Mode mode)
 
70
 
 
71
     osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array;
 
72
     geom->setColorArray(colors.get());
 
73
-    geom->setColorBinding(osg::Geometry::BIND_OVERALL);
 
74
+    geom->setColorBinding(deprecated_osg::Geometry::BIND_OVERALL);
 
75
     if(mode == SURFACE){
 
76
         colors->push_back(osg::Vec4(1.0, 0.0, 0.0, 1.0));
 
77
     } else if(mode == VERTEX) {
 
78
@@ -78,38 +78,40 @@ NormalExtractor::NormalExtractor(float normalScale, NormalVisualizer::Mode mode)
 
79
 void NormalExtractor::apply(osg::Geode& geode)
 
80
 {
 
81
     for(size_t i = 0; i < geode.getNumDrawables(); i++ ){
 
82
-        osg::Geometry* geom = dynamic_cast<osg::Geometry*>(geode.getDrawable(i));
 
83
+        deprecated_osg::Geometry* geom = dynamic_cast<deprecated_osg::Geometry*>(geode.getDrawable(i));
 
84
         if(geom){
 
85
             vertices = dynamic_cast<osg::Vec3Array*>(geom->getVertexArray());
 
86
             if(!vertices) continue;
 
87
             normals  = dynamic_cast<osg::Vec3Array*>(geom->getNormalArray());
 
88
             if(!normals) continue;
 
89
-            osg::Geometry::AttributeBinding binding = geom->getNormalBinding();
 
90
-            if(binding == osg::Geometry::BIND_OFF) continue;
 
91
+            deprecated_osg::Geometry::AttributeBinding binding = geom->getNormalBinding();
 
92
+            if(binding == deprecated_osg::Geometry::BIND_OFF) continue;
 
93
 
 
94
-            if(binding == osg::Geometry::BIND_OVERALL){
 
95
+            if(binding == deprecated_osg::Geometry::BIND_OVERALL){
 
96
                 extractOverallNormal();
 
97
 
 
98
             } else {
 
99
-                osg::Geometry::PrimitiveSetList& primitiveSets = geom->getPrimitiveSetList();
 
100
-                
 
101
+                deprecated_osg::Geometry::PrimitiveSetList& primitiveSets = geom->getPrimitiveSetList();
 
102
+
 
103
                 vertexIter = vertices->begin();
 
104
                 normalIter = normals->begin();
 
105
 
 
106
-                osg::IntArray* vertexIndices = dynamic_cast<osg::IntArray*>(geom->getVertexIndices());
 
107
+                osg::IntArray* vertexIndices = const_cast<osg::IntArray*>
 
108
+                 (dynamic_cast<const osg::IntArray*>(geom->getVertexIndices()));
 
109
                 if(vertexIndices){
 
110
                     vertexIndexIter = vertexIndices->begin();
 
111
                 }
 
112
-                osg::UIntArray* normalIndices = dynamic_cast<osg::UIntArray*>(geom->getNormalIndices());
 
113
+                osg::UIntArray* normalIndices = const_cast<osg::UIntArray*>
 
114
+                 (dynamic_cast<const osg::UIntArray*>(geom->getNormalIndices()));
 
115
                 if(normalIndices){
 
116
                     normalIndexIter = normalIndices->begin();
 
117
                 }
 
118
-                
 
119
-                osg::Geometry::PrimitiveSetList::iterator it;
 
120
+
 
121
+                deprecated_osg::Geometry::PrimitiveSetList::iterator it;
 
122
                 for(it = primitiveSets.begin(); it != primitiveSets.end(); ++it){
 
123
                     osg::PrimitiveSet* primitiveSet = it->get();
 
124
 
 
125
-                    if(binding == osg::Geometry::BIND_PER_PRIMITIVE_SET){
 
126
+                    if(binding == deprecated_osg::Geometry::BIND_PER_PRIMITIVE_SET){
 
127
                         extractPrimitiveSetNormal(primitiveSet);
 
128
                     } else {
 
129
                         switch(primitiveSet->getMode()){
 
130
@@ -165,30 +167,30 @@ void NormalExtractor::extractPrimitiveSetNormal(const osg::PrimitiveSet* primiti
 
131
 
 
132
 
 
133
 void NormalExtractor::extractPrimitiveNormals
 
134
-(const osg::PrimitiveSet* primitiveSet, osg::Geometry::AttributeBinding binding, int numVertices)
 
135
+(const osg::PrimitiveSet* primitiveSet, deprecated_osg::Geometry::AttributeBinding binding, int numVertices)
 
136
 {
 
137
     for(size_t i=0; i < primitiveSet->getNumPrimitives(); ++i){
 
138
-        
 
139
-        if(mode == NormalVisualizer::SURFACE || binding == osg::Geometry::BIND_PER_PRIMITIVE){
 
140
+
 
141
+        if(mode == NormalVisualizer::SURFACE || binding == deprecated_osg::Geometry::BIND_PER_PRIMITIVE){
 
142
             osg::Vec3 n(0.0, 0.0, 0.0);
 
143
-            if(binding == osg::Geometry::BIND_PER_PRIMITIVE){
 
144
+            if(binding == deprecated_osg::Geometry::BIND_PER_PRIMITIVE){
 
145
                 n = *(normalIter++);
 
146
-            } else if(binding == osg::Geometry::BIND_PER_VERTEX){
 
147
+            } else if(binding == deprecated_osg::Geometry::BIND_PER_VERTEX){
 
148
                 for(int j = 0; j < numVertices; ++j){
 
149
                     n += *(normalIter++);
 
150
                 }
 
151
-                n /= numVertices; 
 
152
+                n /= numVertices;
 
153
             }
 
154
-            
 
155
+
 
156
             osg::Vec3 v(0.0, 0.0, 0.0);
 
157
             for(int j = 0; j < numVertices; ++j){
 
158
                 v += *(vertexIter++);
 
159
             }
 
160
             v /= numVertices;
 
161
-            
 
162
+
 
163
             normalLines->push_back(v);
 
164
             normalLines->push_back(v + n * scale);
 
165
-            
 
166
+
 
167
         } else if(mode == NormalVisualizer::VERTEX){
 
168
             for(int j = 0; j < numVertices; ++j){
 
169
                 osg::Vec3& v = *(vertexIter++);
 
170
diff --git a/src/Base/ScenePieces.cpp b/src/Base/ScenePieces.cpp
 
171
index 85e44d1..72fc803 100644
 
172
--- a/src/Base/ScenePieces.cpp
 
173
+++ b/src/Base/ScenePieces.cpp
 
174
@@ -15,9 +15,9 @@ using namespace cnoid;
 
175
 
 
176
 namespace {
 
177
 
 
178
-    osg::Geometry* createCrossGeometry(const osg::Vec4& color, float size, float lineWidth)
 
179
+    deprecated_osg::Geometry* createCrossGeometry(const osg::Vec4& color, float size, float lineWidth)
 
180
     {
 
181
-        osg::Geometry* geom = new osg::Geometry;
 
182
+        deprecated_osg::Geometry* geom = new deprecated_osg::Geometry;
 
183
         osg::StateSet* state = geom->getOrCreateStateSet();
 
184
 
 
185
         state->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
 
186
@@ -204,7 +204,7 @@ AttitudeDragger::AttitudeDragger()
 
187
         const int y = axes[i][1];
 
188
         const int z = axes[i][2];
 
189
 
 
190
-        osg::Geometry* geometry = new osg::Geometry();
 
191
+        deprecated_osg::Geometry* geometry = new deprecated_osg::Geometry();
 
192
         osg::Vec3Array* vertices = new osg::Vec3Array();
 
193
         osg::DrawElementsUShort* face = new osg::DrawElementsUShort(osg::PrimitiveSet::QUADS, 0);
 
194
 
 
195
diff --git a/src/Base/ScenePieces.h b/src/Base/ScenePieces.h
 
196
index 4a7c38c..bfc4c07 100644
 
197
--- a/src/Base/ScenePieces.h
 
198
+++ b/src/Base/ScenePieces.h
 
199
@@ -39,7 +39,7 @@ namespace cnoid {
 
200
         void setCross(const osg::Vec4& color, float size, float lineWidth = 1.0f);
 
201
       private:
 
202
         osg::ref_ptr<osg::Sphere> sphere;
 
203
-        osg::ref_ptr<osg::Geometry> cross;
 
204
+        osg::ref_ptr<deprecated_osg::Geometry> cross;
 
205
     };
 
206
 
 
207
     class CNOID_EXPORT BBMarker : public osg::Geode
 
208
diff --git a/src/Base/SceneView.cpp b/src/Base/SceneView.cpp
 
209
index 07befae..0a44154 100644
 
210
--- a/src/Base/SceneView.cpp
 
211
+++ b/src/Base/SceneView.cpp
 
212
@@ -664,7 +664,7 @@ void SceneViewImpl::setupHUD()
 
213
                 bb.expandBy(geode->getDrawable(i)->getBound());
 
214
             }
 
215
             
 
216
-            osg::Geometry* geom = new osg::Geometry;
 
217
+            deprecated_osg::Geometry* geom = new deprecated_osg::Geometry;
 
218
             
 
219
             osg::Vec3Array* vertices = new osg::Vec3Array;
 
220
             float depth = bb.zMin()-0.1;
 
221
@@ -677,12 +677,12 @@ void SceneViewImpl::setupHUD()
 
222
             osg::Vec3Array* normals = new osg::Vec3Array;
 
223
             normals->push_back(osg::Vec3(0.0f,0.0f,1.0f));
 
224
             geom->setNormalArray(normals);
 
225
-            geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
 
226
+            geom->setNormalBinding(deprecated_osg::Geometry::BIND_OVERALL);
 
227
             
 
228
             osg::Vec4Array* colors = new osg::Vec4Array;
 
229
             colors->push_back(osg::Vec4(1.0f,1.0,0.8f,0.2f));
 
230
             geom->setColorArray(colors);
 
231
-            geom->setColorBinding(osg::Geometry::BIND_OVERALL);
 
232
+            geom->setColorBinding(deprecated_osg::Geometry::BIND_OVERALL);
 
233
             
 
234
             geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4));
 
235
             
 
236
@@ -892,7 +892,7 @@ void SceneViewImpl::updateFloorGridLines()
 
237
         floorGridNode->removeDrawables(0, prevNumDrawables);
 
238
     }
 
239
 
 
240
-    osg::Geometry* geom = new osg::Geometry;
 
241
+    deprecated_osg::Geometry* geom = new deprecated_osg::Geometry;
 
242
     osg::Vec3Array* v = new osg::Vec3Array;
 
243
     geom->setVertexArray(v);
 
244
 
 
245
diff --git a/src/Base/VrmlToOsgConverter.cpp b/src/Base/VrmlToOsgConverter.cpp
 
246
index 8093c1f..461f4be 100644
 
247
--- a/src/Base/VrmlToOsgConverter.cpp
 
248
+++ b/src/Base/VrmlToOsgConverter.cpp
 
249
@@ -42,7 +42,7 @@ namespace cnoid {
 
250
         osg::Group* createTransformNode(VrmlTransform* vt);
 
251
         osg::Node* convertShapeNode(VrmlNode* vnode);
 
252
         osg::Material* createMaterial(VrmlMaterial* vm);
 
253
-        osg::Geometry* createGeometryFromIndexedFaceSet(VrmlIndexedFaceSet* vface, float alpha);
 
254
+        deprecated_osg::Geometry* createGeometryFromIndexedFaceSet(VrmlIndexedFaceSet* vface, float alpha);
 
255
         
 
256
         VrmlMaterialPtr defaultMaterial;
 
257
         osg::ref_ptr<osg::StateSet> stateSetForTransformWithScaling;
 
258
@@ -54,7 +54,7 @@ namespace cnoid {
 
259
         typedef map<VrmlNode*, osg::Node*> VrmlNodeToOsgNodeMap;
 
260
         VrmlNodeToOsgNodeMap vrmlNodeToOsgNodeMap;
 
261
 
 
262
-        typedef map<VrmlGeometry*, osg::Geometry*> VrmlGeometryToOsgGeometryMap;
 
263
+        typedef map<VrmlGeometry*, deprecated_osg::Geometry*> VrmlGeometryToOsgGeometryMap;
 
264
         VrmlGeometryToOsgGeometryMap vrmlGeometryToOsgGeometryMap;
 
265
 
 
266
         osgUtil::Optimizer optimizer;
 
267
@@ -223,7 +223,7 @@ osg::Node* VrmlToOsgConverterImpl::convertShapeNode(VrmlNode* vnode)
 
268
     float alpha = 1.0 - vm->transparency;
 
269
 
 
270
     osg::Geode* geode = 0;
 
271
-    osg::Geometry* geometry = 0;
 
272
+    deprecated_osg::Geometry* geometry = 0;
 
273
     VrmlGeometry* vrmlGeometry = dynamic_node_cast<VrmlGeometry>(vrmlShape->geometry).get();
 
274
     
 
275
     if(vrmlGeometry){
 
276
@@ -307,9 +307,9 @@ osg::Material* VrmlToOsgConverterImpl::createMaterial(VrmlMaterial* vm)
 
277
 }
 
278
 
 
279
 
 
280
-osg::Geometry* VrmlToOsgConverterImpl::createGeometryFromIndexedFaceSet(VrmlIndexedFaceSet* vface, float alpha)
 
281
+deprecated_osg::Geometry* VrmlToOsgConverterImpl::createGeometryFromIndexedFaceSet(VrmlIndexedFaceSet* vface, float alpha)
 
282
 {
 
283
-    osg::Geometry* geometry = new osg::Geometry;
 
284
+    deprecated_osg::Geometry* geometry = new deprecated_osg::Geometry;
 
285
     
 
286
     if(!vface->ccw){
 
287
         osg::StateSet* stateSet = geometry->getOrCreateStateSet();
 
288
@@ -382,9 +382,9 @@ osg::Geometry* VrmlToOsgConverterImpl::createGeometryFromIndexedFaceSet(VrmlInde
 
289
             normals->push_back(osg::Vec3(vec[i][0], vec[i][1], vec[i][2]));
 
290
         }
 
291
         geometry->setNormalArray(normals);
 
292
-        
 
293
+
 
294
         if(vface->normalIndex.empty()){
 
295
-            geometry->setNormalIndices(geometry->getVertexIndices());
 
296
+         geometry->setNormalIndices((osg::IndexArray*)geometry->getVertexIndices());
 
297
         } else {
 
298
             int size = vface->normalIndex.size();
 
299
             osg::UIntArray* indices = new osg::UIntArray;
 
300
@@ -397,12 +397,12 @@ osg::Geometry* VrmlToOsgConverterImpl::createGeometryFromIndexedFaceSet(VrmlInde
 
301
             geometry->setNormalIndices(indices);
 
302
         }
 
303
         if(vface->normalPerVertex == true){
 
304
-            geometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
 
305
+            geometry->setNormalBinding(deprecated_osg::Geometry::BIND_PER_VERTEX);
 
306
         } else {
 
307
-            geometry->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE);
 
308
+            geometry->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
 
309
         }
 
310
     }
 
311
-    
 
312
+
 
313
     if(vface->color){
 
314
         MFColor& c = vface->color->color;
 
315
         if(!c.empty()){
 
316
@@ -412,16 +412,16 @@ osg::Geometry* VrmlToOsgConverterImpl::createGeometryFromIndexedFaceSet(VrmlInde
 
317
                 colors->push_back(osg::Vec4(c[i][0], c[i][1], c[i][2], alpha));
 
318
             }
 
319
             geometry->setColorArray(colors);
 
320
-            
 
321
+
 
322
             if(vface->colorIndex.empty()){
 
323
-                geometry->setColorIndices(geometry->getVertexIndices());
 
324
+             geometry->setColorIndices((osg::IndexArray*)geometry->getVertexIndices());
 
325
             } else {
 
326
                 int size = vface->colorIndex.size();
 
327
                 osg::UIntArray* indices = new osg::UIntArray;
 
328
-                
 
329
+
 
330
                 // osg::TemplateIndexArray <unsigned int, osg::Array::UIntArrayType,4,4> *indices;
 
331
                 // indices = new osg::TemplateIndexArray<unsigned int, osg::Array::UIntArrayType,4,4>;
 
332
-                
 
333
+
 
334
                 for(int i=0; i < size; i++){
 
335
                     int index = vface->colorIndex[i];
 
336
                     if(index >= 0){
 
337
@@ -430,18 +430,18 @@ osg::Geometry* VrmlToOsgConverterImpl::createGeometryFromIndexedFaceSet(VrmlInde
 
338
                 }
 
339
                 geometry->setColorIndices(indices);
 
340
             }
 
341
-            
 
342
+
 
343
             if(vface->colorPerVertex == true){
 
344
-                geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
 
345
+                geometry->setColorBinding(deprecated_osg::Geometry::BIND_PER_VERTEX);
 
346
             } else {
 
347
-                geometry->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE);
 
348
+                geometry->setColorBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
 
349
             }
 
350
         }
 
351
     }
 
352
-    
 
353
+
 
354
     if(!vface->normal){
 
355
         osgUtil::SmoothingVisitor::smooth(*geometry);
 
356
     }
 
357
-    
 
358
+
 
359
     return geometry;
 
360
 }