#include <dali/internal/event/dynamics/dynamics-collision-impl.h>
#include <dali/internal/event/dynamics/dynamics-joint-impl.h>
#include <dali/internal/event/dynamics/dynamics-world-config-impl.h>
-#include <dali/internal/event/effects/shader-effect-impl.h>
#include <dali/internal/update/dynamics/scene-graph-dynamics-body.h>
#include <dali/internal/update/dynamics/scene-graph-dynamics-world.h>
void DynamicsWorld::Initialize(Stage& stage, Integration::DynamicsFactory& dynamicsFactory, DynamicsWorldConfigPtr config)
{
- // Create shader for debug drawing
- const std::string debugDrawVertexShader(
- "attribute lowp vec4 aColor;\n"
- "varying mediump vec4 vColor;\n"
- "void main()\n"
- "{\n"
- " vColor = aColor;\n"
- " gl_Position = uMvpMatrix * vec4(aPosition, 1.0);\n"
- "}\n" );
-
- const std::string debugDrawFragmentShader(
- "varying mediump vec4 vColor;\n"
- "void main()\n"
- "{\n"
- " gl_FragColor = vColor;\n"
- "}\n" );
-
- mDebugShader = ShaderEffect::New(debugDrawVertexShader, debugDrawFragmentShader, GEOMETRY_TYPE_IMAGE, Dali::ShaderEffect::HINT_NONE);
-
mDynamicsWorld = new SceneGraph::DynamicsWorld( stage.GetDynamicsNotifier(),
stage.GetNotificationManager(),
dynamicsFactory );
Integration::DynamicsWorldSettings* worldSettings( new Integration::DynamicsWorldSettings(*config->GetSettings()) );
- const SceneGraph::Shader* shader( static_cast< const SceneGraph::Shader* >(mDebugShader->GetSceneObject()) );
- InitializeDynamicsWorldMessage( stage.GetUpdateManager(), mDynamicsWorld, worldSettings, shader );
+ InitializeDynamicsWorldMessage( stage.GetUpdateManager(), mDynamicsWorld, worldSettings );
mGravity = config->GetGravity();
}
if( mDebugMode != mode )
{
mDebugMode = mode;
-
- SetDebugDrawModeMessage( Stage::GetCurrent()->GetUpdateInterface(), *mDynamicsWorld, mDebugMode );
}
}
Dali::DynamicsWorld::CollisionSignalV2 mCollisionSignalV2;
- ShaderEffectPtr mDebugShader;
-
SlotDelegate< DynamicsWorld > mSlotDelegate;
};
$(internal_src_dir)/event/dynamics/dynamics-sphere-shape-impl.cpp \
$(internal_src_dir)/event/dynamics/dynamics-world-config-impl.cpp \
$(internal_src_dir)/event/dynamics/dynamics-world-impl.cpp \
- $(internal_src_dir)/render/dynamics/scene-graph-dynamics-debug-renderer.cpp \
$(internal_src_dir)/update/dynamics/scene-graph-dynamics-body.cpp \
$(internal_src_dir)/update/dynamics/scene-graph-dynamics-capsule-shape.cpp \
$(internal_src_dir)/update/dynamics/scene-graph-dynamics-cone-shape.cpp \
#include <dali/public-api/common/stage.h>
#include <dali/public-api/render-tasks/render-task.h>
-#ifdef DYNAMICS_SUPPORT
-#include <dali/internal/render/dynamics/scene-graph-dynamics-debug-renderer.h>
-#endif
-
// Uncomment the next line to enable frame snapshot logging
//#define FRAME_SNAPSHOT_LOGGING
float frameTime; ///< The elapsed time since the previous frame
float lastFrameTime; ///< Last frame delta.
-#ifdef DYNAMICS_SUPPORT
- OwnerPointer<DynamicsDebugRenderer> dynamicsDebugRenderer;
-#endif
-
unsigned int frameCount; ///< The current frame count
BufferIndex renderBufferIndex; ///< The index of the buffer to read from; this is opposite of the "update" buffer
mImpl->frameTime = deltaTime;
}
-#ifdef DYNAMICS_SUPPORT
-void RenderManager::InitializeDynamicsDebugRenderer(SceneGraph::DynamicsDebugRenderer* debugRenderer)
-{
- if( !mImpl->dynamicsDebugRenderer )
- {
- mImpl->dynamicsDebugRenderer = debugRenderer;
- debugRenderer->Initialize( mImpl->context );
- }
-}
-#endif
-
void RenderManager::SetDefaultSurfaceRect(const Rect<int>& rect)
{
mImpl->defaultSurfaceRect = rect;
}
}
-#ifdef DYNAMICS_SUPPORT
- if( mImpl->dynamicsDebugRenderer )
- {
- mImpl->dynamicsDebugRenderer->Render();
- }
-#endif
-
GLenum attachments[] = { GL_DEPTH, GL_STENCIL };
mImpl->context.InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments);
{
class Renderer;
class RenderQueue;
-class DynamicsDebugRenderer;
class RenderMaterial;
class TextureCache;
class RenderInstruction;
*/
void SetFrameDeltaTime( float deltaTime );
-#ifdef DYNAMICS_SUPPORT
- /**
- * create a dynamics debug renderer
- * @param[in] debugRenderer The dynamics world debug renderer
- */
- void InitializeDynamicsDebugRenderer(DynamicsDebugRenderer* debugRenderer);
-#endif
-
/**
* Returns the rectangle for the default surface (probably the application window).
* @return Rectangle for the surface.
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "scene-graph-dynamics-debug-renderer.h"
-
-// INTERNAL HEADERS
-#include <dali/integration-api/debug.h>
-#include <dali/internal/render/gl-resources/context.h>
-#include <dali/internal/render/shaders/program.h>
-#include <dali/internal/render/shaders/shader.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace SceneGraph
-{
-
-DynamicsDebugRenderer::DynamicsDebugRenderer(const Shader& debugShader)
-: mShader(const_cast<Shader&>(debugShader)),
- mContext(NULL),
- mBufferIndex(0),
- mViewMatrix(Matrix::IDENTITY),
- mProjectionMatrix(Matrix::IDENTITY),
- mNumberOfPoints(0)
-{
- DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__);
-}
-
-DynamicsDebugRenderer::~DynamicsDebugRenderer()
-{
-}
-
-void DynamicsDebugRenderer::Initialize(Context& context)
-{
- DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__);
-
- mContext = &context;
-}
-
-void DynamicsDebugRenderer::UpdateMatrices( BufferIndex bufferIndex, const Matrix& projectionMatrix, const Matrix& viewMatrix )
-{
- mProjectionMatrix = projectionMatrix;
- mViewMatrix = viewMatrix;
- mBufferIndex = bufferIndex;
-}
-
-void DynamicsDebugRenderer::UpdateBuffer( const Integration::DynamicsDebugVertexContainer& vertices )
-{
- if( NULL != mContext )
- {
- if( !mBuffer )
- {
- mBuffer = new GpuBuffer(*mContext, GpuBuffer::ARRAY_BUFFER, GpuBuffer::STATIC_DRAW);
- }
-
- if( vertices.size() > 1 )
- {
- mBuffer->UpdateDataBuffer( vertices.size() * sizeof(vertices[0]), vertices.data() );
- }
- mNumberOfPoints = vertices.size();
- }
-}
-
-void DynamicsDebugRenderer::Render()
-{
- // @todo reimplement this properly in future
-}
-
-
-} // namespace SceneGraph
-
-} // namespace Internal
-
-} // namespace Dali
+++ /dev/null
-#ifndef __SCENE_GRAPH_DYNAMICS_DEBUG_RENDERER_H__
-#define __SCENE_GRAPH_DYNAMICS_DEBUG_RENDERER_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL HEADERS
-#include <dali/internal/common/buffer-index.h>
-#include <dali/internal/common/message.h>
-#include <dali/internal/common/owner-pointer.h>
-#include <dali/internal/render/gl-resources/gpu-buffer.h>
-#include <dali/integration-api/dynamics/dynamics-debug-vertex.h>
-#include <dali/public-api/math/vector3.h>
-#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/math/matrix.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-class Context;
-
-namespace SceneGraph
-{
-
-class Shader;
-
-/**
- * Dynamics world debug renderer
- * Renderers an array of colored line sections
- */
-class DynamicsDebugRenderer
-{
-public:
-
- DynamicsDebugRenderer(const Shader& debugShader);
- virtual ~DynamicsDebugRenderer();
-
- void Initialize(Context& context);
- void Render();
- void UpdateMatrices( BufferIndex bufferIndex, const Matrix& projectionMatrix, const Matrix& viewMatrix );
- void UpdateBuffer( const Integration::DynamicsDebugVertexContainer& vertices );
-
-private:
- Shader& mShader;
- Context* mContext;
- BufferIndex mBufferIndex;
- Matrix mViewMatrix;
- Matrix mProjectionMatrix;
- OwnerPointer<GpuBuffer> mBuffer;
- int mNumberOfPoints;
-};
-
-} // namespace SceneGraph
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif /* __SCENE_GRAPH_DYNAMICS_DEBUG_RENDERER_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "scene-graph-dynamics-world-debug.h"
-
-// INTERNAL HEADERS
-#include <dali/integration-api/debug.h>
-#include <dali/internal/render/queue/render-queue.h>
-#include <dali/internal/update/controllers/scene-controller.h>
-#include <dali/internal/render/dynamics/scene-graph-dynamics-debug-renderer.h>
-#include <dali/internal/render/shaders/shader.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace SceneGraph
-{
-
-DynamicsWorldDebug::DynamicsWorldDebug(SceneController& sceneController, const Shader& debugShader)
-: mDebugMode(0),//(btIDebugDraw::DBG_DrawWireframe),//(0),
- mSceneController(sceneController)
-{
- DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__);
- mRenderer = new DynamicsDebugRenderer( debugShader );
-}
-
-DynamicsWorldDebug::~DynamicsWorldDebug()
-{
- // TODO Auto-generated destructor stub
-}
-
-//void DynamicsWorldDebug::drawLine(const btVector3& from,const btVector3& to,const btVector3& color)
-//{
-//// DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__);
-//
-// DynamicsDebugVertex vertex;
-// vertex.position = Vector3( from.getX(), from.getY(), from.getZ() );
-// vertex.color = Vector4( color.getX(), color.getY(), color.getZ(), 1.0f );
-// mVertices.push_back( vertex );
-// vertex.position = Vector3( to.getX(), to.getY(), to.getZ());
-// mVertices.push_back( vertex );
-//}
-//
-//void DynamicsWorldDebug::drawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color)
-//{
-// btVector3 to = PointOnB + (normalOnB * distance);// * 10.0f;
-//
-// drawLine(PointOnB, to, color);
-//}
-//
-//void DynamicsWorldDebug::reportErrorWarning(const char* warningString)
-//{
-// DALI_LOG_ERROR( "Dynamics error: %s\n", warningString );
-//}
-//
-//void DynamicsWorldDebug::draw3dText(const btVector3& location,const char* textString)
-//{
-//}
-
-void DynamicsWorldDebug::setDebugMode(int debugMode)
-{
- mDebugMode = debugMode;
-}
-
-int DynamicsWorldDebug::getDebugMode() const
-{
- return mDebugMode;
-}
-
-void DynamicsWorldDebug::UpdateMatrices(BufferIndex bufferIndex, const Matrix& projectionMatrix, const Matrix& viewMatrix)
-{
- mSceneController.GetRenderQueue().QueueMessage(bufferIndex, UpdateMatricesMessage(GetRenderer(), bufferIndex, projectionMatrix, viewMatrix) );
-}
-
-void DynamicsWorldDebug::StartFrame()
-{
- mVertices.clear();
-}
-
-void DynamicsWorldDebug::EndFrame(BufferIndex bufferIndex)
-{
- mSceneController.GetRenderQueue().QueueMessage(bufferIndex, UpdateVerticesMessage(GetRenderer(), mVertices) );
-}
-
-
-const DynamicsDebugVertexContainer& DynamicsWorldDebug::GetVertices() const
-{
- return mVertices;
-}
-
-DynamicsDebugRenderer& DynamicsWorldDebug::GetRenderer() const
-{
- return *mRenderer;
-}
-
-} // namespace SceneGraph
-
-} // namespace Internal
-
-} // namespace Dali
+++ /dev/null
-#ifndef __SCENE_GRAPH_DYNAMICS_WORLD_DEBUG_H__
-#define __SCENE_GRAPH_DYNAMICS_WORLD_DEBUG_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-// INTERNAL HEADERS
-#include <dali/internal/update/dynamics/scene-graph-dynamics-debug-vertex.h>
-
-namespace Dali
-{
-
-class Matrix;
-
-namespace Internal
-{
-
-namespace SceneGraph
-{
-
-class DynamicsDebugRenderer;
-class SceneController;
-class Shader;
-
-/**
- * Debug draw class, Physics engine will invoke methods on this object to render debug information
- */
-class DynamicsWorldDebug// : public btIDebugDraw
-{
-public:
- /**
- * @param[in] sceneController Allows access to render manager message queue
- */
- DynamicsWorldDebug(SceneController& sceneController, const Shader& debugShader );
- virtual ~DynamicsWorldDebug();
-
-// virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& color);
-// virtual void drawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color);
-// virtual void reportErrorWarning(const char* warningString);
-// virtual void draw3dText(const btVector3& location,const char* textString);
- virtual void setDebugMode(int debugMode);
- virtual int getDebugMode() const;
-
- void UpdateMatrices(BufferIndex bufferIndex, const Matrix& projectionMatrix, const Matrix& viewMatrix);
- void StartFrame();
- void EndFrame(BufferIndex bufferIndex);
- const DynamicsDebugVertexContainer& GetVertices() const;
- DynamicsDebugRenderer& GetRenderer() const;
-private:
- int mDebugMode;
- SceneController& mSceneController;
- DynamicsDebugRenderer* mRenderer;
- DynamicsDebugVertexContainer mVertices;
-}; // class DynamicsWorldDebug
-
-} // namespace SceneGraph
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif /* __SCENE_GRAPH_DYNAMICS_WORLD_DEBUG_H__ */
#include <dali/internal/event/dynamics/dynamics-body-config-impl.h>
#include <dali/internal/event/dynamics/dynamics-world-config-impl.h>
#include <dali/internal/render/queue/render-queue.h>
-#include <dali/internal/render/dynamics/scene-graph-dynamics-debug-renderer.h>
#include <dali/internal/update/controllers/scene-controller.h>
#include <dali/internal/update/dynamics/scene-graph-dynamics-body.h>
#include <dali/internal/update/dynamics/scene-graph-dynamics-joint.h>
Integration::DynamicsFactory& dynamicsFactory )
: mDynamicsNotifier(dynamicsNotifier),
mNotificationManager(notificationManager),
- mRenderer(NULL),
mSceneController(NULL),
mBuffers(NULL),
mDynamicsFactory(dynamicsFactory),
mDynamicsFactory.TerminateDynamics();
}
-void DynamicsWorld::Initialize(SceneController* sceneController, Integration::DynamicsWorldSettings* worldSettings, const Shader* debugShader, const SceneGraphBuffers* buffers )
+void DynamicsWorld::Initialize(SceneController* sceneController, Integration::DynamicsWorldSettings* worldSettings, const SceneGraphBuffers* buffers )
{
DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::General, "%s\n", __PRETTY_FUNCTION__);
mSceneController = sceneController;
mBuffers = buffers;
-
- mRenderer = new DynamicsDebugRenderer( *debugShader );
}
void DynamicsWorld::AddBody(DynamicsBody& body)
mDynamicsWorld->SetGravity( gravity );
}
-void DynamicsWorld::SetDebugDrawMode(const int mode)
-{
- mDynamicsWorld->SetDebugDrawMode( mode );
-}
-
BufferIndex DynamicsWorld::GetBufferIndex() const
{
return mBuffers->GetUpdateBufferIndex();
return *mDynamicsWorld;
}
-bool DynamicsWorld::Update( const float elapsedSeconds )
+bool DynamicsWorld::Update( float elapsedSeconds )
{
bool anyPositionChanged( false );
if( anyPositionChanged )
{
- DebugDraw();
CheckForCollisions();
}
}
return 1.0f / mSettings->worldScale;
}
-void DynamicsWorld::DebugDraw()
-{
- // Send request to the simulation to render selected debug information
- typedef MessageValue1< DynamicsDebugRenderer, Integration::DynamicsDebugVertexContainer > DerivedType;
-
- // Reserve some memory inside the render queue
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( GetBufferIndex(), sizeof( DerivedType ) );
-
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &GetDebugRenderer(), &DynamicsDebugRenderer::UpdateBuffer, mDynamicsWorld->DebugDraw() );
-}
-
-void DynamicsWorld::UpdateMatrices( const Matrix& projectionMatrix, const Matrix& viewMatrix)
-{
- typedef MessageDoubleBuffered2< DynamicsDebugRenderer, Matrix, Matrix > DerivedType;
-
- // Reserve some memory inside the render queue
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( GetBufferIndex(), sizeof( DerivedType ) );
-
- if( mNode )
- {
- Matrix modelView(false);
- Matrix::Multiply(modelView, mNode->GetWorldMatrix( GetBufferIndex() ), viewMatrix);
- const float scale(GetWorldScale());
- modelView.SetXAxis(modelView.GetXAxis()*scale);
- modelView.SetYAxis(modelView.GetYAxis()*scale);
- modelView.SetZAxis(modelView.GetZAxis()*scale);
-
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( mRenderer, &DynamicsDebugRenderer::UpdateMatrices, projectionMatrix, modelView );
- }
- else
- {
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( mRenderer, &DynamicsDebugRenderer::UpdateMatrices, projectionMatrix, viewMatrix );
- }
-}
-
-DynamicsDebugRenderer& DynamicsWorld::GetDebugRenderer() const
-{
- return *mRenderer;
-}
-
} // namespace SceneGraph
} // namespace Internal
{
struct DynamicsCollisionData;
-class DynamicsDebugRenderer;
class DynamicsFactory;
class DynamicsWorld;
struct DynamicsWorldSettings;
class DynamicsBody;
class DynamicsJoint;
class DynamicsShape;
-class DynamicsWorldDebug;
-class DynamicsDebugRenderer;
class SceneController;
class DynamicsWorld
* @param[in] sceneController Allows access to the render message queue
* @param[in] worldSettings The configuration for the new DynamicsWorld
*/
- void Initialize(SceneController* sceneController, Integration::DynamicsWorldSettings* worldSettings, const Shader* debugShader, const SceneGraphBuffers* buffers);
+ void Initialize(SceneController* sceneController, Integration::DynamicsWorldSettings* worldSettings, const SceneGraphBuffers* buffers);
void AddBody(DynamicsBody& body);
void RemoveBody(DynamicsBody& body);
/// @copydoc Dali::DynamicsWorld::SetGravity
void SetGravity( const Vector3& gravity );
- /// @copydoc Dali::DynamicsWorld::SetDebugDrawMode
- void SetDebugDrawMode( int mode );
-
/**
* Step the simulation and check for collisions
* @param[in] elapsedSeconds Time in seconds since last invocation
* @return true if any body was translated or rotated
*/
- bool Update( const float elapsedSeconds );
+ bool Update( float elapsedSeconds );
/**
* Update the simulation positions from the corresponding node position
bool PostSimulationStep();
/**
- * Allow dynamics engine to do its debug drawing
- */
- void DebugDraw();
-
- /**
* Check for collisions between simulation objects
*/
void CheckForCollisions();
*/
Integration::DynamicsWorld& GetDynamicsWorld();
-public: // debug drawing
-
- // Send projection and view matrices to the debug renderer
- void UpdateMatrices( const Matrix& projectionMatrix, const Matrix& viewMatrix );
-
- // Get the debug renderer
- DynamicsDebugRenderer& GetDebugRenderer() const;
-
private:
// unimplemented copy constructor and assignment operator
NotificationManager& mNotificationManager;
Node* mNode;
- DynamicsDebugRenderer* mRenderer;
SceneController* mSceneController;
const SceneGraphBuffers* mBuffers;
new (slot) LocalType( &world, &DynamicsWorld::SetGravity, gravity );
}
-inline void SetDebugDrawModeMessage( EventToUpdate& eventToUpdate, const DynamicsWorld& world, int mode )
-{
- typedef MessageValue1< DynamicsWorld, int > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
-
- // Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &world, &DynamicsWorld::SetDebugDrawMode, mode );
-}
-
inline void SetRootActorMessage( EventToUpdate& eventToUpdate, const DynamicsWorld& world, const Node* node )
{
typedef MessageValue1< DynamicsWorld, Node* > LocalType;
mImpl->renderSortingHelper,
mImpl->renderInstructions );
}
-
-#ifdef DYNAMICS_SUPPORT
- // if dynamics enabled and active...update matrices for debug drawing
- if( mImpl->dynamicsWorld && mImpl->dynamicsChanged )
- {
- RenderTask* task(mImpl->taskList.GetTasks()[0]);
- if( task )
- {
- mImpl->dynamicsWorld->UpdateMatrices( task->GetProjectionMatrix(mSceneGraphBuffers.GetUpdateBufferIndex()),
- task->GetViewMatrix(mSceneGraphBuffers.GetUpdateBufferIndex()) );
- }
- }
-#endif // DYNAMICS_SUPPORT
-
}
}
#ifdef DYNAMICS_SUPPORT
-void UpdateManager::InitializeDynamicsWorld( SceneGraph::DynamicsWorld* dynamicsWorld, Integration::DynamicsWorldSettings* worldSettings, SceneGraph::Shader* debugShader )
+void UpdateManager::InitializeDynamicsWorld( SceneGraph::DynamicsWorld* dynamicsWorld, Integration::DynamicsWorldSettings* worldSettings )
{
- dynamicsWorld->Initialize( mImpl->sceneController, worldSettings, debugShader, &mSceneGraphBuffers );
+ dynamicsWorld->Initialize( mImpl->sceneController, worldSettings, &mSceneGraphBuffers );
mImpl->dynamicsWorld = dynamicsWorld;
-
- typedef MessageValue1< RenderManager, DynamicsDebugRenderer* > DerivedType;
-
- // Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
-
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &mImpl->renderManager, &RenderManager::InitializeDynamicsDebugRenderer, &dynamicsWorld->GetDebugRenderer() );
}
void UpdateManager::TerminateDynamicsWorld()
* @param[in] worldSettings The dynamics world settings
* @param[in] debugShader The shader used for rendering dynamics debug information
*/
- void InitializeDynamicsWorld( DynamicsWorld* world, Integration::DynamicsWorldSettings* worldSettings, Shader* debugShader );
+ void InitializeDynamicsWorld( DynamicsWorld* world, Integration::DynamicsWorldSettings* worldSettings );
/**
* Terminate the dynamics world
#ifdef DYNAMICS_SUPPORT
// Dynamics messages
-inline void InitializeDynamicsWorldMessage(UpdateManager& manager, DynamicsWorld* dynamicsworld, Integration::DynamicsWorldSettings* worldSettings, const Shader* debugShader)
+inline void InitializeDynamicsWorldMessage( UpdateManager& manager, DynamicsWorld* dynamicsworld, Integration::DynamicsWorldSettings* worldSettings )
{
- typedef MessageValue3< UpdateManager, DynamicsWorld*, Integration::DynamicsWorldSettings*, Shader*> LocalType;
+ typedef MessageValue2< UpdateManager, DynamicsWorld*, Integration::DynamicsWorldSettings* > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::InitializeDynamicsWorld, dynamicsworld, worldSettings, const_cast<Shader*>(debugShader) );
+ new (slot) LocalType( &manager, &UpdateManager::InitializeDynamicsWorld, dynamicsworld, worldSettings );
}
inline void TerminateDynamicsWorldMessage(UpdateManager& manager)