コード例 #1
0
        static void Main(string[] args)
        {
            Bootstrapper.Configure();

            var viewer = SimpleViewer.Create("Hello Veldrid Scene Graph");

            viewer.SetCameraManipulator(TrackballManipulator.Create());

            var root = Group.Create();

            var geometry = Geometry <VertexPositionColor> .Create();

            VertexPositionColor[] quadVertices =
            {
                new VertexPositionColor(new Vector2(-.75f,  .75f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f)),
                new VertexPositionColor(new Vector2(.75f,   .75f), new Vector4(0.0f, 1.0f, 0.0f, 1.0f)),
                new VertexPositionColor(new Vector2(-.75f, -.75f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f)),
                new VertexPositionColor(new Vector2(.75f,  -.75f), new Vector4(1.0f, 1.0f, 0.0f, 1.0f))
            };

            geometry.VertexData = quadVertices;

            uint[] quadIndices = { 0, 1, 2, 3 };
            geometry.IndexData = quadIndices;

            geometry.VertexLayout = new VertexLayoutDescription(
                new VertexElementDescription("Position", VertexElementSemantic.TextureCoordinate, VertexElementFormat.Float2),
                new VertexElementDescription("Color", VertexElementSemantic.TextureCoordinate, VertexElementFormat.Float4));

            var pSet = DrawElements <VertexPositionColor> .Create(
                geometry,
                PrimitiveTopology.TriangleStrip,
                (uint)geometry.IndexData.Length,
                1,
                0,
                0,
                0);

            geometry.PrimitiveSets.Add(pSet);

            geometry.PipelineState.VertexShaderDescription   = Vertex2Color4Shader.Instance.VertexShaderDescription;
            geometry.PipelineState.FragmentShaderDescription = Vertex2Color4Shader.Instance.FragmentShaderDescription;

            var geode = Geode.Create();

            geode.AddDrawable(geometry);

            root.AddChild(geode);

            viewer.SetSceneData(root);

            viewer.ViewAll();

            viewer.Run();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Bootstrapper.Configure();

            var logger = Veldrid.SceneGraph.Logging.LogManager.CreateLogger <Program>();

            var viewer = SimpleViewer.Create("Phong Shaded Dragon Scene Graph");

            viewer.SetCameraManipulator(TrackballManipulator.Create());

            var root = LightingExampleScene.Build();

            viewer.SetSceneData(root);
            viewer.ViewAll();
            viewer.Run();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Bootstrapper.Configure();

            var logger = Veldrid.SceneGraph.Logging.LogManager.CreateLogger <Program>();

            var viewer = SimpleViewer.Create("Path Shape Example");

            viewer.SetCameraManipulator(TrackballManipulator.Create());

            // Build the path scene
            var root = PathExampleScene.Build();

            viewer.SetSceneData(root);
            viewer.ViewAll();
            viewer.Run();
        }
コード例 #4
0
        static void Main(string[] args)
        {
            Bootstrapper.Configure();

            var viewer = SimpleViewer.Create("Text Rendering Demo");

            viewer.SetCameraManipulator(TrackballManipulator.Create());

            var root = Group.Create();

            var textNode = TextNode.Create("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor");

            var geode = Geode.Create();

            geode.AddDrawable(textNode);

            root.AddChild(geode);

            viewer.SetSceneData(root);

            viewer.ViewAll();
            viewer.Run();
        }
コード例 #5
0
ファイル: SampleApp.cs プロジェクト: fazyloff/XSD
        // Shows a simple example of how the class DespatchAdvice_Summary
        // can be used. This class can be used to load documents whose
        // root (document) element is <DespatchAdvice-Summary>.
        private void SimpleTestDespatchAdvice_Summary(string filename)
        {
            try
            {
                // create an instance of the class to load the XML file into
                DESADV_XSDLib.DespatchAdvice_Summary elm = new DESADV_XSDLib.DespatchAdvice_Summary();

                // load the xml from a file into the object (the root element in the
                // xml document must be <DespatchAdvice-Summary>.
                elm.FromXmlFile(filename);

                // This will open up a viewer, allowing you to navigate the classes
                // that have been generated.
                // Note the viewer can be used to modify properties, and provides a listing of
                // the code required to create the document it is displaying.
                SimpleViewer sv = new SimpleViewer(elm);
                sv.ShowDialog();

                // You can then add code to navigate the data held in the class.
                // When navigating this object model you should refer to the documentation
                // generated in the directory:
                // C:\BTS\XSD\KORUS\DESADV_XSD.xsd.Output\DocumentationCS\.
                // The help should be compiled into a chm before being used, (use build.bat)
                //- HTML Help Workshop is required to perform this,
                // and can be downloaded from Microsoft. The path to the help compiler (hhc.exe)
                // may need adjusting in build.bat

                // ...

                ////////////////////////////////////////////////////////////////////
                // The Xml can be extracted from the class using one of 3 methods //
                ////////////////////////////////////////////////////////////////////

                // This method will extract the xml into a string. The string is always encoded
                // using Unicode, there a number of options allowing the headers,
                // end of line & indenting to be set.
                string strXml = elm.ToXml();
                Console.WriteLine(strXml);

                // This method will extract the xml into a file. This method provides options
                // for changing the encoding (UTF-8, UTF-16) as well as headers,
                // end of line and indenting.
                elm.ToXmlFile(filename + ".testouput.xml");

                // This method will extract the xml into a stream. This method provides options
                // for changing the encoding (UTF-8, UTF-16) as well as headers,
                // end of line and indenting.
                // This method is useful when a specific encoding is required (typically
                // UTF-8), in order to transmit it over an 8-bit connection, smtp etc
                // without the need to write the xml to file first.
                System.IO.Stream stmXml = elm.ToXmlStream();

            }
            catch (Exception e)
            {
                DisplayError(e);
            }
        }