Example #1
0
    static BallComponent()
    {
        VertexShader.CreateFromFile("res/shader/BallVertexShader.hlsl");
        PixelShader0.CreateFromFile("res/shader/BallPixelShader.hlsl", "pass0");
        PixelShader1.CreateFromFile("res/shader/BallPixelShader.hlsl", "pass1");

        VertexLayout.Create(new VertexElement[]
        {
            new VertexElement("POSITION", 0, Format.Float3, 0, 0, VertexElement.Classification.VertexData, 0),
            new VertexElement("NORMAL", 0, Format.Float3, 1, 0, VertexElement.Classification.VertexData, 0),
        }, VertexShader);

        GraphicsModel.CreateSphere(16, 16);

        SamplerState0.Create(TextureAddressMode.Wrap, TextureAddressMode.Wrap, TextureAddressMode.Wrap);
        SamplerState1.CreateComparator();

        Program.ResourceManager.Register("res/shader/BallVertexShader.hlsl", (path) => VertexShader);
        Program.ResourceManager.Load("res/shader/BallVertexShader.hlsl");
        Program.ResourceManager.Register("res/shader/BallPixelShader0.hlsl", (path) => PixelShader0);
        Program.ResourceManager.Load("res/shader/BallPixelShader0.hlsl");
        Program.ResourceManager.Register("res/shader/BallPixelShader1.hlsl", (path) => PixelShader1);
        Program.ResourceManager.Load("res/shader/BallPixelShader1.hlsl");
        Program.ResourceManager.Register("WallVertexLayout", (path) => VertexLayout);
        Program.ResourceManager.Load("WallVertexLayout");
        Program.ResourceManager.Register("WallGraphicsModel", (path) => GraphicsModel);
        Program.ResourceManager.Load("WallGraphicsModel");
        Program.ResourceManager.Register("WallSamplerState0", (path) => SamplerState0);
        Program.ResourceManager.Load("WallSamplerState0");
        Program.ResourceManager.Register("WallSamplerState1", (path) => SamplerState1);
        Program.ResourceManager.Load("WallSamplerState1");
    }
Example #2
0
    static DebugComponent()
    {
        VertexShader.CreateFromFile("res/shader/DebugVertexShader.hlsl");
        PixelShader.CreateFromFile("res/shader/DebugPixelShader.hlsl");

        VertexLayout.Create(new VertexElement[]
        {
            new VertexElement("POSITION", 0, Format.Float3, 0, 0, VertexElement.Classification.VertexData, 0),
        }, VertexShader);

        GraphicsModel.CreateSphere(16, 16);
    }