Changeset 27
- Timestamp:
- 04/17/08 14:39:23 (4 months ago)
- Files:
-
- trunk/fx2.fx (modified) (4 diffs)
- trunk/fx3.fx (modified) (1 diff)
- trunk/fx4.fx (modified) (2 diffs)
- trunk/main.d (modified) (7 diffs)
- trunk/main.opt (modified) (previous)
- trunk/nonagon/pp/effect.d (modified) (3 diffs)
- trunk/nonagon/pp/renderer.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/fx2.fx
r11 r27 13 13 out float4 oNormal : TEXCOORD0) 14 14 { 15 oPosition=mul(Position,WorldViewProj); 16 oNormal=normalize(mul(Normal,World)); 15 oPosition = mul(Position, WorldViewProj); 16 oNormal = normalize(mul(Normal, World)); 17 } 18 19 void VSWire( 20 in float4 Position : POSITION, 21 in float3 Normal : NORMAL, 22 out float4 oPosition : POSITION, 23 out float4 oNormal : TEXCOORD0) 24 { 25 oNormal = normalize(mul(Normal, World)); 26 oPosition = mul(Position, WorldViewProj) + (oNormal * 0.001); 17 27 } 18 28 19 29 //---------------------------------------------------------------------------------- 20 30 21 float3 LightDirection={-0.707,-0.707,0.707}; 22 float3 LightDirection2={-0.707,-0.707,0.707}; 23 float3 LightDirection3={-0.707,-0.707,0.707}; 24 float3 LightDirection4={-0.707,-0.707,0.707}; 25 float3 LightDirection5={-0.707,-0.707,0.707}; 26 float3 LightDirection6={-0.707,-0.707,0.707}; 27 float3 LightDirection7={-0.707,-0.707,0.707}; 28 float3 LightDirection8={-0.707,-0.707,0.707}; 29 float3 LightDirection9={-0.707,-0.707,0.707}; 30 float3 LightDirection0={-0.707,-0.707,0.707}; 31 float3 LightDirectiona={-0.707,-0.707,0.707}; 32 float3 LightDirectionb={-0.707,-0.707,0.707}; 33 float3 LightDirectionc={-0.707,-0.707,0.707}; 34 float3 LightDirectiond={-0.707,-0.707,0.707}; 35 float3 LightDirectione={-0.707,-0.707,0.707}; 36 float3 LightDirectionf={-0.707,-0.707,0.707}; 37 float3 LightDirectiong={-0.707,-0.707,0.707}; 38 float3 LightDirectionh={-0.707,-0.707,0.707}; 39 float3 LightDirectionj={-0.707,-0.707,0.707}; 40 float3 LightDirectionk={-0.707,-0.707,0.707}; 31 float3 LightDirection = {-0.707, -0.707, 0.707}; 41 32 42 33 void PSColor( … … 44 35 out float4 oColor : COLOR0) 45 36 { 46 float temp =(dot(Normal,normalize(-LightDirection))+1)/4+0.5;47 oColor =float4(0.9*temp,0.9*temp,temp,1);37 float temp = (dot(Normal, normalize(-LightDirection)) + 1) / 4 + 0.5; 38 oColor = float4(0.9 * temp, 0.9 * temp, temp, 1); 48 39 } 49 40 … … 52 43 out float4 oColor : COLOR0) 53 44 { 54 float temp =(dot(Normal,normalize(-LightDirection))+1)/4+0.2;55 oColor =float4(0.9*temp,0.9*temp,temp,1);45 float temp = (dot(Normal, normalize(-LightDirection)) + 1) / 4 + 0.2; 46 oColor = float4(0.9 * temp, 0.9 * temp, temp, 1); 56 47 } 57 48 … … 62 53 pass P0 63 54 { 64 vertexshader =compile vs_1_1 VS();65 pixelshader =compile ps_2_0 PSColor();55 vertexshader = compile vs_1_1 VS(); 56 pixelshader = compile ps_2_0 PSColor(); 66 57 67 FillMode =Solid;58 FillMode = Solid; 68 59 } 69 60 70 61 pass P1 71 62 { 72 vertexshader =compile vs_1_1 VS();73 pixelshader =compile ps_2_0 PSWire();63 vertexshader = compile vs_1_1 VSWire(); 64 pixelshader = compile ps_2_0 PSWire(); 74 65 75 66 FillMode=Wireframe; trunk/fx3.fx
r22 r27 26 26 float3 Look = normalize(CamPos - WorldPos.xyz); 27 27 float4 Fresnel = 0.1 + pow(1.0 - dot(Look.xyz, Normal.xyz), 2) * 2; 28 oColor = abs(float4(lerp(Fresnel, float3(0.9, 0.5, 0.2), 0. 95), 1));28 oColor = abs(float4(lerp(Fresnel, float3(0.9, 0.5, 0.2), 0.5), 1)); 29 29 } 30 30 trunk/fx4.fx
r26 r27 1 1 shared float4x4 World : Auto; 2 shared float4x4 WorldView : Auto;2 shared float4x4 WorldViewProj : Auto; 3 3 shared float3 CamPos : Auto; 4 4 … … 65 65 pixelshader = compile ps_2_0 PSCorona(); 66 66 CullMode = CW; 67 ZWriteEnable = False;67 //ZWriteEnable = False; 68 68 } 69 69 } trunk/main.d
r26 r27 13 13 } 14 14 15 version(none) 16 { 15 17 import derelict.ogg.vorbisfile; 16 18 import derelict.ogg.vorbis; … … 138 140 } 139 141 140 version(none)class MyContext : NonagonContext142 class MyContext : NonagonContext 141 143 { 142 144 public override void main(char[][] args) … … 266 268 } 267 269 } 270 } 268 271 } 269 272 … … 478 481 Core.mouseVisible = false; 479 482 480 NG3D.init( 800, 600, true, WinType.Static);483 NG3D.init(1680, 1050, false, WinType.Static); 481 484 Core.windowName = "-= nonagon =-"; 482 485 … … 558 561 version(NGProgrammablePipeline) 559 562 { 560 Effect eff = new Effect(`fx 4.fx`);563 Effect eff = new Effect(`fx3.fx`); 561 564 562 565 // for(uint i = 0; i < minos.effects.length; i++) … … 574 577 // } 575 578 576 //teapot.effects[0] = eff.newInstance();579 teapot.effects[0] = eff.newInstance(); 577 580 // teapot.effects[0].floatVector("Diffuse", &D3DXVECTOR4(1, 0, 0, 1)); 578 // sphere.effects[0] = inst;579 // torus.effects[0] = inst;580 // 581 // ts.effects[] = inst;582 // 581 sphere.effects[0] = teapot.effects[0]; 582 torus.effects[0] = teapot.effects[0]; 583 584 ts.effects[] = teapot.effects[0]; 585 583 586 // water.effects[0] = inst; 584 587 } … … 593 596 float xvel = 0, yvel = 0, zvel = 0; 594 597 float xangvel = 0, yangvel = 0; 595 598 596 599 float posang = 0; 597 600 trunk/nonagon/pp/effect.d
r26 r27 413 413 mEffect.GetParameterDesc(hparam, &pdesc); 414 414 415 if(fromStringz(pdesc.Semantic) =="Auto")415 if(fromStringz(pdesc.Semantic) == "Auto") 416 416 continue; 417 418 i++;419 417 420 418 char[] pname = fromStringz(pdesc.Name); … … 574 572 break; 575 573 } 574 575 i++; 576 576 } 577 577 … … 1108 1108 throw new NGException("ConstantTable.constantName() - Index {} is out of range!", c); 1109 1109 1110 return mConstant Names.keys[c].dup;1110 return mConstantDescs[c].mName.dup; 1111 1111 } 1112 1112 trunk/nonagon/pp/renderer.d
r23 r27 239 239 opaqueRenderEntries[0 .. opaqueIndex].sort((RenderEntry ra, RenderEntry rb) 240 240 { 241 if((cast(void*)ra.mEffectInstance.parentEffect) < (cast(void*)rb.mEffectInstance.parentEffect)) 242 return true; 241 auto diff = (cast(void*)ra.mEffectInstance.parentEffect) - (cast(void*)rb.mEffectInstance.parentEffect); 242 243 if(diff == 0) 244 return (cast(void*)ra.mEffectInstance) < (cast(void*)rb.mEffectInstance); 243 245 else 244 return (cast(void*)ra.mEffectInstance) < (cast(void*)rb.mEffectInstance);246 return diff < 0; 245 247 }); 246 248 247 249 transparentRenderEntries[0 .. transparentIndex].sort((RenderEntry ra, RenderEntry rb) 248 250 {
