ncannasse / hxsl

Haxe Shader Language, a high level 3D shader language for Haxe
86 stars 10 forks source link

VParam getter set modified=true #11

Closed profelis closed 11 years ago

profelis commented 11 years ago

why here https://github.com/ncannasse/hxsl/blob/master/hxsl/ShaderMacros.hx#L272 getter set modified=true; ?

ncannasse commented 11 years ago

This is because when you read a matrix or vector, you might modify its components without having to set it back.

profelis commented 11 years ago

Very bad :( Now I can't do somthing

if (sdr.vec[0] != 1) sdr.vec = new Vector3D(1,1,1,1);

without call modified=true;

ncannasse commented 11 years ago

I made a small change, it nows only set modified is the value is defined, so you can do: if( sdc.vec != null ) sdr.vec = new Vector3D(1,1,1,1); Only for parameters (conditional ones)

profelis commented 11 years ago

Thanks :)

btw, add more docs about consts and params

ncannasse commented 11 years ago

Will do when I have some time :) I have updated http://haxe.org/manual/hxsl but it's not yet complete.

ncannasse commented 11 years ago

Ok, took some time to write it quickly while I was at it ;) http://haxe.org/manual/hxsl?lang=en#hxsl-shader