Author Topic: POF Constructor Suite 2.0 Loads its first model!  (Read 45339 times)

0 Members and 1 Guest are viewing this topic.

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
POF Constructor Suite 2.0 Loads its first model!
he's codeing it in wx so probly.
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
POF Constructor Suite 2.0 Loads its first model!
wmc: grab it from cvs and compile

i don't release linux binaries
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
POF Constructor Suite 2.0 Loads its first model!
no bob.. they're not implemented - if you would have looked at my TODO you would have noticed that :P
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
POF Constructor Suite 2.0 Loads its first model!
ah... yes but why would I avoid waisting both of or time like that?

so what about a ray picker(clik on the screen and it selects the part of the modelyou click on)? there actualy a lot easier to implement than you might think. although if you'r implementig a geometry editor then you will basicly have to.
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

  

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
POF Constructor Suite 2.0 Loads its first model!
bobboau: i can also allow selecting polygons from a dialog that lists them :P

bob.. if you want i'll give you CVS write access and you can help with the 3D stuff

when the ray picker is active it'll be ctrl+Lclick
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline BlackDove

  • Star Killer
  • 211
  • Section 3 of the GTVI
    • http://www.shatteredstar.org
POF Constructor Suite 2.0 Loads its first model!
Well the newer version seems to open more of them.

The 10min wait for the HTL Golgotha (and didn't open) now took approx 3 seconds. Also the Erinyes loaded instantly.

Woot.

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
POF Constructor Suite 2.0 Loads its first model!
BlackDove:

Early versions would go through the BSP tree and copy all it's data into  lists then translate them - the new one is an adaptation of my BSP renderer: which walks the tree instead -- less memory allocations, less memory usage and obviously much faster because of - not to mention it only moves data once instead of twice

oh.. and it cleanly imports the point normals :D


new system

code segment one (with old translation system commented out)
Code: [Select]

// --------- Sub object Consversion ---------
subobjects.resize(poffile.OBJ2_Count());
pcs_sobj *obj;
int type, bspsz;
unsigned int used_polygons;
char *bspdata;
BSP bspparser;

BSP_DefPoints points;

for (i = 0; i < poffile.OBJ2_Count(); i++)
{
obj = &subobjects[i];
poffile.OBJ2_Get_Parent(i, obj->parent_sobj);
poffile.OBJ2_Get_Radius(i, obj->radius);

poffile.OBJ2_Get_Offset(i, obj->offset);
obj->offset = POFTranslate(obj->offset);

poffile.OBJ2_Get_GeoCenter(i, obj->geometric_center);
obj->geometric_center = POFTranslate(obj->geometric_center);

poffile.OBJ2_Get_BoundingMin(i, obj->bounding_box_min_point);
obj->bounding_box_min_point = POFTranslate(obj->bounding_box_min_point);

poffile.OBJ2_Get_BoundingMax(i, obj->bounding_box_max_point);
obj->bounding_box_max_point = POFTranslate(obj->bounding_box_max_point);

poffile.OBJ2_Get_Name(i, obj->name);
poffile.OBJ2_Get_Props(i, obj->properties);
poffile.OBJ2_Get_MoveType(i, type); // -1 = none, 1 = rotate
switch (type)
{
case 1:
obj->movement_type = ROTATE;
break;
default:
obj->movement_type = MNONE;
}
poffile.OBJ2_Get_MoveAxis(i, type); // -1 = none, 1 = X, 2 = Z, 3 = Y
switch (type)
{
case 1:
obj->movement_axis = MV_X;
break;
case 2:
obj->movement_axis = MV_Z;
break;
case 3:
obj->movement_axis = MV_Y;
break;
default:
obj->movement_axis = ANONE;
}

// -------------------------------- fast method --------------------------------
poffile.OBJ2_Get_BSPDataPtr(i, bspsz, bspdata);
obj->polygons.resize(100); // good starting size;
used_polygons = 0;
BSPTransPMF(0, (unsigned char *) bspdata, points, obj->polygons, used_polygons);
obj->polygons.resize(used_polygons); // resize to exact size


/* // --------------------------------  slow method --------------------------------
poffile.OBJ2_Get_BSPData(i, bspsz, bspdata);
bspparser.DataIn(bspdata, bspsz);

obj->polygons.resize(bspparser.Count_FlatPolys() + bspparser.Count_TmapPolys());

k = bspparser.Count_FlatPolys();
for (m = 0; m < k; m++)
{
obj->polygons[m].texture_id = -1;
obj->polygons[m].norm = POFTranslate(bspparser.fpolys[m].normal);
obj->polygons[m].verts.resize(bspparser.fpolys[m].nverts);

for (j = 0; j < bspparser.fpolys[m].nverts; j++)
{
l = bspparser.fpolys[m].verts[j].vertnum;
obj->polygons[m].verts[j].point = POFTranslate(bspparser.points[0].vertex_data[l].vertex);

// i'm stll having problems with norms.. which means i've still been writing
//   the BSP::Points incorrectly in the latest version of PCS 1.x -- /sigh
obj->polygons[m].verts[j].norm = vector3d(0,0,0);
//obj->polygons[m].verts[j].norm = POFTranslate(bspparser.points[0].vertex_data[l].norms[bspparser.fpolys[m].verts[j].normnum]);
}
}

for (m = 0; m < bspparser.Count_TmapPolys(); m++)
{
obj->polygons[m+k].texture_id = bspparser.tpolys[m].tmap_num;
obj->polygons[m+k].norm = POFTranslate(bspparser.tpolys[m].normal);
obj->polygons[m+k].verts.resize(bspparser.tpolys[m].nverts);

for (j = 0; j < bspparser.tpolys[m].nverts; j++)
{
l = bspparser.tpolys[m].verts[j].vertnum;
obj->polygons[m+k].verts[j].point = POFTranslate(bspparser.points[0].vertex_data[l].vertex);

// i'm stll having problems with norms.. which means i've still been writing
//   the BSP::Points incorrectly in the latest version of PCS 1.x -- /sigh
obj->polygons[m+k].verts[j].norm = vector3d(0,0,0);
//obj->polygons[m+k].verts[j].norm = POFTranslate(bspparser.points[0].vertex_data[l].norms[bspparser.tpolys[m].verts[j].normnum]);
obj->polygons[m+k].verts[j].u = bspparser.tpolys[m].verts[j].u;
obj->polygons[m+k].verts[j].v = bspparser.tpolys[m].verts[j].v;
}
}
bspparser.Reset();
delete[] bspdata;*/
}



return true;
}





the walker
Code: [Select]


//****************************************************************************
// DIRTY BSP FUNCTIONS - DON'T READ OR YOU'LL HURT YOUR EYES! AAAARGGGGGHHHHHH
// PARSING
//****************************************************************************


void BSPTransPMF(unsigned int offset, unsigned char *data,
BSP_DefPoints &points, kaz_vector &polygons,
unsigned int &upolys)
{
BSP_BlockHeader blkhdr;
unsigned char *curpos = data + offset;
//BSP_BoundBox *bbox;

blkhdr.Read((char *) curpos);

switch (blkhdr.id)
{
case 0: // End of Tree
break;

case 1: // DEFPOINTS
points.Read((char *) curpos + blkhdr.MySize(), blkhdr); // interpret block
BSPTransPMF(offset + blkhdr.size, data, points, polygons, upolys); // continue traversal
break;

case 2: // Untextured Poly
TranslateFPoly(offset, data, points, polygons, upolys); // interpret and continue
break;

case 3: // Textured Poly
TranslateTPoly(offset, data, points, polygons, upolys); // interpret and continue
break;

case 4: // Sortnorm
InterpretSortNorm(offset, data, points, polygons, upolys); // interpret and continue
break;

case 5: //boundbox
BSPTransPMF(offset + blkhdr.size, data, points, polygons, upolys); // continue traversal
break;
default:
break;
}

}

// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


void TranslateFPoly(unsigned int offset, unsigned char *data,
BSP_DefPoints &points, kaz_vector &polygons,
unsigned int &upolys)
{
BSP_BlockHeader blkhdr;
unsigned char *curpos = data + offset;
blkhdr.Read((char *) curpos);

vector3d point, norm;
int vertex_offset = 0;

pcs_polygon temp_poly;

BSP_FlatPoly fpoly;
fpoly.Read((char *) curpos + blkhdr.MySize(), blkhdr);


temp_poly.norm = POFTranslate(fpoly.normal);
temp_poly.texture_id = -1;
temp_poly.verts.resize(fpoly.nverts);


for (int i = 0; i < fpoly.nverts; i++)
{
temp_poly.verts[i].point = POFTranslate(points.vertex_data[fpoly.verts[i].vertnum].vertex);

vertex_offset = 0;
for (int j = 0; j < fpoly.verts[i].vertnum; j++)
{
vertex_offset += points.norm_counts[j];
}


temp_poly.verts[i].norm = POFTranslate(points.vertex_data[fpoly.verts[i].vertnum].norms[fpoly.verts[i].normnum-vertex_offset]);

temp_poly.verts[i].u = 0;
temp_poly.verts[i].v = 0;

}

if (upolys >= polygons.size())
{
polygons.resize(polygons.size() * 2);
}
polygons[upolys] = temp_poly;
upolys++;

fpoly.Destroy();
BSPTransPMF(offset + blkhdr.size, data, points, polygons, upolys); // continue traversal
}

// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

void TranslateTPoly(unsigned int offset, unsigned char *data,
BSP_DefPoints &points, kaz_vector &polygons,
unsigned int &upolys)
{
BSP_BlockHeader blkhdr;
unsigned char *curpos = data + offset;
blkhdr.Read((char *) curpos);

int vertex_offset = 0;
vector3d point, norm;

BSP_TmapPoly tpoly;
pcs_polygon temp_poly;

tpoly.Read((char *) curpos + blkhdr.MySize(), blkhdr);
// 2^32-1 = 4294967295
// 2^8-1 = 255

temp_poly.norm = POFTranslate(tpoly.normal);
temp_poly.texture_id = tpoly.tmap_num;
temp_poly.verts.resize(tpoly.nverts);
//norm = tpoly.normal

for (int i = 0; i < tpoly.nverts; i++)
{
temp_poly.verts[i].point = POFTranslate(points.vertex_data[tpoly.verts[i].vertnum].vertex);
//protecting ourselves from whacky norm numbers, *shrug* don't know where they're coming from
vertex_offset = 0;
for (int j = 0; j < tpoly.verts[i].vertnum; j++)
{
vertex_offset += points.norm_counts[j];
}

temp_poly.verts[i].norm = POFTranslate(points.vertex_data[tpoly.verts[i].vertnum].norms[tpoly.verts[i].normnum-vertex_offset]);

temp_poly.verts[i].u = tpoly.verts[i].u;
temp_poly.verts[i].v = 1-tpoly.verts[i].v;

}

tpoly.Destroy();

if (upolys >= polygons.size())
{
polygons.resize(polygons.size() * 2);
}
polygons[upolys] = temp_poly;
upolys++;

BSPTransPMF(offset + blkhdr.size, data, points, polygons, upolys); // continue traversal
}

// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

void InterpretSortNorm(unsigned int offset, unsigned char *data,
  BSP_DefPoints &points, kaz_vector &polygons,
unsigned int &upolys)
{
BSP_BlockHeader blkhdr;
BSP_SortNorm snorm;
unsigned char *curpos = data + offset;

blkhdr.Read((char *) curpos);

snorm.Read((char *) curpos + blkhdr.MySize(), blkhdr);

if (snorm.front_offset)
BSPTransPMF(offset + snorm.front_offset, data, points, polygons, upolys); // continue traversal

if (snorm.back_offset)
BSPTransPMF(offset + snorm.back_offset, data, points, polygons, upolys); // continue traversal

if (snorm.prelist_offset)
BSPTransPMF(offset + snorm.prelist_offset, data, points, polygons, upolys); // continue traversal

if (snorm.postlist_offset)
BSPTransPMF(offset + snorm.postlist_offset, data, points, polygons, upolys); // continue traversal

if (snorm.online_offset)
BSPTransPMF(offset + snorm.online_offset, data, points, polygons, upolys); // continue traversal



// No tail recursion on sortnorms
}

« Last Edit: August 24, 2005, 08:33:40 am by 30 »
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline Boomer

  • 28
POF Constructor Suite 2.0 Loads its first model!
Quote
Originally posted by Kazan
Boomer you must be new - you're not aware of my standing orders related to blender

Don't use that piece of monkey excrement!

it corrupts models - I will not give debugging support for any model that has been touched by blender


[defensive] I wouldn't necessarily consider myself new since I read every thread in the damn forum before registering which put me off a few months[\defensive]

And I wouldn't dismiss blender so easily.  You obviously haven't looked at some of the python scripts such as *cough* Truespace .COB import\export *cough* or the built in UVunwrapper, the mesh cleaning tools...  Plus, it can import\export most common 3d object files including .3ds if you get the script.

And, honestly, have you even tried the newer versions of Blender?  Hmmmm?  It's free it makes models, and it exports them to .COB, and it's even free.  if you avoid dxf's no corruption occurs.  So if you want to badmouth blender, fine, but Blender works a hell of a lot better for me than f****** GMAX did.

I'm just sorry it took so long for me to reply to disprove this vile slander against blender.  I've been working on some new ships for my new campaign so I haven't checked here for a while.
« Last Edit: August 24, 2005, 08:50:04 am by 2689 »
Viva la UBERBOMB!

"I have no gods, only questions." -Me

A man once came to me and asked me to express a profound thought.  I told him.....<Static>...

Look on the bright side, it looks absolutely nothing like a penis.-Turambar

I reject your reality and substitute my own!

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
POF Constructor Suite 2.0 Loads its first model!
Boomer: i didn't dismiss Blender so easily - i dismissed if after 99% of people complaining "bugs" to me in PCS 1.x was there bad model data created by blender for about 6 months
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline Boomer

  • 28
POF Constructor Suite 2.0 Loads its first model!
And how long ago was that?
Viva la UBERBOMB!

"I have no gods, only questions." -Me

A man once came to me and asked me to express a profound thought.  I told him.....<Static>...

Look on the bright side, it looks absolutely nothing like a penis.-Turambar

I reject your reality and substitute my own!

 

Offline Vasudan Admiral

  • Member
  • 211
    • Twisted Infinities
POF Constructor Suite 2.0 Loads its first model!
Calm down Boom. ;) Read my posts a couple up from here - it seems that there was indeed a BSP error or somesuch in the pre-source code versions, and it caused problems with importing meshes into other games.
It has since been fixed, but i can well imagine how people back then would automatically assume that the reason for their model not working was PCS, since that'd be where the crash would occur - and thus likely giving Kaz quite a headache with bugsupport and tracking. And if that occured for 6 months as he says, you really can't blame him for distrusting the real cause. ;)

The most effective argument for modern blender is not to argue, but just go and build really cool stuff with it to prove how far it's come. :)
Get the 2014 Media VPs and report any bugs you find in them to the FSU Mantis so that we may squish them. || Blender to POF model conversion guide
Twisted Infinities

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
POF Constructor Suite 2.0 Loads its first model!
if it doesn't give you problems then you never have to come to me admitting "i used blender on this model" and we're both happy :P
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline Mav

  • 28
  • location: Shivan fleet - closing in on GTVA space
POF Constructor Suite 2.0 Loads its first model!
PCS2 alpha? NICE! :)

A small feature request: I'd like to have rotate/move buttons like in modelview, if this would be possible one day (I, errm, used them for making techanis (ok, ok - only one so far) ... - yes, I know they're not needed anymore, but I still like them).



And about Blender: I built my first 3,5 models with it, the first two having clipping issues in FS and the other 1,5 simply not converting at all (completely rebuilt them with tS later on).
But that was in 2001/2002 so possibly that's all solved by now - on the other hand, by now I've gotten used to use tS... ;)
-__ o_O___O_o
I______O_O_______dragons
________o

-----------------------------------
capship shields DO WORK !!!
my models, now with pics
test mission for commanding capships
-----------------------------------
suffering from a late stage of BoE-infection - DON'T call a doctor, it's too late for that anyway ;o)

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
POF Constructor Suite 2.0 Loads its first model!
i was going to put buttons in there.. but it looked kinda ugly.. i'll try doing a toolbar again and see how that looks
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline taylor

  • Super SCP/Linux Guru
  • 212
    • http://www.icculus.org/~taylor
POF Constructor Suite 2.0 Loads its first model!
Quote
Originally posted by Kazan
wmc: grab it from cvs and compile

i don't release linux binaries

Code: [Select]
kaz_templates.h:51: error: ISO C++ forbids declaration of ‘operator=’ with no type
kaz_templates.h:75: error: ISO C++ forbids declaration of ‘operator=’ with no type
wxCTreeCtrl.h:73: error: ISO C++ forbids declaration of ‘operator=’ with no type
wxCTreeCtrl.h:78: error: ISO C++ forbids declaration of ‘operator=’ with no type
wxCTreeCtrl.h:86: error: ISO C++ forbids declaration of ‘operator==’ with no type
wxCTreeCtrl.h:91: error: ISO C++ forbids declaration of ‘operator==’ with no type

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
POF Constructor Suite 2.0 Loads its first model!
um....

slutty MSVC

cvs update and it's corrected

[pst: use your IM services j00 slut!]
« Last Edit: August 25, 2005, 10:10:22 am by 30 »
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
POF Constructor Suite 2.0 Loads its first model!
here the context menus are finished.. play :D
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline BlackDove

  • Star Killer
  • 211
  • Section 3 of the GTVI
    • http://www.shatteredstar.org
POF Constructor Suite 2.0 Loads its first model!
It opens everything I throw at it, except the Charon. :p

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
POF Constructor Suite 2.0 Loads its first model!
i need that model to see what is causing the crash
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline Flipside

  • əp!sd!l£
  • 212
POF Constructor Suite 2.0 Loads its first model!
Looking excellent Kazan :)

You mentioned that you might add .LWO if you can find a description of the format..

http://www.newtek.com/products/lightwave/developer/LW80/8lwsdk/docs/filefmts/lwo2.html

Does that help?