Skip to content

Commit

Permalink
* more small fixes to reordering of layers
Browse files Browse the repository at this point in the history
* added skeletal shader to specularity/etc.
  • Loading branch information
Friedrich Kirschner committed Apr 20, 2015
1 parent afb4ac9 commit 21a5426
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 23 deletions.
Binary file modified Moviesandbox.exe
Binary file not shown.
6 changes: 4 additions & 2 deletions classes/layerInspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void LayerInspector::update(double deltaTime){

for (int i=0;i<(int)actorButtons.size();i++){
actorButtons[i]->bDragable=true;
if (sceneData->actorList[i]->bSelected)
if (sceneData->layerList[0]->actorList[i]->bSelected)
actorButtons[i]->buttonColor=sceneData->selectedElementColor/2.0;
else
actorButtons[i]->buttonColor=sceneData->deselectedElementColor;
Expand Down Expand Up @@ -375,7 +375,9 @@ void LayerInspector::trigger(MsbObject* other){
//relative location in list
//we get a hudTarget! So let's find it!
for (int x=0;x<(int)actorButtons.size();x++){
if (actorButtons[x]==input->hudTarget){

//exclude triggered button, otherwise we cannot click anymore!
if (actorButtons[x]==input->hudTarget && actorButtons[x]!=other ){

//int newLocation = floor((actorButtons[i]->location.y-(location.y+4.0*listHeight))/listHeight);
cout << "moved a LayerInspector Button from: " << i << " to: " << x << endl;
Expand Down
8 changes: 5 additions & 3 deletions shaders/color.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
uniform vec4 postColor;
uniform bool bComputeLight;
uniform float specularity;

uniform float objectID;
uniform float screenX;
Expand Down Expand Up @@ -89,11 +90,12 @@ void main(){

objColor.a=1.0;

//add large amounts of unlitness
//objColor.r+=0.002;
if (!bComputeLight)
objColor.r+=0.005;


//add large amounts of specularity
objColor.g+=0.008;
objColor.g+=0.001*specularity;

//add large amounts of normal blur
objColor.b+=0.004;
Expand Down
10 changes: 5 additions & 5 deletions shaders/ocean.frag
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,18 @@ void main(){
objColor.b=floor(objColor.b*100.0)/100.0 ;
objColor.b=min(0.99,max(0.0,objColor.b));

objColor.a=1.0;
//objColor.a=1.0;

//add large amounts of unlitness
objColor.r+=0.001;
if (!bComputeLight)
objColor.r+=0.005;

//add large amounts of specularity
objColor.g+=0.003;

//add large amounts of specularity
//add large amounts of normalBlur?
objColor.b+=0.000;

objColor.a=gl_Color.a;
//objColor.a=gl_Color.a;
gl_FragData[0]=objColor;
gl_FragData[1].xy=packToVec2(zPos);
gl_FragData[1].zw=packToVec2(oID);
Expand Down
14 changes: 9 additions & 5 deletions shaders/post/deferredLight.frag
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,8 @@ vec4 computeLight(){

//specularity is third digit of alpha
specularExp=int(texture2D(colorTex,texCoord).g* 1000.0)%10;

specularExp*=16.0;


if (NdotL>0.0 && specularExp >0.5){
vec3 NH = normalize(lightDirectionNormalized - camZ );
vec3 specular=1.0 * lightColor.xyz * pow(max(0.0, dot(pixelNormal.xyz,NH)),specularExp );
Expand All @@ -295,11 +293,17 @@ vec4 computeLight(){
colorLight.z=min(colorLight.z,1.0);
*/
//return vec4(1.0);

/*
float unlit=(int(texture2D(colorTex,texCoord).r* 1000.0)%10);
if (unlit>1.0)
return (vec4(1.0));
if (unlit>1.0){
unlit=unlit*0.1;
vec4 mix= unlit * vec4(1.0) + (1.0-unlit)* colorLight;
mix.a=1.0;
//return mix;
return vec4(1.0);
}
*/
return colorLight;


Expand Down
32 changes: 26 additions & 6 deletions shaders/skeletal.frag
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
uniform vec4 postColor;
uniform bool bComputeLight;
uniform float specularity;

uniform sampler2D sceneTex;

varying float zPos;
Expand Down Expand Up @@ -43,16 +46,33 @@ vec2 packToVec2(float value){
void main(){


vec4 objColor=gl_Color * postColor;
vec4 objColor=gl_Color * postColor;

objColor.r=floor(objColor.r*100.0)/100.0 ;
objColor.r=min(0.99,max(0.0,objColor.r));

objColor.g=floor(objColor.g*100.0)/100.0 ;
objColor.g=min(0.99,max(0.0,objColor.g));

objColor.b=floor(objColor.b*100.0)/100.0 ;
objColor.b=min(0.99,max(0.0,objColor.b));

objColor.r=floor(objColor.r*100.0)/100.0 ;
objColor.r=max(0.0,objColor.r);
objColor.a=1.0;
/*
if (!bComputeLight)
objColor.r+=0.005;
*/
//add large amounts of specularity
objColor.g+=0.005;//*specularity;

//add large amounts of normal blur
objColor.b+=0.004;

gl_FragData[0]=objColor;
gl_FragData[0]=objColor;

gl_FragData[1].xy=packToVec2(zPos);
gl_FragData[1].zw=packToVec2(oID);
gl_FragData[1].xy=packToVec2(zPos);
gl_FragData[1].zw=packToVec2(oID);

}

15 changes: 13 additions & 2 deletions shaders/texture.frag
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
uniform sampler2D tex;
uniform vec4 postColor;
uniform bool bComputeLight;
uniform bool bComputeLight;
uniform float specularity;


uniform float farClip;

varying float zPos;
Expand Down Expand Up @@ -62,7 +65,15 @@ void main(){
objColor.b=min(0.99,max(0.0,objColor.b));

//objColor.a=1.0;


if (!bComputeLight)
objColor.r+=0.009;

if (objColor.a<0.9){
//objColor.a=0.0;
//gl_FragDepth=1024.0
discard;
}

//don't light transparency
gl_FragData[0]=objColor;
Expand Down

0 comments on commit 21a5426

Please sign in to comment.