Exemple #1
0
        // Init is called on startup.
        public override void Init()
        {
            // Set the clear color for the backbuffer to light green (intensities in R, G, B, A).
            RC.ClearColor = new float4(0.7f, 1.0f, 0.5f, 1.0f);

            // Create a scene with a cube
            // The three components: one XForm, one Material and the Mesh
            _cubeTransform = new TransformComponent {
                Scale = new float3(1, 1, 1), Translation = new float3(0, 0, 0)
            };
            var cubeShader = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(new float3(0, 0, 1), new float3(1, 1, 1), 4)
            };
            var cubeMesh = SimpleMeshes.CreateCuboid(new float3(10, 10, 10));

            // Assemble the cube node containing the three components
            var cubeNode = new SceneNodeContainer();

            cubeNode.Components = new List <SceneComponentContainer>();
            cubeNode.Components.Add(_cubeTransform);
            cubeNode.Components.Add(cubeShader);
            cubeNode.Components.Add(cubeMesh);

            // Create the scene containing the cube as the only object
            _scene          = new SceneContainer();
            _scene.Children = new List <SceneNodeContainer>();
            _scene.Children.Add(cubeNode);

            // Create a scene renderer holding the scene above
            _sceneRenderer = new SceneRenderer(_scene);
        }
Exemple #2
0
        SceneContainer CreateScene()
        {
            // Initialize transform components that need to be changed inside "RenderAFrame"
            _baseTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 0, 0)
            };

            // Setup the scene graph
            return(new SceneContainer
            {
                Children = new List <SceneNodeContainer>
                {
                    new SceneNodeContainer
                    {
                        Components = new List <SceneComponentContainer>
                        {
                            // TRANSFROM COMPONENT
                            _baseTransform,

                            // SHADER EFFECT COMPONENT
                            new ShaderEffectComponent
                            {
                                Effect = SimpleMeshes.MakeShaderEffect(new float3(0.7f, 0.7f, 0.7f), new float3(1, 1, 1), 5)
                            },

                            // MESH COMPONENT
                            SimpleMeshes.CreateCuboid(new float3(10, 10, 10))
                        }
                    },
                }
            });
        }
Exemple #3
0
        // Init is called on startup.
        public override void Init()
        {
            // Set the clear color for the backbuffer to light green (intensities in R, G, B, A).
            RC.ClearColor = new float4(0.2f, 0.2f, 0.2f, 1.0f);

            // Create a scene with a cube
            // The three components: one XForm, one Material and the Mesh
            _cubeTransform = new TransformComponent {
                Scale = new float3(1, 0.3f, 1), Translation = new float3(0, 0, 0)
            };
            _cube2 = new TransformComponent {
                Scale = new float3(1, 0.3f, 1), Translation = new float3(0, 10, 0)
            };
            _cube3 = new TransformComponent {
                Scale = new float3(1, 0.3f, 1), Translation = new float3(0, -10, 0)
            };

            var cubeMaterial = new MaterialComponent {
                Diffuse = new MatChannelContainer {
                    Color = new float3(1, 0.7f, 0.2f)
                },
                Specular = new SpecularChannelContainer {
                    Color = float3.One, Shininess = 4
                }
            };
            var cubeMesh = SimpleMeshes.CreateCuboid(new float3(10, 10, 10));

            // Assemble the cube nodes containing the three components
            var cubeNode = new SceneNodeContainer();

            cubeNode.Components = new List <SceneComponentContainer>();
            cubeNode.Components.Add(_cubeTransform);
            cubeNode.Components.Add(cubeMaterial);
            cubeNode.Components.Add(cubeMesh);

            var cubeNode2 = new SceneNodeContainer();

            cubeNode2.Components = new List <SceneComponentContainer>();
            cubeNode2.Components.Add(_cube2);
            cubeNode2.Components.Add(cubeMaterial);
            cubeNode2.Components.Add(cubeMesh);

            var cubeNode3 = new SceneNodeContainer();

            cubeNode3.Components = new List <SceneComponentContainer>();
            cubeNode3.Components.Add(_cube3);
            cubeNode3.Components.Add(cubeMaterial);
            cubeNode3.Components.Add(cubeMesh);

            // Create the scene containing the cube as the only object
            _scene          = new SceneContainer();
            _scene.Children = new List <SceneNodeContainer>();
            _scene.Children.Add(cubeNode);
            _scene.Children.Add(cubeNode2);
            _scene.Children.Add(cubeNode3);

            // Create a scene renderer holding the scene above
            _sceneRenderer = new SceneRenderer(_scene);
        }
Exemple #4
0
        // Init is called on startup.
        public override void Init()
        {
            // Set the clear color for the backbuffer to light green (intensities in R, G, B, A).
            RC.ClearColor = new float4(0.5f, 0.5f, 0.5f, 1.0f);

            //Create a scene with a cube
            // The three components: one XFrom, one Shade the Mesh
            _cubeTransform = new TransformComponent {
                Scale = new float3(1, 1, 1), Translation = new float3(0, 0, 0)
            };
            var cubeShader = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(new float3(0, 1, 1), new float3(1, 1, 1), 4)
            };
            var cubeMesh = SimpleMeshes.CreateCuboid(new float3(10, 10, 10));


            var cubeNode = new SceneNodeContainer();

            cubeNode.Components = new List <SceneComponentContainer>();
            cubeNode.Components.Add(_cubeTransform);
            cubeNode.Components.Add(cubeShader);
            cubeNode.Components.Add(cubeMesh);

            //cube 2

            _cubeTransform2 = new TransformComponent {
                Scale = new float3(1, 1, 1), Translation = new float3(0, 0, -20)
            };
            cubeShader2 = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(new float3(1, 0, 0.4f), new float3(1, 1, 1), 4)
            };
            var cubeMesh2 = SimpleMeshes.CreateCuboid(new float3(10, 10, 10));

            var cubeNode2 = new SceneNodeContainer();

            cubeNode2.Components = new List <SceneComponentContainer>();
            cubeNode2.Components.Add(_cubeTransform2);
            cubeNode2.Components.Add(cubeShader2);
            cubeNode2.Components.Add(cubeMesh);


            //scene load
            _scene          = new SceneContainer();
            _scene.Children = new List <SceneNodeContainer>();
            _scene.Children.Add(cubeNode);
            _scene.Children.Add(cubeNode2);

            _sceneRenderer = new SceneRenderer(_scene);
        }
        // Init is called on startup.
        public override void Init()
        {
            // Set the clear color for the backbuffer to light green (intensities in R, G, B, A).
            RC.ClearColor = new float4(0.1f, 0.1f, 0.1f, 1);

            float cubeSpace = (float)1 / _count * 50;                                              //cube width with space between
            float cubeSize  = cubeSpace * 0.75f;                                                   //cube width
            Mesh  cubeMesh  = SimpleMeshes.CreateCuboid(new float3(cubeSize, cubeSize, cubeSize)); //cube mesh

            // Create the scene containing the cube as the only object
            _scene          = new SceneContainer();
            _scene.Children = new List <SceneNodeContainer>();

            // Create a scene with a cube
            // The three components: one XForm, one Shader and the Mesh
            float center = -(cubeSpace * _count) / 2 + cubeSpace / 2; //leftmost x-value to display cubes in center

            Diagnostics.Log("center " + center);
            for (int i = 0; i < _count; i++)
            {
                _cubeTransform[i] = new TransformComponent //Transformation
                {
                    Scale       = new float3(1, 1, 1),
                    Translation = new float3(center + i * cubeSpace, 0, 0),
                    Rotation    = new float3(0, 0, 0)
                };
                Diagnostics.Log(i + " " + _cubeTransform[i].Translation.x);

                float color = (float)(i + 1) / _count;     //color of cubes, gray levels between ]black,white]

                _cubeShader[i] = new ShaderEffectComponent //Shader
                {
                    Effect = SimpleMeshes.MakeShaderEffect(new float3(color, color, color), new float3(1, 1, 1), 4)
                };

                // Assemble the cube node containing the three components
                var cubeNode = new SceneNodeContainer();
                cubeNode.Components = new List <SceneComponentContainer>();
                cubeNode.Components.Add(_cubeTransform[i]);
                cubeNode.Components.Add(_cubeShader[i]);
                cubeNode.Components.Add(cubeMesh);
                _scene.Children.Add(cubeNode);
            }

            // Create a scene renderer holding the scene above
            _sceneRenderer = new SceneRenderer(_scene);
        }
Exemple #6
0
        // Init is called on startup.
        public override void Init()
        {
            // Set the clear color for the backbuffer to white (100% intentsity in all color channels R, G, B, A).
            RC.ClearColor = new float4(0.8f, 0.9f, 0.7f, 1);

            _scene = AssetStorage.Get <SceneContainer>("gabelstapler.fus");


            _RadVLTransform = _scene.Children.FindNodes(node => node.Name == "RadVL")?.FirstOrDefault()?.GetTransform();
            _RadVRTransform = _scene.Children.FindNodes(node => node.Name == "RadVR")?.FirstOrDefault()?.GetTransform();
            _RadHLTransform = _scene.Children.FindNodes(node => node.Name == "RadHL")?.FirstOrDefault()?.GetTransform();
            _RadHRTransform = _scene.Children.FindNodes(node => node.Name == "RadHR")?.FirstOrDefault()?.GetTransform();
            _LiftTransform  = _scene.Children.FindNodes(node => node.Name == "Lift")?.FirstOrDefault()?.GetTransform();
            _GabelTransform = _scene.Children.FindNodes(node => node.Name == "Gabel")?.FirstOrDefault()?.GetTransform();
            _BaseTransform  = _scene.Children.FindNodes(node => node.Name == "Basis")?.FirstOrDefault()?.GetTransform();

            _targetHeight = _GabelTransform.Translation.y;

            _TrailerTransform = new TransformComponent {
                Rotation = new float3(-M.Pi / 5.7f, 0, 0), Scale = float3.One, Translation = new float3(0, 0, -10)
            };

            _scene.Children.Add(new SceneNodeContainer
            {
                Components = new List <SceneComponentContainer>
                {
                    _TrailerTransform,
                    new MaterialComponent {
                        Diffuse = new MatChannelContainer {
                            Color = new float3(0.7f, 0.7f, 0.7f)
                        }, Specular = new SpecularChannelContainer {
                            Color = new float3(1, 1, 1), Shininess = 5
                        }
                    },
                    SimpleMeshes.CreateCuboid(new float3(2, 2, 2))
                }
            });


            _scenePicker = new ScenePicker(_scene);

            // Create a scene renderer holding the scene above
            _sceneRenderer = new SceneRenderer(_scene);
        }
Exemple #7
0
        // Init is called on startup.
        public override void Init()
        {
            // Set the clear color for the backbuffer to white (100% intentsity in all color channels R, G, B, A).
            RC.ClearColor = new float4(1, 1, 1, 1);

            // Create five cubes
            _cubes = new SceneNodeContainer[5];

            for (int i = 0; i < 5; i++)
            {
                var cubeTransform = new TransformComponent {
                    Scale = new float3(1, 1, 1), Translation = new float3((i - 2) * 15, 0, 0)
                };
                var cubeMaterial = new MaterialComponent
                {
                    Diffuse = new MatChannelContainer {
                        Color = new float3(1 - (i / 4.0f), 0.5f, i / 4.0f)
                    },
                    Specular = new SpecularChannelContainer {
                        Color = float3.One, Shininess = 4
                    }
                };
                var cubeMesh = SimpleMeshes.CreateCuboid(new float3(10, 10, 10));

                var cubeNode = new SceneNodeContainer();
                cubeNode.Components = new List <SceneComponentContainer>();
                cubeNode.Components.Add(cubeTransform);
                cubeNode.Components.Add(cubeMaterial);
                cubeNode.Components.Add(cubeMesh);

                _cubes[i] = cubeNode;
            }

            // Create the scene containing the cubes
            _scene          = new SceneContainer();
            _scene.Children = new List <SceneNodeContainer>();
            foreach (SceneNodeContainer cube in _cubes)
            {
                _scene.Children.Add(cube);
            }

            // Create a scene renderer holding the scene above
            _sceneRenderer = new SceneRenderer(_scene);
        }
Exemple #8
0
        SceneContainer CreateScene()
        {
            // Initialize transform components that need to be changed inside "RenderAFrame"
            _baseTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 0, 0)
            };

            // Setup the scene graph
            return(new SceneContainer
            {
                Children = new List <SceneNodeContainer>
                {
                    new SceneNodeContainer
                    {
                        Components = new List <SceneComponentContainer>
                        {
                            // TRANSFROM COMPONENT
                            _baseTransform,

                            // MATERIAL COMPONENT
                            new MaterialComponent
                            {
                                Diffuse = new MatChannelContainer {
                                    Color = new float3(0.7f, 0.7f, 0.7f)
                                },
                                Specular = new SpecularChannelContainer {
                                    Color = new float3(1, 1, 1), Shininess = 5
                                }
                            },

                            // MESH COMPONENT
                            // SimpleAssetsPickinges.CreateCuboid(new float3(10, 10, 10))
                            SimpleMeshes.CreateCuboid(new float3(10, 10, 10))
                        }
                    },
                }
            });
        }
Exemple #9
0
        // Init is called on startup.
        public override void Init()
        {
            // Set the clear color for the backbuffer to white (100% intentsity in all color channels R, G, B, A).
            RC.ClearColor = new float4(0.7f, 1.0f, 0.5f, 1.0f);

            // Create five cubes
            _cubes = new SceneNodeContainer[5];

            for (int i = 0; i < 5; i++)
            {
                var cubeTransform = new TransformComponent {
                    Scale = new float3(1, 1, 1), Translation = new float3((i - 3) * 10, 0, 0)
                };
                var cubeShader = new ShaderEffectComponent
                {
                    Effect = SimpleMeshes.MakeShaderEffect(new float3(1, 1, 1), new float3(1, 1, 1), i)
                };
                var cubeMesh = SimpleMeshes.CreateCuboid(new float3(10, 10, 10));

                var cubeNode = new SceneNodeContainer();
                cubeNode.Components = new List <SceneComponentContainer>();
                cubeNode.Components.Add(cubeTransform);
                cubeNode.Components.Add(cubeShader);
                cubeNode.Components.Add(cubeMesh);

                _cubes[i] = cubeNode;
            }

            // Create the scene containing the cubes
            _scene          = new SceneContainer();
            _scene.Children = new List <SceneNodeContainer>();
            foreach (SceneNodeContainer cube in _cubes)
            {
                _scene.Children.Add(cube);
            }

            // Create a scene renderer holding the scene above
            _sceneRenderer = new SceneRenderer(_scene);
        }
Exemple #10
0
        public void addCube(int amount)
        {
            for (int i = 0; i < amount; i++)
            {
                _cubeTransform = new TransformComponent {
                    Scale = new float3(1, 1, 1), Translation = new float3((float)random.Next(-50, 50), (float)random.Next(-50, 50), (float)random.Next(-50, 50))
                };
                var cubeShader = new ShaderEffectComponent {
                    Effect = SimpleMeshes.MakeShaderEffect(new float3((float)1 / (i + 1), (float)1 / (i + 1), (float)1 / (i + 1)), new float3(1, 1, 1), 4)
                };

                var cubeMesh = SimpleMeshes.CreateCuboid(new float3(random.Next(5, 20), random.Next(5, 20), random.Next(5, 20)));

                //assemble cube node
                var cubeNode = new SceneNodeContainer();
                cubeNode.Components = new List <SceneComponentContainer>();
                cubeNode.Components.Add(_cubeTransform);
                cubeNode.Components.Add(cubeShader);
                cubeNode.Components.Add(cubeMesh);

                _scene.Children.Add(cubeNode);
            }
        }
 private SceneContainer CreateScene()
 {
     return(new SceneContainer
     {
         Header = new SceneHeader
         {
             CreationDate = "March 2017",
             CreatedBy = "mch",
             Generator = "Handcoded with pride",
             Version = 42,
         },
         Children = new List <SceneNodeContainer>
         {
             new SceneNodeContainer
             {
                 Name = "Base",
                 Components = new List <SceneComponentContainer>
                 {
                     new TransformComponent {
                         Scale = float3.One
                     },
                     new MaterialComponent
                     {
                         Diffuse = new MatChannelContainer {
                             Color = ColorUint.Red.Tofloat3()
                         },
                         Specular = new SpecularChannelContainer {
                             Color = ColorUint.White.Tofloat3(), Intensity = 1.0f, Shininess = 4.0f
                         }
                     },
                     SimpleMeshes.CreateCuboid(new float3(100, 20, 100))
                 }
             },
         }
     });
 }
Exemple #12
0
        // Init is called on startup.
        public override void Init()
        {
            // Set the clear color for the backbuffer to light green (intensities in R, G, B, A).
            RC.ClearColor = new float4(3f, 2f, 1f, 1.0f);

            // for(int i = 0; i <= a.Length; i++){

            _cubeTransform = new TransformComponent {
                Scale = new float3(2, 2, 2), Translation = new float3(0, 0, 0)
            };



            var cubeMaterial = new MaterialComponent
            {
                Diffuse = new MatChannelContainer {
                    Color = new float3(3, 0, 1)
                },
                Specular = new SpecularChannelContainer {
                    Color = float3.One, Shininess = 4
                }
            };
            var cubeMesh = SimpleMeshes.CreateCuboid(new float3(1, 1, 1));

            // Assemble the cube node containing the three components
            var cubeNode = new SceneNodeContainer();

            cubeNode.Components = new List <SceneComponentContainer>();
            cubeNode.Components.Add(_cubeTransform);
            cubeNode.Components.Add(cubeMaterial);
            cubeNode.Components.Add(cubeMesh);



            // Create a scene with a cube
            // The three components: one XForm, one Material and the Mesh3
            _cubeTransform1 = new TransformComponent {
                Scale = new float3(3, 6, 7), Translation = new float3(0, 3, 2)
            };
            var cubeMaterial1 = new MaterialComponent
            {
                Diffuse = new MatChannelContainer {
                    Color = new float3(0.5f, .8f, .5f)
                },
                Specular = new SpecularChannelContainer {
                    Color = float3.One, Shininess = 4
                }
            };
            var cubeMesh1 = SimpleMeshes.CreateCuboid(new float3(2, 3, 3));

            // Assemble the cube node containing the three components
            var cubeNode1 = new SceneNodeContainer();

            cubeNode1.Components = new List <SceneComponentContainer>();
            cubeNode1.Components.Add(_cubeTransform1);
            cubeNode1.Components.Add(cubeMaterial1);
            cubeNode1.Components.Add(cubeMesh1);



            // Create a scene with a cube
            // The three components: one XForm, one Material and the Mesh
            _cubeTransform2 = new TransformComponent {
                Scale = new float3(4, 4, 4), Translation = new float3(5, 4, 7)
            };
            cubeMaterial2 = new MaterialComponent
            {
                Diffuse = new MatChannelContainer {
                    Color = new float3(0, 1, 0)
                },
                Specular = new SpecularChannelContainer {
                    Color = float3.One, Shininess = 4
                }
            };
            var cubeMesh2 = SimpleMeshes.CreateCuboid(new float3(1, 1, 1));

            // Assemble the cube node containing the three components
            var cubeNode2 = new SceneNodeContainer();

            cubeNode2.Components = new List <SceneComponentContainer>();
            cubeNode2.Components.Add(_cubeTransform2);
            cubeNode2.Components.Add(cubeMaterial2);
            cubeNode2.Components.Add(cubeMesh2);


            // Create a scene with a cube
            // The three components: one XForm, one Material and the Mesh3
            _cubeTransform3 = new TransformComponent {
                Scale = new float3(3, 3, 1), Translation = new float3(3, 0, -5)
            };
            var cubeMaterial3 = new MaterialComponent
            {
                Diffuse = new MatChannelContainer {
                    Color = new float3(0.5f, .8f, .5f)
                },
                Specular = new SpecularChannelContainer {
                    Color = float3.One, Shininess = 4
                }
            };
            var cubeMesh3 = SimpleMeshes.CreateCuboid(new float3(1, 1, 1));

            // Assemble the cube node containing the three components
            var cubeNode3 = new SceneNodeContainer();

            cubeNode1.Components = new List <SceneComponentContainer>();
            cubeNode1.Components.Add(_cubeTransform3);
            cubeNode1.Components.Add(cubeMaterial3);
            cubeNode1.Components.Add(cubeMesh3);



            // Create the scene containing the cube as the only object
            _scene          = new SceneContainer();
            _scene.Children = new List <SceneNodeContainer>();
            _scene.Children.Add(cubeNode);
            _scene.Children.Add(cubeNode1);
            _scene.Children.Add(cubeNode2);
            _scene.Children.Add(cubeNode3);


            // Create a scene renderer holding the scene above
            _sceneRenderer = new SceneRenderer(_scene);



            // }
        }
Exemple #13
0
        // Init is called on startup.
        public override void Init()
        {
            // Set the clear color for the backbuffer to white (100% intentsity in all color channels R, G, B, A).
            RC.ClearColor = ColorUint.Tofloat4(ColorUint.PaleGreen);

            // Create a scene with a cube
            // The three components: one XForm, one Shader and the Mesh
            _cubeTransform = new TransformComponent {
                Scale = new float3(1, 1, 1), Translation = new float3(0, 0, 0), Rotation = new float3(0.1f, 0, 0.3f)
            };
            _cubeShader = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(ColorUint.Tofloat3(ColorUint.Crimson), new float3(1, 1, 1), 4)
            };
            var cubeMesh = SimpleMeshes.CreateCuboid(new float3(10, 10, 10));

            // Assemble the cube node containing the three components
            var cubeNode = new SceneNodeContainer();

            cubeNode.Components = new List <SceneComponentContainer>();
            cubeNode.Components.Add(_cubeTransform);
            cubeNode.Components.Add(_cubeShader);
            cubeNode.Components.Add(cubeMesh);
// Würfel 2
            _cube2Transform = new TransformComponent {
                Scale = new float3(5, 1, 1), Translation = new float3(30, 0, 30), Rotation = new float3(0.6f, 0.6f, 0)
            };
            _cube2Shader = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(ColorUint.Tofloat3(ColorUint.Navy), new float3(1, 1, 1), 4)
            };
            var cubeMesh2 = SimpleMeshes.CreateCuboid(new float3(5, 5, 5));

            // Assemble the cube node containing the three components
            var cubeNode2 = new SceneNodeContainer();

            cubeNode2.Components = new List <SceneComponentContainer>();
            cubeNode2.Components.Add(_cube2Transform);
            cubeNode2.Components.Add(_cube2Shader);
            cubeNode2.Components.Add(cubeMesh2);
//würfel 3
            _cube3Transform = new TransformComponent {
                Scale = new float3(1, 1, 1), Translation = new float3(18, 0, -30)
            };
            _cube3Shader = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(ColorUint.Tofloat3(ColorUint.Lime), new float3(1, 2, 1), 4)
            };
            var cubeMesh3 = SimpleMeshes.CreateCuboid(new float3(1, 1, 1));

            // Assemble the cube node containing the three components
            var cubeNode3 = new SceneNodeContainer();

            cubeNode3.Components = new List <SceneComponentContainer>();
            cubeNode3.Components.Add(_cube3Transform);
            cubeNode3.Components.Add(_cube3Shader);
            cubeNode3.Components.Add(cubeMesh3);

            // Create the scene containing the cube as the only object
            _scene          = new SceneContainer();
            _scene.Children = new List <SceneNodeContainer>();
            _scene.Children.Add(cubeNode);
            _scene.Children.Add(cubeNode2);
            _scene.Children.Add(cubeNode3);

            // Create a scene renderer holding the scene above
            _sceneRenderer = new SceneRenderer(_scene);

            // RenderAFrame is called once a frame
        }
Exemple #14
0
        SceneContainer CreateScene()
        {
            // Initialize transform components that need to be changed inside "RenderAFrame"
            _baseTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 0, 0)
            };
            //roter Arm
            _bodyTransform = new TransformComponent {
                Rotation = new float3(0, 0, 0),
                Scale    = new float3(1, 1, 1),
                //Position roter Arm
                Translation = new float3(0, 6, 0)
            };


            //grüner Arm
            _upperArmTransform = new TransformComponent {
                Rotation = new float3(0, 0, 0),
                Scale    = new float3(1, 1, 1),
                //Position grüner Arm
                Translation = new float3(2, 4, 0)
            };

            //blauer Arm
            _sideArmTransform = new TransformComponent {
                Rotation = new float3(0, 0, 0),
                Scale    = new float3(1, 1, 1),
                //Position blauer Arm
                Translation = new float3(-2, 8, 0)
            };

            //zweiter baluer Arm
            _othersideArmTransform = new TransformComponent {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(2, 8, 0)
            };

            //erster Greifarm
            //_ersterGreifArmTransform = new TransformComponent{
            //Rotation= new float3(0,0,0),
            //Scale = new float3(0.5f,0.5f,1),
            //Translation = new float3(1,12,0)
            //};

            //zweiter Greifarm
            //_zweiterGreifArmTransform = new TransformComponent{
            //  Rotation= new float3(0,0,0),
            //Scale = new float3(0.5f,0.5f,1),
            //Translation = new float3(-1,12,0)
            //};



            // Setup the scene graph
            return(new SceneContainer
            {
                Children = new List <SceneNodeContainer>
                {
                    new SceneNodeContainer
                    {
                        Components = new List <SceneComponentContainer>
                        {
                            // TRANSFROM COMPONENT
                            _baseTransform,

                            // MATERIAL COMPONENT
                            new MaterialComponent
                            {
                                Diffuse = new MatChannelContainer {
                                    Color = new float3(0.7f, 0.7f, 0.7f)
                                },
                                Specular = new SpecularChannelContainer {
                                    Color = new float3(1, 1, 1), Shininess = 5
                                }
                            },

                            // MESH COMPONENT
                            SimpleMeshes.CreateCuboid(new float3(10, 2, 10))
                        }
                    },

                    //Red Body
                    new SceneNodeContainer {
                        Components = new List <SceneComponentContainer> {
                            _bodyTransform,
                            new MaterialComponent {
                                //Farbe des Cuboiden
                                Diffuse = new MatChannelContainer {
                                    Color = new float3(1, 0, 0)
                                },
                                Specular = new SpecularChannelContainer {
                                    Color = new float3(1, 1, 1), Shininess = 5
                                }
                            },
                            SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                        },

                        Children = new List <SceneNodeContainer> {
                            // GREEN UPPER ARM
                            new SceneNodeContainer
                            {
                                Components = new List <SceneComponentContainer>
                                {
                                    _upperArmTransform,
                                },
                                Children = new List <SceneNodeContainer>
                                {
                                    new SceneNodeContainer
                                    {
                                        Components = new List <SceneComponentContainer>
                                        {
                                            new TransformComponent
                                            {
                                                Rotation = new float3(0, 0, 0),
                                                Scale = new float3(1, 1, 1),
                                                Translation = new float3(0, 4, 0)
                                            },
                                            new MaterialComponent
                                            {
                                                Diffuse = new MatChannelContainer {
                                                    Color = new float3(0, 1, 0)
                                                },
                                                Specular = new SpecularChannelContainer {
                                                    Color = new float3(1, 1, 1), Shininess = 5
                                                }
                                            },
                                            SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                        }
                                    },
                                    // BLUE FOREARM
                                    new SceneNodeContainer
                                    {
                                        Components = new List <SceneComponentContainer>
                                        {
                                            _sideArmTransform,
                                        },
                                        Children = new List <SceneNodeContainer>
                                        {
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    new TransformComponent
                                                    {
                                                        Rotation = new float3(0, 0, 0),
                                                        Scale = new float3(1, 1, 1),
                                                        Translation = new float3(0, 4, 0)
                                                    },
                                                    new MaterialComponent
                                                    {
                                                        Diffuse = new MatChannelContainer {
                                                            Color = new float3(0, 0, 1)
                                                        },
                                                        Specular = new SpecularChannelContainer {
                                                            Color = new float3(1, 1, 1), Shininess = 5
                                                        }
                                                    },
                                                    SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                                }
                                            }
                                        }
                                    },
                                    //zweiter blauer Arm!
                                    new SceneNodeContainer
                                    {
                                        Components = new List <SceneComponentContainer>
                                        {
                                            _othersideArmTransform,
                                        },
                                        Children = new List <SceneNodeContainer>
                                        {
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    new TransformComponent
                                                    {
                                                        Rotation = new float3(0, 0, 0),
                                                        Scale = new float3(1, 1, 1),
                                                        Translation = new float3(0, 4, 0)
                                                    },
                                                    new MaterialComponent
                                                    {
                                                        Diffuse = new MatChannelContainer {
                                                            Color = new float3(0, 0, 1)
                                                        },
                                                        Specular = new SpecularChannelContainer {
                                                            Color = new float3(1, 1, 1), Shininess = 5
                                                        }
                                                    },
                                                    SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                                }
                                            }
                                        }
                                    }
                                }
                            },
                        }
                    }
                }
            });
        }
Exemple #15
0
        public override void Init()
        {
            // Set the clear color for the backbuffer to white (100% intentsity in all color channels R, G, B, A).
            RC.ClearColor = new float4(2f, 2f, 2.7f, 5);

            // Create scene with cubes
            // The three components: one XForm, one Shader and the Mesh
            _cubeTransform = new TransformComponent {
                Scale = new float3(1, 0.1f, 1), Translation = new float3(2, 0.7f, 0)
            };
            var cubeShader = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(new float3(1, 4, 2), new float3(6, 4, 2), 3)
            };
            var cubeMesh  = SimpleMeshes.CreateCuboid(new float3(4, 5, 7));
            var cubeMesh1 = SimpleMeshes.CreateCuboid(new float3(3, 1, 15));
            var cubeMesh2 = SimpleMeshes.CreateCuboid(new float3(5, 7, 9));

            _cubeTransform1 = new TransformComponent {
                Scale = new float3(1.2f, 2.7f, 0.1f), Translation = new float3(10, 5, 5)
            };
            var cubeShader1 = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(new float3(0.2f, 0.4f, 0.6f), new float3(1, 1, 1), 4)
            };

            _cubeTransform2 = new TransformComponent {
                Scale = new float3(0.5f, 0.5f, 0.5f), Translation = new float3(30, 14, 19)
            };
            var cubeShader2 = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(new float3(2, 1, 20), new float3(1, 1, 1), 5)
            };

            // Assemble the cubes
            var cubeNode = new SceneNodeContainer();

            cubeNode.Components = new List <SceneComponentContainer>();
            cubeNode.Components.Add(_cubeTransform);
            cubeNode.Components.Add(cubeShader);
            cubeNode.Components.Add(cubeMesh);

            var cubeNode1 = new SceneNodeContainer();

            cubeNode1.Components = new List <SceneComponentContainer>();
            cubeNode1.Components.Add(_cubeTransform1);
            cubeNode1.Components.Add(cubeShader1);
            cubeNode1.Components.Add(cubeMesh1);

            var cubeNode2 = new SceneNodeContainer();

            cubeNode2.Components = new List <SceneComponentContainer>();
            cubeNode2.Components.Add(_cubeTransform2);
            cubeNode2.Components.Add(cubeShader2);
            cubeNode2.Components.Add(cubeMesh2);


            _scene          = new SceneContainer();
            _scene.Children = new List <SceneNodeContainer>();
            _scene.Children.Add(cubeNode);
            _scene.Children.Add(cubeNode1);
            _scene.Children.Add(cubeNode2);


            _sceneRenderer = new SceneRenderer(_scene);
        }
Exemple #16
0
        public override void Init()
        {
            // Set the clear color for the backbuffer to light green (intensities in R, G, B, A).
            RC.ClearColor  = new float4(0f, 1f, 2f, 1f);
            _cubeTransform = new TransformComponent {
                Scale = new float3(1, 1, 1), Translation = new float3(0, 0, 0)
            };

            var cubeShader = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(ColorUint.Tofloat3(ColorUint.Beige), new float3(1, 1, 1), 4)
            };
            var cubeMesh = SimpleMeshes.CreateCuboid(new float3(10, 10, 10));


            // Assemble the cube node containing the three components
            var cubeNode = new SceneNodeContainer();

            cubeNode.Components = new List <SceneComponentContainer>();
            cubeNode.Components.Add(_cubeTransform);
            cubeNode.Components.Add(cubeShader);
            cubeNode.Components.Add(cubeMesh);

//CUBE2_________________________________________________________________________

            _cube2Transform = new TransformComponent {
                Scale = new float3(3, 3, 1), Translation = new float3(30, 0, 30), Rotation = new float3(0.1f, 0.5f, 0)
            };
            _cube2Shader = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(ColorUint.Tofloat3(ColorUint.DarkRed), new float3(1, 1, 1), 4)
            };
            var cubeMesh2 = SimpleMeshes.CreateCuboid(new float3(5, 5, 5));

            // Assemble the cube node containing the three components
            var cubeNode2 = new SceneNodeContainer();

            cubeNode2.Components = new List <SceneComponentContainer>();
            cubeNode2.Components.Add(_cube2Transform);
            cubeNode2.Components.Add(_cube2Shader);
            cubeNode2.Components.Add(cubeMesh2);



//CUBE3_______________________________________________________________________________
            _cube3Transform = new TransformComponent {
                Scale = new float3(1, 1, 1), Translation = new float3(15, 0, -10), Rotation = new float3(-0.1f, -0.5f, 0)
            };
            _cube3Shader = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(ColorUint.Tofloat3(ColorUint.MediumSeaGreen), new float3(1, 2, 1), 4)
            };
            var cubeMesh3 = SimpleMeshes.CreateCuboid(new float3(2, 3, 1));

            // Assemble the cube node containing the three components
            var cubeNode3 = new SceneNodeContainer();

            cubeNode3.Components = new List <SceneComponentContainer>();
            cubeNode3.Components.Add(_cube3Transform);
            cubeNode3.Components.Add(_cube3Shader);
            cubeNode3.Components.Add(cubeMesh3);

            // Create the scene containing the cube as the only object
            _scene          = new SceneContainer();
            _scene.Children = new List <SceneNodeContainer>();
            _scene.Children.Add(cubeNode);
            _scene.Children.Add(cubeNode2);
            _scene.Children.Add(cubeNode3);



            // Create a scene renderer holding the scene above
            _sceneRenderer = new SceneRenderer(_scene);
        }
Exemple #17
0
        // Init is called on startup.
        public override void Init()
        {
            // Set the clear color for the backbuffer to white (100% intentsity in all color channels R, G, B, A).
            RC.ClearColor = new float4(1, 1, 0.5f, 0.3f);

            // Create a scene with a cube
            // The three components: one XForm, one Material and the Mesh

            //Würfel 1
            _cubeTransform1 = new TransformComponent {
                Scale = new float3(1, 1, 1), Translation = new float3(0, 0, 0), Rotation = new float3(0.3f, 1, 0)
            };
            // var cubeTransform = new TransformComponent { Scale = new float3(1, 1, 1), Translation = new float3(0, 0, 0), Rotation = new float3(0.3f,1,0) };
            var cubeMaterial1 = new MaterialComponent
            {
                Diffuse = new MatChannelContainer {
                    Color = new float3(1, 0.32f, 0.04f)
                },
                Specular = new SpecularChannelContainer {
                    Color = float3.One, Shininess = 4
                }
            };
            var cubeMesh1 = SimpleMeshes.CreateCuboid(new float3(30, 20, 20));


            //Würfel 2
            _cubeTransform2 = new TransformComponent {
                Scale = new float3(2, 2, 2), Rotation = new float3(0, 1, 0), Translation = new float3(0, 40, 40)
            };
            var cubeMaterial2 = new MaterialComponent
            {
                Diffuse = new MatChannelContainer {
                    Color = new float3(1, 0.1f, 0.04f)
                },
                Specular = new SpecularChannelContainer {
                    Color = float3.One, Shininess = 4
                }
            };
            var cubeMesh2 = SimpleMeshes.CreateCuboid(new float3(30, 20, 20));



            //Würfel 3
            _cubeTransform3 = new TransformComponent {
                Scale = new float3(0.5f, 0.5f, 0.5f), Translation = new float3(-80, 0, 0), Rotation = new float3(0, 0, 0)
            };
            var cubeMaterial3 = new MaterialComponent
            {
                Diffuse = new MatChannelContainer {
                    Color = new float3(1, 0.72f, 0.04f)
                },
                Specular = new SpecularChannelContainer {
                    Color = float3.One, Shininess = 4
                }
            };
            var cubeMesh3 = SimpleMeshes.CreateCuboid(new float3(30, 20, 20));



            // Assemble the cube node containing the three components Würfel 1
            var cubeNode1 = new SceneNodeContainer();

            cubeNode1.Components = new List <SceneComponentContainer>();
            cubeNode1.Components.Add(_cubeTransform1);
            cubeNode1.Components.Add(cubeMaterial1);
            cubeNode1.Components.Add(cubeMesh1);

            // Assemble the cube node containing the three components Würfel 2
            var cubeNode2 = new SceneNodeContainer();

            cubeNode2.Components = new List <SceneComponentContainer>();
            cubeNode2.Components.Add(_cubeTransform2);
            cubeNode2.Components.Add(cubeMaterial2);
            cubeNode2.Components.Add(cubeMesh2);

            // Assemble the cube node containing the three components Würfel 2
            var cubeNode3 = new SceneNodeContainer();

            cubeNode3.Components = new List <SceneComponentContainer>();
            cubeNode3.Components.Add(_cubeTransform3);
            cubeNode3.Components.Add(cubeMaterial3);
            cubeNode3.Components.Add(cubeMesh3);

            // Create the scene containing the cube as the only object
            _scene          = new SceneContainer();
            _scene.Children = new List <SceneNodeContainer>();
            _scene.Children.Add(cubeNode1);
            _scene.Children.Add(cubeNode2);
            _scene.Children.Add(cubeNode3);

            // Create a scene renderer holding the scene above
            _sceneRenderer = new SceneRenderer(_scene);
        }
Exemple #18
0
        // Init is called on startup.
        public override void Init()
        {
            // Set the clear color for the backbuffer to custom color (100% intentsity in all color channels R, G, B, A).
            RC.ClearColor = new float4(0.58f, 0, 0.7f, 1);

            // Create a scene with 3 cubes
            // The three components: one XForm, one Shader and the Mesh

            //Würfel Nr.1
            _cube1Transform = new TransformComponent {
                Scale = new float3(1, 1, 1), Translation = new float3(0, 0, 0)
            };                                                                                                         //Translation = Position im Raum
            var cube1Shader = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(new float3(0.3f, 0.88f, 1), new float3(1, 1, 1), 4)
            };
            var cube1Mesh = SimpleMeshes.CreateCuboid(new float3(10, 10, 10));

            //Würfel Nr.2
            _cube2Transform = new TransformComponent {
                Scale = new float3(1, 1, 1), Translation = new float3(20, 0, 0)
            };
            var cube2Shader = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(new float3(1, 0, 0.67f), new float3(1, 1, 1), 4)
            };
            var cube2Mesh = SimpleMeshes.CreateCuboid(new float3(12, 12, 12));

            //Würfel Nr.3
            _cube3Transform = new TransformComponent {
                Scale = new float3(1, 1, 1), Translation = new float3(-20, 5, 0)
            };
            cube3Shader = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(new float3(0.8f, 0, 0.13f), new float3(1, 1, 1), 4)
            };
            var cube3Mesh = SimpleMeshes.CreateCuboid(new float3(10, 10, 10));

            // Assemble the cube node containing the three components
            var cube1Node = new SceneNodeContainer();

            cube1Node.Components = new List <SceneComponentContainer>();
            cube1Node.Components.Add(_cube1Transform);
            cube1Node.Components.Add(cube1Shader);
            cube1Node.Components.Add(cube1Mesh);

            var cube2Node = new SceneNodeContainer();

            cube2Node.Components = new List <SceneComponentContainer>();
            cube2Node.Components.Add(_cube2Transform);
            cube2Node.Components.Add(cube2Shader);
            cube2Node.Components.Add(cube2Mesh);

            var cube3Node = new SceneNodeContainer();

            cube3Node.Components = new List <SceneComponentContainer>();
            cube3Node.Components.Add(_cube3Transform);
            cube3Node.Components.Add(cube3Shader);
            cube3Node.Components.Add(cube3Mesh);

            // Create the scene containing the cube as the only object
            _scene          = new SceneContainer();
            _scene.Children = new List <SceneNodeContainer>();
            _scene.Children.Add(cube1Node);
            _scene.Children.Add(cube2Node);
            _scene.Children.Add(cube3Node);

            // Create a scene renderer holding the scene above
            _sceneRenderer = new SceneRenderer(_scene);
        }
Exemple #19
0
        SceneContainer CreateScene()
        {
            // Initialize transform components that need to be changed inside "RenderAFrame"
            _baseTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 0, 0)
            };

            // Initialisierung des Body Element
            _bodyTransform = new TransformComponent
            {
                Rotation    = new float3(0, 2.2f, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 6, 0)
            };

            // Initialisierung des Grünen Armes
            _upperArmTransform = new TransformComponent
            {
                Rotation    = new float3(1.5f, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(2, 4, 0)
            };
            // Initialisierung des Blauen Armes
            _unterArmTransform = new TransformComponent
            {
                Rotation    = new float3(0.4f, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(-2, 8, 0)
            };

            // Initalisierung des 1 Greifers
            _greifer01 = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(-1, 6, 0)
            };

            // Initalisierung des 1 Greifers
            _greifer02 = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(1, 6, 0)
            };

            // Setup the scene graph
            return(new SceneContainer
            {
                Children = new List <SceneNodeContainer>
                {
                    // Graue Base
                    new SceneNodeContainer
                    {
                        Components = new List <SceneComponentContainer>
                        {
                            // TRANSFROM COMPONENT
                            _baseTransform,

                            // MATERIAL COMPONENT
                            new MaterialComponent
                            {
                                Diffuse = new MatChannelContainer {
                                    Color = new float3(0.7f, 0.7f, 0.7f)
                                },
                                Specular = new SpecularChannelContainer {
                                    Color = new float3(1, 1, 1), Shininess = 5
                                }
                            },

                            // MESH COMPONENT
                            SimpleMeshes.CreateCuboid(new float3(10, 2, 10))
                        }
                    },
                    // Red Body
                    new SceneNodeContainer
                    {
                        Components = new List <SceneComponentContainer>
                        {
                            _bodyTransform,
                            new MaterialComponent
                            {
                                Diffuse = new MatChannelContainer {
                                    Color = new float3(1, 0, 0)
                                },
                                Specular = new SpecularChannelContainer {
                                    Color = new float3(1, 1, 1), Shininess = 5
                                }
                            },
                            SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                        },
                        Children = new List <SceneNodeContainer>
                        {
                            // Grüner Upper Arm
                            new SceneNodeContainer
                            {
                                Components = new List <SceneComponentContainer>
                                {
                                    _upperArmTransform,
                                },
                                Children = new List <SceneNodeContainer>
                                {
                                    new SceneNodeContainer
                                    {
                                        Components = new List <SceneComponentContainer>
                                        {
                                            new TransformComponent
                                            {
                                                Rotation = new float3(0, 0, 0),
                                                Scale = new float3(1, 1, 1),
                                                Translation = new float3(0, 4, 0)
                                            },
                                            new MaterialComponent
                                            {
                                                Diffuse = new MatChannelContainer {
                                                    Color = new float3(0, 1, 0)
                                                },
                                                Specular = new SpecularChannelContainer {
                                                    Color = new float3(1, 1, 1), Shininess = 5
                                                }
                                            },
                                            SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                        }
                                    },
                                    // Blauer Unterarm
                                    new SceneNodeContainer
                                    {
                                        Components = new List <SceneComponentContainer>
                                        {
                                            _unterArmTransform
                                        },
                                        Children = new List <SceneNodeContainer>
                                        {
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    new TransformComponent
                                                    {
                                                        Rotation = new float3(0, 0, 0),
                                                        Scale = new float3(1, 1, 1),
                                                        Translation = new float3(0, 4, 0)
                                                    },
                                                    new MaterialComponent
                                                    {
                                                        Diffuse = new MatChannelContainer {
                                                            Color = new float3(0, 0, 1)
                                                        },
                                                        Specular = new SpecularChannelContainer {
                                                            Color = new float3(1, 1, 1), Shininess = 5
                                                        }
                                                    },
                                                    SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                                }
                                            },
                                            //Greifer01
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    _greifer01
                                                },
                                                Children = new List <SceneNodeContainer>
                                                {
                                                    new SceneNodeContainer
                                                    {
                                                        Components = new List <SceneComponentContainer>
                                                        {
                                                            new TransformComponent
                                                            {
                                                                Rotation = new float3(0, 0, 0),
                                                                Scale = new float3(1, 1, 1),
                                                                Translation = new float3(0, 4, 0)
                                                            },
                                                            new MaterialComponent
                                                            {
                                                                Diffuse = new MatChannelContainer {
                                                                    Color = new float3(0, 0, 0)
                                                                },
                                                                Specular = new SpecularChannelContainer {
                                                                    Color = new float3(1, 1, 1), Shininess = 5
                                                                }
                                                            },
                                                            SimpleMeshes.CreateCuboid(new float3(1, 2, 1))
                                                        }
                                                    },
                                                }
                                            },
                                            //Greifer 02
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    _greifer02
                                                },
                                                Children = new List <SceneNodeContainer>
                                                {
                                                    new SceneNodeContainer
                                                    {
                                                        Components = new List <SceneComponentContainer>
                                                        {
                                                            new TransformComponent
                                                            {
                                                                Rotation = new float3(0, 0, 0),
                                                                Scale = new float3(1, 1, 1),
                                                                Translation = new float3(0, 4, 0)
                                                            },
                                                            new MaterialComponent
                                                            {
                                                                Diffuse = new MatChannelContainer {
                                                                    Color = new float3(0, 0, 0)
                                                                },
                                                                Specular = new SpecularChannelContainer {
                                                                    Color = new float3(1, 1, 1), Shininess = 5
                                                                }
                                                            },
                                                            SimpleMeshes.CreateCuboid(new float3(1, 2, 1))
                                                        }
                                                    },
                                                }
                                            },
                                        }
                                    },
                                }
                            }
                        }
                    }
                }
            });
        }
        SceneContainer CreateScene()
        {
            // Initialize Transform Components that need to be changed inside "RenderAFrame"
            _baseTransform = new TransformComponent
            {
                Rotation    = new float3(0, M.Pi / 2, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 0, 0)
            };
            _bodyTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 6, 0)
            };
            _upperArmJointTransform = new TransformComponent
            {
                Rotation    = new float3(M.Pi / 4, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(2, 4, 0)
            };
            _upperArmTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 4, 0)
            };
            _foreArmJointTransform = new TransformComponent
            {
                Rotation    = new float3(M.Pi / 4, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(-2, 4, 0)
            };
            _foreArmTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 4, 0)
            };
            _prehensileRailTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 5.5f, 0)
            };
            _prehensileClawLeftTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(-2.5f, 3, 0)
            };
            _prehensileClawRightTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(2.5f, 3, 0)
            };

            // Shader Effect Components
            var baseShader = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(new float3(0.7f, 0.7f, 0.7f), new float3(0.7f, 0.7f, 0.7f), 5)
            };
            var bodyShader = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(new float3(0.8f, 0.2f, 0.2f), new float3(0.7f, 0.7f, 0.7f), 5)
            };
            var upperArmShader = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(new float3(0.2f, 0.8f, 0.2f), new float3(0.7f, 0.7f, 0.7f), 5)
            };
            var foreArmShader = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(new float3(0.2f, 0.2f, 0.8f), new float3(0.7f, 0.7f, 0.7f), 5)
            };
            var prehensileRailShader = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(new float3(0.8f, 0.8f, 0.8f), new float3(0.7f, 0.7f, 0.7f), 5)
            };
            var prehensileClawShader = new ShaderEffectComponent
            {
                Effect = SimpleMeshes.MakeShaderEffect(new float3(0.6f, 0.6f, 0.6f), new float3(0.7f, 0.7f, 0.7f), 5)
            };

            // Mesh components
            var baseMesh = SimpleMeshes.CreateCuboid(new float3(10, 2, 10));
            var armMesh  = SimpleMeshes.CreateCuboid(new float3(2, 10, 2));
            var railMesh = SimpleMeshes.CreateCuboid(new float3(6, 1, 2));
            var clawMesh = SimpleMeshes.CreateCuboid(new float3(1, 5, 2));

            // Setup the scene graph
            return(new SceneContainer
            {
                Children = new List <SceneNodeContainer>
                {
                    new SceneNodeContainer
                    {
                        Components = new List <SceneComponentContainer>
                        {
                            _baseTransform,
                            baseShader,
                            baseMesh
                        },
                        Children = new List <SceneNodeContainer>
                        {
                            new SceneNodeContainer
                            {
                                Components = new List <SceneComponentContainer>
                                {
                                    _bodyTransform,
                                    bodyShader,
                                    armMesh
                                },
                                Children = new List <SceneNodeContainer>
                                {
                                    new SceneNodeContainer
                                    {
                                        Components = new List <SceneComponentContainer>
                                        {
                                            _upperArmJointTransform
                                        },
                                        Children = new List <SceneNodeContainer>
                                        {
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    _upperArmTransform,
                                                    upperArmShader,
                                                    armMesh
                                                },
                                                Children = new List <SceneNodeContainer>
                                                {
                                                    new SceneNodeContainer
                                                    {
                                                        Components = new List <SceneComponentContainer>
                                                        {
                                                            _foreArmJointTransform
                                                        },
                                                        Children = new List <SceneNodeContainer>
                                                        {
                                                            new SceneNodeContainer
                                                            {
                                                                Components = new List <SceneComponentContainer>
                                                                {
                                                                    _foreArmTransform,
                                                                    foreArmShader,
                                                                    armMesh
                                                                },
                                                                Children = new List <SceneNodeContainer>
                                                                {
                                                                    new SceneNodeContainer
                                                                    {
                                                                        Components = new List <SceneComponentContainer>
                                                                        {
                                                                            _prehensileRailTransform,
                                                                            prehensileRailShader,
                                                                            railMesh
                                                                        },
                                                                        Children = new List <SceneNodeContainer>
                                                                        {
                                                                            new SceneNodeContainer
                                                                            {
                                                                                Components = new List <SceneComponentContainer>
                                                                                {
                                                                                    _prehensileClawLeftTransform,
                                                                                    prehensileClawShader,
                                                                                    clawMesh
                                                                                }
                                                                            },
                                                                            new SceneNodeContainer
                                                                            {
                                                                                Components = new List <SceneComponentContainer>
                                                                                {
                                                                                    _prehensileClawRightTransform,
                                                                                    prehensileClawShader,
                                                                                    clawMesh
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            });
        }
Exemple #21
0
        SceneContainer CreateScene()
        {
            // Initialize transform components that need to be changed inside "RenderAFrame"
            _baseTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 0, 0)
            };

            _bodyTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0.9f, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 6, 0)    //hier wird die Position festgelegt, um 6 in Y-Richtung transaliert, da man die Position des Pivot Point festlegt, und der Arm 10 lang ist
            };

            _upperArmTransform = new TransformComponent
            {
                Rotation    = new float3(1.2f, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(2, 4, 0)
            };

            _lowerArmTransform = new TransformComponent
            {
                Rotation    = new float3(-1.5f, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(-2, 8, 0)
            };

            _grabMiddleTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 5.25f, 0)
            };

            _grabLeftTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(-0.75f, 6.0f, 0)
            };

            _grabRightTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0.75f, 6.0f, 0)
            };


            // Setup the scene graph
            return(new SceneContainer
            {
                Children = new List <SceneNodeContainer>
                {   // Grundplatte
                    new SceneNodeContainer
                    {
                        Components = new List <SceneComponentContainer>
                        {
                            // TRANSFROM COMPONENT
                            _baseTransform,

                            // Shader Effect
                            new ShaderEffectComponent
                            {
                                Effect = SimpleMeshes.MakeShaderEffect(new float3(0.7f, 0.7f, 0.7f), new float3(1, 1, 1), 5)
                            },

                            // MESH COMPONENT
                            SimpleMeshes.CreateCuboid(new float3(10, 2, 10))
                        }
                    },
                    //roter Arm
                    new SceneNodeContainer
                    {
                        Components = new List <SceneComponentContainer>
                        {
                            _bodyTransform,
                            new ShaderEffectComponent
                            {
                                Effect = SimpleMeshes.MakeShaderEffect(new float3(1, 0, 0), new float3(1, 1, 1), 5)
                            },
                            SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                        },
                        Children = new List <SceneNodeContainer>
                        {
                            //grüner Arm
                            new SceneNodeContainer
                            {
                                Components = new List <SceneComponentContainer>
                                {
                                    _upperArmTransform,
                                },
                                Children = new List <SceneNodeContainer>
                                {
                                    new SceneNodeContainer
                                    {
                                        Components = new List <SceneComponentContainer>
                                        {
                                            new TransformComponent
                                            {
                                                Rotation = new float3(0, 0, 0),
                                                Scale = new float3(1, 1, 1),
                                                Translation = new float3(0, 4, 0)
                                            },
                                            new ShaderEffectComponent
                                            {
                                                Effect = SimpleMeshes.MakeShaderEffect(new float3(0, 1, 0), new float3(1, 1, 1), 5)
                                            },
                                            SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                        }
                                    },
                                    //blauer Arm
                                    new SceneNodeContainer
                                    {
                                        Components = new List <SceneComponentContainer>
                                        {
                                            _lowerArmTransform,
                                        },
                                        Children = new List <SceneNodeContainer>
                                        {
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    new TransformComponent
                                                    {
                                                        Rotation = new float3(0, 0, 0),
                                                        Scale = new float3(1, 1, 1),
                                                        Translation = new float3(0, 4, 0)
                                                    },
                                                    new ShaderEffectComponent
                                                    {
                                                        Effect = SimpleMeshes.MakeShaderEffect(new float3(0, 0, 1), new float3(1, 1, 1), 5)
                                                    },
                                                    SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                                }
                                            },
                                            //middleGrap
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    _grabMiddleTransform,
                                                },
                                                Children = new List <SceneNodeContainer>
                                                {
                                                    new SceneNodeContainer
                                                    {
                                                        Components = new List <SceneComponentContainer>
                                                        {
                                                            new TransformComponent
                                                            {
                                                                Rotation = new float3(0, 0, 0),
                                                                Scale = new float3(1, 1, 1),
                                                                Translation = new float3(0, 4, 0)
                                                            },
                                                            new ShaderEffectComponent
                                                            {
                                                                Effect = SimpleMeshes.MakeShaderEffect(ColorUint.Tofloat3(ColorUint.Silver), new float3(1, 1, 1), 5)
                                                            },
                                                            SimpleMeshes.CreateCuboid(new float3(1, 0.5f, 0.5f))
                                                        }
                                                    }
                                                }
                                            },
                                            //leftGrap
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    _grabLeftTransform,
                                                },
                                                Children = new List <SceneNodeContainer>
                                                {
                                                    new SceneNodeContainer
                                                    {
                                                        Components = new List <SceneComponentContainer>
                                                        {
                                                            new TransformComponent
                                                            {
                                                                Rotation = new float3(0, 0, 0),
                                                                Scale = new float3(1, 1, 1),
                                                                Translation = new float3(0, 4, 0)
                                                            },
                                                            new ShaderEffectComponent
                                                            {
                                                                Effect = SimpleMeshes.MakeShaderEffect(ColorUint.Tofloat3(ColorUint.Silver), new float3(1, 1, 1), 5)
                                                            },
                                                            SimpleMeshes.CreateCuboid(new float3(0.5f, 2, 0.5f))
                                                        }
                                                    }
                                                }
                                            },
                                            //RightGrap
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    _grabRightTransform,
                                                },
                                                Children = new List <SceneNodeContainer>
                                                {
                                                    new SceneNodeContainer
                                                    {
                                                        Components = new List <SceneComponentContainer>
                                                        {
                                                            new TransformComponent
                                                            {
                                                                Rotation = new float3(0, 0, 0),
                                                                Scale = new float3(1, 1, 1),
                                                                Translation = new float3(0, 4, 0)
                                                            },
                                                            new ShaderEffectComponent
                                                            {
                                                                Effect = SimpleMeshes.MakeShaderEffect(ColorUint.Tofloat3(ColorUint.Silver), new float3(1, 1, 1), 5)
                                                            },
                                                            SimpleMeshes.CreateCuboid(new float3(0.5f, 2, 0.5f))
                                                        }
                                                    }
                                                }
                                            },
                                        }
                                    },
                                }
                            },//grünerARm
                        } //Children roterArm
                    }
                }
            }); //SceneContainer
        } //SceneNodeContainer
Exemple #22
0
        SceneContainer CreateScene()
        {
            // Initialize transform components that need to be changed inside "RenderAFrame"
            _baseTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 0, 0)
            };
            _bodyTransform = new TransformComponent
            {
                Rotation    = new float3(0, 1.2f, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 6, 0)
            };
            _upperArmTransform = new TransformComponent
            {
                Rotation    = new float3(0.8f, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(2, 4, 0)
            };
            _foreArmTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(-2, 8, 0)
            };
            _clawBaseTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 5.5f, 0)
            };
            _claw1Transform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(-3, 5.5f, 0)
            };
            _claw2Transform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(3, 5.5f, 0)
            };

            // Setup the scene graph
            return(new SceneContainer
            {
                Children = new List <SceneNodeContainer>
                {
                    // GREY BASE
                    new SceneNodeContainer
                    {
                        Components = new List <SceneComponentContainer>
                        {
                            // TRANSFROM COMPONENT
                            _baseTransform,

                            // MATERIAL COMPONENT
                            new MaterialComponent
                            {
                                Diffuse = new MatChannelContainer {
                                    Color = new float3(0.7f, 0.7f, 0.7f)
                                },
                                Specular = new SpecularChannelContainer {
                                    Color = new float3(1, 1, 1), Shininess = 5
                                }
                            },

                            // MESH COMPONENT
                            SimpleMeshes.CreateCuboid(new float3(10, 2, 10))
                        }
                    },
                    // RED BODY
                    new SceneNodeContainer
                    {
                        Components = new List <SceneComponentContainer>
                        {
                            _bodyTransform,
                            new MaterialComponent
                            {
                                Diffuse = new MatChannelContainer {
                                    Color = new float3(1, 0, 0)
                                },
                                Specular = new SpecularChannelContainer {
                                    Color = new float3(1, 1, 1), Shininess = 5
                                }
                            },
                            SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                        },
                        Children = new List <SceneNodeContainer>
                        {
                            // GREEN UPPER ARM
                            new SceneNodeContainer
                            {
                                Components = new List <SceneComponentContainer>
                                {
                                    _upperArmTransform,
                                },
                                Children = new List <SceneNodeContainer>
                                {
                                    new SceneNodeContainer
                                    {
                                        Components = new List <SceneComponentContainer>
                                        {
                                            new TransformComponent
                                            {
                                                Rotation = new float3(0, 0, 0),
                                                Scale = new float3(1, 1, .5f),
                                                Translation = new float3(0, 4, 0)
                                            },
                                            new MaterialComponent
                                            {
                                                Diffuse = new MatChannelContainer {
                                                    Color = new float3(0, 1, 0)
                                                },
                                                Specular = new SpecularChannelContainer {
                                                    Color = new float3(1, 1, 1), Shininess = 5
                                                }
                                            },
                                            SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                        }
                                    },
                                    // BLUE FOREARM
                                    new SceneNodeContainer
                                    {
                                        Components = new List <SceneComponentContainer>
                                        {
                                            _foreArmTransform,
                                        },
                                        Children = new List <SceneNodeContainer>
                                        {
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    new TransformComponent
                                                    {
                                                        Rotation = new float3(0, 0, 0),
                                                        Scale = new float3(1, 1, .5f),
                                                        Translation = new float3(0, 4, 0)
                                                    },
                                                    new MaterialComponent
                                                    {
                                                        Diffuse = new MatChannelContainer {
                                                            Color = new float3(0, 0, 1)
                                                        },
                                                        Specular = new SpecularChannelContainer {
                                                            Color = new float3(1, 1, 1), Shininess = 5
                                                        }
                                                    },
                                                    SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                                }
                                            },
                                            //Claw base
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    _clawBaseTransform,
                                                },
                                                Children = new List <SceneNodeContainer>
                                                {
                                                    new SceneNodeContainer
                                                    {
                                                        Components = new List <SceneComponentContainer>
                                                        {
                                                            new TransformComponent
                                                            {
                                                                Rotation = new float3(0, 0, 0),
                                                                Scale = new float3(7, .1f, .5f),
                                                                Translation = new float3(0, 4, 0)
                                                            },
                                                            new MaterialComponent
                                                            {
                                                                Diffuse = new MatChannelContainer {
                                                                    Color = new float3(0, 1, 1)
                                                                },
                                                                Specular = new SpecularChannelContainer {
                                                                    Color = new float3(1, 1, 1), Shininess = 5
                                                                }
                                                            },
                                                            SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                                        }
                                                    },
                                                    //Claw 2
                                                    new SceneNodeContainer
                                                    {
                                                        Components = new List <SceneComponentContainer>
                                                        {
                                                            _claw2Transform,
                                                        },
                                                        Children = new List <SceneNodeContainer>
                                                        {
                                                            new SceneNodeContainer
                                                            {
                                                                Components = new List <SceneComponentContainer>
                                                                {
                                                                    new TransformComponent
                                                                    {
                                                                        Rotation = new float3(0, 0, 0),
                                                                        Scale = new float3(.5f, 1, .5f),
                                                                        Translation = new float3(3.5f, 9.5f, 0)
                                                                    },
                                                                    new MaterialComponent
                                                                    {
                                                                        Diffuse = new MatChannelContainer {
                                                                            Color = new float3(1, 0, 1)
                                                                        },
                                                                        Specular = new SpecularChannelContainer {
                                                                            Color = new float3(1, 1, 1), Shininess = 5
                                                                        }
                                                                    },
                                                                    SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                                                }
                                                            }
                                                        }
                                                    },
                                                    //Claw 1
                                                    new SceneNodeContainer
                                                    {
                                                        Components = new List <SceneComponentContainer>
                                                        {
                                                            _claw1Transform,
                                                        },
                                                        Children = new List <SceneNodeContainer>
                                                        {
                                                            new SceneNodeContainer
                                                            {
                                                                Components = new List <SceneComponentContainer>
                                                                {
                                                                    new TransformComponent
                                                                    {
                                                                        Rotation = new float3(0, 0, 0),
                                                                        Scale = new float3(.5f, 1, .5f),
                                                                        Translation = new float3(-3.5f, 9.5f, 0)
                                                                    },
                                                                    new MaterialComponent
                                                                    {
                                                                        Diffuse = new MatChannelContainer {
                                                                            Color = new float3(1, 0, 1)
                                                                        },
                                                                        Specular = new SpecularChannelContainer {
                                                                            Color = new float3(1, 1, 1), Shininess = 5
                                                                        }
                                                                    },
                                                                    SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                                                }
                                                            },
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            },
                        }
                    }
                }
            });
        }
Exemple #23
0
        // Init is called on startup.
        public override void Init()
        {
            // Set the clear color for the backbuffer to light green (intensities in R, G, B, A).
            // Hintergrund
            RC.ClearColor = new float4(1.0f, 1.0f, 0, 1.0f);

            // Create a scene with a cube
            // The three components: one XForm, one Material and the Mesh
            _cubeTransform = new TransformComponent {
                Scale = new float3(1, 1, 1), Translation = new float3(0, 0, 0)
            };
            var cubeMaterial = new MaterialComponent
                               //Farbe vom Würfel
            {
                Diffuse = new MatChannelContainer {
                    Color = new float3(66, 244, 149)
                },                                                                //grün
                Specular = new SpecularChannelContainer {
                    Color = float3.One, Shininess = 4
                }
            };
            var cubeMesh = SimpleMeshes.CreateCuboid(new float3(10, 10, 10));

            //Würfel1
            _cubeTransform1 = new TransformComponent {
                Scale = new float3(1, 1, 1), Translation = new float3(0, 0, 20)
            };
            var cubeMaterial1 = new MaterialComponent
            {
                Diffuse = new MatChannelContainer {
                    Color = new float3(244, 65, 83)
                },                                                               //rot
                Specular = new SpecularChannelContainer {
                    Color = float3.One, Shininess = 4
                }
            };
            var cubeMesh1 = SimpleMeshes.CreateCuboid(new float3(6, 6, 6));

            //Würfel2
            _cubeTransform2 = new TransformComponent {
                Scale = new float3(8, 8, 3), Translation = new float3(20, 0, 0)
            };
            var cubeMaterial2 = new MaterialComponent
            {
                Diffuse = new MatChannelContainer {
                    Color = new float3(244, 65, 83)
                },
                Specular = new SpecularChannelContainer {
                    Color = float3.One, Shininess = 4
                }
            };
            var cubeMesh2 = SimpleMeshes.CreateCuboid(new float3(2, 2, 2));


            // Assemble the cube node containing the three components
            var cubeNode = new SceneNodeContainer();

            cubeNode.Components = new List <SceneComponentContainer>();
            cubeNode.Components.Add(_cubeTransform);
            cubeNode.Components.Add(cubeMaterial);
            cubeNode.Components.Add(cubeMesh);

            var cubeNode1 = new SceneNodeContainer();

            cubeNode1.Components = new List <SceneComponentContainer>();
            cubeNode1.Components.Add(_cubeTransform1);
            cubeNode1.Components.Add(cubeMaterial1);
            cubeNode1.Components.Add(cubeMesh1);

            var cubeNode2 = new SceneNodeContainer();

            cubeNode2.Components = new List <SceneComponentContainer>();
            cubeNode2.Components.Add(_cubeTransform2);
            cubeNode2.Components.Add(cubeMaterial2);
            cubeNode2.Components.Add(cubeMesh2);

            // Create the scene containing the cube as the only object
            _scene          = new SceneContainer();
            _scene.Children = new List <SceneNodeContainer>();
            _scene.Children.Add(cubeNode);
            _scene.Children.Add(cubeNode1);
            _scene.Children.Add(cubeNode2);

            // Create a scene renderer holding the scene above
            _sceneRenderer = new SceneRenderer(_scene);
        }
Exemple #24
0
 SceneContainer CreateScene()
 {
     // Initialize transform components that need to be changed inside "RenderAFrame"
     _baseTransform = new TransformComponent {
         Rotation    = new float3(0, 0, 0),
         Scale       = new float3(1, 1, 1),
         Translation = new float3(0, 0, 0)
     };
     _bodyTransform = new TransformComponent {
         Rotation    = new float3(0, 0, 0),
         Scale       = new float3(1, 1, 1),
         Translation = new float3(0, 6, 0)
     };
     _upperArmTransform = new TransformComponent {
         Rotation    = new float3(0.8f, 0, 0),
         Scale       = new float3(1, 1, 1),
         Translation = new float3(2, 4, 0)
     };
     _foreArmTransform = new TransformComponent {
         Rotation    = new float3(0.8f, 0, 0),
         Scale       = new float3(1, 1, 1),
         Translation = new float3(-2, 8, 0)
     };
     _finger1 = new TransformComponent {
         Rotation    = new float3(0.2f, 0, 0),
         Scale       = new float3(0.4f, 0.4f, 0.4f),
         Translation = new float3(0, 8.4f, 0.7f)
     };
     _finger2 = new TransformComponent {
         Rotation    = new float3(-0.4f, 0, 0),
         Scale       = new float3(0.4f, 0.4f, 0.4f),
         Translation = new float3(0, 8.4f, -0.7f)
     };
     _finger3 = new TransformComponent {
         Rotation    = new float3(0, 0, -0.2f),
         Scale       = new float3(0.4f, 0.4f, 0.4f),
         Translation = new float3(1, 8.4f, 0)
     };
     // Setup the scene graph
     return(new SceneContainer {
         //Initialising a list for the children to append
         Children = new List <SceneNodeContainer> {
             // GREY BASE
             new SceneNodeContainer {
                 //Initialising a list for the components to append
                 Components = new List <SceneComponentContainer> {
                     // TRANSFROM COMPONENT
                     _baseTransform,
                     // MATERIAL COMPONENT
                     new MaterialComponent {
                         Diffuse = new MatChannelContainer {
                             Color = new float3(0.7f, 0.7f, 0.7f)
                         },
                         Specular = new SpecularChannelContainer {
                             Color = new float3(1, 1, 1), Shininess = 5
                         }
                     },
                     // MESH COMPONENT
                     SimpleMeshes.CreateCuboid(new float3(10, 2, 10))
                 }
             },
             // RED BODY
             new SceneNodeContainer {
                 Components = new List <SceneComponentContainer> {
                     _bodyTransform,
                     new MaterialComponent {
                         Diffuse = new MatChannelContainer {
                             Color = new float3(1, 0, 0)
                         },
                         Specular = new SpecularChannelContainer {
                             Color = new float3(1, 1, 1), Shininess = 5
                         }
                     },
                     SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                 },
                 Children = new List <SceneNodeContainer> {
                     // GREEN UPPER ARM
                     new SceneNodeContainer {
                         Components = new List <SceneComponentContainer> {
                             _upperArmTransform,
                         },
                         Children = new List <SceneNodeContainer> {
                             new SceneNodeContainer {
                                 Components = new List <SceneComponentContainer> {
                                     new TransformComponent
                                     {
                                         Rotation = new float3(0, 0, 0),
                                         Scale = new float3(1, 1, 1),
                                         Translation = new float3(0, 4, 0)
                                     },
                                     new MaterialComponent
                                     {
                                         Diffuse = new MatChannelContainer {
                                             Color = new float3(0, 1, 0)
                                         },
                                         Specular = new SpecularChannelContainer {
                                             Color = new float3(1, 1, 1), Shininess = 5
                                         }
                                     },
                                     SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                 }
                             },
                             // BLUE FOREARM
                             new SceneNodeContainer
                             {
                                 Components = new List <SceneComponentContainer>
                                 {
                                     _foreArmTransform,
                                 },
                                 Children = new List <SceneNodeContainer>
                                 {
                                     new SceneNodeContainer
                                     {
                                         Components = new List <SceneComponentContainer>
                                         {
                                             new TransformComponent
                                             {
                                                 Rotation = new float3(0, 0, 0),
                                                 Scale = new float3(1, 1, 1),
                                                 Translation = new float3(0, 4, 0)
                                             },
                                             new MaterialComponent
                                             {
                                                 Diffuse = new MatChannelContainer {
                                                     Color = new float3(0, 0, 1)
                                                 },
                                                 Specular = new SpecularChannelContainer {
                                                     Color = new float3(1, 1, 1), Shininess = 5
                                                 }
                                             },
                                             SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                         }
                                     },
                                     //Finger 1
                                     new SceneNodeContainer
                                     {
                                         Components = new List <SceneComponentContainer>
                                         {
                                             _finger1,
                                         },
                                         Children = new List <SceneNodeContainer>
                                         {
                                             new SceneNodeContainer {
                                                 Components = new List <SceneComponentContainer>
                                                 {
                                                     new TransformComponent {
                                                         Rotation = new float3(0, 0, 0),
                                                         Scale = new float3(1, 1, 1),
                                                         Translation = new float3(0, 4, 0)
                                                     },
                                                     new MaterialComponent
                                                     {
                                                         Diffuse = new MatChannelContainer {
                                                             Color = new float3(0, 0, 1)
                                                         },
                                                         Specular = new SpecularChannelContainer {
                                                             Color = new float3(1, 1, 1), Shininess = 5
                                                         }
                                                     },
                                                     SimpleMeshes.CreateCuboid(new float3(2, 5, 2))
                                                 }
                                             }
                                         }
                                     },
                                     //Finger 2
                                     new SceneNodeContainer
                                     {
                                         Components = new List <SceneComponentContainer>
                                         {
                                             _finger2,
                                         },
                                         Children = new List <SceneNodeContainer>
                                         {
                                             new SceneNodeContainer {
                                                 Components = new List <SceneComponentContainer>
                                                 {
                                                     new TransformComponent {
                                                         Rotation = new float3(0, 0, 0),
                                                         Scale = new float3(1, 1, 1),
                                                         Translation = new float3(0, 4, 0)
                                                     },
                                                     new MaterialComponent {
                                                         Diffuse = new MatChannelContainer {
                                                             Color = new float3(0, 0, 1)
                                                         },
                                                         Specular = new SpecularChannelContainer {
                                                             Color = new float3(1, 1, 1), Shininess = 5
                                                         }
                                                     },
                                                     SimpleMeshes.CreateCuboid(new float3(2, 5, 2))
                                                 }
                                             }
                                         }
                                     },
                                     //Finger 3
                                     new SceneNodeContainer
                                     {
                                         Components = new List <SceneComponentContainer>
                                         {
                                             _finger3,
                                         },
                                         Children = new List <SceneNodeContainer>
                                         {
                                             new SceneNodeContainer {
                                                 Components = new List <SceneComponentContainer>
                                                 {
                                                     new TransformComponent {
                                                         Rotation = new float3(0, 0, 0),
                                                         Scale = new float3(1, 1, 1),
                                                         Translation = new float3(0, 4, 0)
                                                     },
                                                     new MaterialComponent {
                                                         Diffuse = new MatChannelContainer {
                                                             Color = new float3(0, 0, 1)
                                                         },
                                                         Specular = new SpecularChannelContainer {
                                                             Color = new float3(1, 1, 1), Shininess = 5
                                                         }
                                                     },
                                                     SimpleMeshes.CreateCuboid(new float3(2, 5, 2))
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     },
                 }
             }
         }
     });
 }
Exemple #25
0
        // Init is called on startup.
        public override void Init()
        {
            // Set the clear color for the backbuffer to light green (intensities in R, G, B, A).
            RC.ClearColor = new float4(255, 0, 0, 0.7f);

            // Create a scene with a cube
            // The three components: one XForm, one Material and the Mesh
            _cubeTransform = new TransformComponent {
                Scale = new float3(1, 1, 1), Translation = new float3(0, 0, 0)
            };
            //Neu
            _cubeTransform1 = new TransformComponent {
                Scale = new float3(1, 1, 5), Translation = new float3(0, 0, 0)
            };
            //Neu
            _cubeTransform2 = new TransformComponent {
                Scale = new float3(1, 1, 1), Translation = new float3(0, 0, 0)
            };

            var cubeMaterial2 = new MaterialComponent {
                Diffuse = new MatChannelContainer {
                    Color = new float3(0, 0, 1)
                },
                Specular = new SpecularChannelContainer {
                    Color = float3.One, Shininess = 4
                }
            };

            var cubeMesh2 = SimpleMeshes.CreateCuboid(new float3(3, 3, 3));

            var cubeNode2 = new SceneNodeContainer();

            cubeNode2.Components = new List <SceneComponentContainer>();
            cubeNode2.Components.Add(_cubeTransform2);
            cubeNode2.Components.Add(cubeMaterial2);
            cubeNode2.Components.Add(cubeMesh2);

            var cubeMaterial1 = new MaterialComponent {
                //Farbe Würfel1
                Diffuse = new MatChannelContainer {
                    Color = new float3(0, 1, 0)
                },
                Specular = new SpecularChannelContainer {
                    Color = float3.One, Shininess = 4
                }
            };
            //Maße Würfel1
            var cubeMesh1 = SimpleMeshes.CreateCuboid(new float3(3, 3, 3));

            var cubeNode1 = new SceneNodeContainer();

            cubeNode1.Components = new List <SceneComponentContainer>();
            cubeNode1.Components.Add(_cubeTransform1);
            cubeNode1.Components.Add(cubeMaterial1);
            cubeNode1.Components.Add(cubeMesh1);



            var cubeMaterial = new MaterialComponent

            { //Farbe Würfel
                Diffuse = new MatChannelContainer {
                    Color = new float3(139, 0, 139)
                },
                Specular = new SpecularChannelContainer {
                    Color = float3.One, Shininess = 4
                }
            };
            //Maße Würfel
            var cubeMesh = SimpleMeshes.CreateCuboid(new float3(5, 5, 5));

            // Assemble(montieren) the cube node containing the three components
            var cubeNode = new SceneNodeContainer();

            cubeNode.Components = new List <SceneComponentContainer>();
            cubeNode.Components.Add(_cubeTransform);
            cubeNode.Components.Add(cubeMaterial);
            cubeNode.Components.Add(cubeMesh);


            // Create the scene containing the cube as the only object
            _scene          = new SceneContainer();
            _scene.Children = new List <SceneNodeContainer>();
            _scene.Children.Add(cubeNode);
            //neu
            _scene.Children.Add(cubeNode1);

            //neu
            _scene.Children.Add(cubeNode2);

            // Create a scene renderer holding the scene above
            _sceneRenderer = new SceneRenderer(_scene);
        }
Exemple #26
0
        // Scale Variable
        // private float y = 0;


        // Init is called on startup.
        public override void Init()
        {
            // Set the clear color for the backbuffer to white (100% intentsity in all color channels R, G, B, A).
            RC.ClearColor = new float4(1, 1, 1, 1);

            // Neuen Würfel Erstellen
            /*var cubeTransform = new TransformComponent { Scale = new float3(1, 1, 1),/*Würfel zum Rechteck machen */
            /* Translation = new float3(0, 0, 0)}; // Drehung und Posiotion des Würfels*/

            _cubeTransform = new TransformComponent {
                Scale = new float3(1, 1, 1), Translation = new float3(0, 0, 0)
            };
            var cubeMaterial = new MaterialComponent
            {
                Diffuse = new MatChannelContainer {
                    Color = new float3(0.5f, 0.7f, 0)
                },                                                                       //Farbe ändern. aber wie richtig ?!
                Specular = new SpecularChannelContainer {
                    Color = float3.One, Shininess = 4
                }
            };
            var cubeMesh = SimpleMeshes.CreateCuboid(new float3(10, 10, 10)); // Skalierung des Würfels // Würfel zum Rechteck machen

            var cubeNode = new SceneNodeContainer();

            cubeNode.Components = new List <SceneComponentContainer>();
            /*cubeNode.Components.Add(cubeTransform);*/
            cubeNode.Components.Add(_cubeTransform);
            cubeNode.Components.Add(cubeMaterial);
            cubeNode.Components.Add(cubeMesh);

            _scene          = new SceneContainer();
            _scene.Children = new List <SceneNodeContainer>();
            _scene.Children.Add(cubeNode);

            _sceneRenderer = new SceneRenderer(_scene);


            // Würfel 02
            _cubeTransform1 = new TransformComponent {
                Scale = new float3(1, 1, 1), Translation = new float3(0, 0, 0)
            };
            var cubeMaterial1 = new MaterialComponent
            {
                Diffuse = new MatChannelContainer {
                    Color = new float3(0.5f, 1.0f, 0.5f)
                },                                                                          //Farbe ändern. aber wie richtig ?!
                Specular = new SpecularChannelContainer {
                    Color = float3.One, Shininess = 4
                }
            };
            var cubeMesh1 = SimpleMeshes.CreateCuboid(new float3(1, 1, 1)); // Skalierung des Würfels // Würfel zum Rechteck machen

            var cubeNode1 = new SceneNodeContainer();

            cubeNode1.Components = new List <SceneComponentContainer>();
            /*cubeNode.Components.Add(cubeTransform);*/

            cubeNode1.Components.Add(_cubeTransform1);
            cubeNode1.Components.Add(cubeMaterial1);
            cubeNode1.Components.Add(cubeMesh1);

            _scene1          = new SceneContainer();
            _scene1.Children = new List <SceneNodeContainer>();
            _scene1.Children.Add(cubeNode1);

            _sceneRenderer1 = new SceneRenderer(_scene1);

            // Würfel 03
            _cubeTransform2 = new TransformComponent {
                Scale = new float3(1, 1, 1), Translation = new float3(0, 0, 0)
            };
            var cubeMaterial2 = new MaterialComponent
            {
                Diffuse = new MatChannelContainer {
                    Color = new float3(0, 2 * M.Sin(0.2f * TimeSinceStart), 0.5f)
                },                                                                                                   //Farbe ändern. aber wie richtig ?!
                Specular = new SpecularChannelContainer {
                    Color = float3.One, Shininess = 4
                }
            };
            var cubeMesh2 = SimpleMeshes.CreateCuboid(new float3(1, 1, 1)); // Skalierung des Würfels // Würfel zum Rechteck machen

            var cubeNode2 = new SceneNodeContainer();

            cubeNode2.Components = new List <SceneComponentContainer>();
            /*cubeNode.Components.Add(cubeTransform);*/

            cubeNode2.Components.Add(_cubeTransform2);
            cubeNode2.Components.Add(cubeMaterial2);
            cubeNode2.Components.Add(cubeMesh2);

            _scene2          = new SceneContainer();
            _scene2.Children = new List <SceneNodeContainer>();
            _scene2.Children.Add(cubeNode2);

            _sceneRenderer2 = new SceneRenderer(_scene2);
        }
Exemple #27
0
        SceneContainer CreateScene()
        {
            // Initialize transform components that need to be changed inside "RenderAFrame"
            _baseTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 0, 0)
            };

            _bodyTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 6, 0)
            };

            _upperArmTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(2, 4, 0)
            };

            _foreArmTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(-2, 8, 0)
            };

            _handTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(1, 9, 0)
            };

            _hand2Transform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(-1, 9, 0)
            };


            // Setup the scene graph
            return(new SceneContainer
            {
                Children = new List <SceneNodeContainer>
                {
                    // Grey base
                    new SceneNodeContainer
                    {
                        Components = new List <SceneComponentContainer>
                        {
                            // TRANSFROM COMPONENT
                            _baseTransform,

                            // SHADER EFFECT COMPONENT
                            new ShaderEffectComponent
                            {
                                Effect = SimpleMeshes.MakeShaderEffect(new float3(0.7f, 0.7f, 0.7f), new float3(0.7f, 0.7f, 0.7f), 5)
                            },

                            // MESH COMPONENT
                            SimpleMeshes.CreateCuboid(new float3(10, 2, 10))
                        }
                    },
                    // red body
                    new SceneNodeContainer
                    {
                        Components = new List <SceneComponentContainer>
                        {
                            _bodyTransform,
                            new ShaderEffectComponent
                            {
                                Effect = SimpleMeshes.MakeShaderEffect(new float3(1.0f, 0.1f, 0.1f), new float3(0.7f, 0.7f, 0.7f), 5)
                            },
                            SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                        },
                        Children = new List <SceneNodeContainer>
                        {
                            // green upper arm
                            new SceneNodeContainer
                            {
                                Components = new List <SceneComponentContainer>
                                {
                                    _upperArmTransform
                                },
                                Children = new List <SceneNodeContainer>
                                {
                                    new SceneNodeContainer
                                    {
                                        Components = new List <SceneComponentContainer>
                                        {
                                            new TransformComponent
                                            {
                                                Rotation = new float3(0, 0, 0),
                                                Scale = new float3(1, 1, 1),
                                                Translation = new float3(0, 4, 0)
                                            },
                                            new ShaderEffectComponent
                                            {
                                                Effect = SimpleMeshes.MakeShaderEffect(new float3(0.1f, 1.0f, 0.1f), new float3(0.7f, 0.7f, 0.7f), 5)
                                            },
                                            SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                        }
                                    },

                                    // blue arm
                                    new SceneNodeContainer
                                    {
                                        Components = new List <SceneComponentContainer>
                                        {
                                            _foreArmTransform
                                        },
                                        Children = new List <SceneNodeContainer>
                                        {
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    new TransformComponent
                                                    {
                                                        Rotation = new float3(0, 0, 0),
                                                        Scale = new float3(1, 1, 1),
                                                        Translation = new float3(0, 4, 0)
                                                    },
                                                    new ShaderEffectComponent
                                                    {
                                                        Effect = SimpleMeshes.MakeShaderEffect(new float3(0.1f, 0.1f, 1.0f), new float3(0.7f, 0.7f, 0.7f), 5)
                                                    },
                                                    SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                                }
                                            },

                                            // hand
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    _handTransform
                                                },
                                                Children = new List <SceneNodeContainer>
                                                {
                                                    new SceneNodeContainer
                                                    {
                                                        Components = new List <SceneComponentContainer>
                                                        {
                                                            new TransformComponent
                                                            {
                                                                Rotation = new float3(0, 0, 0),
                                                                Scale = new float3(1, 1, 1),
                                                                Translation = new float3(0, 1.5f, 0)
                                                            },
                                                            new ShaderEffectComponent
                                                            {
                                                                Effect = SimpleMeshes.MakeShaderEffect(new float3(1.0f, 1.0f, 1.0f), new float3(0.7f, 0.7f, 0.7f), 5)
                                                            },
                                                            SimpleMeshes.CreateCuboid(new float3(0.5f, 3, 2))
                                                        }
                                                    }
                                                }
                                            },
                                            // hand2
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    _hand2Transform
                                                },
                                                Children = new List <SceneNodeContainer>
                                                {
                                                    new SceneNodeContainer
                                                    {
                                                        Components = new List <SceneComponentContainer>
                                                        {
                                                            new TransformComponent
                                                            {
                                                                Rotation = new float3(0, 0, 0),
                                                                Scale = new float3(1, 1, 1),
                                                                Translation = new float3(0, 1.5f, 0)
                                                            },
                                                            new ShaderEffectComponent
                                                            {
                                                                Effect = SimpleMeshes.MakeShaderEffect(new float3(1.0f, 1.0f, 1.0f), new float3(0.7f, 0.7f, 0.7f), 5)
                                                            },
                                                            SimpleMeshes.CreateCuboid(new float3(0.5f, 3, 2))
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            });
        }
Exemple #28
0
        SceneContainer CreateScene()
        {
            // Initialize transform components that need to be changed inside "RenderAFrame"
            _baseTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 0, 0)
            };


            //roter Arm
            _bodyTransform = new TransformComponent {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 6, 0)
            };


            //grüner Arm
            _upperArmTransform = new TransformComponent {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(2, 4, 0)
            };


            //blauer Arm
            _ArmTransform = new TransformComponent {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(-3, 8, 0)
            };


            //blauer Arm
            _Arm2Transform = new TransformComponent {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(3, 8, 0)
            };



            // Setup the scene graph
            return(new SceneContainer
            {
                Children = new List <SceneNodeContainer>
                {
                    new SceneNodeContainer
                    {
                        Components = new List <SceneComponentContainer>
                        {
                            // TRANSFROM COMPONENT
                            _baseTransform,



                            // MATERIAL COMPONENT
                            new MaterialComponent
                            {
                                Diffuse = new MatChannelContainer {
                                    Color = new float3(0.7f, 0.7f, 0.7f)
                                },
                                Specular = new SpecularChannelContainer {
                                    Color = new float3(1, 1, 1), Shininess = 5
                                }
                            },


                            // MESH COMPONENT
                            SimpleMeshes.CreateCuboid(new float3(10, 2, 10))
                        }
                    },



                    //Red Body
                    new SceneNodeContainer {
                        Components = new List <SceneComponentContainer> {
                            _bodyTransform,
                            new MaterialComponent {
                                Diffuse = new MatChannelContainer {
                                    Color = new float3(1, 0, 0)
                                },
                                Specular = new SpecularChannelContainer {
                                    Color = new float3(1, 1, 1), Shininess = 5
                                }
                            },
                            SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                        },

                        Children = new List <SceneNodeContainer> {
                            // GREEN UPPER ARM
                            new SceneNodeContainer
                            {
                                Components = new List <SceneComponentContainer>
                                {
                                    _upperArmTransform,
                                },
                                Children = new List <SceneNodeContainer>
                                {
                                    new SceneNodeContainer
                                    {
                                        Components = new List <SceneComponentContainer>
                                        {
                                            new TransformComponent
                                            {
                                                Rotation = new float3(0, 0, 0),
                                                Scale = new float3(1, 1, 1),
                                                Translation = new float3(0, 4, 0)
                                            },
                                            new MaterialComponent
                                            {
                                                Diffuse = new MatChannelContainer {
                                                    Color = new float3(0, 1, 0)
                                                },
                                                Specular = new SpecularChannelContainer {
                                                    Color = new float3(1, 1, 1), Shininess = 5
                                                }
                                            },
                                            SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                        }
                                    },


                                    // BLUE FOREARM
                                    new SceneNodeContainer
                                    {
                                        Components = new List <SceneComponentContainer>
                                        {
                                            _ArmTransform,
                                        },
                                        Children = new List <SceneNodeContainer>
                                        {
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    new TransformComponent
                                                    {
                                                        Rotation = new float3(0, 0, 0),
                                                        Scale = new float3(1, 1, 1),
                                                        Translation = new float3(0, 4, 0)
                                                    },
                                                    new MaterialComponent
                                                    {
                                                        Diffuse = new MatChannelContainer {
                                                            Color = new float3(0, 0, 1)
                                                        },
                                                        Specular = new SpecularChannelContainer {
                                                            Color = new float3(1, 1, 1), Shininess = 5
                                                        }
                                                    },
                                                    SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                                }
                                            }
                                        }
                                    },


                                    //arm2
                                    new SceneNodeContainer
                                    {
                                        Components = new List <SceneComponentContainer>
                                        {
                                            _Arm2Transform,
                                        },
                                        Children = new List <SceneNodeContainer>
                                        {
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    new TransformComponent
                                                    {
                                                        Rotation = new float3(0, 0, 0),
                                                        Scale = new float3(1, 1, 1),
                                                        Translation = new float3(0, 4, 0)
                                                    },
                                                    new MaterialComponent
                                                    {
                                                        Diffuse = new MatChannelContainer {
                                                            Color = new float3(0, 0, 1)
                                                        },
                                                        Specular = new SpecularChannelContainer {
                                                            Color = new float3(1, 1, 1), Shininess = 5
                                                        }
                                                    },
                                                    SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                                }
                                            }
                                        }
                                    }
                                }
                            },
                        }
                    }
                }
            });
        }
Exemple #29
0
        SceneContainer CreateScene()
        {
            // Initialize transform components that need to be changed inside "RenderAFrame"
            _baseTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 0, 0)
            };
            _bodyTransform = new TransformComponent
            {
                Rotation    = new float3(0, -45 * M.Pi / 180, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 6, 0)
            };
            _upperArmTransform = new TransformComponent
            {
                Rotation    = new float3(38 * M.Pi / 180, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(2, 4, 0)
            };
            _foreArmTransform = new TransformComponent
            {
                Rotation    = new float3(90 * M.Pi / 180, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(-2, 4, 0)
            };
            _greifLeftTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 45 * M.Pi / 180),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(-1, 5, 0)
            };
            _greifRightTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, -45 * M.Pi / 180),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(1, 5, 0)
            };


            // Setup the scene graph
            return(new SceneContainer
            {
                Children = new List <SceneNodeContainer>
                {
                    new SceneNodeContainer
                    {
                        Components = new List <SceneComponentContainer>
                        {
                            // TRANSFROM COMPONENT
                            _baseTransform,

                            // SHADER EFFECT COMPONENT
                            new ShaderEffectComponent
                            {
                                Effect = SimpleMeshes.MakeShaderEffect(new float3(0.7f, 0.7f, 0.7f), new float3(0.7f, 0.7f, 0.7f), 5)
                            },

                            // MESH COMPONENT
                            SimpleMeshes.CreateCuboid(new float3(10, 2, 10))
                        },

                        Children = new List <SceneNodeContainer>
                        {
                            //roter Arm/ roter Body
                            new SceneNodeContainer
                            {
                                Components = new List <SceneComponentContainer>
                                {
                                    _bodyTransform,

                                    new ShaderEffectComponent
                                    {
                                        Effect = SimpleMeshes.MakeShaderEffect(new float3(0.83f, 0.13f, 0.18f), new float3(0.7f, 0.7f, 0.7f), 5)
                                    },

                                    SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                },

                                Children = new List <SceneNodeContainer>
                                {
                                    //grüner Arm
                                    new SceneNodeContainer
                                    {
                                        Components = new List <SceneComponentContainer>
                                        {
                                            _upperArmTransform //extra Koordinatensystem für Rotation um bestimmten Punkt eingefügt als extra Child
                                        },

                                        Children = new List <SceneNodeContainer>
                                        {
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    new TransformComponent
                                                    {
                                                        Rotation = new float3(0, 0, 0),
                                                        Scale = new float3(1, 1, 1),
                                                        Translation = new float3(0, 4, 0)
                                                    },

                                                    new ShaderEffectComponent
                                                    {
                                                        Effect = SimpleMeshes.MakeShaderEffect(new float3(0.23f, 0.64f, 0.34f), new float3(0.7f, 0.7f, 0.7f), 5)
                                                    },

                                                    SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                                },

                                                Children = new List <SceneNodeContainer>
                                                {
                                                    //blauer Arm
                                                    new SceneNodeContainer
                                                    {
                                                        Components = new List <SceneComponentContainer>
                                                        {
                                                            _foreArmTransform //extra Koordinatensystem für Rotation um bestimmten Punkt eingefügt als extra Child
                                                        },

                                                        Children = new List <SceneNodeContainer>
                                                        {
                                                            new SceneNodeContainer
                                                            {
                                                                Components = new List <SceneComponentContainer>
                                                                {
                                                                    new TransformComponent
                                                                    {
                                                                        Rotation = new float3(0, 0, 0),
                                                                        Scale = new float3(1, 1, 1),
                                                                        Translation = new float3(0, 4, 0)
                                                                    },

                                                                    new ShaderEffectComponent
                                                                    {
                                                                        Effect = SimpleMeshes.MakeShaderEffect(new float3(0.13f, 0.21f, 0.61f), new float3(0.7f, 0.7f, 0.7f), 5)
                                                                    },

                                                                    SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                                                },

                                                                //Greifarme
                                                                Children = new List <SceneNodeContainer>
                                                                {
                                                                    //Linker Arm
                                                                    new SceneNodeContainer
                                                                    {
                                                                        Components = new List <SceneComponentContainer>
                                                                        {
                                                                            _greifLeftTransform
                                                                        },

                                                                        Children = new List <SceneNodeContainer>
                                                                        {
                                                                            new SceneNodeContainer
                                                                            {
                                                                                Components = new List <SceneComponentContainer>
                                                                                {
                                                                                    new TransformComponent
                                                                                    {
                                                                                        Rotation = new float3(0, 0, 0),
                                                                                        Scale = new float3(1, 1, 1),
                                                                                        Translation = new float3(0, 1.25f, 0)
                                                                                    },

                                                                                    new ShaderEffectComponent
                                                                                    {
                                                                                        Effect = SimpleMeshes.MakeShaderEffect(new float3(0, 0.84f, 1.0f), new float3(0.7f, 0.7f, 0.7f), 5)
                                                                                    },

                                                                                    SimpleMeshes.CreateCuboid(new float3(1, 2.5f, 1))
                                                                                }
                                                                            }
                                                                        }
                                                                    },

                                                                    //Rechter Arm
                                                                    new SceneNodeContainer
                                                                    {
                                                                        Components = new List <SceneComponentContainer>
                                                                        {
                                                                            _greifRightTransform
                                                                        },

                                                                        Children = new List <SceneNodeContainer>
                                                                        {
                                                                            new SceneNodeContainer
                                                                            {
                                                                                Components = new List <SceneComponentContainer>
                                                                                {
                                                                                    new TransformComponent
                                                                                    {
                                                                                        Rotation = new float3(0, 0, 0),
                                                                                        Scale = new float3(1, 1, 1),
                                                                                        Translation = new float3(0, 1.25f, 0)
                                                                                    },

                                                                                    new ShaderEffectComponent
                                                                                    {
                                                                                        Effect = SimpleMeshes.MakeShaderEffect(new float3(0, 0.84f, 1.0f), new float3(0.7f, 0.7f, 0.7f), 5)
                                                                                    },

                                                                                    SimpleMeshes.CreateCuboid(new float3(1, 2.5f, 1))
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            });
        }
Exemple #30
0
        SceneContainer CreateScene()
        {
            // Initialize transform components that need to be changed inside "RenderAFrame"
            _baseTransform = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 0, 0)
            };
            _bodyTransform = new TransformComponent
            {
                Rotation    = new float3(0, 1.2f, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 6, 0)
            };
            _upperArmTransform = new TransformComponent
            {
                Rotation    = new float3(-0.8f, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(2, 4, 0)
            };
            _foreArmTransform = new TransformComponent
            {
                Rotation    = new float3(-0.8f, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(-2, 8, 0)
            };
            _greifHandBase = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(0, 5.5f, -0.5f)
            };
            _greifFingerLinks = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(2.5f, -0.5f, 1.0f)
            };
            _greifFingerRechts = new TransformComponent
            {
                Rotation    = new float3(0, 0, 0),
                Scale       = new float3(1, 1, 1),
                Translation = new float3(-2.5f, -0.5f, 1.0f)
            };


            // Setup the scene graph
            return(new SceneContainer
            {
                Children = new List <SceneNodeContainer>
                {
                    // GREY BASE
                    new SceneNodeContainer
                    {
                        Components = new List <SceneComponentContainer>
                        {
                            // TRANSFROM COMPONENT
                            _baseTransform,

                            // MATERIAL COMPONENT
                            new MaterialComponent
                            {
                                Diffuse = new MatChannelContainer {
                                    Color = new float3(0.7f, 0.7f, 0.7f)
                                },
                                Specular = new SpecularChannelContainer {
                                    Color = new float3(1, 1, 1), Shininess = 5
                                }
                            },


                            // MESH COMPONENT
                            SimpleMeshes.CreateCuboid(new float3(10, 2, 10))
                        }
                    },
                    // RED BODY
                    new SceneNodeContainer
                    {
                        Components = new List <SceneComponentContainer>
                        {
                            _bodyTransform,
                            new MaterialComponent
                            {
                                Diffuse = new MatChannelContainer {
                                    Color = new float3(1, 0, 0)
                                },
                                Specular = new SpecularChannelContainer {
                                    Color = new float3(1, 1, 1), Shininess = 5
                                }
                            },
                            new ShaderEffectComponent
                            {
                                Effect = SimpleMeshes.MakeShaderEffect(new float3(1, 0, 0), new float3(1, 0, 0), 5)
                            },
                            SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                        },
                        Children = new List <SceneNodeContainer>
                        {
                            // GREEN UPPER ARM
                            new SceneNodeContainer
                            {
                                Components = new List <SceneComponentContainer>
                                {
                                    _upperArmTransform,
                                },
                                Children = new List <SceneNodeContainer>
                                {
                                    new SceneNodeContainer
                                    {
                                        Components = new List <SceneComponentContainer>
                                        {
                                            new TransformComponent
                                            {
                                                Rotation = new float3(0, 0, 0),
                                                Scale = new float3(1, 1, 1),
                                                Translation = new float3(0, 4, 0)
                                            },
                                            new MaterialComponent
                                            {
                                                Diffuse = new MatChannelContainer {
                                                    Color = new float3(0, 1, 0)
                                                },
                                                Specular = new SpecularChannelContainer {
                                                    Color = new float3(1, 1, 1), Shininess = 5
                                                }
                                            },
                                            new ShaderEffectComponent
                                            {
                                                Effect = SimpleMeshes.MakeShaderEffect(new float3(0, 1, 0), new float3(0, 1, 0), 5)
                                            },
                                            SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                        }
                                    },
                                    // BLUE FOREARM
                                    new SceneNodeContainer
                                    {
                                        Components = new List <SceneComponentContainer>
                                        {
                                            _foreArmTransform,
                                        },
                                        Children = new List <SceneNodeContainer>
                                        {
                                            new SceneNodeContainer
                                            {
                                                Components = new List <SceneComponentContainer>
                                                {
                                                    new TransformComponent
                                                    {
                                                        Rotation = new float3(0, 0, 0),
                                                        Scale = new float3(1, 1, 1),
                                                        Translation = new float3(0, 4, 0)
                                                    },
                                                    new MaterialComponent
                                                    {
                                                        Diffuse = new MatChannelContainer {
                                                            Color = new float3(0, 0, 1)
                                                        },
                                                        Specular = new SpecularChannelContainer {
                                                            Color = new float3(1, 1, 1), Shininess = 5
                                                        }
                                                    },
                                                    new ShaderEffectComponent
                                                    {
                                                        Effect = SimpleMeshes.MakeShaderEffect(new float3(0, 0, 1), new float3(0, 0, 1), 5)
                                                    },
                                                    SimpleMeshes.CreateCuboid(new float3(2, 10, 2))
                                                },
                                                Children = new List <SceneNodeContainer>
                                                {
                                                    //GreifHand
                                                    new SceneNodeContainer
                                                    {
                                                        Components = new List <SceneComponentContainer>
                                                        {
                                                            _greifHandBase
                                                        },
                                                        Children = new List <SceneNodeContainer>
                                                        {
                                                            new SceneNodeContainer
                                                            {
                                                                Components = new List <SceneComponentContainer>
                                                                {
                                                                    new TransformComponent
                                                                    {
                                                                        Rotation = new float3(0, 0, 0),
                                                                        Scale = new float3(1, 1, 1),
                                                                        Translation = new float3(0, 0, 0)
                                                                    },
                                                                    new MaterialComponent
                                                                    {
                                                                        Diffuse = new MatChannelContainer {
                                                                            Color = new float3(0, 0, 1)
                                                                        },
                                                                        Specular = new SpecularChannelContainer {
                                                                            Color = new float3(1, 1, 1), Shininess = 5
                                                                        }
                                                                    },
                                                                    new ShaderEffectComponent
                                                                    {
                                                                        Effect = SimpleMeshes.MakeShaderEffect(new float3(0.5f, 0.5f, 0.5f), new float3(1, 1, 1), 5)
                                                                    },
                                                                    SimpleMeshes.CreateCuboid(new float3(6, 1, 1))
                                                                },
                                                                Children = new List <SceneNodeContainer>
                                                                {
                                                                    new SceneNodeContainer
                                                                    {
                                                                        Components = new List <SceneComponentContainer>
                                                                        {
                                                                            _greifFingerRechts
                                                                        },
                                                                        Children = new List <SceneNodeContainer>
                                                                        {
                                                                            new SceneNodeContainer
                                                                            {
                                                                                Components = new List <SceneComponentContainer>
                                                                                {
                                                                                    new TransformComponent
                                                                                    {
                                                                                        Rotation = new float3(0, 0, 0),
                                                                                        Scale = new float3(1, 1, 1),
                                                                                        Translation = new float3(0, 2, 0)
                                                                                    },
                                                                                    new MaterialComponent
                                                                                    {
                                                                                        Diffuse = new MatChannelContainer {
                                                                                            Color = new float3(0, 0, 1)
                                                                                        },
                                                                                        Specular = new SpecularChannelContainer {
                                                                                            Color = new float3(1, 1, 1), Shininess = 5
                                                                                        }
                                                                                    },
                                                                                    new ShaderEffectComponent
                                                                                    {
                                                                                        Effect = SimpleMeshes.MakeShaderEffect(new float3(0, 0, 0), new float3(1, 1, 1), 5)
                                                                                    },
                                                                                    SimpleMeshes.CreateCuboid(new float3(1, 4.3f, 1))
                                                                                }
                                                                            }
                                                                        }
                                                                    },
                                                                    new SceneNodeContainer
                                                                    {
                                                                        Components = new List <SceneComponentContainer>
                                                                        {
                                                                            _greifFingerLinks
                                                                        },
                                                                        Children = new List <SceneNodeContainer>
                                                                        {
                                                                            new SceneNodeContainer
                                                                            {
                                                                                Components = new List <SceneComponentContainer>
                                                                                {
                                                                                    new TransformComponent
                                                                                    {
                                                                                        Rotation = new float3(0, 0, 0),
                                                                                        Scale = new float3(1, 1, 1),
                                                                                        Translation = new float3(0, 2, 0)
                                                                                    },
                                                                                    new MaterialComponent
                                                                                    {
                                                                                        Diffuse = new MatChannelContainer {
                                                                                            Color = new float3(0, 0, 1)
                                                                                        },
                                                                                        Specular = new SpecularChannelContainer {
                                                                                            Color = new float3(1, 1, 1), Shininess = 5
                                                                                        }
                                                                                    },
                                                                                    new ShaderEffectComponent
                                                                                    {
                                                                                        Effect = SimpleMeshes.MakeShaderEffect(new float3(0, 0, 0), new float3(1, 1, 1), 5)
                                                                                    },
                                                                                    SimpleMeshes.CreateCuboid(new float3(1, 4.3f, 1))
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            });
        }