Skip to content

Commit

Permalink
Merge pull request #654 from dartsim/deprecate_draw_from_dynamics
Browse files Browse the repository at this point in the history
Deprecate draw functions of classes in dynamics namespace
  • Loading branch information
jslee02 committed Apr 3, 2016
2 parents 836d16f + deffdcd commit 896a678
Show file tree
Hide file tree
Showing 67 changed files with 483 additions and 898 deletions.
4 changes: 2 additions & 2 deletions apps/addDeleteSkels/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ MyWindow::~MyWindow() {
}


void MyWindow::drawSkels() {
void MyWindow::drawWorld() const {
glEnable(GL_LIGHTING);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

SimWindow::drawSkels();
SimWindow::drawWorld();
}

void MyWindow::keyboard(unsigned char _key, int _x, int _y) {
Expand Down
2 changes: 1 addition & 1 deletion apps/addDeleteSkels/MyWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MyWindow : public dart::gui::SimWindow {
virtual ~MyWindow();

/// \brief
virtual void drawSkels();
virtual void drawWorld() const override;

/// \brief
virtual void keyboard(unsigned char _key, int _x, int _y);
Expand Down
2 changes: 1 addition & 1 deletion apps/atlasSimbicon/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void MyWindow::drawSkels()
// glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

for (unsigned int i = 0; i < mWorld->getNumSkeletons(); i++)
mWorld->getSkeleton(i)->draw(mRI);
drawSkeleton(mWorld->getSkeleton(i).get());

// draw arrow
if (mImpulseDuration > 0)
Expand Down
6 changes: 3 additions & 3 deletions apps/bipedStand/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ void MyWindow::timeStepping() {
}
}

void MyWindow::drawSkels() {
for (unsigned int i = 0; i < mWorld->getNumSkeletons(); i++)
mWorld->getSkeleton(i)->draw(mRI);
void MyWindow::drawWorld() const {

SimWindow::drawWorld();

// draw arrow
if (mImpulseDuration > 0) {
Expand Down
2 changes: 1 addition & 1 deletion apps/bipedStand/MyWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class MyWindow : public dart::gui::SimWindow {
virtual ~MyWindow();

virtual void timeStepping();
virtual void drawSkels();
virtual void drawWorld() const override;
virtual void keyboard(unsigned char _key, int _x, int _y);

void setController(Controller* _controller);
Expand Down
2 changes: 1 addition & 1 deletion apps/hardcodedDesign/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void MyWindow::draw() {
glDisable(GL_LIGHTING);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
skel->draw(mRI);
drawSkeleton(skel.get());
}

void MyWindow::keyboard(unsigned char _key, int _x, int _y) {
Expand Down
4 changes: 2 additions & 2 deletions apps/hardcodedDesign/MyWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@

#include "dart/dart.h"

class MyWindow : public dart::gui::Win3D {
class MyWindow : public dart::gui::SimWindow {
public:
/// \brief The constructor - set the position of the skeleton
explicit MyWindow(dart::dynamics::SkeletonPtr _skel): Win3D(), skel(_skel) {
explicit MyWindow(dart::dynamics::SkeletonPtr _skel): SimWindow(), skel(_skel) {
mTrans[1] = 200.f;
mZoom = 0.3;
}
Expand Down
4 changes: 2 additions & 2 deletions apps/hybridDynamics/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ void MyWindow::timeStepping()
}

//==============================================================================
void MyWindow::drawSkels()
void MyWindow::drawWorld() const
{
glEnable(GL_LIGHTING);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

SimWindow::drawSkels();
SimWindow::drawWorld();
}

//==============================================================================
Expand Down
2 changes: 1 addition & 1 deletion apps/hybridDynamics/MyWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class MyWindow : public dart::gui::SimWindow
virtual void timeStepping();

/// \brief
virtual void drawSkels();
virtual void drawWorld() const override;

/// \brief
virtual void keyboard(unsigned char _key, int _x, int _y);
Expand Down
2 changes: 1 addition & 1 deletion apps/jointConstraints/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void MyWindow::timeStepping()
void MyWindow::drawSkels()
{
for (unsigned int i = 0; i < mWorld->getNumSkeletons(); i++)
mWorld->getSkeleton(i)->draw(mRI);
drawSkeleton(mWorld->getSkeleton(i).get());

// draw arrow
if (mImpulseDuration > 0)
Expand Down
4 changes: 2 additions & 2 deletions apps/mixedChain/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void MyWindow::timeStepping()
mForceOnVertex /= 2.0;
}

void MyWindow::drawSkels()
void MyWindow::drawWorld() const
{
glEnable(GL_LIGHTING);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
Expand All @@ -99,7 +99,7 @@ void MyWindow::drawSkels()
dart::gui::drawArrow3D(start, mForceOnRigidBody, len, 0.025, 0.05);
}

SimWindow::drawSkels();
SimWindow::drawWorld();
}

void MyWindow::keyboard(unsigned char key, int x, int y)
Expand Down
2 changes: 1 addition & 1 deletion apps/mixedChain/MyWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class MyWindow : public dart::gui::SoftSimWindow
virtual void keyboard(unsigned char key, int x, int y);

/// \brief
virtual void drawSkels();
virtual void drawWorld() const override;

private:
/// \brief
Expand Down
6 changes: 3 additions & 3 deletions apps/operationalSpaceControl/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void MyWindow::timeStepping()
}

//==============================================================================
void MyWindow::drawSkels()
void MyWindow::drawWorld() const
{
// Draw the target position
if (mRI)
Expand All @@ -93,8 +93,8 @@ void MyWindow::drawSkels()
mRI->popMatrix();
}

// Draw skeletons
SimWindow::drawSkels();
// Draw world
SimWindow::drawWorld();
}

//==============================================================================
Expand Down
2 changes: 1 addition & 1 deletion apps/operationalSpaceControl/MyWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class MyWindow : public dart::gui::SimWindow
virtual void timeStepping();

// Documentation inherited
virtual void drawSkels();
virtual void drawWorld() const override;

// Documentation inherited
virtual void keyboard(unsigned char _key, int _x, int _y);
Expand Down
4 changes: 2 additions & 2 deletions apps/rigidCubes/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ void MyWindow::timeStepping() {
mForce /= 2.0;
}

void MyWindow::drawSkels() {
void MyWindow::drawWorld() const {
glEnable(GL_LIGHTING);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

SimWindow::drawSkels();
SimWindow::drawWorld();
}

void MyWindow::keyboard(unsigned char _key, int _x, int _y) {
Expand Down
2 changes: 1 addition & 1 deletion apps/rigidCubes/MyWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class MyWindow : public dart::gui::SimWindow {
virtual void timeStepping();

/// \brief
virtual void drawSkels();
virtual void drawWorld() const override;

/// \brief
virtual void keyboard(unsigned char _key, int _x, int _y);
Expand Down
4 changes: 2 additions & 2 deletions apps/rigidShapes/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ void MyWindow::timeStepping()
}

//==============================================================================
void MyWindow::drawSkels()
void MyWindow::drawWorld() const
{
glEnable(GL_LIGHTING);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

SimWindow::drawSkels();
SimWindow::drawWorld();
}

//==============================================================================
Expand Down
2 changes: 1 addition & 1 deletion apps/rigidShapes/MyWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class MyWindow : public dart::gui::SimWindow
virtual void keyboard(unsigned char key, int x, int y) override;

// Documentation inherited
virtual void drawSkels() override;
virtual void drawWorld() const override;

/// Spawn a box into the world
void spawnBox(
Expand Down
6 changes: 3 additions & 3 deletions apps/softBodies/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ void MyWindow::timeStepping()
mForceOnVertex /= 2.0;
}

void MyWindow::drawSkels()
void MyWindow::drawWorld() const
{
glEnable(GL_LIGHTING);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
Eigen::Vector4d color;
color << 0.5, 0.8, 0.6, 1.0;
mWorld->getSkeleton(0)->draw(mRI, color, false);
drawSkeleton(mWorld->getSkeleton(0).get(), color, false);

// draw arrow
if (mImpulseDuration > 0)
Expand All @@ -98,7 +98,7 @@ void MyWindow::drawSkels()
dart::gui::drawArrow3D(start, mForceOnRigidBody, len, 0.025, 0.05);
}

SimWindow::drawSkels();
SimWindow::drawWorld();
}

void MyWindow::keyboard(unsigned char key, int x, int y)
Expand Down
2 changes: 1 addition & 1 deletion apps/softBodies/MyWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class MyWindow : public dart::gui::SoftSimWindow
virtual void keyboard(unsigned char key, int x, int y);

/// \brief
virtual void drawSkels();
virtual void drawWorld() const override;

private:
/// \brief
Expand Down
4 changes: 2 additions & 2 deletions apps/vehicle/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ void MyWindow::timeStepping() {
mWorld->step();
}

void MyWindow::drawSkels() {
void MyWindow::drawWorld() const {
glEnable(GL_LIGHTING);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

SimWindow::drawSkels();
SimWindow::drawWorld();
}

void MyWindow::keyboard(unsigned char _key, int _x, int _y) {
Expand Down
2 changes: 1 addition & 1 deletion apps/vehicle/MyWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class MyWindow : public dart::gui::SimWindow {
virtual void timeStepping();

/// \brief
virtual void drawSkels();
virtual void drawWorld() const override;

/// \brief
virtual void keyboard(unsigned char _key, int _x, int _y);
Expand Down
11 changes: 0 additions & 11 deletions dart/collision/fcl_mesh/FCLMeshCollisionDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@

#include <fcl/collision.h>

#include "dart/renderer/LoadOpengl.h"
#include "dart/math/Helpers.h"
#include "dart/dynamics/BodyNode.h"
#include "dart/dynamics/SoftBodyNode.h"
Expand Down Expand Up @@ -140,15 +139,5 @@ bool FCLMeshCollisionDetector::detectCollision(CollisionNode* _node1,
mNumMaxContacts);
}

//==============================================================================
void FCLMeshCollisionDetector::draw()
{
for (size_t i = 0; i < mCollisionNodes.size(); i++)
{
static_cast<FCLMeshCollisionNode*>(
mCollisionNodes[i])->drawCollisionSkeletonNode();
}
}

} // namespace collision
} // namespace dart
3 changes: 0 additions & 3 deletions dart/collision/fcl_mesh/FCLMeshCollisionDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ class FCLMeshCollisionDetector : public CollisionDetector
// Documentation inherited
virtual bool detectCollision(CollisionNode* _node1, CollisionNode* _node2,
bool _calculateContactPoints);

///
void draw();
};

} // namespace collision
Expand Down
36 changes: 0 additions & 36 deletions dart/collision/fcl_mesh/FCLMeshCollisionNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
#include "dart/dynamics/EllipsoidShape.h"
#include "dart/dynamics/CylinderShape.h"
#include "dart/dynamics/SoftMeshShape.h"
#include "dart/renderer/LoadOpengl.h"
#include "dart/collision/fcl_mesh/CollisionShapes.h"
#include "dart/collision/fcl_mesh/FCLMeshCollisionDetector.h"

Expand Down Expand Up @@ -432,41 +431,6 @@ int FCLMeshCollisionNode::evalContactPosition(
return testRes;
}

//==============================================================================
void FCLMeshCollisionNode::drawCollisionSkeletonNode(bool _bTrans)
{
evalRT();
double M[16];
for (int i = 0; i < 4; i++)
for (int j = 0; j < 4; j++)
M[j * 4 + i] = mWorldTrans(i, j);
// fcl::Vec3f v1, v2, v3;
glPushMatrix();
if (_bTrans)
glMultMatrixd(M);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glBegin(GL_TRIANGLES);
for (size_t i = 0; i < mMeshes.size(); i++)
{
for (int j = 0; j < mMeshes[i]->num_tris; j++)
{
fcl::Triangle tri = mMeshes[i]->tri_indices[j];
glVertex3f(mMeshes[i]->vertices[tri[0]][0],
mMeshes[i]->vertices[tri[0]][1],
mMeshes[i]->vertices[tri[0]][2]);
glVertex3f(mMeshes[i]->vertices[tri[1]][0],
mMeshes[i]->vertices[tri[1]][1],
mMeshes[i]->vertices[tri[1]][2]);
glVertex3f(mMeshes[i]->vertices[tri[2]][0],
mMeshes[i]->vertices[tri[2]][1],
mMeshes[i]->vertices[tri[2]][2]);
}
}
glEnd();
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glPopMatrix();
}

//==============================================================================
template<class BV>
fcl::BVHModel<BV>* createSoftMesh(const aiMesh* _mesh,
Expand Down
3 changes: 0 additions & 3 deletions dart/collision/fcl_mesh/FCLMeshCollisionNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ class FCLMeshCollisionNode : public CollisionNode
Eigen::Vector3d* _contactPosition1,
Eigen::Vector3d* _contactPosition2);

///
void drawCollisionSkeletonNode(bool _bTrans = true);

private:
///
static int FFtest(
Expand Down
Loading

0 comments on commit 896a678

Please sign in to comment.