Beispiel #1
0
 public void AddTempVertex(Vector3 pos, Vector2 uv, Vector4 color)
 {
     pos += offset;
     if (currentScale != 1f)
     {
         pos *= currentScale;
     }
     //Console.WriteLine("currentMaterial = " + currentMaterial + ", totalCount = " + textureImages.Count);
     if (currentMaterial == -1)
     {
         AddTexture(
             TextureFormats.createColorTexture(System.Drawing.Color.White),
             newTexInfo((int)OpenTK.Graphics.OpenGL.All.Repeat, (int)OpenTK.Graphics.OpenGL.All.Repeat),
             0x00000000
             );
     }
     TempMeshes[currentMaterial].vertices.Add(pos);
     TempMeshes[currentMaterial].texCoords.Add(uv);
     TempMeshes[currentMaterial].colors.Add(color);
 }
Beispiel #2
0
        private static void switchTextureStatus(ref Model3D mdl, ref TempMaterial temp, bool status)
        {
            ROM rom = ROM.Instance;

            if (mdl.builder.processingTexture != status)
            {
                if (status == false)
                {
                    if (!mdl.builder.hasTexture(temp.segOff))
                    {
                        //System.Console.WriteLine("Adding new texture!");
                        if (temp.segOff != 0)
                        {
                            //System.Console.WriteLine("temp.segOff = " + temp.segOff.ToString("X8"));
                            mdl.builder.AddTexture(
                                TextureFormats.decodeTexture(
                                    temp.format,
                                    rom.getDataFromSegmentAddress_safe(
                                        temp.segOff,
                                        (uint)(temp.w * temp.h * 2)
                                        ),
                                    temp.w,
                                    temp.h
                                    ),
                                mdl.builder.newTexInfo(temp.wrapS, temp.wrapT),
                                temp.segOff
                                );
                        }
                        else
                        {
                            mdl.builder.AddTexture(
                                TextureFormats.createColorTexture(System.Drawing.Color.FromArgb((int)temp.color)),
                                mdl.builder.newTexInfo(temp.wrapS, temp.wrapT),
                                temp.segOff
                                );
                        }
                    }
                }
                mdl.builder.processingTexture = status;
            }
        }