Exemplo n.º 1
0
    Mesh GenerateMesh()
    {
        Mesh mesh = new Mesh();

        //_quadGenerator.Generate(mesh);
        _boxGenerator.Generate(mesh);
        return(mesh);
    }
Exemplo n.º 2
0
        private void BtnReadHarryModel_Click(object sender, EventArgs e)
        {
            int harryModelAddressRaw = Mem !.ReadS32(Rom.Addresses.MainRam.HarryModelPointer);

            int harryModelAddress = harryModelAddressRaw - (int)Rom.Addresses.MainRam.BaseAddress;

            List <byte> headerBytes = Mem !.ReadByteRange(harryModelAddress, IlmHeader.Length);

            IlmHeader header;

            try
            {
                header = new IlmHeader(headerBytes, harryModelAddressRaw);
            }
            catch (ArgumentException)
            {
                return;
            }

            // Can't get an actual stream from ApiHawk, but this'll do nicely.
            List <byte> remaining = Mem !.ReadByteRange(harryModelAddress, (int)(Mem !.GetMemoryDomainSize("MainRAM") - harryModelAddress));

            Model = new Ilm(header, remaining, TrkModelScale.Value);

            var generator = new BoxGenerator(0.025f, Color.Yellow);

            bool all = CmbModelSubmeshName.Text == "*";

            ModelBoxes.Clear();
            foreach (Submesh submesh in Model.Submeshes)
            {
                if (!all && submesh.Name != CmbModelSubmeshName.Text.ToUpper())
                {
                    continue;
                }

                foreach (Vector3 vertex in submesh.Vertices)
                {
                    Renderable box = generator.Generate().ToWorld();

                    box.Position = new Vector3(vertex.X, -vertex.Y, vertex.Z);

                    ModelBoxes.Add(box);
                }

                if (!all)
                {
                    break;
                }
            }
        }