~ubuntu-branches/debian/experimental/openscenegraph/experimental

« back to all changes in this revision

Viewing changes to OpenSceneGraph/src/osgPlugins/bsp/VBSPEntity.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alberto Luaces
  • Date: 2010-05-03 21:42:01 UTC
  • mfrom: (1.1.9 upstream) (2.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20100503214201-iy060qxb94vsfv87
Tags: 2.8.3-3
* Added README.source. Thanks Manuel Montecelo.
* Removed FindGDAL.cmake file supplied by upstream since it does not
  detect current libgdal1-1.6.0. The script provided by CMake works
  fine.
* Removed openthreads-doc since OpenThreads documentation is shared with
  OpenSceneGraph's, hence this package was empty.
* Now ccache handling is being done automatically by CMake.
* Drop conflict dependencies with previous versions to let them coexist
  with current ones (Closes: #580079 #580081).

Show diffs side-by-side

added added

removed removed

Lines of Context:
181
181
 
182
182
Vec3f VBSPEntity::getVector(std::string str)
183
183
{
184
 
    double x, y, z;
 
184
    float x, y, z;
185
185
 
186
186
    // Look for the first non-whitespace
187
187
    std::string::size_type start = str.find_first_not_of(" \t\r\n", 0);
190
190
    std::string::size_type end = str.find_first_of(" \t\r\n", start);
191
191
 
192
192
    if ((end > start) && (start != std::string::npos))
193
 
        x = atof(str.substr(start, end-start).c_str());
 
193
        x = osg::asciiToFloat(str.substr(start, end-start).c_str());
194
194
    else
195
195
        return Vec3f();
196
196
 
201
201
    end = str.find_first_of(" \t\r\n", start);
202
202
 
203
203
    if ((end > start) && (start != std::string::npos))
204
 
        y = atof(str.substr(start, end-start).c_str());
 
204
        y = osg::asciiToFloat(str.substr(start, end-start).c_str());
205
205
    else
206
206
        return Vec3f();
207
207
 
214
214
        end = str.length();
215
215
 
216
216
    if ((end > start) && (start != std::string::npos))
217
 
        z = atof(str.substr(start, end-start).c_str());
 
217
        z = osg::asciiToFloat(str.substr(start, end-start).c_str());
218
218
    else
219
219
        return Vec3f();
220
220
 
315
315
    }
316
316
 
317
317
    // Get the class name and process the entity appropriately
318
 
    std::string className = (*param).second;
319
 
    if (className.compare("worldspawn") == 0)
 
318
    class_name = (*param).second;
 
319
    if (class_name.compare("worldspawn") == 0)
320
320
    {
321
321
        // This is the entity that represents the main geometry of the map
322
322
        // (the terrain and much of the static geometry)
323
323
        entity_class = ENTITY_WORLDSPAWN;
324
324
        processWorldSpawn();
325
325
    }
326
 
    else if (className.compare(0, 3, "env") == 0)
 
326
    else if (class_name.compare(0, 3, "env") == 0)
327
327
    {
328
328
        // This is an environmental effect (such as a fire or dust cloud)
329
329
        entity_class = ENTITY_ENV;
330
330
        processEnv();
331
331
    }
332
 
    else if ((className.compare("func_brush") == 0) ||
333
 
             (className.compare("func_illusionary") == 0) ||
334
 
             (className.compare("func_wall_toggle") == 0) ||
335
 
             (className.compare("func_breakable") == 0))
 
332
    else if ((class_name.compare("func_brush") == 0) ||
 
333
             (class_name.compare("func_illusionary") == 0) ||
 
334
             (class_name.compare("func_wall_toggle") == 0) ||
 
335
             (class_name.compare("func_breakable") == 0))
336
336
    {
337
337
        // This is secondary map geometry, created along with the main
338
338
        // map geometry (not an external model)
339
339
        entity_class = ENTITY_FUNC_BRUSH;
340
340
        processFuncBrush();
341
341
    }
342
 
    else if (className.compare(0, 4, "prop") == 0)
 
342
    else if (class_name.compare(0, 4, "prop") == 0)
343
343
    {
344
344
        // This is a "prop", an external model placed somewhere in the
345
345
        // scene
346
346
        entity_class = ENTITY_PROP;
347
347
        processProp();
348
348
    }
349
 
    else if (className.compare("infodecal") == 0)
 
349
    else if (class_name.compare("infodecal") == 0)
350
350
    {
351
351
        // This is a decal, which applies a texture to some surface in the
352
352
        // scene
353
353
        entity_class = ENTITY_INFO_DECAL;
354
354
        processInfoDecal();
355
355
    }
356
 
    else if (className.compare(0, 4, "item") == 0)
 
356
    else if (class_name.compare(0, 4, "item") == 0)
357
357
    {
358
358
        // This is an "item".  Like a prop, these are external models
359
359
        // placed in the scene, but the specific model is determined
367
367
 
368
368
ref_ptr<Group> VBSPEntity::createBrushGeometry()
369
369
{
370
 
    int                i;
371
 
    int                numGeoms;
372
 
    VBSPGeometry **    vbspGeomList;
373
 
    Model              currentModel;
374
 
    Face               currentFace;
375
 
    TexInfo            currentTexInfo;
376
 
    TexData            currentTexData;
377
 
    const char *       texName;
378
 
    char               currentTexName[256];
379
 
    int                currentGeomIndex;
380
 
    VBSPGeometry *     currentGeom;
381
 
    ref_ptr<Group>     entityGroup;
382
 
    ref_ptr<Group>     geomGroup;
 
370
    int                 i;
 
371
    int                 numGeoms;
 
372
    VBSPGeometry **     vbspGeomList;
 
373
    Model               currentModel;
 
374
    Face                currentFace;
 
375
    TexInfo             currentTexInfo;
 
376
    TexData             currentTexData;
 
377
    const char *        texName;
 
378
    char                currentTexName[256];
 
379
    int                 currentGeomIndex;
 
380
    VBSPGeometry *      currentGeom;
 
381
    ref_ptr<Group>      entityGroup;
 
382
    ref_ptr<Group>      geomGroup;
 
383
    std::stringstream   groupName;
383
384
 
384
385
    // Create a list of VBSPGeometry objects for each texdata entry in the
385
386
    // scene.  These objects will hold the necessary geometry data until we
501
502
        }
502
503
    }
503
504
 
 
505
    // Name the entity group
 
506
    groupName << class_name << ":" << entity_model_index;
 
507
    entityGroup->setName(groupName.str());
 
508
 
504
509
    // Return the group we created
505
510
    return entityGroup;
506
511
}
549
554
 
550
555
        // Add the model node to the group
551
556
        entityGroup->addChild(modelNode.get());
 
557
 
 
558
        // Set the group's name
 
559
        entityGroup->setName(class_name + std::string(":") + entity_model);
552
560
    }
553
561
    else
554
562
    {