VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
terrainImplementation.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
17 #include <geometry/chord.h>
24 #include "features/feature.h"
25 #include "features/featureSet.h"
28 #include <vlpi/appearance.h>
29 
30 #include <string>
31 #include <boost/noncopyable.hpp>
32 
35 class DtScenarioExplorer;
36 class DtString;
37 class Coordinate_System;
40 class DtTaitBryan;
43 class DtEntityType;
44 
46 typedef void (*DtCacheProgressCallbackFunction)(int requestId, int current, bool completed, double elapsedTime, void* usr);
47 
48 typedef void(*DtTerrainChangeNotificationCallbackFcn)(const DtExtent& spatExtent, void* userData);
49 
50 namespace makArchives
51 {
52  class DtGenericTerrainRecord;
53 }
54 
55 namespace MAKVRinTerra
56 {
57  class DtProj;
58 }
59 
60 namespace makVrv
61 {
62  class DtDynamicTerrainGeometry;
63  class DtDynamicTerrainChange;
64  class DtDynamicTerrainFeature;
65  class DtDynamicTerrainChanges;
66 }
67 
72 {
73 public:
74 
76  {
77  public:
79  virtual void removeTerrainChange() = 0;
80  virtual void releaseOwnership() = 0;
81  };
82 
85 
87  DtDynamicTerrainRequestHandle(const boost::shared_ptr<RequestHandleImpl>&);
88 
92  void removeTerrainChange();
93 
96  void releaseOwnership();
97 
98 private:
99 
100  boost::shared_ptr<RequestHandleImpl> myImpl;
101 };
102 
107 {
108 public:
109 
111  {
112  public:
114  virtual void removeQuery() = 0;
115  virtual void releaseOwnership() = 0;
116  };
117 
120 
122  DtDynamicTerrainQueryHandle(const boost::shared_ptr<QueryHandleImpl>&);
123 
125  void removeQuery();
126 
129  void releaseOwnership();
130 
131 private:
132 
133  boost::shared_ptr<QueryHandleImpl> myImpl;
134 };
135 
136 typedef boost::function<void (const makVrv::DtDynamicTerrainFeature&)>
138 
142 {
143 public:
145  virtual ~DtTerrainGeometryHandle();
146 
148  virtual bool isDisabled() const = 0;
149 
152  virtual void disable() = 0;
153 
155  virtual void setAppearance(DtAppearance app) = 0;
156 
158  virtual void setPosition(const DtPoint& location, const DtDcm& orientation) = 0;
159 
160  virtual DtVector position() const = 0;
161  virtual DtDcm orientation() const = 0;
162 };
163 
171  : boost::noncopyable
172 {
173 public:
175  virtual ~DtTerrainImplementation();
176 
178  virtual MAKVRinTerra::DtFeatureDatabase& featureDatabase();
179  virtual const MAKVRinTerra::DtFeatureDatabase& featureDatabase() const;
180 
182  virtual MAKVRinTerra::DtFeatureContext& featureContext();
183  virtual const MAKVRinTerra::DtFeatureContext& featureContext() const;
184 
186  virtual void init();
187 
190  virtual void finishedLoading(const MAKVRinTerra::DtProj& proj);
191 
193  virtual bool loadTerrain(const makArchives::DtGenericTerrainRecord& rec) = 0;
194 
196  virtual void clearCache();
197 
199  virtual void shutdown(bool block=true);
200 
201  virtual const Coordinate_System* coordinateSystem() const = 0;
202 
205  virtual double modelHeightDifferencesFromAppearances(int oldApp, int newApp) const;
206 
208  virtual bool createFromExtent(const Dt3dBoundingVolume&);
209 
212  virtual bool loadModel(const DtFilename&, const DtEntityType& t = DtEntityType());
213 
214  virtual DtTerrainInterfaceConfig& configurationOptions();
215  virtual const DtTerrainInterfaceConfig& configurationOptions() const;
216 
224  virtual bool chordIntersect(
225  DtTerrainIntersectStatus& status,
226  const DtChord& chord,
228  const DtTerrainIntersectOptions& options) const = 0;
229 
237  virtual bool allIntersectsAlongChord(DtTerrainIntersectStatus& status,
238  const DtChord& chord,
240  const DtTerrainIntersectOptions& options) const = 0;
241 
256  virtual void preloadTerrainAreas(
257  const DtTerrainPagingGeometryList& preloadGeometry) {};
258 
260  virtual bool dataAvailable(
261  const DtTerrainPagingGeometryList& geometry,
263 
266  virtual const DtTerrainCapabilities* terrainCapabilities() const = 0;
267 
278  virtual void setAssertOnBlockingTerrainCalls(bool assertBlock);
279  virtual bool assertOnBlockingTerrainCalls() const;
281 
284  virtual void setWarnOnBlockingTerrainCalls(bool warnBlock);
285  virtual bool warnOnBlockingTerrainCalls() const;
287 
293  virtual void setIntersectDataLoadExpireTime(const double& expireTime) {};
294 
299  virtual void expireDataLoadRequestsBeforeTime(const double& currentTime) {};
300 
301  virtual void processTrianglesInArea(DtTriangleOutputInterface&, const DtTerrainProcessPolygonsBox&) const = 0;
302 
305  virtual DtTerrainInformation* terrainInformation() { return NULL; };
306 
307  virtual void breakUpChords(const MAKVRinTerra::DtProj&, const DtChord& chord,
308  std::vector<DtChord>& chords);
309 
311  virtual bool hasFeatureContext() const;
312 
314  virtual DtTerrainGeometryHandle* createEntityGeometry(const DtFilename& file) { return 0; }
315 
317  virtual DtTerrainGeometryHandle* createEntityGeometry(const DtEntityType& file) { return 0; }
318 
320  virtual void loadVisuals(const DtScenarioExplorer&) {};
321 
328  double time,
330 
331  typedef boost::function<void (const makVrv::DtDynamicTerrainFeature&)>
333 
334  /*
335  virtual DtDynamicTerrainRequestHandle addDynamicTerrainCraterRequest(
336  double time,
337  makVrv::DtDynamicTerrainChange* command,
338  const std::map<DtString, DtString>& keyValueChanges,
339  const DtVector& centerLocation,
340  double radius) {
341  return DtDynamicTerrainRequestHandle(); }
342  */
343 
348  const DtDynamicTerrainQueryCallback& callback,
349  makVrv::DtDynamicTerrainGeometry* geometry = 0,
350  bool useOriginalGeometry = false) {
352  };
353 
355  const DtDynamicTerrainQueryCallback& callback,
356  makVrv::DtDynamicTerrainGeometry* geometry = 0,
357  bool useOriginalGeometry = false) { };
358 
361  virtual void cacheTerrainArea(int requestId,
362  unsigned minLOD, unsigned maxLOD, const DtExtent& cacheArea,
363  DtCacheProgressCallbackFunction fcn = 0, void* usr = 0);
364 
366  virtual void cancelCacheTerrainArea(int requestId);
367 
369  virtual void writeTerrainIndex(const DtString& name);
370 
372  virtual void addTerrainChangeNotificationCallback(DtTerrainChangeNotificationCallbackFcn fcn,
373  void* user);
374 
376  virtual void removeTerrainChangeNotificationCallback(DtTerrainChangeNotificationCallbackFcn fcn,
377  void* user);
378 
380  virtual void invokeTerrainChangeNotificationCallBacks();
381 
382 protected:
384 
390 
391  boost::scoped_ptr<MAKVRinTerra::DtFeatureDatabase> myFeatureDatabase;
392  boost::scoped_ptr<MAKVRinTerra::DtFeatureContext> myFeatureContext;
393 };
394 
boost::scoped_ptr< MAKVRinTerra::DtFeatureDatabase > myFeatureDatabase
Definition: terrainImplementation.h:391
boost::function< void(const makVrv::DtDynamicTerrainFeature &)> DtDynamicTerrainQueryCallback
Definition: terrainImplementation.h:137
NOTE: This entire class is deprecated, in favor of Dt3dChord.
Definition: chord.h:40
Definition: stringKeyFactory.h:80
Class DtTerrainInterfaceConfig is a readable-writable class holding terrain interface configuration o...
Definition: terrainInterfaceConfig.h:32
This is the abstract base class for all terrain implementations. A terrain implementation is used by ...
Definition: terrainImplementation.h:170
boost::function< void(const makVrv::DtDynamicTerrainFeature &)> DtDynamicTerrainQueryCallback
Definition: terrainImplementation.h:332
Definition: terrainIntersectOptions.h:78
DtVrfChordIntersectionRecord represents a list of DtChordIntersectRecords. This is useful for followi...
Definition: vrfChordIntersectRecordList.h:31
virtual DtTerrainGeometryHandle * createEntityGeometry(const DtFilename &file)
Create geometry in the terrain which represents the entity.
Definition: terrainImplementation.h:314
virtual void queryCurrentDynamicTerrainFeatures(const DtDynamicTerrainQueryCallback &callback, makVrv::DtDynamicTerrainGeometry *geometry=0, bool useOriginalGeometry=false)
Definition: terrainImplementation.h:354
DtGenericTerrainRecords allow the VR-Forces terrainInterface library to instantiate and configure the...
Definition: DtGenericTerrainRecord.h:34
DtTerrainImplementation *(* DtCreatorFcn)(DtConsoleCommandManager *)
Definition: stringKeyFactory.h:84
std::list< std::pair< DtPagingMetaDataPtr, DtTerrainPagingGeometryPtr > > DtTerrainPagingGeometryList
Definition: terrainPagingGeometry.h:104
Represents (possibly infinite) area of space.
Definition: DtDynamicTerrainGeometry.h:20
class DtScenarioExplorer:
Definition: scenarioExplorer.h:26
Allows manipulating a terrain object. Returned by functions which create terrain objects.
Definition: terrainImplementation.h:141
bool myAssertOnBlockingTerrainCalls
Determines if an exception should be thrown if a blocking terrain call is made. This can help to trac...
Definition: terrainImplementation.h:388
DtTerrainInterfaceConfig myConfig
Definition: terrainImplementation.h:383
Definition: terrainImplementation.h:75
This is a class which maintains a list of string command names and the callback functions that are to...
Definition: consoleCommandManager.h:56
The DtExtent represents an axis-aligned 3d bounding box.
Definition: extent.h:43
boost::shared_ptr< RequestHandleImpl > myImpl
Definition: terrainImplementation.h:100
bool myWarnOnBlockingTerrainCalls
Definition: terrainImplementation.h:389
DtTerrainIntersectOptions Passed to terrain intersect functions to modify how intersect acts...
Definition: terrainIntersectOptions.h:15
virtual bool dataAvailable(const DtTerrainPagingGeometryList &geometry, DtTerrainIntersectOptions::Fidelity=DtTerrainIntersectOptions::MAX_FIDELITY)
Returns true if all of the terrain which intersects the geometry list is paged in.
Definition: terrainImplementation.h:260
Definition: coordSystem.h:54
Represents some coordinate system. The terms &quot;coordinate system&quot;, &quot;projection&quot;, &quot;spatial reference&quot;...
Definition: proj.h:44
void(* DtTerrainChangeNotificationCallbackFcn)(const DtExtent &spatExtent, void *userData)
Definition: terrainImplementation.h:48
#define DT_DLL_terrainInterface
This file is used to determine how to build.
Definition: terrainInterfaceDefines.h:25
Factory templates DtStringKeyFactory and DtStringKeyFactoryWithParam.
virtual DtTerrainGeometryHandle * createEntityGeometry(const DtEntityType &file)
Create geometry in the terrain which represents the entity by the given type, looking up visuals...
Definition: terrainImplementation.h:317
This class holds parameters which define the capabilities of the current terrain. The terrain impleme...
Definition: terrainCapabilities.h:28
virtual void preloadTerrainAreas(const DtTerrainPagingGeometryList &preloadGeometry)
Specifies a list of terrain areas that should be preloaded by the terrain implementation, in the case of a paging or streaming terrain source. The typical use of this is to specify parts of the terrain that are expected to be needed in the near future.
Definition: terrainImplementation.h:256
RequestHandleImpl()
Definition: terrainImplementation.h:78
Definition: featureContext.h:51
DtTerrainImplementationFactory::DtCreatorFcn DtTerrainImplementationCreatorFcn
Definition: terrainImplementation.h:398
virtual DtTerrainInformation * terrainInformation()
Return the terrain information pointer of the terrain implementation (null if none exist) this is a d...
Definition: terrainImplementation.h:305
virtual DtDynamicTerrainRequestHandle addDynamicTerrainChangeRequest(double time, makVrv::DtDynamicTerrainChange *command)
Add a dynamic terrain change request to the system.
Definition: terrainImplementation.h:327
Definition: terrainImplementation.h:110
boost::shared_ptr< QueryHandleImpl > myImpl
Definition: terrainImplementation.h:133
Definition: vrfChordIntersectionRecord.h:19
virtual void loadVisuals(const DtScenarioExplorer &)
Tells the terrain implementation (if it cares) to load visuals to support terrain/model usage...
Definition: terrainImplementation.h:320
A DtChord is a finite line segment in 3-space, represented by two points. Data derived from the two e...
Fidelity
Allows the system to use differently fidelity data for intersecting against. Currently only implement...
Definition: terrainIntersectOptions.h:76
virtual void setIntersectDataLoadExpireTime(const double &expireTime)
No-op. Override to set the default expiration time for data load requests generated by intersect call...
Definition: terrainImplementation.h:293
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
DtStringKeyFactoryWithParam< DtTerrainImplementation, DtConsoleCommandManager * > DtTerrainImplementationFactory
Definition: terrainImplementation.h:396
Command which can be given to the dynamic terrain system to perform some change. This class is a simp...
Definition: DtDynamicTerrainChange.h:42
void(* DtCacheProgressCallbackFunction)(int requestId, int current, bool completed, double elapsedTime, void *usr)
Callback for terrain caching.
Definition: terrainImplementation.h:46
Resource handle for a query which has been added to the system. Returned from DtTerrainImplementation...
Definition: terrainImplementation.h:106
Interface for getting terrain triangle data out of DtTerrainInterface::trianglesInArea. This object should always be created on the stack.
Definition: terrainProcessPolygonsBox.h:113
Definition: featureContext.h:223
Resource handle for a dynamic terrain change request which has been added to the system. Returned from DtTerrainImplementation::addDynamicTerrainChangeRequest(). Allows caller to manage request.
Definition: terrainImplementation.h:71
boost::scoped_ptr< MAKVRinTerra::DtFeatureContext > myFeatureContext
Definition: terrainImplementation.h:392
virtual DtDynamicTerrainQueryHandle queryDynamicTerrainFeatures(const DtDynamicTerrainQueryCallback &callback, makVrv::DtDynamicTerrainGeometry *geometry=0, bool useOriginalGeometry=false)
Install a query which will call the supplied callback on matching dynamic terrain features as they ar...
Definition: terrainImplementation.h:347
virtual void expireDataLoadRequestsBeforeTime(const double &currentTime)
No-op. Override to expire data load requests generated before the given time. See comment for #setInt...
Definition: terrainImplementation.h:299
TODO Put this in the makTerrainLib.
Definition: terrainInformation.h:17
Definition: point.h:34
DtTerrainIntersectStatus Contains information about result of terrain intersection.
Definition: terrainIntersectStatus.h:16
QueryHandleImpl()
Definition: terrainImplementation.h:113
Represents an area query which can be used to extract triangles from DtTerrainInterface. The box points are in local but the box is always projected against the local topo at the center point of the box.
Definition: terrainProcessPolygonsBox.h:39

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)