Exemple #1
0
        private static void G_SETTIMG(ref TempMaterial temp, byte[] cmd, ref string desc)
        {
            temp.segOff = bytesToInt(cmd, 4, 4);
            byte format = (byte)(cmd[1] & 0xF8);

            desc = "Set load format to " + TextureFormats.ConvertFormatToString((byte)(format >> 5), (byte)(format >> 3)) +
                   " & address to 0x" + temp.segOff.ToString("X8");
            temp.isPaletteRGBA16 = (format != 0x70);
        }
Exemple #2
0
        private static void switchTextureStatus(ref Model3D mdl, ref TempMaterial temp, bool status, byte?areaID)
        {
            ROM rom = ROM.Instance;

            if (mdl.builder.processingTexture != status)
            {
                if (status == false)
                {
                    if (!mdl.builder.hasTexture(temp.segOff))
                    {
                        if (temp.segOff != 0 && temp.w != 0 && temp.h != 0)
                        {
                            mdl.builder.AddTexture(
                                TextureFormats.decodeTexture(
                                    temp.format,
                                    rom.getDataFromSegmentAddress_safe(
                                        temp.segOff,
                                        (uint)(temp.w * temp.h * 4),
                                        areaID
                                        ),
                                    temp.w,
                                    temp.h,
                                    temp.palette,
                                    temp.isPaletteRGBA16
                                    ),
                                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;
            }
        }
Exemple #3
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);
 }
Exemple #4
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(
                                        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;
            }
        }