Пример #1
0
 public ParticleSystem(TransparentObjectManager manager)
 {
     this.transparentObjectManager = manager;
     this.VisibleChanged          += new EventHandler(ParticleSystem_VisibleChanged);
     mesh = new SquareMesh(0.2f, 1, 1, 1.0f);
     Initialize();
 }
Пример #2
0
        /// <summary>
        /// Clean up.
        /// </summary>
        public void Dispose()
        {
            foreach (Foliage fol in foliages)
            {
                owner.TransparentObjectManager.Objects.Remove(fol);
            }
            foliages.Clear();

            counter--;
            if (counter == 0)
            {
                if (foliageMesh != null)
                {
                    foliageMesh.Dispose();
                    foliageMesh = null;
                }
                if (trunkMesh != null)
                {
                    trunkMesh.Dispose();
                    trunkMesh = null;
                }
                if (foliageTexture != null)
                {
                    foliageTexture.Dispose();
                    foliageTexture = null;
                }
            }
        }
Пример #3
0
 private void CreateGround(ref GameObject gameObject, SquareMesh mesh, int x, int y)
 {
     gameObject              = new GameObject();
     gameObject.Mesh         = mesh;
     gameObject.RotateXAngle = (float)Math.PI / 2;
     gameObject.Position     = new Vector3(3000f * x, 0f, 3000f * y);
 }
Пример #4
0
        public Particle(SquareMesh mesh)
        {
            defaultMaterial.Diffuse = System.Drawing.Color.White;
            defaultMaterial.Ambient = System.Drawing.Color.White;

            this.mesh   = mesh;
            this.number = totalNumber++;
        }
Пример #5
0
        /// <summary>
        /// This event will be fired immediately after the Direct3D device has been
        /// created, which will happen during application initialization and windowed/full screen
        /// toggles. This is the best location to create Pool.Managed resources since these
        /// resources need to be reloaded whenever the device is destroyed. Resources created
        /// here should be released in the Disposing event.
        /// </summary>
        private void OnCreateDevice(object sender, DeviceEventArgs e)
        {
            // Initialize the stats font
            //statsFont = ResourceCache.GetGlobalInstance().CreateFont(e.Device, 15, 0, FontWeight.Bold, 1, false, CharacterSet.Default,
            //    Precision.Default, FontQuality.Default, PitchAndFamily.FamilyDoNotCare | PitchAndFamily.DefaultPitch
            //    , "Arial");
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

            SoundManager.Initialize(Framework.Instance.Window);
            inputManager = new Bonsai.Input.InputManager(Framework.Instance.Window);

            transparentObjectManager = new TransparentObjectManager();
            weather = new Weather(this);

            //modelControl = new ModelControl("Data/cessna/cessna.par");
            modelControl = new ModelControl();

            rotationAxisMesh = new LineMesh();

            sky = new GameObject();
            DomeMesh skyDome = new DomeMesh(5000, 10, 16);

            skyDome.Texture = new Bonsai.Objects.Textures.TextureBase("data\\sky2.JPG");
            sky.Position    = new Vector3(0, -5f, 0);
            sky.Mesh        = skyDome;

            scenery = new GameObject();
            SquareMesh sceneryMesh = new SquareMesh(5000, 10, 10, 1000f);

            sceneryMesh.Texture  = new Bonsai.Objects.Textures.TextureBase("data\\scenery\\default\\grass1.jpg");
            scenery.Mesh         = sceneryMesh;
            scenery.Position     = new Vector3(0, -5f, 0);
            scenery.RotateXAngle = (float)Math.PI / 2;

            cameraEditor      = new CameraBase("ObserverCamera");
            cameraEditor.Near = 0.05f;

            cameraPilot          = new ObserverCamera("PilotCamera", modelControl.AirplaneModel);
            cameraPilot.LookFrom = new Vector3(5f, -3.3f, 5f);

            //camera.LookAt = modelControl.AirplaneModel.Position;
            //camera.LookFrom = modelControl.AirplaneModel.Position + new Vector3(cameraDistance, 0f, 0f);
            //camera.AutoZoom = true;
            cameraEditor.AspectRatio = (float)(e.BackBufferDescription.Width) / e.BackBufferDescription.Height;
            cameraPilot.AspectRatio  = (float)(e.BackBufferDescription.Width) / e.BackBufferDescription.Height;


            Framework.Instance.CurrentCamera = cameraEditor;

            sun       = new DirectionalLight(new Vector3(-0.5f, -0.707f, 0.5f));
            sun.Color = System.Drawing.Color.FromArgb(148, 148, 148);

            collisionPoints = new CollisionPoints();

            cursor3d  = new Cursor3d();
            cursor3d2 = new Cursor3d();
        }
Пример #6
0
 public Bombing(Program owner)
 {
     this.owner                     = owner;
     targetMesh                     = new SquareMesh(5.0f, 1, 1, 1.0f);
     targetMesh.Texture             = new TextureBase("data\\target1.png");
     targetMesh.Texture.Transparent = true;
     target              = new GameObject();
     target.Mesh         = targetMesh;
     target.Position     = new Microsoft.DirectX.Vector3(0, 0.004f, 0);
     target.RotateXAngle = (float)(Math.PI / 2);
 }
Пример #7
0
 private static void CreateMesh()
 {
     if (detail > 0)
     {
         rippleMesh = new SquareMesh(1.0f, 1, 1, 1.0f, new Vector3(0, 1, 0));
         if (detail == 2)
         {
             rippleMesh.Texture = new TextureBase("//data//wave128.png");
         }
         rippleMesh.Texture.Transparent = true;
     }
 }
Пример #8
0
 internal static void CleanUp()
 {
     if (rippleMesh != null)
     {
         if (rippleMesh.Texture != null)
         {
             rippleMesh.Texture.Dispose();
             rippleMesh.Texture = null;
         }
         rippleMesh.Dispose();
         rippleMesh = null;
     }
 }
Пример #9
0
 /// <summary>
 /// Clean up.
 /// </summary>
 public void Dispose()
 {
     if (targetMesh != null)
     {
         targetMesh.Dispose();
         targetMesh  = null;
         target.Mesh = null;
     }
     if (target != null)
     {
         target.Dispose();
         target = null;
     }
 }
Пример #10
0
        private void CreateSurroundings()
        {
            SquareMesh  groundMesh   = new SquareMesh(2500, 1, 1, 1.0f);
            TextureBase grassTexture = new TextureBase("data\\surrounding.png");

            groundMesh.Texture = grassTexture;
            CreateGround(ref ground00, groundMesh, 1, 1);
            CreateGround(ref ground01, groundMesh, 1, 0);
            CreateGround(ref ground02, groundMesh, 1, -1);
            CreateGround(ref ground10, groundMesh, 0, 1);
            CreateGround(ref ground12, groundMesh, 0, -1);
            CreateGround(ref ground20, groundMesh, -1, 1);
            CreateGround(ref ground21, groundMesh, -1, 0);
            CreateGround(ref ground22, groundMesh, -1, -1);
        }
Пример #11
0
        public void AddSimpleTallTree(float x, float y, float z)
        {
            if (simpleTallTreeTexture1 == null)
            {
                simpleTallTreeTexture1 = new TextureBase("/data/tall_tree1_256.png");
            }
            if (simpleTallTreeTexture2 == null)
            {
                simpleTallTreeTexture2 = new TextureBase("/data/tall_tree2_256.png");
            }
            if (simpleTallTreeMesh1 == null)
            {
                simpleTallTreeMesh1                     = new SquareMesh(5.0f, 1, 1, 1.0f);
                simpleTallTreeMesh1.Texture             = simpleTallTreeTexture1;
                simpleTallTreeMesh1.Texture.Transparent = true;
            }
            if (simpleTallTreeMesh2 == null)
            {
                simpleTallTreeMesh2                     = new SquareMesh(5.0f, 1, 1, 1.0f);
                simpleTallTreeMesh2.Texture             = simpleTallTreeTexture2;
                simpleTallTreeMesh2.Texture.Transparent = true;
            }

            GameObject tree = new GameObject();

            if (plants.Count % 2 == 0)
            {
                tree.Mesh     = simpleTallTreeMesh1;
                tree.Scale    = new Vector3(1.0f, 1.4f, 1.0f);
                tree.Position = new Vector3(x, y + 7.0f, z);
            }
            else
            {
                tree.Mesh     = simpleTallTreeMesh2;
                tree.Scale    = new Vector3(0.8f, 1.0f, 1.0f);
                tree.Position = new Vector3(x, y + 5.0f, z);
            }
            tree.IsBillboard = true;
            plants.Add(tree);
            owner.TransparentObjectManager.Objects.Add(tree);
        }
Пример #12
0
        public void AddGrass(float x, float z)
        {
            if (grassTexture == null)
            {
                grassTexture = new TextureBase("/data/grassbillboard.png");
            }
            if (grassMesh == null)
            {
                grassMesh                     = new SquareMesh(1f, 1, 1, 1.0f);
                grassMesh.Texture             = grassTexture;
                grassMesh.Texture.Transparent = true;
            }

            GameObject grass = new GameObject();

            grass.Mesh        = grassMesh;
            grass.Scale       = new Vector3(1f, 1f, 5f);
            grass.Position    = new Vector3(x, 0.5f, z);
            grass.IsBillboard = true;
            plants.Add(grass);
            owner.TransparentObjectManager.Objects.Add(grass);
        }
Пример #13
0
        public void AddSimpleSmallTree(float x, float y, float z)
        {
            if (simpleSmallTreeTexture1 == null)
            {
                simpleSmallTreeTexture1 = new TextureBase("/data/small_tree1_256.png");
            }
            if (simpleSmallTreeMesh1 == null)
            {
                simpleSmallTreeMesh1                     = new SquareMesh(1.5f, 1, 1, 1.0f);
                simpleSmallTreeMesh1.Texture             = simpleSmallTreeTexture1;
                simpleSmallTreeMesh1.Texture.Transparent = true;
            }

            GameObject tree = new GameObject();

            tree.Mesh        = simpleSmallTreeMesh1;
            tree.Scale       = new Vector3(1.0f, 1.5f, 1.0f);
            tree.Position    = new Vector3(x, y + 2.25f, z);
            tree.IsBillboard = true;
            plants.Add(tree);
            owner.TransparentObjectManager.Objects.Add(tree);
        }
Пример #14
0
        public Tree(Program owner)
        {
            this.owner = owner;

            // Instantiate statics if needed
            if (trunkMesh == null)
            {
                trunkMesh = new TransparentXMesh("/data/tree_trunk.x");
            }
            if (foliageMesh == null)
            {
                foliageMesh = new SquareMesh(2f, 1, 1, 1.0f, new Vector3(0, 0, 1));
            }
            if (foliageTexture == null)
            {
                foliageTexture = new TextureBase("/data/leaves1.png");
            }

            trunk       = new GameObject();
            trunk.Mesh  = trunkMesh;
            trunk.Scale = new Vector3(1f, 1f, 1f);

            foliageMesh.Texture             = foliageTexture;
            foliageMesh.Texture.Transparent = true;

            foreach (Vector3 pos in foliagePositions)
            {
                Foliage foliage = new Foliage();
                foliage.RelativePosition = pos;
                foliage.Mesh             = foliageMesh;
                foliages.Add(foliage);
                owner.TransparentObjectManager.Objects.Add(foliage);
            }

            counter++;
        }
Пример #15
0
 /// <summary>
 /// Clean up.
 /// </summary>
 public void Dispose()
 {
     foreach (GameObject plant in plants)
     {
         owner.TransparentObjectManager.Objects.Remove(plant);
         plant.Dispose();
     }
     plants.Clear();
     foreach (Tree tree in trees)
     {
         tree.Dispose();
     }
     trees.Clear();
     if (simpleTreeTexture1 != null)
     {
         simpleTreeTexture1.Dispose();
         simpleTreeTexture1 = null;
     }
     if (simpleTreeTexture2 != null)
     {
         simpleTreeTexture2.Dispose();
         simpleTreeTexture2 = null;
     }
     if (simpleTallTreeTexture1 != null)
     {
         simpleTallTreeTexture1.Dispose();
         simpleTallTreeTexture1 = null;
     }
     if (simpleTallTreeTexture2 != null)
     {
         simpleTallTreeTexture2.Dispose();
         simpleTallTreeTexture2 = null;
     }
     if (simpleSmallTreeTexture1 != null)
     {
         simpleSmallTreeTexture1.Dispose();
         simpleSmallTreeTexture1 = null;
     }
     if (simpleTreeMesh1 != null)
     {
         simpleTreeMesh1.Dispose();
         simpleTreeMesh1 = null;
     }
     if (simpleTreeMesh2 != null)
     {
         simpleTreeMesh2.Dispose();
         simpleTreeMesh2 = null;
     }
     if (simpleTallTreeMesh1 != null)
     {
         simpleTallTreeMesh1.Dispose();
         simpleTallTreeMesh1 = null;
     }
     if (simpleTallTreeMesh2 != null)
     {
         simpleTallTreeMesh2.Dispose();
         simpleTallTreeMesh2 = null;
     }
     if (simpleSmallTreeMesh1 != null)
     {
         simpleSmallTreeMesh1.Dispose();
         simpleSmallTreeMesh1 = null;
     }
     if (grassTexture != null)
     {
         grassTexture.Dispose();
         grassTexture = null;
     }
     if (grassMesh != null)
     {
         grassMesh.Dispose();
         grassMesh = null;
     }
 }
Пример #16
0
        public Water(Vector3 position, float size, QualityLevelEnum quality)
        {
            this.qualityLevel = quality;
            squareMesh        = new SquareMesh(size, 1, 1, 1.0f);
            this.Mesh         = squareMesh;
            this.RotateXAngle = (float)Math.PI / 2;
            this.Position     = position;

            if (quality != QualityLevelEnum.Low)
            {
                Vector3 point1 = new Vector3(-1, 0f, 1);
                Vector3 point2 = new Vector3(1, 0f, 1);
                Vector3 point3 = new Vector3(-1, 0f, -1);
                Plane   plane  = Plane.FromPoints(point1, point2, point3);

                // reflection
                //reflectionTexture = new TextureBase(256, 256);
                reflectionClipPlane = plane;

                // refraction
                plane               = Plane.FromPoints(point1, point2, point3);
                plane.C            *= -1;
                refractionClipPlane = plane;

                waterNormalTexture = new TextureBase("waterbump.dds");

                // initialize shader
                waterShader = new ShaderBase("water", "watereffects.fx");
                waterShader.SetVariable("xWorld", ShaderBase.ShaderParameters.World);
                waterShader.SetVariable("xView", ShaderBase.ShaderParameters.View);
                waterShader.SetVariable("xReflectionView", ShaderBase.ShaderParameters.Reflection);
                waterShader.SetVariable("xProjection", ShaderBase.ShaderParameters.Projection);
                //waterShader.SetVariable("xReflectionMap", reflectionTexture);
                //waterShader.SetVariable("xRefractionMap", refractionTexture);
                waterShader.SetVariable("xDrawMode", reflectionRefractionRatio);
                waterShader.SetVariable("fresnelMode", fresnelMode);
                waterShader.SetVariable("xdullBlendFactor", 0.2f);
                waterShader.SetVariable("xEnableTextureBlending", 0);
                waterShader.SetVariable("xWaterBumpMap", waterNormalTexture);
                waterShader.SetVariable("xWaterPos", new Vector3(position.X, position.Z, position.Y));

                // parameteres for the wave
                waterShader.SetVariable("WaveLength", 0.1f);
                waterShader.SetVariable("WaveHeight", 0.4f);
                waterShader.SetVariable("SunPosition", new Vector3(1.0f, 1.0f, 1.0f));
                //waterShader.SetVariable("xCamPos", Framework.Instance.CurrentCamera.LookFrom);

                //waterShader.SetVariable("xTime", totalTime);
                waterShader.SetVariable("xWindForce", 20.0f);
                waterShader.SetVariable("xWindDirection", Matrix.RotationY(1.0f));

                //specular reflection parameters
                waterShader.SetVariable("specPower", 364);
                waterShader.SetVariable("specPerturb", 4);

                waterShader.SetTechnique("Water");

                CreateShaderResources(Framework.Instance.Device);

                this.Shader = waterShader;
            }
            else // low quality
            {
                squareMesh.Texture = new TextureBase("water.jpg");
            }

            Framework.Instance.DeviceReset += new Bonsai.Core.EventArgs.DeviceEventHandler(Instance_DeviceReset);
            Framework.Instance.DeviceLost  += new EventHandler(Instance_DeviceLost);
        }
Пример #17
0
        static void Main(string[] args)
        {
            // supplying a custom error handler to SDK initialisation

            // note that a simple messagebox error handler will be supplied, by default
            // but you should probably provide a custom error callback that interfaces directly with application side error reporting and logging functionality
            // this example code shows how to implement a custom error callback that directs error information to console output

            PathEngine.PathEngine pathEngine = DLLManagement.loadDLL("PathEngine", new ConsoleErrorHandler());

            // querying SDK version attributes

            {
                int major, minor, internalRelease;
                pathEngine.getReleaseNumbers(out major, out minor, out internalRelease);
                Console.WriteLine("getReleaseNumbers returns {0}.{1}.{2}", major, minor, internalRelease);
            }

            String[] versionAttributes = pathEngine.getVersionAttributes();
            Console.WriteLine("version attributes:");
            for (int i = 0; i < versionAttributes.Length; i += 2)
            {
                Console.WriteLine("{0} = {1}", versionAttributes[i], versionAttributes[i + 1]);
            }
            Console.WriteLine("(end of version attributes)");

            // provoke a non fatal error, and null object return

            // The error handling philosophy in PathEngine is that code should be set up so that errors should not occur,
            // so the API provides methods to validate data where relevant, and where data is validated correctly you shouldn't see any errors.

            int[] shapeCoords = { -10, -10, -10, 10, 10, 10, 10, -10 };
            shapeCoords[0] = 100; // bad coordinate

            bool valid = pathEngine.shapeIsValid(shapeCoords);

            Console.WriteLine("shapeIsValid returns {0}", valid);

            // The following call to newShape() is not considered good coding practice, then.
            // Instead application code should use shapeIsValid() (as above) to ensure that newShape() isn't called with bad coordinates.
            // But we use this here to provoke a 'NonFatal' error, so that we can see this being passed to the application side error handler.
            // In this case PathEngine will handle the error gracefully, and you should get an error posted to the supplied error handler callback, and a null object returned,
            // but in other cases, PathEngine may emit 'Fatal' errors on invalid data, and then crash after the error callback returns!

            Shape shape = pathEngine.newShape(shapeCoords); // will generate a NonFatal Error

            Console.WriteLine("shape.isNull() returns {0}", shape.isNull());

            shapeCoords[0] = -10; // fix the bad coordinate
            Console.WriteLine("(coordinates fixed)");

            valid = pathEngine.shapeIsValid(shapeCoords);
            Console.WriteLine("shapeIsValid returns {0}", valid);

            shape = pathEngine.newShape(shapeCoords);
            Console.WriteLine("shape.isNull() returns {0}", shape.isNull());

            // using the FaceVertexMesh callback to generate a simple square ground mesh

            FaceVertexMesh[] contentMeshes = new FaceVertexMesh[1];
            contentMeshes[0] = new SquareMesh();
            Mesh mesh = pathEngine.buildMeshFromContent(contentMeshes, new String[0]);

            Console.WriteLine("mesh built from content, getNumberOf3DFaces returns {0}", mesh.getNumberOf3DFaces());

            // this time we generate unobstructed space preprocess only
            // (this enables collision queries for the agent shape, pathfind preprocess is not required for the following)

            mesh.generateUnobstructedSpaceFor(shape, false, new String[0]);

            // place an agent and add to a collision context

            Position         pos         = mesh.generateRandomPosition();
            Agent            placedAgent = mesh.placeAgent(shape, pos);
            CollisionContext context     = mesh.newContext();

            context.addAgent(placedAgent);
            Console.WriteLine("context getNumberOfAgents() returns {0}", context.getNumberOfAgents());

            // call getAllAgentsOverlapped
            // (this shows the linkage for an array out argument, and also gives as another handle to compare to placedAgent)

            Agent[] overlapped;
            mesh.getAllAgentsOverlapped(shape, context, pos, out overlapped);
            Console.WriteLine("number of agents overlapped = {0}", overlapped.Length);

            // we can't compare interface object handles directly, but a getComparisonToken() method is supplied for this purpose
            // (and can also be used for sorting, if this is required)

            Console.WriteLine("placedAgent.getComparisonToken() returns {0}", placedAgent.getComparisonToken());
            foreach (Agent overlappedAgent in overlapped)
            {
                Console.WriteLine("overlappedAgent.getComparisonToken() returns {0}", overlappedAgent.getComparisonToken());
            }

            // a simple file output stream callback is supplied

            OutputStream os = new FileOutputStream("savedMesh.xml");

            mesh.saveGround("xml", false, os);

            // object lifetime notes

            {
                Mesh mesh2 = pathEngine.buildMeshFromContent(contentMeshes, new String[0]);
                // ** PathEngine interface objects are not garbage collected, so mesh2 will not be cleaned up automatically
                // ** and will therefore now be leaked, unless pathEngine.deleteAllObjects() is called
            }
            mesh.destroy(); // clean up this interface object explicitly
            // ** but don't forget that the interface object is now no longer valid, and methods should not be called on this object
            // ** and note that dependant objects such as placed agents and collision contexts are also destroyed with the mesh
            pathEngine.deleteAllObjects(); // cleans up all objects created by PathEngine

            Console.WriteLine("(completed, press enter)");
            Console.ReadLine();
        }
Пример #18
0
        private void BuildCube()
        {
            float squareSize = 1000f;

            for (int i = 0; i < 6; i++)
            {
                meshes[i]                   = new SquareMesh(squareSize + 1.0f, 1, 1, 0.999f);
                meshes[i].Lighted           = false;
                meshes[i].ZBufferEnabled    = false;
                meshes[i].RenderTransparent = true;
                objects[i]                  = new GameObject();
                FileInfo fileInfo  = new FileInfo(parameters.FileName);
                string   directory = fileInfo.DirectoryName + "\\";
                switch (i)
                {
                case 0:
                    textures[i] = new TextureBase(directory + parameters.FrontPhoto);
                    if (!string.IsNullOrEmpty(parameters.FrontDepthMap))
                    {
                        depthMaps[i] = new TextureBase(directory + parameters.FrontDepthMap);
                    }
                    objects[i].Position = new Microsoft.DirectX.Vector3(0, 0, squareSize);
                    break;

                case 1:
                    textures[i] = new TextureBase(directory + parameters.BackPhoto);
                    if (!string.IsNullOrEmpty(parameters.BackDepthMap))
                    {
                        depthMaps[i] = new TextureBase(directory + parameters.BackDepthMap);
                    }
                    objects[i].Position     = new Microsoft.DirectX.Vector3(0, 0, -squareSize);
                    objects[i].RotateYAngle = (float)Math.PI;
                    break;

                case 2:
                    textures[i] = new TextureBase(directory + parameters.RightPhoto);
                    if (!string.IsNullOrEmpty(parameters.RightDepthMap))
                    {
                        depthMaps[i] = new TextureBase(directory + parameters.RightDepthMap);
                    }
                    objects[i].Position     = new Microsoft.DirectX.Vector3(squareSize, 0, 0);
                    objects[i].RotateYAngle = (float)Math.PI / 2;
                    break;

                case 3:
                    textures[i] = new TextureBase(directory + parameters.LeftPhoto);
                    if (!string.IsNullOrEmpty(parameters.LeftDepthMap))
                    {
                        depthMaps[i] = new TextureBase(directory + parameters.LeftDepthMap);
                    }
                    objects[i].Position     = new Microsoft.DirectX.Vector3(-squareSize, 0, 0);
                    objects[i].RotateYAngle = (float)-Math.PI / 2;
                    break;

                case 4:
                    textures[i] = new TextureBase(directory + parameters.BottomPhoto);
                    if (!string.IsNullOrEmpty(parameters.BottomDepthMap))
                    {
                        depthMaps[i] = new TextureBase(directory + parameters.BottomDepthMap);
                    }
                    objects[i].Position     = new Microsoft.DirectX.Vector3(0, -squareSize, 0);
                    objects[i].RotateXAngle = (float)Math.PI / 2;
                    break;

                case 5:
                    textures[i] = new TextureBase(directory + parameters.TopPhoto);
                    if (!string.IsNullOrEmpty(parameters.TopDepthMap))
                    {
                        depthMaps[i] = new TextureBase(directory + parameters.TopDepthMap);
                    }
                    objects[i].Position     = new Microsoft.DirectX.Vector3(0, squareSize, 0);
                    objects[i].RotateXAngle = (float)-Math.PI / 2;
                    break;
                }
                objects[i].Mesh = meshes[i];
                //meshes[i].Texture = textures[i];
                shaders[i]        = new ShaderBase("photo" + i.ToString(), "data/photo.fx", false);
                objects[i].Shader = shaders[i];
                objects[i].Shader.SetVariable("Texture", textures[i]);
                if (depthMaps[i] != null)
                {
                    objects[i].Shader.SetVariable("DepthMap", depthMaps[i]);
                }
                objects[i].Shader.SetVariable("Distance", 0.5f);
                objects[i].Shader.SetTechnique("TPhoto");
            }
        }
Пример #19
0
    private void Awake()
    {
        squareMesh = GetComponentInChildren <SquareMesh>();

        cells = new SquareCell[SquareMetrics.chunkSizeX * SquareMetrics.chunkSizeY];
    }