Esempio n. 1
0
        public (ParticipatingMediaComponent, TransformComponent) Create(int resolutionWidth, int resolutionHeight)
        {
            var entity = this.Entities.Create();
            var cube   = CubeGenerator.Generate(this.Device);

            var participatingMedia = ParticipatingMediaComponent.Create(entity, this.Device, cube, resolutionWidth, resolutionHeight, 1.0f, Color.White);
            var transform          = new TransformComponent(entity);

            this.Components.Add(participatingMedia);
            this.Components.Add(transform);

            return(participatingMedia, transform);
        }
Esempio n. 2
0
 public void NSwitch()
 {
     generator_now.Generate();
     cube_now = generator_now.cube.GetComponent <CubeBehavior>();
     if (cube_now.GetDir() == 0)
     {
         target = null;
     }
     else
     {
         target = generator_now.neighbors[cube_now.GetDir() - 1];
     }
 }
Esempio n. 3
0
        public void Load(ContentStack content)
        {
            var red = new Texture2D(this.Device, 1, 1);

            red.SetData(new Color[] { Color.White });
            content.Link(red);

            var white = new Texture2D(this.Device, 1, 1);

            white.SetData(new Color[] { Color.White });
            content.Link(white);

            var black = new Texture2D(this.Device, 1, 1);

            black.SetData(new Color[] { Color.Black });
            content.Link(black);

            var normal = new Texture2D(this.Device, 1, 1);

            normal.SetData(new Color[] { new Color(0.5f, 0.5f, 1.0f) });
            content.Link(normal);

            var blue  = content.Load <Texture2D>("Textures/Blue");
            var bumps = content.Load <Texture2D>("Textures/Bricks_Normal");

            var rows     = 7;
            var columns  = 7;
            var spacing  = 2.5f;
            var geometry = SphereGenerator.Generate(this.Device, 15);

            for (var row = 0; row < rows; row++)
            {
                var metalicness = row / (float)rows;

                var metalicnessTexture = new Texture2D(this.Device, 1, 1);
                metalicnessTexture.SetData(new Color[] { new Color(Vector3.One * metalicness) });
                content.Link(metalicnessTexture);

                for (var col = 0; col < columns; col++)
                {
                    var roughness        = Math.Clamp(col / (float)columns, 0.05f, 1.0f);
                    var roughnessTexture = new Texture2D(this.Device, 1, 1);
                    roughnessTexture.SetData(new Color[] { new Color(Vector3.One * roughness) });
                    content.Link(roughnessTexture);

                    var material = new Material(red, normal, metalicnessTexture, roughnessTexture, white);

                    var position = new Vector3((col - (columns / 2.0f)) * spacing, (row - (rows / 2.0f)) * spacing, 0.0f);
                    this.CreateSphere(geometry, material, position, Vector3.One);
                }
            }

            var backgroundGeometry = CubeGenerator.Generate(this.Device);

            this.CreateSphere(backgroundGeometry, new Material(bumps, GeneratedAssets.NormalPixel(), black, white, white), Vector3.Forward * 20, new Vector3(200, 200, 1));

            this.CreateLight(new Vector3(-10, 10, 10), Color.Red, 30.0f);
            this.CreateLight(new Vector3(10, 10, 10), Color.Blue, 30.0f);
            this.CreateLight(new Vector3(-10, -10, 10), Color.Green, 30.0f);
            this.CreateLight(new Vector3(10, -10, 10), Color.White, 30.0f);

            this.CreateSpotLight(new Vector3(0, 0, 10), Vector3.Forward, 1500.0f);
        }