Graphics

 View Only
  • 1.  API and colordiffuse

    Posted 05-13-2012 18:36
    Hi everyone,

    I have an existing material with a B/W image and I have to colorize it (with RGB) by API.

    I saw the colordiffuse property, but it's an read-only one.

    Does anyone know how can I do ?

    Thanks !


  • 2.  RE: API and colordiffuse

    Posted 05-13-2012 19:14
    You can read the Color Diffuse property from the material and assign it to a Color object. Once you have the color object you can access the .R .G and .B properties of it (those properties are read/write)

    #XPression


  • 3.  RE: API and colordiffuse

    Posted 05-13-2012 19:58
    I don't really understand.

    At the beginning, my material has a white colorDiffuse and image inside is W/B (imagine a box). So by applying a color (ie blue 0,0,200), my box will appear blue.

    You give me another way to have the same result, but I don't see how to access it.

    Could you explain it ? How my xpColor wil interact to my specific material ?

    Thank you.

    #XPression


  • 4.  RE: API and colordiffuse

    Posted 05-14-2012 01:37
    Maybe I'm not understanding what you're asking; but don't you just need to do this?



    dim mat as xpMaterial

    dim color as xpColor

    engine.GetMaterialByName("material1", mat)

    color = mat.colorDiffuse

    color.R = 0

    color.G = 0

    color.B = 200



    #XPression


  • 5.  RE: API and colordiffuse

    Posted 05-14-2012 19:04
    It works like a charm, thank you !

    #XPression