About Store Forum Documentation Contact



Post Reply 
CSG
Author Message
Dynad Offline
Member

Post: #1
CSG
Hey,

Is it possible to use custom meshes with CSG?

e.g:
Game::ObjParams &wall = *Game::Objs("obj/static/wall/0.obj");

In the header file u can only use standard shapes and Mshr. So who can help me out? smile

Thnx,
~Dynad

There is always evil somewhere, you just have to look for it properly.
02-27-2010 06:29 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: CSG
CSG?

there is a function Csg which accepts MeshBase
02-27-2010 10:44 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #3
RE: CSG
Ok thnx, the only problem left is that the meshBase only accepts meshes so without textures etc. Do i have to make a struct mesh and use that in the meshBase?

There is always evil somewhere, you just have to look for it properly.
02-28-2010 04:20 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: CSG
you can create 1 MeshBase from all mesh parts in a single mesh,
encode the part number(index) in each MeshBase triangle/quad "id" member
perform CSG
then recreate mesh parts according to "id" member
02-28-2010 04:34 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #5
RE: CSG
Thnx Esenthel, Ok well i tried that but i cant figure it out.

This works as meshBase:
PHP Code:
Meshs("obj/item/misc/barrel/0.mesh")->base(0); 

and this doesnt:
PHP Code:
Game::ObjParams &obj=*Game::Objs("obj/item/misc/barrel/0.obj");
Game::World.objCreate(obj,Matrix(obj.scale(),Vec(16,8,16))); 

mb.create(Ball(1),VTX_NRM);      
wall1.add(obj.mesh()->base(0));
Csg(test,mb,SEL_SUB,&csg);
obj.mesh()->base(0) = csg;
wall1.del(); 

Can someone give a small example how it works properly?

Thnx,
~Dynad

There is always evil somewhere, you just have to look for it properly.
03-02-2010 02:24 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #6
RE: CSG
ok ill clear some code up:

PHP Code:
MeshBase mbcsgwall1;

Game::ObjParams &obj=*Game::Objs("obj/item/misc/barrel/0.obj");
Game::World.objCreate(obj,Matrix(obj.scale(),Vec(16,8,16))); 

mb.create(Ball(1),VTX_NRM);      
wall1.add(obj.mesh()->base(0));
Csg(obj.mesh()->base(0),mb,SEL_SUB,&csg);
obj.mesh()->base(0) = csg;
wall1.del(); 

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 03-04-2010 11:01 PM by Dynad.)
03-02-2010 06:22 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
RE: CSG
I'll try to make a function which does that all
03-02-2010 07:02 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #8
RE: CSG
that would be awsome thnx smile

There is always evil somewhere, you just have to look for it properly.
03-02-2010 07:03 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #9
RE: CSG
Ive downloaded the March update, and i saw u can use MeshLod with csg now thnx for that smile

I tried it with 2 meshes(MeshLods) but when i use csg both meshes just disappear.

And this does not compile why?
PHP Code:
MeshLod *lod;
cskel.setMatrix();
lod mesh->getDrawLod(cskel.matrix()); 

PHP Code:
error C2440'=' cannot convert from 'EE::MeshLod' to 'EE::MeshLod *' 

or this when "MeshLod lod"
PHP Code:
error C2783'void EE::MeshLod::operator =(EE::MeshLod &)' could not deduce template argument for 'TYPE' 

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 03-03-2010 06:47 PM by Dynad.)
03-03-2010 06:13 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #10
RE: CSG
maybe you should call setRender after csg,
I suggest using reference

MeshLod &lod=mesh->getDrawLod..
for pointer its
MeshLod *lod=&mesh->getDrawLod..
03-03-2010 08:52 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #11
RE: CSG
Ok the pointer is working. But setRender will do nothing aswell. I have really no idea whats wrong....


PHP Code:
player.cskel.setMatrix(); 
lod = &player.mesh->getDrawLod(player.cskel.matrix());
player2.cskel.setMatrix(); 
lod2 = &player2.mesh->getDrawLod(player2.cskel.matrix());

Csg(*lod,*lod2,SEL_SUB,NULL); 


PHP Code:
lod->setRender();
lod2->setRender(); 
OR
PHP Code:
player.mesh->setRender();
player2.mesh->setRender(); 

PHP Code:
player.mesh->draw(player.cskel); 
OR
PHP Code:
REPA(*lod)lod->part(i).draw(player.cskel); 

Ive tried any option i can think of but still not working :(

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 03-04-2010 11:27 AM by Dynad.)
03-04-2010 11:26 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #12
RE: CSG
do the meshes have 1 lod?
does the lods actually intersect?
03-04-2010 02:42 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #13
RE: CSG
Well i am using the tattoo example, so i guess the player has a lod otherwise the tattoo wont work either.

The players don't need to intersect with each other to be rendered.
Its kinda weird after the csg function the meshes just disappear...

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 03-04-2010 06:25 PM by Dynad.)
03-04-2010 05:51 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #14
RE: CSG
Csg function operates only on 1 lod,

perhaps the meshes are the same?
so A-A = 0 ?

Csg doesn't accept any additional matrix transformations
you must transform meshes before calling Csg
03-04-2010 06:34 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #15
RE: CSG
Meshes are the same yes, but its like Player* pl,pl2; so then it doesn't matter if its the same mesh right?

And yes ive tried transformation before csg but that didn't help either.

There is always evil somewhere, you just have to look for it properly.
03-04-2010 06:55 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply