About Store Forum Documentation Contact



Post Reply 
world area and materials/material_map?
Author Message
jagatai Offline
Member

Post: #1
world area and materials/material_map?
Im hoping someone could help me understand the following as im having a tough time understanding what the remarks mean:

Code:
Image  material_map   ; // area material map, each pixel value stores information about index of the most significant material in the 'materials' container, must be in sync with 'materials' member !!

Mems<MaterialPtr> materials   ; // list of materials used by the terrain, must be in sync with 'material_map' member !!

What is ment by *must be in sync with*, they both ref each other having to be insync, im having (or im just over thinking it) a tough time understanding the meaning behind those remarks.

Any help is appreciated!
Thanks,
-J
06-21-2013 01:33 AM
Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #2
RE: world area and materials/material_map?
Each channel of material_map refers to a material from the materials list. There are four channels, rgba, so r = material 0, g = material 1, b = material 2 and a = material 3.
06-21-2013 02:40 AM
Find all posts by this user Quote this message in a reply
jagatai Offline
Member

Post: #3
RE: world area and materials/material_map?
(06-21-2013 02:40 AM)fatcoder Wrote:  Each channel of material_map refers to a material from the materials list. There are four channels, rgba, so r = material 0, g = material 1, b = material 2 and a = material 3.

Thanks for the reply!, i think i got it now! so via .pixel() to return the materials related channel ... sorry im slooowww! smile

Thanks again!

-J
(This post was last modified: 06-21-2013 05:11 PM by jagatai.)
06-21-2013 04:55 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: world area and materials/material_map?
In the Game.Area.Data the Image material_map should actually be one channel (for simplicity only the most significant material is stored) IMAGE_I8 type, so you can use Image.pixel(x, y), and it's the index for the materials array.
MaterialPtr m=materials[material_map.pixel(x,y)];
06-23-2013 04:09 PM
Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #5
RE: world area and materials/material_map?
Oh yes, I see that now after actually reading the header comments. My bad. lol
06-24-2013 01:17 AM
Find all posts by this user Quote this message in a reply
Post Reply