EntityFX
Blitz3D Forums/Blitz3D Beginners Area/EntityFX
| ||
If someone could explain this to me.. EntityFX mesh,1+16 I dont understand how the flags work. what does 1+16 mean? 16 isn't referenced in the command reference Thanks! |
| ||
From the doc... entity - entity handle fx - 0: nothing (default) 1: full-bright 2: use vertex colors instead of brush color 4: flatshaded 8: disable fog 16: disable backface culling 32: force alpha-blending |
| ||
for the flags: you have 3 options when using flags really. The example you gave is '16 + 1' which is the first way. This basically does a calculation and gives the result '17' being 16+1=17. This means 'disable backface culling' + 'full-bright' To get this same effect your 3 ways of doing it are: EntityFX mesh,17 EntityFX mesh,1+16 ;or predefining all the effects as readable variables. Const FX_FullBright% = 1 Const FX_DisableBackface% = 16 EntityFX mesh, FX_DisableBackface + FX_FullBright These all use the number '17' which is then what Blitz uses to work out the mixture of effects you want. |
| ||
I dont understand how the flags work. At the risk of sounding sarcastic, EntityFX mesh,1+16, is the same as EntityFX mesh,17. Although both are acceptable, its normally expressed as the former for clarity when re-reading your code.what does 1+16 mean? Not sure which version of the documentation you're looking at but the section tonyg refers to has been there for as long as I can remember. |
| ||
And let me mention, these are Bit Flags. Each bit may activate or deactivate something. It is ok to say 16+1, but by definition you should use boolean operators to control Bit Flags. So if you want to set certain bits in a variable, you'll use the OR command, sample: settings%= 16 OR 1 OR 4 OR 512 and if you want to erase certain bits then you'll use AND NOT(value), where the NOT operator must be replaced by the ~ operator, because NOT does not work as it should IMHO eg: settings%=settings% AND ~(16) so this would set the bit number 5 (that represents the value 16) to Zero, no matter if it was aready Zero before, or if it was One. Note: The common boolean command NOT will/should invert an integer variables bits. ~ is doing the same, but by convention NOT is classical syntax (but doesn't work in Blitz). |
| ||
1+16 = 4 letters :D for anyone who dont know + is almoust same as a or. as long as the bits done overlaps. 010010 + 101101 = 111111 010010 OR 101101 = 111111 so ressult is same.. but only cause the bitds dint overlap |