Ejemplo n.º 1
0
        public override void apply(List <VertIndexWeight> verts, float intensity, bool alternate)
        {
            if (verts.Count == 0)
            {
                return;
            }

            BTileBoundingBox vertexTouchedExtends = new BTileBoundingBox();

            // Go through points and adjust accordingly.
            for (int i = 0; i < verts.Count; i++)
            {
                int   index  = verts[i].index;
                float weight = verts[i].weight;

                int z = (int)(index / TerrainGlobals.getEditor().getSimRep().getHeightRep().getNumXPoints());
                int x = (int)(index % TerrainGlobals.getEditor().getSimRep().getHeightRep().getNumZPoints());

                SimTileData.eTileTypeOverrideVal passV = TerrainGlobals.getEditor().getSimRep().getDataTiles().getTileTypeBrushState();
                if (passV == SimTileData.eTileTypeOverrideVal.cTileType_None || alternate)
                {
                    TerrainGlobals.getEditor().getSimRep().getDataTiles().setJaggedTileType(x - 1, z - 1, 0);
                }
                else
                {
                    {
                        //find the override index, and set it to the type.
                        int idx = SimTerrainType.getTileTypeIndexByName(TerrainGlobals.getEditor().getSimRep().getDataTiles().getTileTypeOverrideSelection());
                        TerrainGlobals.getEditor().getSimRep().getDataTiles().setJaggedTileType(x - 1, z - 1, idx);
                    }
                }
                vertexTouchedExtends.addPoint(x, z);
            }
            TerrainGlobals.getEditor().getSimRep().updateAfterPainted(vertexTouchedExtends.minX, vertexTouchedExtends.minZ, vertexTouchedExtends.maxX, vertexTouchedExtends.maxZ);
        }
Ejemplo n.º 2
0
        public override void apply(List <VertIndexWeight> verts, float intensity, bool alternate)
        {
            float            speedFactor          = 0.4f;
            BTileBoundingBox vertexTouchedExtends = new BTileBoundingBox();

            float factor = speedFactor * intensity;

            if (alternate)
            {
                factor *= -1.0f;
            }

            // Go through points and adjust accordingly.
            for (int i = 0; i < verts.Count; i++)
            {
                int   index  = verts[i].index;
                float weight = verts[i].weight;

                int z = (int)(index / TerrainGlobals.getEditor().getCameraRep().getNumXPoints());
                int x = (int)(index % TerrainGlobals.getEditor().getCameraRep().getNumZPoints());

                TerrainGlobals.getEditor().getCameraRep().setJaggedHeight(x, z, CameraHeightRep.cJaggedEmptyValue);

                vertexTouchedExtends.addPoint(x, z);
            }

            TerrainGlobals.getEditor().getCameraRep().updateAfterPainted(vertexTouchedExtends.minX, vertexTouchedExtends.minZ, vertexTouchedExtends.maxX, vertexTouchedExtends.maxZ);
        }
Ejemplo n.º 3
0
        public override void apply(List <VertIndexWeight> verts, float intensity, bool alternate)
        {
            if (verts.Count == 0)
            {
                return;
            }

            // Set convolution size based on intesity.
            if (intensity <= 0.5f)
            {
                mConvolutionSize = 3;
            }
            else if (intensity <= 0.75f)
            {
                mConvolutionSize = 5;
            }
            else if (intensity <= 0.9f)
            {
                mConvolutionSize = 7;
            }
            else if (intensity <= 1.0f)
            {
                mConvolutionSize = 11;
            }

            mHalfConvolutionSize = (short)(mConvolutionSize / 2);
            int   numConvolutionCoefficients = mConvolutionSize * mConvolutionSize;
            float newVertPos_Y = 0;

            float            speedFactor          = 0.4f;
            BTileBoundingBox vertexTouchedExtends = new BTileBoundingBox();

            float factor = speedFactor * intensity;

            if (alternate)
            {
                factor *= -1.0f;
            }

            // Go through points and adjust accordingly.
            for (int i = 0; i < verts.Count; i++)
            {
                int   index         = verts[i].index;
                float weight        = verts[i].weight;
                float weight_scaled = verts[i].weight * intensity;

                int z = (int)(index / TerrainGlobals.getEditor().getSimRep().getHeightRep().getNumXPoints());
                int x = (int)(index % TerrainGlobals.getEditor().getSimRep().getHeightRep().getNumZPoints());


                applyFastLowPassFilter((int)x, (int)z, out newVertPos_Y);

                TerrainGlobals.getEditor().getSimRep().getHeightRep().setJaggedHeight(x, z, newVertPos_Y);

                vertexTouchedExtends.addPoint(x, z);
            }

            TerrainGlobals.getEditor().getSimRep().updateAfterPainted(vertexTouchedExtends.minX, vertexTouchedExtends.minZ, vertexTouchedExtends.maxX, vertexTouchedExtends.maxZ);
        }
Ejemplo n.º 4
0
        public override void apply(List <VertIndexWeight> verts, float intensity, bool alternate)
        {
            if (verts.Count == 0)
            {
                return;
            }
            BTileBoundingBox vertexTouchedExtends = new BTileBoundingBox();

            if (alternate)
            {
                return;
            }


            // Go through points and adjust accordingly.
            for (int i = 0; i < verts.Count; i++)
            {
                int   index  = verts[i].index;
                float weight = verts[i].weight;

                int z = (int)(index / TerrainGlobals.getEditor().getSimRep().getHeightRep().getNumXPoints());
                int x = (int)(index % TerrainGlobals.getEditor().getSimRep().getHeightRep().getNumZPoints());


                //float currHeight = TerrainGlobals.getTerrain().getPos(z, x).Y;
                //float suggHeight = mSampledHeight * weight;

                //float targetHeight = (Math.Abs(mSampledHeight - suggHeight) > Math.Abs(mSampledHeight - currHeight)) ? currHeight : suggHeight;


                //// Change the vertex.
                //float overideHeight = heights.GetValue(transIndex);
                //if (overideHeight != BTerrainSimRep.cJaggedEmptyValue)
                //{
                //   targetHeight = (Math.Abs(mSampledHeight - overideHeight) > Math.Abs(mSampledHeight - targetHeight)) ? targetHeight : overideHeight;
                //}


                TerrainGlobals.getEditor().getSimRep().getHeightRep().setJaggedHeight(x, z, mSampledHeight);

                vertexTouchedExtends.addPoint(x, z);
            }


            TerrainGlobals.getEditor().getSimRep().updateAfterPainted(vertexTouchedExtends.minX, vertexTouchedExtends.minZ, vertexTouchedExtends.maxX, vertexTouchedExtends.maxZ);
        }
Ejemplo n.º 5
0
        public override void apply(List <VertIndexWeight> verts, float intensity, bool alternate)
        {
            if (verts.Count == 0)
            {
                return;
            }

            BTileBoundingBox vertexTouchedExtends = new BTileBoundingBox();

            // Go through points and adjust accordingly.
            for (int i = 0; i < verts.Count; i++)
            {
                int   index  = verts[i].index;
                float weight = verts[i].weight;

                int z = (int)(index / TerrainGlobals.getEditor().getSimRep().getHeightRep().getNumXPoints()) - 1;
                int x = (int)(index % TerrainGlobals.getEditor().getSimRep().getHeightRep().getNumZPoints()) - 1;

                //CLM the -1's here are to convert from simrep verts to simrep tiles
                SimTileData.ePassOverrideVal passV = TerrainGlobals.getEditor().getSimRep().getDataTiles().getPassableBrushState();
                if (passV == SimTileData.ePassOverrideVal.cPass_None)
                {
                    TerrainGlobals.getEditor().getSimRep().getDataTiles().setJaggedPassable(x, z, 0);
                }
                else
                {
                    if (passV == SimTileData.ePassOverrideVal.cPass_Unpassable)
                    {
                        TerrainGlobals.getEditor().getSimRep().getDataTiles().setJaggedPassable(x, z, alternate ? 1 : -1);
                    }
                    else if (passV == SimTileData.ePassOverrideVal.cPass_Passable)
                    {
                        TerrainGlobals.getEditor().getSimRep().getDataTiles().setJaggedPassable(x, z, alternate ? -1 : 1);
                    }
                }
                vertexTouchedExtends.addPoint(x, z);
            }
            TerrainGlobals.getEditor().getSimRep().updateAfterPainted(vertexTouchedExtends.minX, vertexTouchedExtends.minZ, vertexTouchedExtends.maxX, vertexTouchedExtends.maxZ);
        }
Ejemplo n.º 6
0
        public override void apply(List <VertIndexWeight> verts, float intensity, bool alternate)
        {
            float            speedFactor          = 0.4f;
            BTileBoundingBox vertexTouchedExtends = new BTileBoundingBox();

            float factor = speedFactor * intensity;

            if (alternate)
            {
                factor *= -1.0f;
            }

            // Go through points and adjust accordingly.
            for (int i = 0; i < verts.Count; i++)
            {
                int   index  = verts[i].index;
                float weight = verts[i].weight;

                int z = (int)(index / TerrainGlobals.getEditor().getSimRep().getFlightRep().getNumXPoints());
                int x = (int)(index % TerrainGlobals.getEditor().getSimRep().getFlightRep().getNumZPoints());

                // Change the vertex.
                //float overideHeight = TerrainGlobals.getEditor().getFlightRep().getJaggedHeight(x, z);
                //if (overideHeight != FlightHeightRep.cJaggedEmptyValue)
                //{
                //   overideHeight += factor * weight;
                //}
                //else
                //{
                //   overideHeight = TerrainGlobals.getEditor().getFlightRep().getHeight(x, z) + (factor * weight);
                //}

                TerrainGlobals.getEditor().getSimRep().getFlightRep().setJaggedHeight(x, z, mSampledHeight);

                vertexTouchedExtends.addPoint(x, z);
            }

            TerrainGlobals.getEditor().getSimRep().getFlightRep().updateAfterPainted(vertexTouchedExtends.minX, vertexTouchedExtends.minZ, vertexTouchedExtends.maxX, vertexTouchedExtends.maxZ);
        }
Ejemplo n.º 7
0
        public override void apply(List <VertIndexWeight> verts, float intensity, bool alternate)
        {
            if (verts.Count == 0)
            {
                return;
            }

            BTileBoundingBox vertexTouchedExtends = new BTileBoundingBox();

            // Go through points and adjust accordingly.
            for (int i = 0; i < verts.Count; i++)
            {
                int   index  = verts[i].index;
                float weight = verts[i].weight;

                int z = (int)(index / TerrainGlobals.getEditor().getSimRep().getHeightRep().getNumXPoints());
                int x = (int)(index % TerrainGlobals.getEditor().getSimRep().getHeightRep().getNumZPoints());

                SimTileData.eBuildOverrideVal passV = TerrainGlobals.getEditor().getSimRep().getDataTiles().getBuildibleBrushState();
                if (passV == SimTileData.eBuildOverrideVal.cBuild_None)
                {
                    TerrainGlobals.getEditor().getSimRep().getDataTiles().setJaggedBuildable(x - 1, z - 1, 0);
                }
                else
                {
                    if (passV == SimTileData.eBuildOverrideVal.cBuild_Unbuildable)
                    {
                        TerrainGlobals.getEditor().getSimRep().getDataTiles().setJaggedBuildable(x - 1, z - 1, alternate ? 1 : -1);
                    }
                    else if (passV == SimTileData.eBuildOverrideVal.cBuild_Buildable)
                    {
                        TerrainGlobals.getEditor().getSimRep().getDataTiles().setJaggedBuildable(x - 1, z - 1, alternate ? -1 : 1);
                    }
                }
                vertexTouchedExtends.addPoint(x, z);
            }
            TerrainGlobals.getEditor().getSimRep().updateAfterPainted(vertexTouchedExtends.minX, vertexTouchedExtends.minZ, vertexTouchedExtends.maxX, vertexTouchedExtends.maxZ);
        }