Scaling Convex

Laiquendir

08-07-2008 15:34:30

Hi.
I have a small problem with mighty NxOgre. I have to scale convex. The question is how? I saw function NxScaleCookedConvexMesh(), but I don't know how to use it :( . Can someone help me? :)
http://polish-law.strefa.pl/

Btw. Betajaen big thanks for making this wrapper :) .

betajaen

08-07-2008 16:41:40

Which version of NxOgre are you using? Also are you planning to scale the convex once or many times? Because you could just scale it in flour before hand.

Laiquendir

08-07-2008 19:39:26

I'm using Bleeding 1.0.20. I want sale only once... and I didnt know that I can scale in Flour. Can you tell me how to?

betajaen

08-07-2008 19:41:49

flour meshes type: convex, in: cube.mesh, scale: 2 2 2

Bajter

08-07-2008 20:39:44

Sorry for disturbing you guys, but I've noticed one thing :)
I tried to use the scale function (got the newest bleeding) and... Debugger shows no difference between scale: 20 20 20 and scale: 9 9 9, or even scale: 2000 2000 2000 - they are all the same size. Too small. (At least for me, I don't know what was Laiquendir problem)
// I hope our 'lots of problems' isn't anything annoying for you, Betajaen ;)

betajaen

08-07-2008 20:43:16

Not at all. But I am confused why it doesn't scale. I had a quick look at the code and it does scale, and the code to read the scale param from the arguments seems to work.

Bajter

08-07-2008 21:07:23

Maybe it's just that Flour doesn't like me :(
I tried few more times, even tried altering the model a bit, and changing it to simple box (from what it was) - nothing helps.
My Flour.exe is from 3rd April 2008, 15:54.
I got it from the SVN. (Edit :: Im not sure about that, maybe I got it from other place, but 100% that it's from around here)
Maybe Laiquendir don't have this problem, hope he will come online today so we will know :)

betajaen

08-07-2008 21:47:52

No. It isn't on SVN, most likely you got the installer. Unless you can remember; setting all the paths of the required libraries and compiling NxOgre as a static library, then Ogre, etc.

My NxOgre isn't compiling at the moment, but I'll test the scale function once it is.

Bajter

08-07-2008 22:26:14

Im sure I wasn't compiling flour :)
So it's probably via the installer... I remember something like "clean install" sentence :D

Laiquendir

08-07-2008 23:45:40

Dosen't work for me :( .

I did:
flour meshes type: convex, in: test.mesh, scale: 10 10 10
And nothing changed. :(

Btw. In Flour source I found only 3 params: type, in, out. (FlourParams.cpp)

Bajter

09-07-2008 19:10:01

Betajaen... Maybe we have other versions of Flour?
Could you give us the code that can help us in scaling the meshes? (As it appears that my flour lacks that part)

betajaen

09-07-2008 19:27:05

Well. It's in my source anyway. I'm positive it was in the first release of flour.

Anyway, it'll be out soon.

Laiquendir

09-07-2008 20:09:19

This is FlourParams.cpp from SVN:
#include "FlourParams.h"

void FlourParams::setToDefault() {
mType = NxString();
mInput = NxString();
mOutput = NxString();
}

void FlourParams::parse(Parameters params) {

for (Parameter* parameter = params.Begin(); parameter = params.Next();) {

if (Set("type", parameter, mType)) continue;
if (Set("in", parameter, mInput)) continue;
if (Set("out", parameter, mOutput)) continue;

}

}


There is no scale :( .


I also searched for scale in entire soultion:

Find all "scale", Subfolders, Find Results 1, "Entire Solution"
C:\flour-src\source\FlourConvertHeightfield.cpp(13): printf("Description:\n Converts an greyscale RAW image into a heightfield for use in NxOgre.");
C:\flour-src\build\MeshToNXS.cpp(129):// tmi->mVertices[current_offset + j] = NxVec3(pReal[0]*scale.x, pReal[1]*scale.y, pReal[2]*scale.z);
C:\flour-src\build\MeshToNXS.cpp(210):TriangleMeshIntermediary* ResourceManager::generateTriangleMeshDescription(Ogre::MeshPtr meshPtr, MaterialAlias* alias, NxVec3 scale) {
C:\flour-src\build\MeshToNXS.cpp(284): tmi->mVertices[current_offset + j] = NxVec3(pReal[0]*scale.x, pReal[1]*scale.y, pReal[2]*scale.z);
Matching lines: 4 Matching files: 2 Total files searched: 12


So it looks like scale param is only in your flour. :(

betajaen

09-07-2008 20:13:15

Add this then:

void FlourParams::setToDefault() {
mType = NxString();
mInput = NxString();
mOutput = NxString();
mScale.set(1,1,1);
}

void FlourParams::parse(Parameters params) {

for (Parameter* parameter = params.Begin(); parameter = params.Next();) {

if (Set("type", parameter, mType)) continue;
if (Set("in", parameter, mInput)) continue;
if (Set("out", parameter, mOutput)) continue;
if (Set("scale", parameter, mScale)) continue;
}

}



_FlourParams
class FlourParams : .... {
NxVec3 mScale;
};



_toConvexMesh
man_mesh->vertex(pReal[0] * params.mScale.x, pReal[1] * params.mScale.y, pReal[2] * params.mScale.z);

_toTriangleMesh
man_mesh->vertex(pReal[0] * params.mScale.x, pReal[1] * params.mScale.y, pReal[2] * params.mScale.z);

Laiquendir

09-07-2008 21:20:50

It's working now. Thanks. :)