Ejemplo n.º 1
0
        public Engine(Matrix3D camera)
        {
            var ambient  = 0.00;
            var diffuse  = 0.95;
            var scale    = 75;
            var distance = 100.0;

            this.camera = camera;


            this.screen = new Screen(width, height);
            this.window = new Window(width, height, scale, distance, camera);

            var randomFactory      = new RandomFactory();
            var hemiSamplerFactory = new HemiSamplerFactory();
            var triangleSampler    = new TriangleSampler(randomFactory);
            var primitives         = new Construction();
            var illumination       = new Illumination(primitives, randomFactory, triangleSampler);

            var seedFactory = new Random();

            this.tracer = new Tracer(primitives, new Emissive(Constant.WHITE, ambient, 1.0), randomFactory, hemiSamplerFactory);

            ExampleUtil.buildCornelBox(primitives, illumination, diffuse, tracer, randomFactory, hemiSamplerFactory);
        }
Ejemplo n.º 2
0
        protected override XDocument SaveToXmlDocument(XElement rootPropsElement, L3dFilePath filePath)
        {
            XElement root = new XElement(FileDescriptions.FILE_WEATHER_EL_ROOT);

            if (!string.IsNullOrWhiteSpace(_header))
            {
                rootPropsElement.SetAttributeValue(FileDescriptions.FILE_WEATHER_AT_PROPS_HEADER, _header);
                root.Add(rootPropsElement);
            }

            root.Add(Illumination.ConvertToXml());

            foreach (var w in WeatherSet)
            {
                foreach (var t in w.AllTextures.Where(el => el != null))
                {
                    t._texture.ParentFile = filePath;
                }
            }

            root.Add(new XElement(FileDescriptions.FILE_WEATHER_EL_WEATHER_SET, WeatherSet.Select(w =>
                                                                                                  w.ConvertToXml(filePath)
                                                                                                  )));

            return(new XDocument(root));
        }
Ejemplo n.º 3
0
        public void UpdateIlluminationProperties(Illumination illumination)
        {
            DeviceContext deviceContext = _directX3DGraphics.DeviceContext;
            //deviceContext.UpdateSubresource<Illumination.IlluminationDescription>(ref illuminationDescription, _illuminationConstantBuffer);
            DataStream dataStream;

            deviceContext.MapSubresource(_illuminationConstantBuffer, MapMode.WriteDiscard, SharpDX.Direct3D11.MapFlags.None, out dataStream);
            dataStream.Write(illumination.IlluminationProperties);
            deviceContext.UnmapSubresource(_illuminationConstantBuffer, 0);
            deviceContext.PixelShader.SetConstantBuffer(1, _illuminationConstantBuffer);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Clones this instance.
        /// </summary>
        /// <returns>
        /// A new object that is a copy of this instance.
        /// </returns>
        public XlsxShapeEffectsOptions Clone()
        {
            var cloned = (XlsxShapeEffectsOptions)MemberwiseClone();

            cloned.Illumination = Illumination.Clone();
            cloned.Reflection   = Reflection.Clone();
            cloned.Shadow       = Shadow.Clone();
            cloned.SoftEdge     = SoftEdge.Clone();

            return(cloned);
        }
Ejemplo n.º 5
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Temperature: ");
            sb.AppendLine(Temperature.ToString());

            sb.Append("Illumination: ");
            sb.AppendLine(Illumination.ToString());

            sb.Append("Distance: ");
            sb.AppendLine(Distance.ToString());

            sb.Append("Presence: ");
            sb.AppendLine(Presence.ToString());

            return(sb.ToString());
        }
Ejemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        if (Card.showSpawnTiles && playerSpawn)
        {
            illumination = Illumination.SPAWN;
        }
        else if (!Card.showSpawnTiles && illumination == Illumination.SPAWN)
        {
            illumination = Illumination.NONE;
        }
        if (highlight || illumination != Illumination.NONE)
        {
            overlay.enabled = true;
        }
        else
        {
            overlay.enabled = false;
        }
        Color overlayColor = Color.white;

        overlayColor.a = 0.5f;
        switch (illumination)
        {
        case Illumination.ATTACK:
            overlayColor = Color.red;
            break;

        case Illumination.MOVEMENT:
            overlayColor = Color.blue;
            break;

        case Illumination.SPAWN:
            overlayColor = Color.cyan;
            break;
        }
        if (highlight)
        {
            overlayColor = Color.green;
        }
        overlayColor.a = overlayOpacity;
        overlay.color  = overlayColor;
    }
 public void InitializeLight()
 {
     illumination = new Illumination(Vector4.Zero, new Vector4(1.0f, 1.0f, 1.0f, 1.0f), new LightSource[]
     {
         new LightSource(LightSource.LightType.DirectionalLight,
                         new Vector4(-40.0f, 10.0f, 0.0f, 1.0f), // Position
                         new Vector4(10.0f, -20.0f, 0.0f, 1.0f), // Direction
                         new Vector4(1.0f, 1.0f, 1.0f, 1.0f),    // Color
                         0.0f,                                   // Spot angle
                         1.0f,                                   // Const atten
                         1.0f,                                   // Linear atten
                         1.0f,                                   // Quadratic atten
                         1),
         new LightSource(LightSource.LightType.SpotLight,
                         new Vector4(0.0f, 1.0f, 0.0f, 1.0f),
                         new Vector4(0.0f, -1.0f, 0.0f, 1.0f),
                         new Vector4(1.0f, 1.0f, 1.0f, 1.0f),
                         PositionalObject.HALF_PI / 4.0f,
                         1.0f,
                         0.05f,
                         0.01f,
                         0),
         new LightSource(LightSource.LightType.PointLight,
                         new Vector4(0.0f, 1.0f, 0.0f, 1.0f),
                         Vector4.Zero,
                         new Vector4(-4.0f, 1.0f, 0.0f, 1.0f),
                         1.0f,
                         1.0f,
                         0.05f,
                         0.005f,
                         0),
         new LightSource(),
         new LightSource(),
         new LightSource(),
         new LightSource(),
         new LightSource()
     });
 }
Ejemplo n.º 8
0
 public override string ToString()
 {
     return($"RGB Color: {RgbValue:X}\n" + $"Brightness: {Illumination.ToString()}\n" +
            $"Protocol version: {ProtoVersion}\n" + $"Current music ID: {MusicId.ToString()}\n" +
            $"Able to join: {JoinPermission}\n");
 }