Beispiel #1
0
        private void buttonAutoChunk_Click(object sender, EventArgs e)
        {
            if (visibilityFunctions.ChunkList.Count > 0)
            {
                List <RenderWareModelFile> bspAndCol = new List <RenderWareModelFile>();
                bspAndCol.AddRange(bspRenderer.BSPList);
                bspAndCol.AddRange(bspRenderer.ShadowColBSPList);

                VisibilityFunctions.AutoChunk((int)NumChunkNum.Value, bspAndCol, out bool success, out Vector3 Min, out Vector3 Max);

                if (success)
                {
                    visibilityFunctions.ChunkList[(int)numericCurrentChunk.Value - 1].Min.X = (int)(Min.X - (int)numericUpDownAdd.Value);
                    visibilityFunctions.ChunkList[(int)numericCurrentChunk.Value - 1].Min.Y = (int)(Min.Y - (int)numericUpDownAdd.Value);
                    visibilityFunctions.ChunkList[(int)numericCurrentChunk.Value - 1].Min.Z = (int)(Min.Z - (int)numericUpDownAdd.Value);
                    visibilityFunctions.ChunkList[(int)numericCurrentChunk.Value - 1].Max.X = (int)(Max.X + (int)numericUpDownAdd.Value);
                    visibilityFunctions.ChunkList[(int)numericCurrentChunk.Value - 1].Max.Y = (int)(Max.Y + (int)numericUpDownAdd.Value);
                    visibilityFunctions.ChunkList[(int)numericCurrentChunk.Value - 1].Max.Z = (int)(Max.Z + (int)numericUpDownAdd.Value);
                    numericCurrentChunk_ValueChanged(new object(), new EventArgs());
                }
                else
                {
                    MessageBox.Show("I couldn't find any BSP with a matching chunk number.");
                }
            }
        }
Beispiel #2
0
        private void ButtonAutoBuild_Click(object sender, EventArgs e)
        {
            DialogResult d = MessageBox.Show("Warning: this will overwrite the current chunk data with an automatically generated one. Continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (d != DialogResult.Yes)
            {
                return;
            }

            visibilityFunctions.ChunkList.Clear();

            List <RenderWareModelFile> bspAndCol = new List <RenderWareModelFile>();

            bspAndCol.AddRange(bspRenderer.BSPList);
            bspAndCol.AddRange(bspRenderer.ShadowColBSPList);

            HashSet <int> numbers = new HashSet <int>();

            foreach (RenderWareModelFile rwmf in bspAndCol)
            {
                if (rwmf.ChunkNumber != -1)
                {
                    numbers.Add(rwmf.ChunkNumber);
                }
            }

            Vector3 add = new Vector3((int)numericUpDownAdd.Value);

            foreach (int i in numbers)
            {
                VisibilityFunctions.AutoChunk(i, bspAndCol, out bool success, out Vector3 Min, out Vector3 Max);

                if (success)
                {
                    visibilityFunctions.ChunkList.Add(new Chunk()
                    {
                        Max    = Max + add,
                        Min    = Min - add,
                        number = i
                    });
                }
            }

            visibilityFunctions.ChunkList = visibilityFunctions.ChunkList.OrderBy(c => c.number).ToList();

            numericCurrentChunk.Minimum = 1;
            numericCurrentChunk.Maximum = visibilityFunctions.ChunkList.Count();
            numericCurrentChunk.Value   = visibilityFunctions.ChunkList.Count();
            labelChunkAmount.Text       = "Amount: " + visibilityFunctions.ChunkList.Count();
        }