コード例 #1
0
ファイル: ImageRenderer.cs プロジェクト: yong-ja/starodyssey
        public override void Init()
        {
            TexturedPolygon quad = TexturedPolygon.CreateTexturedQuad("ScreenQuad", Vector3.Zero, 1920, 1080);
            ImageLoadInformation info = new ImageLoadInformation()
            {
                BindFlags = BindFlags.None,
                CpuAccessFlags = CpuAccessFlags.Read,
                FilterFlags = FilterFlags.None,
                Format = SlimDX.DXGI.Format.R8G8B8A8_UNorm,
                MipFilterFlags = FilterFlags.None,
                OptionFlags = ResourceOptionFlags.None,
                Usage = ResourceUsage.Staging,
                MipLevels = 1
            };
            Texture2D tex = Texture2D.FromFile(Game.Context.Device, "medusa.jpg",  info);

            ShaderResourceView srv = new ShaderResourceView(Game.Context.Device,  Make3D(tex));
            quad.DiffuseMapResource = srv;
            rNode = new RenderableNode(quad);
            iMat = new ImageMaterial();
            FixedNode fNode = new FixedNode();
            fNode.Init();
            quad.PositionV3 = Layout.OrthographicTransform(Vector2.Zero, 100, new Size(1920,1080));

            RenderableCollection rCol = new RenderableCollection(iMat.RenderableCollectionDescription);
            MaterialNode mMat = new MaterialNode(iMat);
            rCol.Add(rNode);

            fNode.AppendChild(mMat);
            mMat.AppendChild(rNode);

            rCommand = new RenderCommand(mMat, rCol);
            rCommand.Init();
            DeviceContext.Immediate.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;

            Scene.Tree.RootNode.AppendChild(fNode);
            Scene.BuildRenderScene();
        }
コード例 #2
0
ファイル: DebugLogger.cs プロジェクト: yong-ja/starodyssey
 public void Activate()
 {
     text = new TextLiteral(FrameStats, new Vector3(10, 10, 0));
     FunctionalMaterial textWriter = new FunctionalMaterial();
     MaterialNode mNode = new MaterialNode("Logger", textWriter);
     RenderableNode rNode = new RenderableNode(text);
     mNode.AppendChild(rNode);
     RenderableCollection rCollection = new RenderableCollection(textWriter.RenderableCollectionDescription)
                                            {rNode};
     //RenderCommand rCommand = new RenderCommand(mNode, rCollection);
     Game.CurrentRenderer.Scene.Tree.RootNode.AppendChild(mNode);
 }