Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

feat(gameclient): defer drawable transform and condition work to after the tick

Olcay Seygan42fa5d5bdef8
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/LogicThread.h b/GeneralsMD/Code/GameEngine/Include/Common/LogicThread.h
index 4825ab14c..a158bfb00 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/LogicThread.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/LogicThread.h
@@ -44,8 +44,8 @@ namespace LogicThread
enum Channel
{
- CENSUS_DRAWABLE, ///< Object::getDrawable from the tick
- CENSUS_MODEL_CONDITION, ///< Drawable model condition setters
+ CENSUS_DRAWABLE, ///< draw modules told of a transform change from the tick
+ CENSUS_MODEL_CONDITION, ///< a model condition flush from the tick
CENSUS_AUDIO, ///< AudioManager add/remove event
CENSUS_INGAMEUI, ///< TheInGameUI messages, floating text, selection, superweapons, idle workers
CENSUS_CONTROLBAR, ///< TheControlBar dirty mark and command lookups
@@ -62,6 +62,7 @@ namespace LogicThread
CENSUS_MESSAGESTREAM, ///< MessageStream::appendMessage
CENSUS_DISPLAY, ///< TheDisplay shroud levels
CENSUS_JOBS, ///< JobSystem::parallel_for
+ CENSUS_ON_DEMAND_FLUSH, ///< Drawable::getDrawModulesFlushed applying deferred work inside the tick
CENSUS_COUNT
};
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h
index 3dccf2265..d7b8820b9 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h
@@ -439,8 +439,11 @@ public:
ClientUpdateModule* findClientUpdateModule( NameKeyType key );
DrawModule** getDrawModulesNonDirty();
- DrawModule** getDrawModules();
+ DrawModule** getDrawModules(); ///< flushes a model condition change, or inside a logic tick queues it for after the tick
DrawModule const** getDrawModules() const;
+ DrawModule** getDrawModulesFlushed(); ///< applies what the tick deferred now, for a caller that needs the render object as it stands
+ static void flushPendingClientWork(); ///< after each tick, on the main thread: the transforms and model conditions the tick deferred
+ void flushPendingTransform( Bool onDemand ); ///< tells the draw modules of a transform the tick deferred; GameClient::destroyDrawable
//---------------------------------------------------------------------------
void setDrawableStatus( DrawableStatus bit ) { BitSet( m_status, bit ); }
@@ -821,6 +824,13 @@ private:
#ifdef DIRTY_CONDITION_FLAGS
mutable Bool m_isModelDirty; ///< if true, must call replaceModelConditionState() before drawing or accessing drawmodule info
#endif
+ mutable Bool m_clientWorkQueued; ///< this drawable's ID is in the list flushPendingClientWork walks
+ Bool m_transformPending; ///< the tick moved it; the draw modules have not been told
+
+ void queueClientWork() const;
+ void flushModelCondition( Bool onDemand ) const;
+ void doPendingClientWork( Bool onDemand );
+ void markModelDirty();
//*******************************************
//Perhaps we can move this out of Drawable???
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h
index 02d59c71c..eb6aa5891 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h
@@ -237,7 +237,7 @@ public:
// ids and binding
ObjectID getID() const { return m_id; } ///< this object's unique ID
void friend_bindToDrawable( Drawable *draw ); ///< set drawable association. for use ONLY by GameLogic!
- Drawable* getDrawable() const { LOGIC_CENSUS( CENSUS_DRAWABLE ); return m_drawable; } ///< drawable (if any) bound to obj
+ Drawable* getDrawable() const { return m_drawable; } ///< drawable (if any) bound to obj
ObjectID getProducerID() const { return m_producerID; }
void setProducer(const Object* obj);
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/LogicThread.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/LogicThread.cpp
index 720c4d00a..6329c5946 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/System/LogicThread.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/System/LogicThread.cpp
@@ -25,6 +25,7 @@
#include "Common/LogicThread.h"
#include "Common/EarlyCommandLine.h"
#include "Common/MessageStream.h"
+#include "GameClient/Drawable.h"
#include "GameLogic/FPUControl.h"
#include "GameLogic/GameLogic.h"
@@ -77,7 +78,7 @@ namespace
{
"drawable", "modelcondition", "audio", "ingameui", "controlbar", "tacticalview", "radar",
"fxlist", "terrainvisual", "particles", "gameclient", "eva", "newdrawable", "clientrandom",
- "ghost", "messagestream", "display", "jobs"
+ "ghost", "messagestream", "display", "jobs", "ondemandflush"
};
Real elapsedMS( LogicClock::time_point a, LogicClock::time_point b )
@@ -205,6 +206,7 @@ void LogicThread::runTick( void )
{
++s_inlineTicks;
TheGameLogic->UPDATE();
+ Drawable::flushPendingClientWork();
return;
}
@@ -245,6 +247,9 @@ void LogicThread::runTick( void )
if( error )
std::rethrow_exception( error );
+
+ // What the tick deferred on the drawables (phase 2, M1), here on the main thread at both settings.
+ Drawable::flushPendingClientWork();
}
//-------------------------------------------------------------------------------------------------
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
index 297c85177..88ee0b1ac 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
@@ -553,6 +553,8 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatus statusBit
// assign status bits before anything else can be done
m_status = statusBits;
+ m_clientWorkQueued = FALSE;
+ m_transformPending = FALSE;
// Added By Sadullah Nader
// Initialization missing and needed
@@ -915,7 +917,7 @@ Bool Drawable::getProjectileLaunchOffset(WeaponSlotType wslot, Int specificBarre
//-------------------------------------------------------------------------------------------------
void Drawable::setAnimationLoopDuration(UnsignedInt numFrames)
{
- for (DrawModule** dm = getDrawModules(); *dm; ++dm)
+ for (DrawModule** dm = getDrawModulesFlushed(); *dm; ++dm)
{
ObjectDrawInterface* di = (*dm)->getObjectDrawInterface();
if (di)
@@ -926,7 +928,7 @@ void Drawable::setAnimationLoopDuration(UnsignedInt numFrames)
//-------------------------------------------------------------------------------------------------
void Drawable::setAnimationCompletionTime(UnsignedInt numFrames)
{
- for (DrawModule** dm = getDrawModules(); *dm; ++dm)
+ for (DrawModule** dm = getDrawModulesFlushed(); *dm; ++dm)
{
ObjectDrawInterface* di = (*dm)->getObjectDrawInterface();
if (di)
@@ -938,7 +940,7 @@ void Drawable::setAnimationCompletionTime(UnsignedInt numFrames)
//-------------------------------------------------------------------------------------------------
void Drawable::setAnimationFrame( int frame )
{
- for (DrawModule** dm = getDrawModules(); *dm; ++dm)
+ for (DrawModule** dm = getDrawModulesFlushed(); *dm; ++dm)
{
ObjectDrawInterface* di = (*dm)->getObjectDrawInterface();
if (di)
@@ -1053,7 +1055,8 @@ Int Drawable::getCurrentClientBonePositions(const char* boneNamePrefix, Int star
//-------------------------------------------------------------------------------------------------
Bool Drawable::getCurrentWorldspaceClientBonePositions(const char* boneName, Matrix3D& transform) const
{
- for (const DrawModule** dm = getDrawModules(); *dm; ++dm)
+ // LaserUpdate asks from the tick; the bones have to be where the tick left the drawable
+ for (DrawModule** dm = const_cast<Drawable*>(this)->getDrawModulesFlushed(); *dm; ++dm)
{
const ObjectDrawInterface* di = (*dm)->getObjectDrawInterface();
if (di && di->getCurrentWorldspaceClientBonePositions(boneName, transform))
@@ -5064,7 +5067,6 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)
//-------------------------------------------------------------------------------------------------
void Drawable::clearAndSetModelConditionState( ModelConditionFlagType clr, ModelConditionFlagType set )
{
- LOGIC_CENSUS( CENSUS_MODEL_CONDITION );
ModelConditionFlags c, s;
if (clr != MODELCONDITION_INVALID)
c.set(clr);
@@ -5087,23 +5089,10 @@ DrawModule** Drawable::getDrawModules()
#ifdef DIRTY_CONDITION_FLAGS
if (m_isModelDirty)
{
- if (s_modelLockCount > 0)
- {
- DEBUG_CRASH(("Should not need to update dirty stuff while locked-for-iteration. Ignoring."));
- // this shouldn't happen, but if it does, just return the current (dirty) scenario.
- // we must NOT update the condition state, as someone is relying on the current
- // list of W3D render objects not being munged. (srj)
- }
+ if (TheGameLogic->isInGameLogicUpdate())
+ queueClientWork();
else
- {
- for (DrawModule** dm2 = dm; *dm2; ++dm2)
- {
- ObjectDrawInterface* di = (*dm2)->getObjectDrawInterface();
- if (di)
- di->replaceModelConditionState( m_conditionState );
- }
- m_isModelDirty = false;
- }
+ flushModelCondition( FALSE );
}
#endif
return dm;
@@ -5116,43 +5105,122 @@ DrawModule const** Drawable::getDrawModules() const
#ifdef DIRTY_CONDITION_FLAGS
if (m_isModelDirty)
{
- if (s_modelLockCount > 0)
- {
- DEBUG_CRASH(("Should not need to update dirty stuff while locked-for-iteration. Ignoring."));
- // this shouldn't happen, but if it does, just return the current (dirty) scenario.
- // we must NOT update the condition state, as someone is relying on the current
- // list of W3D render objects not being munged. (srj)
- }
+ if (TheGameLogic->isInGameLogicUpdate())
+ queueClientWork();
else
- {
- // yeah, yeah, yeah... I know (srj)
- for (DrawModule** dm2 = (DrawModule**)dm; *dm2; ++dm2)
- {
- ObjectDrawInterface* di = (*dm2)->getObjectDrawInterface();
- if (di)
- di->replaceModelConditionState( m_conditionState );
- }
- m_isModelDirty = false;
- }
+ flushModelCondition( FALSE );
}
#endif
return dm;
}
+//-------------------------------------------------------------------------------------------------
+/* LOGIC-THREAD.md phase 2, M1. Inside a logic tick a drawable takes its new transform and model
+ condition bits at once, so everything logic reads stays as it was, but the work they cause on the
+ draw modules (render object transforms, tread edges, model and render object swaps) waits for
+ LogicThread::runTick, which calls flushPendingClientWork right after the tick on the main thread.
+ It keys on isInGameLogicUpdate rather than on the thread, so -logicthread 0 and 1 run one path. */
+static std::vector<DrawableID> s_clientWorkQueue;
+
+//-------------------------------------------------------------------------------------------------
+void Drawable::queueClientWork() const
+{
+ if (m_clientWorkQueued)
+ return;
+ m_clientWorkQueued = TRUE;
+ s_clientWorkQueue.push_back( getID() );
+}
+
+//-------------------------------------------------------------------------------------------------
+/** The model condition flush. The census counts it from the logic thread: on its own channel when a
+ caller asked for it on demand, under modelcondition when anything else made it run there. */
+void Drawable::flushModelCondition( Bool onDemand ) const
+{
+ LogicThread::census( onDemand ? LogicThread::CENSUS_ON_DEMAND_FLUSH : LogicThread::CENSUS_MODEL_CONDITION );
+ if (s_modelLockCount > 0)
+ {
+ DEBUG_CRASH(("Should not need to update dirty stuff while locked-for-iteration. Ignoring."));
+ // this shouldn't happen, but if it does, just return the current (dirty) scenario.
+ // we must NOT update the condition state, as someone is relying on the current
+ // list of W3D render objects not being munged. (srj)
+ return;
+ }
+ // yeah, yeah, yeah... I know (srj)
+ for (DrawModule** dm = (DrawModule**)getModuleList(MODULETYPE_DRAW); *dm; ++dm)
+ {
+ ObjectDrawInterface* di = (*dm)->getObjectDrawInterface();
+ if (di)
+ di->replaceModelConditionState( m_conditionState );
+ }
+ m_isModelDirty = false;
+}
+
+//-------------------------------------------------------------------------------------------------
+void Drawable::doPendingClientWork( Bool onDemand )
+{
+ if (m_isModelDirty)
+ flushModelCondition( onDemand );
+ flushPendingTransform( onDemand );
+}
+
+//-------------------------------------------------------------------------------------------------
+void Drawable::flushPendingTransform( Bool onDemand )
+{
+ if (m_transformPending)
+ {
+ m_transformPending = FALSE;
+ LogicThread::census( onDemand ? LogicThread::CENSUS_ON_DEMAND_FLUSH : LogicThread::CENSUS_DRAWABLE );
+ // no draw module reads the old transform, so the one the tick ended on stands in for it
+ for (DrawModule** dm = getDrawModulesNonDirty(); *dm; ++dm)
+ (*dm)->reactToTransformChange( getTransformMatrix(), getPosition(), getOrientation() );
+ }
+}
+
+//-------------------------------------------------------------------------------------------------
+/** The draw modules with whatever the tick has deferred applied now. For the callers inside a tick
+ that act on the render object as it stands (animation timing, weapon fire FX, live bones, ghost
+ snapshots): the census counts these on their own channel, the list phase 3 has to resolve. */
+DrawModule** Drawable::getDrawModulesFlushed()
+{
+ doPendingClientWork( TRUE );
+ return getDrawModulesNonDirty();
+}
+
+//-------------------------------------------------------------------------------------------------
+void Drawable::flushPendingClientWork()
+{
+ for (size_t i = 0; i < s_clientWorkQueue.size(); ++i)
+ {
+ Drawable* draw = TheGameClient->findDrawableByID( s_clientWorkQueue[i] );
+ if (draw == NULL)
+ continue; // destroyed in the tick
+ draw->m_clientWorkQueued = FALSE;
+ draw->doPendingClientWork( FALSE );
+ }
+ s_clientWorkQueue.clear();
+}
+
+//-------------------------------------------------------------------------------------------------
+void Drawable::markModelDirty()
+{
+ m_isModelDirty = true;
+ if (TheGameLogic->isInGameLogicUpdate())
+ queueClientWork();
+}
+
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
void Drawable::clearAndSetModelConditionFlags(const ModelConditionFlags& clr, const ModelConditionFlags& setf)
{
- LOGIC_CENSUS( CENSUS_MODEL_CONDITION );
ModelConditionFlags oldFlags = m_conditionState;
m_conditionState.clearAndSet(clr, setf);
-
+
if (m_conditionState == oldFlags)
return;
#ifdef DIRTY_CONDITION_FLAGS
- m_isModelDirty = true;
+ markModelDirty();
#else
for (DrawModule** dm = getDrawModules(); *dm; ++dm)
{
@@ -5189,8 +5257,8 @@ void Drawable::replaceModelConditionFlags( const ModelConditionFlags &flags, Boo
}
m_isModelDirty = false;
}
- else
- m_isModelDirty = true;
+ else
+ markModelDirty();
#else
for (DrawModule** dm = getDrawModules(); *dm; ++dm)
{
@@ -5349,6 +5417,13 @@ void Drawable::setPosition(const Coord3D *pos)
//-------------------------------------------------------------------------------------------------
void Drawable::reactToTransformChange(const Matrix3D* oldMtx, const Coord3D* oldPos, Real oldAngle)
{
+ if (TheGameLogic->isInGameLogicUpdate())
+ {
+ m_transformPending = TRUE;
+ queueClientWork();
+ return;
+ }
+ LOGIC_CENSUS( CENSUS_DRAWABLE );
for (DrawModule** dm = getDrawModules(); *dm; ++dm)
{
(*dm)->reactToTransformChange(oldMtx, oldPos, oldAngle);
@@ -5381,7 +5456,8 @@ Bool Drawable::handleWeaponFireFX(WeaponSlotType wslot, Int specificBarrelToUse,
}
}
- for (DrawModule** dm = getDrawModules(); *dm; ++dm)
+ // the barrels, muzzle flash and FX bones of the state the shot set, where the tick left the drawable
+ for (DrawModule** dm = getDrawModulesFlushed(); *dm; ++dm)
{
ObjectDrawInterface* di = (*dm)->getObjectDrawInterface();
if (di && di->handleWeaponFireFX(wslot, specificBarrelToUse, fxl, weaponSpeed, victimPos, damageRadius))
@@ -5886,7 +5962,8 @@ void Drawable::setSelectable( Bool selectable )
if( !selectable )
TheInGameUI->deselectDrawable( this );
- for (DrawModule** dm = getDrawModules(); *dm; ++dm)
+ // onto the render object the tick's model condition builds; setModelState takes it from the template
+ for (DrawModule** dm = getDrawModulesFlushed(); *dm; ++dm)
{
ObjectDrawInterface* di = (*dm)->getObjectDrawInterface();
if (di)
@@ -5970,7 +6047,7 @@ void Drawable::xferDrawableModules( Xfer *xfer )
//
#ifdef DIRTY_CONDITION_FLAGS
if( xfer->getXferMode() == XFER_SAVE )
- getDrawModules(); // will re-evaluate modules that are dirty and update them
+ getDrawModulesFlushed(); // will re-evaluate modules that are dirty and update them
#endif
// xfer number of module types
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp
index 9e225f421..82a9dab8e 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp
@@ -1042,6 +1042,10 @@ void GameClient::destroyDrawable( Drawable *draw )
} // end if
+ // what the tick deferred on it happens now or never: the batched trees and props are made, placed
+ // and destroyed in one go by startNewGame, and placing them is what hands them to the terrain
+ draw->flushPendingTransform( TRUE );
+
// remove the drawable from our hash of drawables
removeDrawableFromLookupTable( draw );
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp
index 634cd9284..21a1cf925 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp
@@ -1213,11 +1213,14 @@ Bool ParticleUplinkCannonUpdate::calculateUpBonePositions()
Coord3D pos;
if( draw )
{
- if( data->m_connectorBoneName.isNotEmpty() && draw->getCurrentClientBonePositions( data->m_connectorBoneName.str(), 0, &pos, &mtx, 1 ) )
+ // Pristine bones of the state logic believes in: both positions are saved and steer the beam, and
+ // the render object's live bones are where this machine last drew the antenna. The uplink has
+ // no turret, so there is no turret angle to add.
+ if( data->m_connectorBoneName.isNotEmpty() && draw->getPristineBonePositions( data->m_connectorBoneName.str(), 0, &pos, &mtx, 1 ) )
{
obj->convertBonePosToWorldPos( &pos, &mtx, &m_connectorNodePosition, &mtx );
}
- if( data->m_fireBoneName.isNotEmpty() && draw->getCurrentClientBonePositions( data->m_fireBoneName.str(), 0, &pos, &mtx, 1 ) )
+ if( data->m_fireBoneName.isNotEmpty() && draw->getPristineBonePositions( data->m_fireBoneName.str(), 0, &pos, &mtx, 1 ) )
{
obj->convertBonePosToWorldPos( &pos, &mtx, &m_laserOriginPosition, &mtx );
}
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp
index d5d2e667e..3143fd084 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp
@@ -4031,9 +4031,11 @@ Int W3DModelDraw::getPristineBonePositionsForConditionState(
//BONEPOS_DUMPREAL(getDrawable()->getScale());
// we must call this every time we set m_nextState, to ensure cached bones are happy
stateToUse->validateStuff(
- // if the state is the current state, pass in the current render object
- // so that we don't have to re-create it!
- stateToUse == m_curState ? m_renderObject : NULL,
+ // never the current render object, the way getProjectileLaunchOffset and getBarrelCount ask:
+ // whether m_curState has caught up with the logic's state inside a tick depends on this
+ // machine's view (on-demand flushes behind visibility and ghosts), and a render object kept
+ // from the state before can carry that state's animation into the cached pristine bones
+ NULL,
getDrawable()->getScale(),
getW3DModelDrawModuleData()->m_extraPublicBones);
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp
index cba106124..094a0230b 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp
@@ -355,7 +355,7 @@ void W3DGhostObject::snapShot(int playerIndex)
W3DRenderObjectSnapshot *snap=m_parentSnapshots[playerIndex],*prevSnap=NULL;
//walk through all W3D render objects used by this object
- for (DrawModule ** dm = draw->getDrawModules(); *dm; ++dm)
+ for (DrawModule ** dm = draw->getDrawModulesFlushed(); *dm; ++dm)
{
const ObjectDrawInterface* di = (*dm)->getObjectDrawInterface();
if (di)
@@ -430,7 +430,7 @@ void W3DGhostObject::removeParentObject(void)
draw->setFullyObscuredByShroud(true);
//walk through all W3D render objects used by this object
- for (DrawModule ** dm = draw->getDrawModules(); *dm; ++dm)
+ for (DrawModule ** dm = draw->getDrawModulesFlushed(); *dm; ++dm)
{
const ObjectDrawInterface* di = (*dm)->getObjectDrawInterface();
if (di)
@@ -466,7 +466,7 @@ void W3DGhostObject::restoreParentObject(void)
return;
//walk through all W3D render objects used by this object
- for (DrawModule ** dm = draw->getDrawModules(); *dm; ++dm)
+ for (DrawModule ** dm = draw->getDrawModulesFlushed(); *dm; ++dm)
{
const ObjectDrawInterface* di = (*dm)->getObjectDrawInterface();
if (di)