Exemplo n.º 1
0
        /// <summary>
        /// Uses the given mesh for rendering and calculation.
        /// 
        /// Computes shadow volumes for rendering.
        /// </summary>
        private void SetModel(Mesh mesh)
        {
            // create shadow volumes
            Logger.info("computing shadows...");
            Shadow newShadow = new Shadow(mesh);
            newShadow.Initialize(); // make sure init works before setting shadow
            shadow = newShadow;

            // render them
            ShadowMeshSprite shadowSprite = new ShadowMeshSprite(shadow);
            var center = (mesh.BoundingBox.Max + mesh.BoundingBox.Min) / 2;
            shadowSprite.Position = new Vector4(-center, 1);
            glControl.Sprite = shadowSprite;

            simInput.Array.Mesh = mesh;
        }
Exemplo n.º 2
0
 public ShadowMeshSprite(Shadow shadow)
     : base(shadow.Mesh)
 {
     this.shadow = shadow;
 }