Re: Passing floats/doubles to C

new topic     » goto parent     » topic index » view thread      » older message » newer message

Bernie:
Okay, I did it this way:
constant material=struc(" duffuse_r : float : 1 "&
                        " duffuse_g : float : 1 "&
                        " duffuse_b : float : 1 "&
                        " duffuse_a : float : 1 "&
                        " ambient_r : float : 1 "&
                        " ambient_g : float : 1 "&
                        " ambient_b : float : 1 "&
                        " ambient_a : float : 1 "&
                        " specular_r : float : 1 "&
                        " specular_g : float : 1 "&
                        " specular_b : float : 1 "&
                        " specular_a : float : 1 "&
                        " emissive_r : float : 1 "&
                        " emissive_g : float : 1 "&
                        " emissive_b : float : 1 "&
                        " emissive_a : float : 1 "&
                        " power : float : 1 ",HIGH)

Fill in the values:
  Sets(material, "duffuse_r",  1.0)
  Sets(material, "duffuse_r",  1.1)
  Sets(material, "duffuse_r",  1.2)
  Sets(material, "duffuse_r",  1.3)
  Sets(material, "ambient_r",  1.4)
  Sets(material, "ambient_r",  1.5)
  Sets(material, "ambient_r",  1.6)
  Sets(material, "ambient_r",  1.7)
  Sets(material, "specular_r", 1.8)
  Sets(material, "specular_r", 1.9)
  Sets(material, "specular_r", 1.11)
  Sets(material, "specular_r", 1.12)
  Sets(material, "emissive_r", 1.13)
  Sets(material, "emissive_r", 1.14)
  Sets(material, "emissive_r", 1.15)
  Sets(material, "emissive_r", 1.16)
  Sets(material, "power",      1.17)

Now I update my C structure through my dll function.
this is my C structure:

typedef struct tagMATERIAL
{
        float diffuse_r;
        float diffuse_g;
        float diffuse_b;
        float diffuse_a;
        float ambient_r;
        float ambient_g;
        float ambient_b;
        float ambient_a;
        float specular_r;
        float specular_g;
        float specular_b;
        float specular_a;
        float emissive_r;
        float emissive_g;
        float emissive_b;
        float emissive_a;
        float power;
} MATERIAL;

Now I get these values when I print out each member of my structure
in the same order as your structure:
1.300000
0.000000
0.000000
0.000000
1.700000
0.000000
0.000000
0.000000
1.120000
0.000000
0.000000
0.000000
1.160000
0.000000
0.000000
0.000000
1.170000

I get the same values if I use double for eveything...
At least I get different values...

-- Todd Riggins

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu