Tutorial - BatteryTech 1.1 && Newton core 200 Tutorial

From Newton Wiki
Revision as of 08:02, 10 June 2019 by WikiSysop (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This tutorial is for building Newton with BatteryTech, a mobile platform-abstraction library.


Install

This tutorial is for building Newton with BatteryTech, a mobile platform-abstraction library.

Please note that i will not endorse any responsability ...etc.. because it's just here to help, and does not represent an approved solution. Please note that i've tested only core_200, with nosimd, and on my milestone as real device (because in my code lies something that is shaders only)

  • enter the cygwin bash shell, type 3 commands :
  • cd /cygdrive/c/ (or what you want)

very long, normal


Patch, android

  • patch.exe < Netwon2_AndroidNDK_NoSimd_rev687.patch

for dgTypes.cpp, it will ask : enter the path "newton-dynamics-read-only/coreLibrary_200/source/core/dgTypes.cpp" (without quotes")

now, in the current directory lies 2 NEW files "Android.mk" and "NewtonSrc.mk" (the dgTypes.cpp have been patched at the right place) go to newton-dynamics-read-only\coreLibrary_200\projets and create "android" folder then copy those 2 .mk files in there patch done

In fact, you only need the core android.mk patch, and the dgTypes patch, because -i think- we must deal with only one .mk with batterytech. Krystian patch was made more for JNI if you use Java. However, below this wiki page is a complete Android.mk file i've tested successfully. But you could test the multiple .mk files approach Krystian chose.


Patch, batterytech

  • COPY newton-dynamics-read-only\coreLibrary_200\source directories "core" "newton" "physics" (all except cuda)
  IN   src/newton (create that directory from eclipse, and do the copy with copy paste from explorer to eclipse)
  • COPY newton-dynamics-read-only\packages directories "dMath"
  IN   src/newton
  • some \dirty\ patches (generally because mingw DEFINE are not spotted, i have to investigate on that) from me
  DELETE physics\dgVehicleConstraint.* (hum)
  patch also core\dgThreads.cpp comment out from line 371 to 375 (because nothing declared, then a syntax error happen on the { )
  patch also physics\dgWorld.cpp comment out from line 370 to 372 (in order to avoid  undefined reference to `dgGetCpuType()')
  • for your win32 project, right-click the project --> properties --> C/C++ build --> Settings --> GCC C++ Compiler --> Includes
  add that to include paths
  "${workspace_loc:/${ProjName}/src/newton/core}"
  "${workspace_loc:/${ProjName}/src/newton/dMath}"
  "${workspace_loc:/${ProjName}/src/newton/newton}"
  "${workspace_loc:/${ProjName}/src/newton/physics}"
  (WITH the quotes ")
  • for win32 project, i didnt get simd working (gcc ?), so here's a way to disable it :
  right-click the project --> properties --> C/C++ build --> Settings --> GCC C++ Compiler --> Preprocessor --> add _SCALAR_ARITHMETIC_ONLY
  • COPY the core patch of Android.mk in coreLibrary_200\projets\android for your android project
  TO jni/Android.mk (with eclipse still, or refresh right after) See end of this page for a complete example (and syntax)


Code example

  • NOTE THAT YOU SHOULD GO FROM BATTERYTECH EXAMPLE WITH BULLET, IN ORDER TO HAVE THE SAME CODE BASE I USED

world.h

#include <newton/newton/Newton.h>
#include <newton/dMath/dVector.h>

	NewtonWorld * newtonWorld;

game.cpp

	// in loadlevel() or where you want (better at game::game, because i had some problems, see http://www.newtondynamics.com/forum/viewtopic.php?f=9&t=6863 )

	// world creation
	world->newtonWorld = NewtonCreate();
	// set a fix world size
	dVector minSize (-500.0f, -500.0f, -500.0f);
	dVector maxSize ( 500.0f,  500.0f,  500.0f);
	NewtonSetWorldSize (world->newtonWorld, &minSize[0], &maxSize[0]);

	// the function to update physics
	void Game::updatePhysics() {
	//..
		// here we tick the simulation
		NewtonUpdate(world->newtonWorld, context->tickDelta);
	/..
	}

Ball.h (simple example, isn't it ?)

	NewtonBody * body;

Ball.cpp

// the callback for gravity : this is a MAJOR difference with bullet example
void applyForceAndTorqueCallBack(const NewtonBody * const body, dFloat timestep, int threadIndex) {
	float mass, ix, iy, iz;
	NewtonBodyGetMassMatrix(body, &mass, &ix, &iy, &iz);
	float force[4] = { 0.0f, WORLD_GRAVITY * mass, 0.0f, 0.0f };
	NewtonBodySetForce(body, force);
}

	// matrix init
	Matrix4f rotMv;
	rotMv.data[12] = pos.x;
	rotMv.data[13] = pos.y;
	rotMv.data[14] = pos.z;

	// NewtonCollision describes the shape, LET'S TRY A SPHERE
	NewtonCollision * const collision = NewtonCreateSphere(context->world->newtonWorld, BALL_RADIUS, BALL_RADIUS, BALL_RADIUS, 0, NULL);

	// creation of the body (declared in header and public, in order to access it from your renderer)
	body = NewtonCreateBody(context->world->newtonWorld, collision, rotMv);

	// here we must set a callback : this is our function applyForceAndTorqueCallBack (must be declared before, and not a member, cause C ?)
	NewtonBodySetForceAndTorqueCallback(body, applyForceAndTorqueCallBack);

	// mass
	NewtonBodySetMassMatrix(body, 0.05f, 1, 1, 1);

	// initial velocity, YEAH, if you need it only
	dVector velocity = dVector(3*force, -3*force/20, 0);
	NewtonBodySetVelocity(body, &velocity.m_x);

	// It is interesting to note that between Bullet and Newton, the balls fall exactly at the same speed.
	//  As against the initial forces do not push the ball as far as the X in Newton in Bullet.
	//  Must be multiplied by 3 to have almost the same result (2.89 and 3.14 were tested, but are slightly offset).

now the renderer for the Ball :

		// we acquire the rot matrix data
		NewtonBodyGetMatrix(ball->body, rotMv.data);
		// NO NEED TO CHANGE other code right before and after

		// to compare, for bullet physics the same line was
		// ball->btBody->getWorldTransform().getOpenGLMatrix(rotMv.data);


Now for the future

  • you could experiment the debug renderer, which is not embedded is the library, but provided in newton-dynamics-read-only\applications\newtonDemos\sdkDemos\toolBox\DebugDisplay.cpp

Here's my version of a debug display (tested only with shaders used) header :

/*
 * NewtonDebugDisplay.h
 *
 *  Created on: 11 sept. 2011
 *      Author: syl
 */

#ifndef NEWTONDEBUGDISPLAY_H_
#define NEWTONDEBUGDISPLAY_H_

#include <batterytech/primitives.h>
#include <batterytech/Context.h>
#include <batterytech/Logger.h>
#include <batterytech/render/RenderContext.h>
#include <batterytech/render/Renderer.h>
#include <batterytech/platform/platformgl.h>
#include <batterytech/render/ShaderProgram.h>
#include "BatchSpriteRenderer.h"
#include <stdio.h>
#include <newton/newton/Newton.h>
#include <newton/dMath/dMatrix.h>
#include <newton/dMath/dVector.h>

using namespace BatteryTech;

#define NEWTON_DEBUG_MAX_LINES 1000000

class NewtonDebugDisplay: public Renderer {
public:
	NewtonDebugDisplay(Context * context);
	virtual ~NewtonDebugDisplay();
	virtual void init(BOOL32 newContext);
	void start();
	void end();
	void DebugShowCollisions(const NewtonWorld * world);
private:
	//static because it's for a callback (see also some static variables in the cpp file)
	static void DebugShowPolygonCollision(void * userData, int vertexCount, const dFloat * FaceArray, int faceId);
	int m_debugMode;
	Context * context;
	ShaderProgram * shaderProgram;
};

#endif /* NEWTONDEBUGDISPLAY_H_ */

code

/*
 * NewtonDebugDisplay.cpp
 *
 *  Created on: 11 sept. 2011
 *      Author: syl
 */

#include "NewtonDebugDisplay.h"

// static declares for the callback
F32 vPos[NEWTON_DEBUG_MAX_LINES * 6];
F32 vColor[NEWTON_DEBUG_MAX_LINES * 8];
S32 lineCount;
dVector color (0, 0, 0, 0);
dVector p0 (0, 0, 0);
dVector p1 (0, 0, 0);

// static function that Newton game dynamics will use as a callback (we give it at NewtonCollisionForEachPolygonDo)
void NewtonDebugDisplay::DebugShowPolygonCollision(void * userData, int vertexCount, const dFloat * faceArray, int faceId) {

	// choosen color (just before NewtonCollisionForEachPolygonDo) for a primitive type of collision
	color = (const float *)userData;

	// for each vertex/vertice/sommet of this polygon
	for (int i = 0; i < vertexCount-1; i++) {

		// next vertex of the polygon (or first)
		p0 = dVector(faceArray[i * 3 + 0], faceArray[i * 3 + 1], faceArray[i * 3 + 2]);
		// next+1 vertex of the polygon (or second)
		p1 = dVector(faceArray[(i+1) * 3 + 0], faceArray[(i+1) * 3 + 1], faceArray[(i+1) * 3 + 2]);

		if (lineCount < NEWTON_DEBUG_MAX_LINES) {
			vPos[lineCount * 6] = p0.m_x;
			vPos[lineCount * 6 + 1] = p0.m_y;
			vPos[lineCount * 6 + 2] = p0.m_z;

			vPos[lineCount * 6 + 3] = p1.m_x;
			vPos[lineCount * 6 + 4] = p1.m_y;
			vPos[lineCount * 6 + 5] = p1.m_z;

			vColor[lineCount * 8] = color.m_x;
			vColor[lineCount * 8 + 1] = color.m_y;
			vColor[lineCount * 8 + 2] = color.m_z;
			vColor[lineCount * 8 + 3] = 1.0;

			vColor[lineCount * 8 + 4] = color.m_x;
			vColor[lineCount * 8 + 5] = color.m_y;
			vColor[lineCount * 8 + 6] = color.m_z;
			vColor[lineCount * 8 + 7] = 1.0;
			lineCount++;
		}
	}
}


NewtonDebugDisplay::NewtonDebugDisplay(Context * context) {
	this->context = context;
	m_debugMode = 1;
	shaderProgram = new ShaderProgram("shaders/lineshader.vert", "shaders/lineshader.frag");
	lineCount = 0;
}

NewtonDebugDisplay::~NewtonDebugDisplay() {
	delete shaderProgram;
}

void NewtonDebugDisplay::init(BOOL32 newContext) {
	if (context->gConfig->useShaders) {
		shaderProgram->init(newContext);
		shaderProgram->addVertexAttributeLoc("vPosition");
		shaderProgram->addVertexAttributeLoc("vColor");
		shaderProgram->addUniformLoc("projection_matrix");
		shaderProgram->addUniformLoc("modelview_matrix");
	}
	checkGLError("NewtonDebugDisplay init");
}

void NewtonDebugDisplay::start() {
	checkGLError("NewtonDebugDisplay Start");
	glFrontFace(GL_CW);
	if (context->gConfig->useShaders) {
		shaderProgram->bind();
		//glEnable(0x8642);
	}
	lineCount = 0;
}

void NewtonDebugDisplay::end() {
	// draw line batch
	if (context->gConfig->useShaders) {
		//glUniform4f(shaderColorFilter, color.getX(), color.getY(), color.getZ(), 1.0f);
		glVertexAttribPointer(shaderProgram->getVertexAttributeLoc("vPosition"), 3, GL_FLOAT, GL_FALSE, 0, vPos);
		glVertexAttribPointer(shaderProgram->getVertexAttributeLoc("vColor"), 4, GL_FLOAT, GL_FALSE, 0, vColor);
		glUniformMatrix4fv(shaderProgram->getUniformLoc("projection_matrix"), 1, GL_FALSE, context->renderContext->projMatrix);
		glUniformMatrix4fv(shaderProgram->getUniformLoc("modelview_matrix"), 1, GL_FALSE, context->renderContext->mvMatrix);
		glDrawArrays(GL_POINTS, 0, lineCount * 2);
		glDrawArrays(GL_LINES, 0, lineCount * 2);
	} else {
		//glColor4f(color.getX(), color.getY(), color.getZ(), 1.0f);
		glVertexPointer(3, GL_FLOAT, 0, &vPos);
		glColorPointer(4, GL_FLOAT, 0, &vColor);
		glPointSize(5.0f);
		glDrawArrays(GL_POINTS, 0, lineCount);
		glDrawArrays(GL_LINES, 0, lineCount);
	}
	if (context->gConfig->useShaders) {
		shaderProgram->unbind();
		//glDisable(0x8642);
		glUseProgram(0);
	}
	checkGLError("NewtonDebugDisplay end");
}

// To show/draw geometry of objects in a Newton game dynamics world
void NewtonDebugDisplay::DebugShowCollisions(const NewtonWorld * world) {
	dMatrix m;
	dVector color = dVector(1.0f, 1.0f, 1.0f);
	NewtonCollision * collision;
	NewtonCollisionInfoRecord collisionInfo;

	for (NewtonBody* body = NewtonWorldGetFirstBody(world); body; body = NewtonWorldGetNextBody(world, body)) {
		NewtonBodyGetMatrix(body, &m[0][0]);

		// lookup collision type (primitive) to choose color we will draw
		collision = NewtonBodyGetCollision(body);
		NewtonCollisionGetInfo(collision, &collisionInfo);

		//if sphere
		if (collisionInfo.m_collisionType == SERIALIZE_ID_SPHERE)
			color = dVector(1.0f, 0.0f, 0.0f);
		else if (collisionInfo.m_collisionType == SERIALIZE_ID_BOX)
			color = dVector(0.0f, 0.0f, 1.0f);
		else
			color = dVector(1.0f, 1.0f, 1.0f);

		// HERE for each polygon on the collisions (of the body), setup our callback DebugShowPolygonCollision
		//  color is in fact embedded in a void, in order to pass some datas to the callback
		NewtonCollisionForEachPolygonDo(NewtonBodyGetCollision(body), &m[0][0], DebugShowPolygonCollision, &color);
	}
}

calling it :

// I'VE LET SOME CODE FROM BULLET EXAMPLE AS COMMENT SO YOU GET IT EASILY
			//if (context->world->btWorld) {
			if (context->world->newtonWorld) {
				glDisable(GL_BLEND);
				glDisable(GL_CULL_FACE);
				glDisable(GL_DEPTH_TEST);

				// TODO debug renderer
				newtonDebugDisplay->start();
				newtonDebugDisplay->DebugShowCollisions(context->world->newtonWorld);
				newtonDebugDisplay->end();

				/*context->world->btWorld->setDebugDrawer(btDebugRenderer);
				btDebugRenderer->setDebugMode(btIDebugDraw::DBG_DrawWireframe);
				btDebugRenderer->start();
				context->world->btWorld->debugDrawWorld();
				btDebugRenderer->end();*/
			}


android work to get the thing building

  • A windows batch script to enumerate recursively all cpp files :
dir /O N /S /B core\*.cpp > test.txt
dir /O N /S /B newton\*.cpp >> test.txt
dir /O N /S /B physics\*.cpp >> test.txt
  • Then, play with notepad edit->replace 3 times to obtain that :
my_src_files +=\
	newton/core/dg.cpp \
	newton/core/dgAABBPolygonSoup.cpp \
	newton/core/dgConvexHull3d.cpp \
	newton/core/dgConvexHull4d.cpp \
	newton/core/dgCRC.cpp \
	newton/core/dgDebug.cpp \
	newton/core/dgDelaunayTetrahedralization.cpp \
	newton/core/dgGeneralMatrix.cpp \
	newton/core/dgGeneralVector.cpp \
	newton/core/dgGoogol.cpp \
	newton/core/dgIntersections.cpp \
	newton/core/dgMatrix.cpp \
	newton/core/dgMemory.cpp \
	newton/core/dgNode.cpp \
	newton/core/dgPolygonSoupBuilder.cpp \
	newton/core/dgPolyhedra.cpp \
	newton/core/dgPolyhedraMassProperties.cpp \
	newton/core/dgQuaternion.cpp \
	newton/core/dgRandom.cpp \
	newton/core/dgRef.cpp \
	newton/core/dgRefCounter.cpp \
	newton/core/dgSmallDeterminant.cpp \
	newton/core/dgSPDMatrix.cpp \
	newton/core/dgSphere.cpp \
	newton/core/dgThreads.cpp \
	newton/core/dgTree.cpp \
	newton/core/dgTypes.cpp \
	newton/newton/Newton.cpp \
	newton/newton/NewtonClass.cpp \
	newton/physics/dgBallConstraint.cpp \
	newton/physics/dgBilateralConstraint.cpp \
	newton/physics/dgBody.cpp \
	newton/physics/dgBodyMasterList.cpp \
	newton/physics/dgBroadPhaseCollision.cpp \
	newton/physics/dgCollision.cpp \
	newton/physics/dgCollisionBox.cpp \
	newton/physics/dgCollisionBVH.cpp \
	newton/physics/dgCollisionCapsule.cpp \
	newton/physics/dgCollisionChamferCylinder.cpp \
	newton/physics/dgCollisionCompound.cpp \
	newton/physics/dgCollisionCompoundBreakable.cpp \
	newton/physics/dgCollisionCone.cpp \
	newton/physics/dgCollisionConvex.cpp \
	newton/physics/dgCollisionConvexHull.cpp \
	newton/physics/dgCollisionConvexModifier.cpp \
	newton/physics/dgCollisionCylinder.cpp \
	newton/physics/dgCollisionEllipse.cpp \
	newton/physics/dgCollisionHeightField.cpp \
	newton/physics/dgCollisionMesh.cpp \
	newton/physics/dgCollisionNull.cpp \
	newton/physics/dgCollisionScene.cpp \
	newton/physics/dgCollisionSphere.cpp \
	newton/physics/dgCollisionUserMesh.cpp \
	newton/physics/dgConnectorConstraint.cpp \
	newton/physics/dgConstraint.cpp \
	newton/physics/dgContact.cpp \
	newton/physics/dgCorkscrewConstraint.cpp \
	newton/physics/dgHingeConstraint.cpp \
	newton/physics/dgMeshEffect.cpp \
	newton/physics/dgMeshEffect2.cpp \
	newton/physics/dgMeshEffectSolidTree.cpp \
	newton/physics/dgMinkowskiConv.cpp \
	newton/physics/dgNarrowPhaseCollision.cpp \
	newton/physics/dgPointToCurveConstraint.cpp \
	newton/physics/dgSlidingConstraint.cpp \
	newton/physics/dgUniversalConstraint.cpp \
	newton/physics/dgUpVectorConstraint.cpp \
	newton/physics/dgUserConstraint.cpp \
	newton/physics/dgVehicleConstraint.cpp \
	newton/physics/dgWorld.cpp \
	newton/physics/dgWorldDynamicUpdate.cpp
  • my complete actual Android.mk, as an example :
# Batterytech Demo App 3d Newton Android makefile

LOCAL_PATH := $(call my-dir)/../../batterytech-win32/src

# List all of your local source files here that you want included in this build
my_src_files :=\
	batterytech/batterytech.cpp \
	batterytech/Logger.cpp \
	batterytech/Context.cpp \
	batterytech/VibrationManager.cpp \
	batterytech/decoders/stb_image.c \
	batterytech/decoders/stb_vorbis.c \
	batterytech/audio/PCMSound.cpp \
	batterytech/audio/PCMStream.cpp \
	batterytech/audio/PCMAudioManager.cpp \
	batterytech/audio/AudioManager.cpp \
	batterytech/network/NetworkManager.cpp \
	batterytech/network/GameConnection.cpp \
	batterytech/network/NetworkMessage.cpp \
	batterytech/render/Renderer.cpp \
	batterytech/render/RenderContext.cpp \
	batterytech/render/TextRasterRenderer.cpp \
	batterytech/render/GraphicsConfiguration.cpp \
	batterytech/render/MenuRenderer.cpp \
	batterytech/render/ShaderProgram.cpp \
	batterytech/render/GLModelBinding.cpp \
	batterytech/importers/obj/ObjImporter.cpp \
	batterytech/importers/obj/ObjScene.cpp \
	batterytech/platform/android/androidgeneral.cpp \
	batterytech/platform/android/boot.cpp \
	batterytech/platform/android/importgl.cpp \
	batterytech/platform/opengles.cpp \
	batterytech/platform/platformgeneral.cpp \
	batterytech/ui/Button.cpp \
	batterytech/ui/Checkbox.cpp \
	batterytech/ui/Label.cpp \
	batterytech/ui/Layout.cpp \
	batterytech/ui/LinearLayout.cpp \
	batterytech/ui/Menu.cpp \
	batterytech/ui/UIComponent.cpp \
	batterytech/ui/UIManager.cpp \
	batterytech/ui/UIAnimator.cpp \
	batterytech/ui/ScrollableContainer.cpp \
	batterytech/ui/SlideAnimator.cpp \
	batterytech/ui/TextField.cpp \
	batterytech/math/Triangulator.cpp \
	batterytech/util/esTransform.cpp \
	batterytech/util/ByteUtil.cpp \
	batterytech/util/TextFileUtil.cpp \
	batterytech/util/Property.cpp \
	batterytech/util/PropertiesIO.cpp \
	batterytech/util/strx.cpp
	
my_src_files +=\
	demo-app/Game.cpp \
	demo-app/GameUtil.cpp \
	demo-app/World.cpp \
	demo-app/gameobject/Ball.cpp \
	demo-app/gameobject/Clou.cpp \
	demo-app/gameobject/GameObjectFactory.cpp \
	demo-app/gameobject/GameObjectMeta.cpp \
	demo-app/gameobject/GameObjectProperty.cpp \
	demo-app/gameobject/GameObjectPropertyMeta.cpp \
	demo-app/gameobject/Torus.cpp \
	demo-app/input/TouchInputProcessor.cpp \
	demo-app/level/Grille.cpp \
	demo-app/level/Level.cpp \
	demo-app/level/LevelIO.cpp \
	demo-app/menus/GameOptionsMenu.cpp \
	demo-app/menus/MenuButtonMenu.cpp \
	demo-app/menus/SettingsMenu.cpp \
	demo-app/menus/SoundcheckMenu.cpp \
	demo-app/menus/TopMenu.cpp \
	demo-app/render/BatchSpriteRenderer.cpp \
	demo-app/render/Camera.cpp \
	demo-app/render/IndicatorRenderer.cpp \
	demo-app/render/LevelRenderer.cpp \
	demo-app/render/NewtonDebugDisplay.cpp \
	demo-app/render/ObjRenderer.cpp \
	demo-app/render/SimpleSpriteRenderer.cpp \
	demo-app/render/WorldRenderer.cpp
	
my_src_files +=\
	newton/core/dg.cpp \
	newton/core/dgAABBPolygonSoup.cpp \
	newton/core/dgConvexHull3d.cpp \
	newton/core/dgConvexHull4d.cpp \
	newton/core/dgCRC.cpp \
	newton/core/dgDebug.cpp \
	newton/core/dgDelaunayTetrahedralization.cpp \
	newton/core/dgGeneralMatrix.cpp \
	newton/core/dgGeneralVector.cpp \
	newton/core/dgGoogol.cpp \
	newton/core/dgIntersections.cpp \
	newton/core/dgMatrix.cpp \
	newton/core/dgMemory.cpp \
	newton/core/dgNode.cpp \
	newton/core/dgPolygonSoupBuilder.cpp \
	newton/core/dgPolyhedra.cpp \
	newton/core/dgPolyhedraMassProperties.cpp \
	newton/core/dgQuaternion.cpp \
	newton/core/dgRandom.cpp \
	newton/core/dgRef.cpp \
	newton/core/dgRefCounter.cpp \
	newton/core/dgSmallDeterminant.cpp \
	newton/core/dgSPDMatrix.cpp \
	newton/core/dgSphere.cpp \
	newton/core/dgThreads.cpp \
	newton/core/dgTree.cpp \
	newton/core/dgTypes.cpp \
	newton/newton/Newton.cpp \
	newton/newton/NewtonClass.cpp \
	newton/physics/dgBallConstraint.cpp \
	newton/physics/dgBilateralConstraint.cpp \
	newton/physics/dgBody.cpp \
	newton/physics/dgBodyMasterList.cpp \
	newton/physics/dgBroadPhaseCollision.cpp \
	newton/physics/dgCollision.cpp \
	newton/physics/dgCollisionBox.cpp \
	newton/physics/dgCollisionBVH.cpp \
	newton/physics/dgCollisionCapsule.cpp \
	newton/physics/dgCollisionChamferCylinder.cpp \
	newton/physics/dgCollisionCompound.cpp \
	newton/physics/dgCollisionCompoundBreakable.cpp \
	newton/physics/dgCollisionCone.cpp \
	newton/physics/dgCollisionConvex.cpp \
	newton/physics/dgCollisionConvexHull.cpp \
	newton/physics/dgCollisionConvexModifier.cpp \
	newton/physics/dgCollisionCylinder.cpp \
	newton/physics/dgCollisionEllipse.cpp \
	newton/physics/dgCollisionHeightField.cpp \
	newton/physics/dgCollisionMesh.cpp \
	newton/physics/dgCollisionNull.cpp \
	newton/physics/dgCollisionScene.cpp \
	newton/physics/dgCollisionSphere.cpp \
	newton/physics/dgCollisionUserMesh.cpp \
	newton/physics/dgConnectorConstraint.cpp \
	newton/physics/dgConstraint.cpp \
	newton/physics/dgContact.cpp \
	newton/physics/dgCorkscrewConstraint.cpp \
	newton/physics/dgHingeConstraint.cpp \
	newton/physics/dgMeshEffect.cpp \
	newton/physics/dgMeshEffect2.cpp \
	newton/physics/dgMeshEffectSolidTree.cpp \
	newton/physics/dgMinkowskiConv.cpp \
	newton/physics/dgNarrowPhaseCollision.cpp \
	newton/physics/dgPointToCurveConstraint.cpp \
	newton/physics/dgSlidingConstraint.cpp \
	newton/physics/dgUniversalConstraint.cpp \
	newton/physics/dgUpVectorConstraint.cpp \
	newton/physics/dgUserConstraint.cpp \
	newton/physics/dgWorld.cpp \
	newton/physics/dgWorldDynamicUpdate.cpp

include $(CLEAR_VARS)

# newton includes
LOCAL_C_INCLUDES := $(LOCAL_PATH)/newton/core/
LOCAL_C_INCLUDES += $(LOCAL_PATH)/newton/dMath/
LOCAL_C_INCLUDES += $(LOCAL_PATH)/newton/newton/
LOCAL_C_INCLUDES += $(LOCAL_PATH)/newton/physics/

# newton specs with nosimd (took from Krystian patch http://www.newtondynamics.com/forum/viewtopic.php?f=26&t=6802)
LOCAL_CFLAGS := -ffast-math -freciprocal-math -funsafe-math-optimizations -fsingle-precision-constant -D_SCALAR_ARITHMETIC_ONLY
LOCAL_CFLAGS += -DANDROID_NDK -I src

LOCAL_MODULE    := demo-app
LOCAL_SRC_FILES := $(my_src_files)
	
LOCAL_LDLIBS := -ldl -llog

include $(BUILD_SHARED_LIBRARY)


TODO

I will investigate it to have a better handling of win32 build (related to dirty patches, because of mingw miss of define flags, or because of version of mingw?).