Mogre 1.7.4 binary files (release + debug) + MogreNewt 2.35

Beauty

01-11-2012 13:59:31

I created 2 packages of files, which I compiled for my project.


Package 1:
Contains Mogre 1.7.4 (inclusive Terrain/Paging component) as release version
and MogreNewt (compiled against Newton 2.35)
Additionally I added further files, which are needed as depency to compile some Mogre add-ons.

Mogre_1.7.4__MogreNewt_2.35__Release.NET4.rar
Download size: 16 MB


Package 2:
Contains Mogre 1.7.4 (inclusive Terrain/Paging component) which was compiled as the debug version.
Additionally I added all source files, which are needed for deep debugging.
By use of these binary files, you can debug inside of the wrapped Ogre C++ code.
Have a look to the info.txt file. There I added some notes.

Don't use this package as default binaries for your project. Several compiler optimisations are disabled, because of debugging purposes. So the FPS rate can be slower.

Mogre_1.7.4__DEBUG.NET4.rar
Download size: 88 MB


Notes:
Both packages were created by the MogreBuilder.
The DLL versions are compiled against .NET 4.0 and X86.

The compilation itself was done by Visual Studio 2010 SP1.
If this VS version isn't available on your computer, you should install the Microsoft Visual C++ 2010 SP1 Redistributable Package (x86).

To be shure to have the latest DirectX version you should run the DirectX End-User Runtime Web Installer.

If you are not shure whether to choose package 1 or 2, than use the first.

I hope this is useful for somebody.


By the way:
If somebody compiles an add-on (e.g. MOIS) against my files, you can send the binaries to me (or post a download link).
Then I will update the package(s) and include it.

ianhfar

05-11-2012 13:58:58

Thanks Beauty,
I'm sure this make life alot easier for a lot of users

Ian

ianhfar

09-11-2012 09:44:24

Hi Beauty

With MogreNewt / Newton 2.34 , I used to use "GetBodyCollisionID" to get the subcomponent from a compound mesh. This is no longer available in Newton 2.35 upwards. I have made a change to the following files to provide similar functionality on 2.35 upwards.

I have attached the two files I changed, I am not sure if everybody would want to use this, so I have left it open, let me know if I should submit this as a patch.

The changes reside in the following two Mogrenewt files

ContactMaterial.h and ContactMaterial.cpp


int ContactMaterial::GetBodyCollidingShapeID( MogreNewt::Body^ body )
{
NewtonCollision* col = NewtonMaterialGetBodyCollidingShape (_mat, body->NewtonBody);
NewtonCollisionInfoRecord *info = new NewtonCollisionInfoRecord();
NewtonCollisionGetInfo( col, info );
return info->m_collisionUserID;
}


Seems I'm getting an error saying
Sorry, the board attachment quota has been reached.
when trying to upload attachment

so here's the code
ContactMaterial.h

#pragma once

#pragma managed(push, off)
#include <Newton.h>
#include <Ogre.h>
#pragma managed(pop)
#include "OgreNewt_Prerequisites.h"
#include "OgreNewt_Collision.h"

// OgreNewt namespace. all functions and classes use this namespace.
namespace MogreNewt
{

ref class Body;

public value class ContactMaterial
{
NewtonMaterial *_mat;

internal:
ContactMaterial(NewtonMaterial *material);

public:
property unsigned ContactFaceAttribute
{
unsigned get();
}

// NOTE: This function was removed in Newton 2.34
// unsigned GetBodyCollisionID( MogreNewt::Body^ body );

int GetBodyCollidingShapeID( MogreNewt::Body^ body );

property dFloat ContactNormalSpeed
{
dFloat get();
}

Mogre::Vector3 GetContactForce( MogreNewt::Body^ body );

Mogre::Vector3 GetContactPosition( MogreNewt::Body^ body );

Mogre::Vector3 GetContactNormal( MogreNewt::Body^ body );

Mogre::Vector3 GetContactFirstTangent( MogreNewt::Body^ body );

Mogre::Vector3 GetContactSecondTangent( MogreNewt::Body^ body );

void GetContactPositionAndNormal(
MogreNewt::Body^ body,
[Out] Mogre::Vector3 %position, [Out] Mogre::Vector3 %normal
);
void GetContactTangentDirections(
MogreNewt::Body^ body,
[Out] Mogre::Vector3 %dir0, [Out] Mogre::Vector3 %dir1
);
dFloat GetContactTangentSpeed(int index);


//! set softness of the current contact
void SetContactSoftness( Mogre::Real softness ) { NewtonMaterialSetContactSoftness( _mat, (float)softness ); }

//! set elasticity of the current contact
void SetContactElasticity( Mogre::Real elasticity ) { NewtonMaterialSetContactElasticity( _mat, (float)elasticity ); }

//! set friction state of current contact
void SetContactFrictionState( int state, int index ) { NewtonMaterialSetContactFrictionState( _mat, state, index ); }

//! set tangent acceleration for contact
void SetContactTangentAcceleration( Mogre::Real accel, int index ) { NewtonMaterialSetContactTangentAcceleration( _mat, (float)accel, index ); }

//! align tangent vectors with a user supplied direction
void RotateTangentDirections( Mogre::Vector3 dir ) { NewtonMaterialContactRotateTangentDirections( _mat, &dir.x ); }

//! manually set the normal for the collision.
void SetContactNormalDirection( Mogre::Vector3 dir ) { NewtonMaterialSetContactNormalDirection( _mat, &dir.x ); }

//! manually set the acceleration along the collision normal.
void SetContactNormalAcceleration( Mogre::Real accel ) { NewtonMaterialSetContactNormalAcceleration( _mat, accel ); }

//! Set friction for contact
void SetContactFrictionCoef(dFloat staticFrictionCoef, dFloat kineticFrictionCoef, int index)
{NewtonMaterialSetContactFrictionCoef(_mat,staticFrictionCoef,kineticFrictionCoef,index);}
};


} // end namespace MogreNewt



ContactMaterial.cpp

#include <ContactMaterial.h>
#include "OgreNewt_Body.h"
#include "OgreNewt_Collision.h"

namespace MogreNewt
{

ContactMaterial::ContactMaterial(NewtonMaterial *material) {
if (material == NULL)
throw gcnew Exception("Cannot create a Material from a null NewtonMaterial");
_mat = material;
}


// NOTE: This function was removed in Newton 2.34

//unsigned ContactMaterial::GetBodyCollisionID( MogreNewt::Body^ body )
//{
// return NewtonMaterialGetBodyCollisionID( _mat, body->NewtonBody );
//}

int ContactMaterial::GetBodyCollidingShapeID( MogreNewt::Body^ body )
{
NewtonCollision* col = NewtonMaterialGetBodyCollidingShape (_mat, body->NewtonBody);
NewtonCollisionInfoRecord *info = new NewtonCollisionInfoRecord();
NewtonCollisionGetInfo( col, info );
return info->m_collisionUserID;
}

unsigned ContactMaterial::ContactFaceAttribute::get()
{
return NewtonMaterialGetContactFaceAttribute(_mat);
}

dFloat ContactMaterial::ContactNormalSpeed::get()
{
return NewtonMaterialGetContactNormalSpeed(_mat);
}


Mogre::Vector3 ContactMaterial::GetContactForce( MogreNewt::Body^ body )
{
Mogre::Vector3 force;
NewtonMaterialGetContactForce( _mat, body->NewtonBody, &force.x );
return force;
}

Mogre::Vector3 ContactMaterial::GetContactPosition( MogreNewt::Body^ body )
{
Mogre::Vector3 pos, norm;
GetContactPositionAndNormal(body, pos, norm);
return pos;
}

Mogre::Vector3 ContactMaterial::GetContactNormal( MogreNewt::Body^ body )
{
Mogre::Vector3 pos, norm;
GetContactPositionAndNormal(body, pos, norm);
return norm;
}

Mogre::Vector3 ContactMaterial::GetContactFirstTangent( MogreNewt::Body^ body )
{
Mogre::Vector3 t1, t2;
GetContactTangentDirections(body, t1, t2);
return t1;
}

Mogre::Vector3 ContactMaterial::GetContactSecondTangent( MogreNewt::Body^ body )
{
Mogre::Vector3 t1, t2;
GetContactTangentDirections(body, t1, t2);
return t2;
}

void ContactMaterial::GetContactPositionAndNormal(
MogreNewt::Body^ body, Mogre::Vector3% pos, Mogre::Vector3% norm
)
{
pin_ptr<Mogre::Vector3> p_pos = &pos;
pin_ptr<Mogre::Vector3> p_norm = &norm;
NewtonMaterialGetContactPositionAndNormal( _mat, body->NewtonBody, &p_pos->x, &p_norm->x );
}


void ContactMaterial::GetContactTangentDirections(
MogreNewt::Body^ body, Mogre::Vector3% dir0, Mogre::Vector3% dir1
)
{
pin_ptr<Mogre::Vector3> p_dir0 = &dir0;
pin_ptr<Mogre::Vector3> p_dir1 = &dir1;
NewtonMaterialGetContactTangentDirections( _mat, body->NewtonBody, &p_dir0->x, &p_dir1->x );
}

dFloat ContactMaterial::GetContactTangentSpeed(int index) {
return NewtonMaterialGetContactTangentSpeed(_mat, index);
}

} // end namespace MogreNewt



Beauty

09-11-2012 10:22:54

Hi ianhfar,

I recognised the removement of this Newton function.
It's nice that you provide a special solution to offer downwards compatibility.

To commit your improvements I want to give you write access to the Mogre and MogreAddons repository.
Do you have a Bitbucket account? If not, just send me your e-mail address.

Before you commit code (in general), please check if the code compiles successfully and make a quick test with the added/modified content.

By the way:
Did you continue your work on your MogreNewt Visualisation tool?
There is no further commit in its repository.

Beauty

09-11-2012 12:53:16

I have compiled against your Mogre using MogreBuilder ( following your instructions :D ) to build Mogrenewt.
Nice to know.
Were the instructions OK or did I forget to describe anything?

I never did proceed with MogreNewt Visualisation tool, the path I was trying to take, was not the correct one, so I have just left the code there for people to get ideas.
Your tool was realy interesting. Perhaps it's useful for somebody else.

andyhebear1

16-11-2012 08:49:01

is there has support .net 2.0 release?

Beauty

16-11-2012 11:00:50

.NET 2.0 / 3.5

The packages are only compiled against .NET 4.0.

Currently the MogreBuilder only compiles 4.0.
Maybe you can modify the wrapping process for older .NET versions.
I think for this you need to change the poperties of the Visual Studio project files, which are generated my CMake (which is called by MogreBuilder).

You could do it in 3 halfautomated steps.
* Use the MogreBuilder tasks to build the depencies and generate the CMake files. (comment out the build calls and following tasks)
* Change the settings of the VS project files for NET 2.0
* Call MogreBuilder again to call the remaining tasks (by commenting the first tasks and un-comment the last tasks)

Well, it's no good guide and no ready-to-use solution. Just an idea.

Beauty

18-12-2012 20:05:10

ianhfar, did you commit your MogreNewt improvements to the official repository?
If not, please do it.
If you have no write access, just give me your mail address and I'll send you an invitation.

ianhfar

19-12-2012 10:29:43

Hi Beauty

No not yet, I don't have access during the day, and trying to find time after hours tends to be tricky, will try this festive break

Ian

Beauty

30-01-2013 19:27:24

ianhfar, did you check in your MogreNewt modification?
If not, it would be fine when you do it.

Beauty

10-02-2014 18:52:36

ianhfar, I still would be happy if you check in your improvements to the official MogreAddons repository.
I already gave you write access.