VR-Forces 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) 2023 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 #include <boost/signals2.hpp>
33 
36 class DtScenarioExplorer;
37 class DtString;
38 class Coordinate_System;
41 class DtTaitBryan;
44 class DtEntityType;
45 
47 typedef void (*DtCacheProgressCallbackFunction)(int requestId, int current, bool completed, double elapsedTime, void* usr);
48 
49 typedef void(*DtTerrainChangeNotificationCallbackFcn)(const DtExtent& spatExtent, void* userData);
50 
51 namespace makArchives
52 {
53  class DtGenericTerrainRecord;
54 }
55 
56 namespace MAKVRinTerra
57 {
58  class DtProj;
59  class DtAerodromeLoader;
60 }
61 
62 namespace makVrv
63 {
64  class DtDynamicTerrainGeometry;
65  class DtDynamicTerrainChange;
66  class DtDynamicTerrainFeature;
67  class DtDynamicTerrainChanges;
68 }
69 
74 {
75 public:
76 
78  {
79  public:
81  virtual void removeTerrainChange() = 0;
82  virtual void releaseOwnership() = 0;
83  };
84 
87 
89  DtDynamicTerrainRequestHandle(const boost::shared_ptr<RequestHandleImpl>&);
90 
94  void removeTerrainChange();
95 
98  void releaseOwnership();
99 
100 private:
101 
102  boost::shared_ptr<RequestHandleImpl> myImpl;
103 };
104 
109 {
110 public:
111 
113  {
114  public:
116  virtual void removeQuery() = 0;
117  virtual void releaseOwnership() = 0;
118  };
119 
122 
124  DtDynamicTerrainQueryHandle(const boost::shared_ptr<QueryHandleImpl>&);
125 
127  void removeQuery();
128 
131  void releaseOwnership();
132 
133 private:
134 
135  boost::shared_ptr<QueryHandleImpl> myImpl;
136 };
137 
138 typedef boost::function<void (const makVrv::DtDynamicTerrainFeature&)>
140 
144 {
145 public:
147  virtual ~DtTerrainGeometryHandle();
148 
150  virtual bool isDisabled() const = 0;
151 
154  virtual void disable() = 0;
155 
157  virtual void setAppearance(DtAppearance app) = 0;
158 
160  virtual void setPosition(const DtPoint& location, const DtDcm& orientation) = 0;
161 
162  virtual DtVector position() const = 0;
163  virtual DtDcm orientation() const = 0;
164 };
165 
173  : boost::noncopyable
174 {
175 public:
177  virtual ~DtTerrainImplementation();
178 
180  virtual MAKVRinTerra::DtFeatureDatabase& featureDatabase();
181  virtual const MAKVRinTerra::DtFeatureDatabase& featureDatabase() const;
182 
184  virtual MAKVRinTerra::DtFeatureContext& featureContext();
185  virtual const MAKVRinTerra::DtFeatureContext& featureContext() const;
186 
187  virtual MAKVRinTerra::DtAerodromeLoader& aerodromeLoader();
188  virtual const MAKVRinTerra::DtAerodromeLoader& aerodromeLoader() const;
189  virtual void cacheAerodromes();
190 
192  virtual void init();
193 
196  virtual void finishedLoading(const MAKVRinTerra::DtProj& proj);
197 
199  virtual bool loadTerrain(const makArchives::DtGenericTerrainRecord& rec) = 0;
200 
202  virtual void clearCache();
203 
205  virtual void shutdown(bool block=true);
206 
207  virtual const Coordinate_System* coordinateSystem() const = 0;
208 
211  virtual double modelHeightDifferencesFromAppearances(int oldApp, int newApp) const;
212 
214  virtual bool createFromExtent(const Dt3dBoundingVolume&);
215 
218  virtual bool loadModel(const DtFilename&, const DtEntityType& t = DtEntityType());
219 
220  virtual DtTerrainInterfaceConfig& configurationOptions();
221  virtual const DtTerrainInterfaceConfig& configurationOptions() const;
222 
230  virtual bool chordIntersect(
231  DtTerrainIntersectStatus& status,
232  const DtChord& chord,
234  const DtTerrainIntersectOptions& options) const = 0;
235 
243  virtual bool allIntersectsAlongChord(DtTerrainIntersectStatus& status,
244  const DtChord& chord,
246  const DtTerrainIntersectOptions& options) const = 0;
247 
262  virtual void preloadTerrainAreas(
263  const DtTerrainPagingGeometryList& preloadGeometry) {};
264 
266  virtual bool dataAvailable(
267  const DtTerrainPagingGeometryList& geometry,
269 
272  virtual const DtTerrainCapabilities* terrainCapabilities() const = 0;
273 
284  virtual void setAssertOnBlockingTerrainCalls(bool assertBlock);
285  virtual bool assertOnBlockingTerrainCalls() const;
287 
290  virtual void setWarnOnBlockingTerrainCalls(bool warnBlock);
291  virtual bool warnOnBlockingTerrainCalls() const;
293 
299  virtual void setIntersectDataLoadExpireTime(const double& expireTime) {};
300 
305  virtual void expireDataLoadRequestsBeforeTime(const double& currentTime) {};
306 
307  virtual void processTrianglesInArea(DtTriangleOutputInterface&, const DtTerrainProcessPolygonsBox&) const = 0;
308 
311  virtual DtTerrainInformation* terrainInformation() { return NULL; };
312 
313  virtual void breakUpChords(const MAKVRinTerra::DtProj&, const DtChord& chord,
314  std::vector<DtChord>& chords);
315 
317  virtual bool hasFeatureContext() const;
318 
320  virtual DtTerrainGeometryHandle* createEntityGeometry(const DtFilename& file) { return 0; }
321 
323  virtual DtTerrainGeometryHandle* createEntityGeometry(const DtEntityType& file) { return 0; }
324 
326  virtual void loadVisuals(const DtScenarioExplorer&) {};
327 
334  double time,
336 
337  typedef boost::function<void (const makVrv::DtDynamicTerrainFeature&)>
339 
340  /*
341  virtual DtDynamicTerrainRequestHandle addDynamicTerrainCraterRequest(
342  double time,
343  makVrv::DtDynamicTerrainChange* command,
344  const std::map<DtString, DtString>& keyValueChanges,
345  const DtVector& centerLocation,
346  double radius) {
347  return DtDynamicTerrainRequestHandle(); }
348  */
349 
354  const DtDynamicTerrainQueryCallback& callback,
355  makVrv::DtDynamicTerrainGeometry* geometry = 0,
356  bool useOriginalGeometry = false) {
358  };
359 
361  const DtDynamicTerrainQueryCallback& callback,
362  makVrv::DtDynamicTerrainGeometry* geometry = 0,
363  bool useOriginalGeometry = false) { };
364 
367  virtual void cacheTerrainArea(int requestId,
368  unsigned minLOD, unsigned maxLOD, const DtExtent& cacheArea,
369  DtCacheProgressCallbackFunction fcn = 0, void* usr = 0);
370 
372  virtual void cancelCacheTerrainArea(int requestId);
373 
375  virtual void writeTerrainIndex(const DtString& name);
376 
378  virtual void addTerrainChangeNotificationCallback(DtTerrainChangeNotificationCallbackFcn fcn,
379  void* user);
380 
382  virtual void removeTerrainChangeNotificationCallback(DtTerrainChangeNotificationCallbackFcn fcn,
383  void* user);
384 
386  virtual void invokeTerrainChangeNotificationCallBacks();
387 
389  boost::signals2::signal<void(bool)> signal_terrainPaging;
390 
391 protected:
393 
399 
400  boost::scoped_ptr<MAKVRinTerra::DtFeatureDatabase> myFeatureDatabase;
401  boost::scoped_ptr<MAKVRinTerra::DtFeatureContext> myFeatureContext;
402  boost::shared_ptr<MAKVRinTerra::DtAerodromeLoader> myAerodromeLoader;
403 };
404 
boost::scoped_ptr< MAKVRinTerra::DtFeatureDatabase > myFeatureDatabase
Definition: terrainImplementation.h:400
boost::function< void(const makVrv::DtDynamicTerrainFeature &)> DtDynamicTerrainQueryCallback
Definition: terrainImplementation.h:139
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:172
boost::function< void(const makVrv::DtDynamicTerrainFeature &)> DtDynamicTerrainQueryCallback
Definition: terrainImplementation.h:338
Definition: terrainIntersectOptions.h:78
DtVrfChordIntersectionRecord represents a list of DtChordIntersectRecords. This is useful for followi...
Definition: vrfChordIntersectRecordList.h:31
boost::shared_ptr< MAKVRinTerra::DtAerodromeLoader > myAerodromeLoader
Definition: terrainImplementation.h:402
virtual DtTerrainGeometryHandle * createEntityGeometry(const DtFilename &file)
Create geometry in the terrain which represents the entity.
Definition: terrainImplementation.h:320
virtual void queryCurrentDynamicTerrainFeatures(const DtDynamicTerrainQueryCallback &callback, makVrv::DtDynamicTerrainGeometry *geometry=0, bool useOriginalGeometry=false)
Definition: terrainImplementation.h:360
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:143
bool myAssertOnBlockingTerrainCalls
Determines if an exception should be thrown if a blocking terrain call is made. This can help to trac...
Definition: terrainImplementation.h:397
DtTerrainInterfaceConfig myConfig
Definition: terrainImplementation.h:392
boost::signals2::signal< void(bool)> signal_terrainPaging
If the implementation is currently paging in terrain, this signal will be sent for the start/stop of ...
Definition: terrainImplementation.h:389
Definition: terrainImplementation.h:77
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:102
bool myWarnOnBlockingTerrainCalls
Definition: terrainImplementation.h:398
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:266
Definition: aerodromeLoader.h:29
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:49
#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:323
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:262
RequestHandleImpl()
Definition: terrainImplementation.h:80
Definition: featureContext.h:51
DtTerrainImplementationFactory::DtCreatorFcn DtTerrainImplementationCreatorFcn
Definition: terrainImplementation.h:408
virtual DtTerrainInformation * terrainInformation()
Return the terrain information pointer of the terrain implementation (null if none exist) this is a d...
Definition: terrainImplementation.h:311
virtual DtDynamicTerrainRequestHandle addDynamicTerrainChangeRequest(double time, makVrv::DtDynamicTerrainChange *command)
Add a dynamic terrain change request to the system.
Definition: terrainImplementation.h:333
Definition: terrainImplementation.h:112
boost::shared_ptr< QueryHandleImpl > myImpl
Definition: terrainImplementation.h:135
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:326
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:299
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
DtStringKeyFactoryWithParam< DtTerrainImplementation, DtConsoleCommandManager * > DtTerrainImplementationFactory
Definition: terrainImplementation.h:406
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:47
Resource handle for a query which has been added to the system. Returned from DtTerrainImplementation...
Definition: terrainImplementation.h:108
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:225
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:73
boost::scoped_ptr< MAKVRinTerra::DtFeatureContext > myFeatureContext
Definition: terrainImplementation.h:401
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:353
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:305
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:115
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 Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)