Steve Hackett | 9 Sep 2008 14:11
Picon
Picon
Favicon

lib3ds & DirectX

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 | 9 Sep 2008 15:28
Picon

Re: lib3ds & DirectX

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
-------------------------------------------------------------------------
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=/
_______________________________________________
lib3ds-devel mailing list
lib3ds-devel@...
https://lists.sourceforge.net/lists/listinfo/lib3ds-devel
Kyprianidis, Jan Eric | 9 Sep 2008 16:26
Picon
Picon

Lib3ds Release 2.0.0-rc1 available!

Hello,

Lib3ds Release 2.0.0-rc1 is now available for download!
The release includes two new examples:

* 3ds2obj shows how to convert a 3ds file to a
   Wavefront OBJ file.

* cube shows how to create a texture mapped cube an
   save it as a 3DS file.

Regards,
Jan Eric

-------------------------------------------------------------------------
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=/
John Tsiombikas | 10 Sep 2008 09:24

Re: lib3ds & DirectX

On Tue, Sep 09, 2008 at 12:11:55PM +0000, Steve Hackett wrote:
> 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=/
Steve Hackett | 10 Sep 2008 09:53
Picon
Picon
Favicon

Re: lib3ds & DirectX (thomas pleyber)

Sorry.

I've to explain better:

I'm making a program with DirectX 8.1 and 3DS files.
In DirectX 8.1 a material is defined as:

typedef struct _D3DMATERIAL8 { 
   D3DCOLORVALUE Diffuse; 
   D3DCOLORVALUE Ambient; 
      D3DCOLORVALUE Specular; 
      D3DCOLORVALUE Emissive; 
      float Power; 
} D3DMATERIAL8; 

Diffuse, Ambient, Specular, and Emissive 
Values specifying the diffuse color, ambient color, specular color, and 
emissive color of the material, respectively. These values are D3DCOLORVALUE structures. 
Power 
Floating-point value specifying the sharpness of specular highlights. To 
turn off specular highlights for a material, set this member to 0.0; setting the 
specular color components to 0 is not enough. 

Diffuse, Ambient and Specular can be obtained from Lib3dsMaterial, but Emissive and Power... where are?

Thx!

----- Mensaje original ----

Date: Tue, 9 Sep 2008 15:28:26 +0200
From: "thomas pleyber" <thomas.pleyber@...>
Subject: Re: [Lib3ds-devel] lib3ds & DirectX
To: "Discussion about lib3ds" <lib3ds-devel@...>
Message-ID:
    <87972da60809090628g172346d4vf18e8816a3fa455f@...>
Content-Type: text/plain; charset="iso-8859-1"

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

-------------------------------------------------------------------------
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=/
Kyprianidis, Jan Eric | 10 Sep 2008 10:07
Picon
Picon

Re: lib3ds & DirectX (thomas pleyber)

Steve,

in OpenGL I use GL_EMISSION = (0,0,0,1). That works in
in DirectX maybe too.

But John approach sound reasonable to me. Note that in
lib3ds 2.0 variable names changed:
   int   self_illum_flag; // self illumination on/off
   float self_illum;      // self illumination strength (0.0-1.0)

If power is the Phong exponent you may want to try
power = 2 ^ (10 * shininess + 1)

--Jan Eric

Steve Hackett wrote:
> Sorry.
> 
> I've to explain better:
> 
> I'm making a program with DirectX 8.1 and 3DS files.
> In DirectX 8.1 a material is defined as:
> 
> typedef struct _D3DMATERIAL8 { 
>    D3DCOLORVALUE Diffuse; 
>    D3DCOLORVALUE Ambient; 
>       D3DCOLORVALUE Specular; 
>       D3DCOLORVALUE Emissive; 
>       float Power; 
> } D3DMATERIAL8; 
> 
> Diffuse, Ambient, Specular, and Emissive 
> Values specifying the diffuse color, ambient color, specular color, and 
> emissive color of the material, respectively. These values are D3DCOLORVALUE structures. 
> Power 
> Floating-point value specifying the sharpness of specular highlights. To 
> turn off specular highlights for a material, set this member to 0.0; setting the 
> specular color components to 0 is not enough. 
> 
> 
> Diffuse, Ambient and Specular can be obtained from Lib3dsMaterial, but Emissive and Power... where are?
> 
> Thx!

-------------------------------------------------------------------------
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=/
Roberto D'Aprile | 13 Sep 2008 14:14
Picon

Installing lib3d on Mac OSX

Hello

I'm sorry if this is not the right place to ask but I didn't find anything else.
I've tried to install lib3d on my ibook (OS version Tiger 10.4.11); I've made the ./configure, then make, it goes well for a while then at last gives this message.

Making all in cube
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src     -g -O2 -MT cube.o -MD -MP -MF .deps/cube.Tpo -c -o cube.o cube.c
cube.c:30:1: warning: "M_PI" redefined
In file included from /usr/include/math.h:26,
                 from cube.c:22:
/usr/include/architecture/ppc/math.h:661:1: warning: this is the location of the previous definition
mv -f .deps/cube.Tpo .deps/cube.Po
/bin/sh ../../libtool --tag=CC   --mode=link gcc  -g -O2   -o cube cube.o ../../src/lib3ds.la 
mkdir .libs
gcc -g -O2 -o .libs/cube cube.o  ../../src/.libs/lib3ds.dylib -lm
creating cube
make[3]: Nothing to be done for `all-am'.
make[2]: Nothing to be done for `all-am'.

Since it seem than the problem is only in an example file I tied to install and it stills gives me some simila problems when installing the examples but the source code seem to be installed correctly, so I tried using lib3ds_file_open() to load a simple 3ds file, but when I try to compile it gives me this error:

/Developer/usr/bin/../libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: Undefined symbols:
_lib3ds_file_open
/Users/robertodaprile/Documents/Progetti/SDL/build/SDL.build/Debug/SDL.build/Objects-normal/ppc/main.o reference to undefined _lib3ds_file_open

I have no idea of what the problem is but it seems to me that the library is not installed correctly.
If somebody could help me I will appreciate much.

Tanks.
-------------------------------------------------------------------------
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=/
_______________________________________________
lib3ds-devel mailing list
lib3ds-devel@...
https://lists.sourceforge.net/lists/listinfo/lib3ds-devel
John Tsiombikas | 13 Sep 2008 16:39

Re: Installing lib3d on Mac OSX

On Sat, Sep 13, 2008 at 02:14:31PM +0200, Roberto D'Aprile wrote:
> made the ./configure, then make, it goes well for a while then at last gives
> this message.
> 
> Making all in cube
> gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src     -g -O2 -MT cube.o -MD -MP
> -MF .deps/cube.Tpo -c -o cube.o cube.c
> cube.c:30:1: warning: "M_PI" redefined
> In file included from /usr/include/math.h:26,
>                  from cube.c:22:
> /usr/include/architecture/ppc/math.h:661:1: warning: this is the location of
> the previous definition
> mv -f .deps/cube.Tpo .deps/cube.Po
> /bin/sh ../../libtool --tag=CC   --mode=link gcc  -g -O2   -o cube cube.o
> ../../src/lib3ds.la
> mkdir .libs
> gcc -g -O2 -o .libs/cube cube.o  ../../src/.libs/lib3ds.dylib -lm
> creating cube
> make[3]: Nothing to be done for `all-am'.
> make[2]: Nothing to be done for `all-am'.
> 
> Since it seem than the problem is only in an example file I tied to install
> and it stills gives me some simila problems when installing the examples but
> the source code seem to be installed correctly,

What problem? that's just a warning, M_PI is already defined in math.h,
and it's redefined inside cube.c. It shouldn't be redefined but it's not
an issue.

> so I tried using
> lib3ds_file_open() to load a simple 3ds file, but when I try to compile it
> gives me this error:
> 
> /Developer/usr/bin/../libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: Undefined
> symbols:
> _lib3ds_file_open
> /Users/robertodaprile/Documents/Progetti/SDL/build/SDL.build/Debug/SDL.build/Objects-normal/ppc/main.o
> reference to undefined _lib3ds_file_open
> 
> I have no idea of what the problem is but it seems to me that the library is
> not installed correctly.
> If somebody could help me I will appreciate much.

Obviously you're not linking lib3ds.

--

-- 
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=/
Adrian Bedeau | 23 Sep 2008 19:53
Picon

texture map tiling and clamping

Hi,

I have been trying to write a rectangle out to 3ds with an image tiled onto it. I have tried to set Lib3dsTextureMap::scale and Lib3dsTextureMap::offset as well as Lib3dsMesh::map_tile but did not see any tiling happen. If anyone knows of a way to do this, will you please help me out?

I would also like to use texture clamping but did not see any fields I can set to do to this with lib3ds - does anyone know of a way to do this using lib3ds?

Thanks very much again!

Adrian
-------------------------------------------------------------------------
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=/
_______________________________________________
lib3ds-devel mailing list
lib3ds-devel@...
https://lists.sourceforge.net/lists/listinfo/lib3ds-devel

Gmane