Permalink
Browse files

Merge pull request #30 from ButchDean/master

Examples can be run on Ubuntu 14.04 LTS 64-bit
  • Loading branch information...
2 parents 9537fec + eaf6b8a commit fd0cf4956fd83ebf9e2e75421dfbf9f5cdac49fa @idmillington committed Oct 2, 2014
View
@@ -1,14 +1,9 @@
-
-
-# LINK FLAGS AND PLATFORM
-
-# Linux (default)
-LDFLAGS = -lGL -lGLU -lglut
-
# OS X
ARCH = $(shell uname)
ifeq ($(ARCH),Darwin)
LDFLAGS = -framework GLUT -framework OpenGL -framework Cocoa
+else
+ $(error This OS is not Mac OSX. Aborting. Please run linuxmake.mk)
endif
mkdir=mkdir -p
@@ -18,7 +13,7 @@ RANLIB=ranlib
# CYCLONEPHYSICS LIB
-CXXFLAGS=-O2 -I./include -fPIC
+CXXFLAGS=-O2 -Iinclude -fPIC
CYCLONEOBJS=src/body.o src/collide_coarse.o src/collide_fine.o src/contacts.o src/core.o src/fgen.o src/joints.o src/particle.o src/pcontacts.o src/pfgen.o src/plinks.o src/pworld.o src/random.o src/world.o
@@ -43,7 +38,7 @@ OUTDIRS=./lib/linux ./bin/linux
all: out_dirs $(CYCLONELIB) $(DEMOS)
-out_dirs:
+out_dirs:
$(mkdir) $(OUTDIRS)
@@ -53,8 +48,8 @@ $(CYCLONELIB): $(CYCLONEOBJS)
$(RANLIB) $@
-$(DEMOS):
- $(CXX) $(CXXFLAGS) $(LDFLAGS) -o ./bin/linux/$@ $(DEMO_CPP) $(CYCLONELIB) ./src/demos/$@/$@.cpp
+$(DEMOS):
+ $(CXX) $(CXXFLAGS) -o ./bin/linux/$@ $(DEMO_CPP) $(CYCLONELIB) ./src/demos/$@/$@.cpp $(LDFLAGS)
clean:
@@ -21,6 +21,7 @@
#define CYCLONE_COLLISION_COARSE_H
#include <vector>
+#include <cstddef>
#include "contacts.h"
namespace cyclone {
View
@@ -0,0 +1,32 @@
+# New makefile to build the Cyclone physics engine for Linux.
+
+# Determine architecture (Linux or Mac OS X).
+PLATFORM = $(shell uname)
+
+ifeq ($(PLATFORM), Linux)
+ LDFLAGS = -lGL -lGLU -lglut
+else
+ $(error This OS is not Ubuntu Linux. Aborting)
+endif
+
+# Demo files path.
+DEMOPATH = ./src/demos/
+
+# Demo core files.
+DEMOCOREFILES = $(DEMOPATH)main.cpp $(DEMOPATH)app.cpp $(DEMOPATH)timing.cpp
+
+# Demo files.
+DEMOLIST = ballistic bigballistic blob bridge explosion fireworks flightsim fracture platform ragdoll sailboat
+
+# Cyclone core files.
+CYCLONEFILES = ./src/body.cpp ./src/collide_coarse.cpp ./src/collide_fine.cpp ./src/contacts.cpp ./src/core.cpp ./src/fgen.cpp ./src/joints.cpp ./src/particle.cpp ./src/pcontacts.cpp ./src/pfgen.cpp ./src/plinks.cpp ./src/pworld.cpp ./src/random.cpp ./src/world.cpp
+
+.PHONY: clean
+
+all: $(DEMOLIST)
+
+$(DEMOLIST):
+ g++ -O2 -Iinclude $(DEMOCOREFILES) $(CYCLONEFILES) $(DEMOPATH)$@/$@.cpp -o $@ $(LDFLAGS)
+
+clean:
+ rm $(DEMOLIST)
View
@@ -10,7 +10,6 @@
* software licence.
*/
-
#include <cyclone/body.h>
#include <memory.h>
#include <assert.h>
@@ -550,7 +549,7 @@ void RigidBody::addForceAtBodyPoint(const Vector3 &force,
// Convert to coordinates relative to center of mass.
Vector3 pt = getPointInWorldSpace(point);
addForceAtPoint(force, pt);
-
+
}
void RigidBody::addForceAtPoint(const Vector3 &force,
@@ -10,7 +10,6 @@
* software licence.
*/
-
#include <cyclone/collide_coarse.h>
using namespace cyclone;
@@ -10,7 +10,6 @@
* software licence.
*/
-
#include <cyclone/collide_fine.h>
#include <memory.h>
#include <assert.h>
View
@@ -154,7 +154,7 @@ void Contact::calculateDesiredDeltaVelocity(real duration)
if (body[0]->getAwake())
{
- velocityFromAcc+=
+ velocityFromAcc+=
body[0]->getLastFrameAcceleration() * duration * contactNormal;
}
View
@@ -10,7 +10,6 @@
* software licence.
*/
-
#include <cyclone/core.h>
using namespace cyclone;
View
@@ -10,7 +10,7 @@
* software licence.
*/
#include <cstring>
-#include <gl/glut.h>
+#include "ogl_headers.h"
#include "app.h"
#include "timing.h"
View
@@ -136,12 +136,12 @@ class Application
*/
virtual void mouseDrag(int x, int y);
- // These are helper functions that can be used by an application
+ // These are helper functions that can be used by an application
// to render things.
/**
* Renders the given text to the given x,y location (in screen space)
- * on the window. This is used to pass status information to the
+ * on the window. This is used to pass status information to the
* application.
*/
void renderText(float x, float y, const char *text, void* font=NULL);
@@ -172,8 +172,8 @@ class MassAggregateApplication : public Application
};
/**
- * This application adds additional functionality used in many of the
- * demos. This includes the ability to track contacts (for rigid bodies)
+ * This application adds additional functionality used in many of the
+ * demos. This includes the ability to track contacts (for rigid bodies)
* and move the camera around.
*/
class RigidBodyApplication : public Application
@@ -207,16 +207,16 @@ class MassAggregateApplication : public Application
bool pauseSimulation;
/** Pauses the simulation after the next frame automatically */
- bool autoPauseSimulation;
+ bool autoPauseSimulation;
/** Processes the contact generation code. */
virtual void generateContacts() = 0;
/** Processes the objects in the simulation forward in time. */
virtual void updateObjects(cyclone::real duration) = 0;
- /**
- * Finishes drawing the frame, adding debugging information
+ /**
+ * Finishes drawing the frame, adding debugging information
* as needed.
*/
void drawDebug();
@@ -225,14 +225,14 @@ class MassAggregateApplication : public Application
virtual void reset() = 0;
public:
- /**
+ /**
* Creates a new application object.
*/
RigidBodyApplication();
/** Display the application. */
virtual void display();
-
+
/** Update the objects. */
virtual void update();
@@ -10,8 +10,8 @@
* software licence.
*/
-#include <gl/glut.h>
#include <cyclone/cyclone.h>
+#include "../ogl_headers.h"
#include "../app.h"
#include "../timing.h"
@@ -10,8 +10,8 @@
* software licence.
*/
-#include <gl/glut.h>
#include <cyclone/cyclone.h>
+#include "../ogl_headers.h"
#include "../app.h"
#include "../timing.h"
@@ -219,7 +219,7 @@ class BigBallisticDemo : public RigidBodyApplication
/** Sets up the rendering. */
virtual void initGraphics();
-
+
/** Display world. */
virtual void display();
@@ -232,7 +232,7 @@ class BigBallisticDemo : public RigidBodyApplication
// Method definitions
BigBallisticDemo::BigBallisticDemo()
-:
+:
RigidBodyApplication(),
currentShotType(LASER)
{
@@ -328,7 +328,7 @@ void BigBallisticDemo::updateObjects(cyclone::real duration)
void BigBallisticDemo::display()
{
const static GLfloat lightPosition[] = {-1,1,0,0};
-
+
// Clear the viewport and set the camera direction
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
Oops, something went wrong.

0 comments on commit fd0cf49

Please sign in to comment.