Changeset 27

Show
Ignore:
Timestamp:
04/17/08 14:39:23 (4 months ago)
Author:
JarrettBillingsley
Message:

Fixed two (2) bugs.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/fx2.fx

    r11 r27  
    1313    out float4 oNormal      : TEXCOORD0) 
    1414{ 
    15     oPosition=mul(Position,WorldViewProj); 
    16     oNormal=normalize(mul(Normal,World)); 
     15    oPosition = mul(Position, WorldViewProj); 
     16    oNormal = normalize(mul(Normal, World)); 
     17
     18 
     19void 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); 
    1727} 
    1828 
    1929//---------------------------------------------------------------------------------- 
    2030 
    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}; 
     31float3 LightDirection = {-0.707, -0.707, 0.707}; 
    4132 
    4233void PSColor( 
     
    4435    out float4 oColor   : COLOR0) 
    4536{ 
    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); 
    4839} 
    4940 
     
    5243    out float4 oColor   : COLOR0) 
    5344{ 
    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); 
    5647} 
    5748 
     
    6253    pass P0 
    6354    { 
    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(); 
    6657 
    67         FillMode=Solid; 
     58        FillMode = Solid; 
    6859    } 
    6960 
    7061    pass P1 
    7162    { 
    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(); 
    7465         
    7566        FillMode=Wireframe; 
  • trunk/fx3.fx

    r22 r27  
    2626    float3 Look = normalize(CamPos - WorldPos.xyz); 
    2727    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)); 
    2929} 
    3030 
  • trunk/fx4.fx

    r26 r27  
    11shared float4x4 World : Auto; 
    2 shared float4x4 WorldView : Auto; 
     2shared float4x4 WorldViewProj : Auto; 
    33shared float3 CamPos : Auto; 
    44 
     
    6565        pixelshader = compile ps_2_0 PSCorona(); 
    6666        CullMode = CW; 
    67         ZWriteEnable = False; 
     67        //ZWriteEnable = False; 
    6868    } 
    6969} 
  • trunk/main.d

    r26 r27  
    1313} 
    1414 
     15version(none) 
     16{ 
    1517import derelict.ogg.vorbisfile; 
    1618import derelict.ogg.vorbis; 
     
    138140} 
    139141 
    140 version(none) class MyContext : NonagonContext 
     142class MyContext : NonagonContext 
    141143{ 
    142144    public override void main(char[][] args) 
     
    266268        } 
    267269    } 
     270} 
    268271} 
    269272 
     
    478481        Core.mouseVisible = false; 
    479482 
    480         NG3D.init(800, 600, true, WinType.Static); 
     483        NG3D.init(1680, 1050, false, WinType.Static); 
    481484        Core.windowName = "-= nonagon =-"; 
    482485 
     
    558561        version(NGProgrammablePipeline) 
    559562        { 
    560             Effect eff = new Effect(`fx4.fx`); 
     563            Effect eff = new Effect(`fx3.fx`); 
    561564 
    562565//          for(uint i = 0; i < minos.effects.length; i++) 
     
    574577//          } 
    575578 
    576 //            teapot.effects[0] = eff.newInstance(); 
     579          teapot.effects[0] = eff.newInstance(); 
    577580//          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 
    583586//          water.effects[0] = inst; 
    584587        } 
     
    593596        float xvel = 0, yvel = 0, zvel = 0; 
    594597        float xangvel = 0, yangvel = 0; 
    595          
     598 
    596599        float posang = 0; 
    597600         
  • trunk/nonagon/pp/effect.d

    r26 r27  
    413413                mEffect.GetParameterDesc(hparam, &pdesc); 
    414414 
    415                 if(fromStringz(pdesc.Semantic)=="Auto") 
     415                if(fromStringz(pdesc.Semantic) == "Auto") 
    416416                    continue; 
    417                      
    418                 i++; 
    419417 
    420418                char[] pname = fromStringz(pdesc.Name); 
     
    574572                        break; 
    575573                } 
     574                 
     575                i++; 
    576576            } 
    577577 
     
    11081108            throw new NGException("ConstantTable.constantName() - Index {} is out of range!", c); 
    11091109 
    1110         return mConstantNames.keys[c].dup; 
     1110        return mConstantDescs[c].mName.dup; 
    11111111    } 
    11121112 
  • trunk/nonagon/pp/renderer.d

    r23 r27  
    239239        opaqueRenderEntries[0 .. opaqueIndex].sort((RenderEntry ra, RenderEntry rb) 
    240240        { 
    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); 
    243245            else 
    244                 return (cast(void*)ra.mEffectInstance) < (cast(void*)rb.mEffectInstance)
     246                return diff < 0
    245247        }); 
    246  
     248         
    247249        transparentRenderEntries[0 .. transparentIndex].sort((RenderEntry ra, RenderEntry rb) 
    248250        {