Beispiel #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");
    }
Beispiel #2
0
 public static void initialize0()
 {
     NoBlend.Create(BlendOperation.None);
     Addition.Create(BlendOperation.Add, BlendFactor.One, BlendFactor.One);
     HalfAddition.Create(BlendOperation.Add, BlendFactor.One, BlendFactor.InvSrcAlpha);
     Subtraction.Create(BlendOperation.RevSubtract, BlendFactor.One, BlendFactor.One);
     Multiplication.Create(BlendOperation.Add, BlendFactor.Zero, BlendFactor.SrcColor);
     Reverse.Create(BlendOperation.Add, BlendFactor.InvDestColor, BlendFactor.InvSrcColor);
     AlphaBlend.Create(BlendOperation.Add, BlendFactor.SrcAlpha, BlendFactor.InvSrcAlpha);
     Wrap.Create(TextureAddressMode.Wrap, TextureAddressMode.Wrap, TextureAddressMode.Wrap);
     Mirror.Create(TextureAddressMode.Mirror, TextureAddressMode.Mirror, TextureAddressMode.Mirror);
     CullingOn.Create(CullMode.Back, FillMode.Solid);
     CullingOff.Create(CullMode.None, FillMode.Solid);
     ZTestOn.Create(true, false, true);
     ZTestOnWriteOff.Create(true, false, false);
     ZTestOff.Create(false, false, false);
 }
Beispiel #3
0
        public ForwardRenderer(GraphicsDevice device)
        {
            //Scene.Processors.Add(renderableProcessor);
            samplerState = SamplerState.Create(device, null);

            descriptorPool     = new DisposableObjectPool <DescriptorSet>(() => new DescriptorSet(device, geometryShader.Layout));
            constantBufferPool = new DisposableObjectPool <GraphicsBuffer>(() => GraphicsBuffer.Create(device, constants, false));

            geometryShader = new GeometryShader(device);
            geometryShader.Initialize();
            pipelineStateDescription = new PipelineStateDescription()
            {
                InputLayout   = PositionColorTexture.Layout,
                RootSignature = geometryShader.RootSignature,
                VertexShader  = geometryShader.VertexShader,
                PixelShader   = geometryShader.PixelShader,
            };
            pipelineState = PipelineState.Create(device, pipelineStateDescription);
        }
Beispiel #4
0
    public static void initialize()
    {
        MeiryoUI.Create("Meiryo UI", 64);
        MSMincho.Create("MS 明朝", 64);

        NoBlend.Create(BlendOperation.None);
        Addition.Create(BlendOperation.Add, BlendFactor.One, BlendFactor.One);
        HalfAddition.Create(BlendOperation.Add, BlendFactor.One, BlendFactor.InvSrcAlpha);
        Subtraction.Create(BlendOperation.RevSubtract, BlendFactor.One, BlendFactor.One);
        Multiplication.Create(BlendOperation.Add, BlendFactor.Zero, BlendFactor.SrcColor);
        Reverse.Create(BlendOperation.Add, BlendFactor.InvDestColor, BlendFactor.InvSrcColor);
        AlphaBlend.Create(BlendOperation.Add, BlendFactor.SrcAlpha, BlendFactor.InvSrcAlpha);

        Wrap.Create(TextureAddressMode.Wrap, TextureAddressMode.Wrap, TextureAddressMode.Wrap);
        Mirror.Create(TextureAddressMode.Mirror, TextureAddressMode.Mirror, TextureAddressMode.Mirror);

        CullingOn.Create(CullMode.Back, FillMode.Solid);
        CullingOff.Create(CullMode.None, FillMode.Solid);

        ZTestOn.Create(true, false, true);
        ZTestOnWriteOff.Create(true, false, false);
        ZTestOff.Create(false, false, false);

        font(MeiryoUI);

        ExplosionSound.Create("res/sound/explosion1.wav");
        LargeExplosionSound.Create("res/sound/explosion2.wav");
        JetSound.Create("res/sound/burner_f15.wav");
        LockonSound.Create("res/sound/lockon4.wav");
        LockonSound.Volume = 0.25;
        AlertSound.Create("res/sound/alert2.wav");
        AlertSound.Volume = 0.25;
        BulletSound.Create("res/sound/bullet.wav");
        BulletHitSound.Create("res/sound/bulletHit.wav");
        BulletHitSound.Volume = 0.1;

        Graphics2D.Instance.Create();
        color(ColorCode.White);

        _rasterizerState.Create(CullMode.None, FillMode.Solid);
        _depthStencilState.Create(false, false, false);
    }