Discussion:
lib3ds & DirectX
Steve Hackett
17 years ago
Permalink
Hi!

How can I get this DirectX materials attributes?

D3DCOLORVALUE Emissive; // R,G,B,A
float Power;

Thx!

Hergest.





-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
thomas pleyber
17 years ago
Permalink
Hi Steve


You mean retrieving this information from a Lib3ds structure ?

if yes, here it is : the material information is handled by the faces. So
for the face n°*idxface* you have the corresponding material as follow :

*Lib3dsMesh *p3dsMesh ;

// ... init stuff

**std::string materialName = p3dsMesh->faceL[idxface].material ;* // which
gives you the name of the material for the face indexed *idxFace*


and then :

*Lib3dsMesh *p3dsMaterial ;*

*p3dsMaterial = **lib3ds_file_material_by_name( p3dsFile,
**materialName**.c_str()
) ;* // with p3dsFile of type Lib3sdFile

*float r = p3dsMaterial->diffuse[0] ;
float g = p3dsMaterial->diffuse[1] ;
float b = p3dsMaterial->diffuse[2] ;*

But obviously before that you have to read the file and so on.


Hope it's what you want !


Regards,


Thomas
John Tsiombikas
17 years ago
Permalink
Post by Steve Hackett
Hi!
How can I get this DirectX materials attributes?
D3DCOLORVALUE Emissive; // R,G,B,A
float Power;
if mat is a Lib3dsMaterial pointer:

mat->shininess is the specular power

mat->self_illum is a boolean value indicating whether the object is
self-illuminated or not. So you could set all emissive components to 1.0
if this one is true, or multiply that with the diffuse or something. I
don't think that self-illumination color is carried along the 3ds
format.
--
John Tsiombikas (Nuclear / Mindlapse)
http://nuclear.sdf-eu.org/

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Continue reading on narkive:
Loading...