VR-Forces 4.0.4 Class Documentation
examples/extentTerrainImplementation/extentTerrainImplementation.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2011 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 
00006 //\file extentTerrainImplementation.h
00007 //\ingroup terrainInterface
00008 
00009 //\brief
00010 
00011 #pragma once
00012 
00013 #include "terrainInterface/terrainImplementation.h"
00014 #include "terrainInterface/terrainCapabilities.h"
00015 
00016 class DtCoordinateSystem;
00017 class DtVectorNetwork;
00018 namespace makArchives
00019 {
00020    class DtGenericTerrainRecord;
00021 }
00022 
00023 //This terrain implementation is an algorithmic representation of the world
00024 //as a flat earth extent.  All soil types are returned as 
00025 //the undefined soil type.
00026 class DtExtentTerrainImplementation : public DtTerrainImplementation
00027 {
00028 public:
00029 
00030    DtExtentTerrainImplementation(DtConsoleCommandManager* cmdMgr);
00031    virtual ~DtExtentTerrainImplementation();
00032 
00033    //Static creator function
00034    static DtTerrainImplementation* create(DtConsoleCommandManager* cmdMgr);
00035 
00036    //Called with the generic terrain record from the mtf file.
00037    //Use to setup initial values on terrain load.
00038    virtual bool loadTerrain(const makArchives::DtGenericTerrainRecord& record,
00039       const TerrainSettings& settings = TerrainSettings());
00040 
00041    //Returns myCoordinateSystem 
00042    virtual const Coordinate_System* coordinateSystem() const;
00043 
00044    //Returns topmost intersection of chord with terrain in record. 
00045    //irtFlag specifies what intersection
00046    //data should be filled in for the record.
00047    virtual bool chordIntersect(const DtChord& chord,
00048       DtChordIntersectionRecord& record,
00049       DtIntersectionRecord::DtIntersectionType irtFlag = 
00050       DtIntersectionRecord::INT_ALL_DATA,
00051       bool* dataAvailable = 0, bool overrideBlockingAssert = false) const;
00052 
00053    //Returns all intersections of chord with terrain. intList is the list of each intersection record.
00054    //irtFlag specifies what intersection data should be filled in for the record.
00055    //In this example there will only ever be at most 1 intersection.
00056    virtual bool allIntersectsAlongChord(const DtChord& chord,
00057       DtChordIntersectRecordList& intList,
00058       DtIntersectionRecord::DtIntersectionType irtFlag = 
00059       DtIntersectionRecord::INT_ALL_DATA,
00060       bool* dataAvailable = 0, bool overrideBlockingAssert = false) const;
00061 
00062    //Returns intersection of sphere with the terrain in the record irtFlag specifies what intersection
00063    //data should be filled in for the record.
00064    virtual bool sphereIntersect(const DtSphere& sphere, DtSphereIntersectionRecord& record,
00065       DtIntersectionRecord::DtIntersectionType irtFlag = 
00066       DtIntersectionRecord::INT_ALL_DATA,
00067       bool* dataAvailable = 0, bool overrideBlockingAssert = false) const;
00068 
00069    //Returns myVectorNetwork
00070    virtual const DtVectorNetwork* vectorNetwork() const;
00071 
00072    //User passes in the chord to intersect the vector network and the vectorRecord defining the 
00073    //desired search parameters like the kind of features to be searched. Returns the best feature 
00074    //intersection and associated data in the vectorIntersectionRecord if there is an intersection.
00075    //Returns false if there is no intersection.
00076    virtual bool intersectVectorNetwork(const DtChord& chord,
00077       DtVectorNetworkRecord* vectorRecord, 
00078       DtVectorNetworkIntersectionRecord* vectorIntersectionRecord) const;
00079 
00080    //Returns the capabilities of the current terrain.
00081    virtual const DtTerrainCapabilities* terrainCapabilities() const;
00082 
00083    //Used by B-HAVE for creating path data.  func is a function to be called
00084    //on the triangles in the terrain.  box is an extent that determines which
00085    //triangles should be considered.  finalize is called once all triangles
00086    //have been processed.
00087    virtual void processTrianglesInArea(DtTriangleCallbackFcn func, 
00088       DtTriangleCallbackFinalizeFcn finalize, 
00089       const DtTerrainProcessPolygonsBox& box, void* usr);
00090 
00091 protected:
00092 
00093    //Fill in the intersection record based on the result of the intersection
00094    //test.
00095    void fillHitRecord(DtChordIntersectionRecord& rec, 
00096       const DtChord& chord, const DtPoint& chordNormal, double intersectTime,
00097       DtIntersectionRecord::DtIntersectionType irtFlag) const;
00098 
00099    //Function that actually does the chord-extent intersection test.
00100    bool chordExtentIntersect(const DtChord& chord, 
00101       DtChordIntersectionRecord& hit, 
00102       DtIntersectionRecord::DtIntersectionType irtFlag) const;
00103 
00104 protected:
00105    Coordinate_System* myCoordinateSystem;
00106    DtVectorNetwork * myVectorNetwork;
00107    DtTerrainCapabilities myCapabilities;
00108 };

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)