mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 12:22:35 +00:00
Added PCX image format support.
This commit is contained in:
parent
a9bc8f9e05
commit
55dce5eac3
5 changed files with 44 additions and 64 deletions
|
@ -3,14 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 10.00
|
|||
# Visual C# Express 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Builder", "Builder.csproj", "{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GZDoomEditing", "..\Plugins\GZDoomEditing\GZDoomEditing.csproj", "{760A9BC7-CB73-4C36-858B-994C14996FCD}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuilderModes", "..\Plugins\BuilderModes\BuilderModes.csproj", "{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisplaneExplorer", "..\Plugins\VisplaneExplorer\VisplaneExplorer.csproj", "{CF670175-7099-4090-A330-EE25C7230139}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorPicker", "..\Plugins\ColorPicker\ColorPicker.csproj", "{A4761900-0EA3-4FE4-A919-847FD5080EFC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -31,48 +23,6 @@ Global
|
|||
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Release|x86.ActiveCfg = Release|x86
|
||||
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Release|x86.Build.0 = Release|x86
|
||||
{760A9BC7-CB73-4C36-858B-994C14996FCD}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{760A9BC7-CB73-4C36-858B-994C14996FCD}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{760A9BC7-CB73-4C36-858B-994C14996FCD}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{760A9BC7-CB73-4C36-858B-994C14996FCD}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{760A9BC7-CB73-4C36-858B-994C14996FCD}.Debug|x86.Build.0 = Debug|x86
|
||||
{760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|x86.ActiveCfg = Release|x86
|
||||
{760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|x86.Build.0 = Release|x86
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug|x86.Build.0 = Debug|x86
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release|x86.ActiveCfg = Release|x86
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release|x86.Build.0 = Release|x86
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{CF670175-7099-4090-A330-EE25C7230139}.Release|x86.Build.0 = Release|Any CPU
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|x86.Build.0 = Debug|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|x86.ActiveCfg = Release|x86
|
||||
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -42,6 +42,15 @@ namespace CodeImp.DoomBuilder.Data
|
|||
private static readonly int[] GIF_SIGNATURE = new int[] { 71, 73, 70 };
|
||||
private static readonly int[] BMP_SIGNATURE = new int[] { 66, 77 };
|
||||
private static readonly int[] DDS_SIGNATURE = new int[] { 68, 68, 83, 32 };
|
||||
//mxd
|
||||
private static readonly int[] PCX_SIGNATURE = new int[] { 10, 5, 1, 8 };
|
||||
//char Manufacturer; // 10 = ZSoft .PCX
|
||||
//char Version; // 0 = Version 2.5
|
||||
// 2 = Version 2.8 with palette info
|
||||
// 3 = Version 2.8 without palette info
|
||||
// 5 = Version 3.0
|
||||
//char Encoding; // 1 = .PCX encoding
|
||||
//char BitsPerLayer; // bpp
|
||||
|
||||
// This check image data and returns the appropriate image reader
|
||||
public static IImageReader GetImageReader(Stream data, int guessformat, Playpal palette)
|
||||
|
@ -69,6 +78,10 @@ namespace CodeImp.DoomBuilder.Data
|
|||
data.Seek(0, SeekOrigin.Begin);
|
||||
if(CheckSignature(data, GIF_SIGNATURE)) return new FileImageReader();
|
||||
|
||||
//mxd. Check for PCX signature
|
||||
data.Seek(0, SeekOrigin.Begin);
|
||||
if (CheckSignature(data, PCX_SIGNATURE)) return new FileImageReader();
|
||||
|
||||
// Check for BMP signature
|
||||
data.Seek(0, SeekOrigin.Begin);
|
||||
if(CheckSignature(data, BMP_SIGNATURE))
|
||||
|
|
|
@ -6,6 +6,6 @@ using System.Text;
|
|||
namespace CodeImp.DoomBuilder.GZBuilder.Data {
|
||||
public struct TextureData {
|
||||
public const string INVALID_TEXTURE = "**INVALID_TEXTURE**";
|
||||
public static string[] SUPPORTED_TEXTURE_EXTENSIONS = { ".jpg", ".tga", ".png", ".dds" };
|
||||
public static string[] SUPPORTED_TEXTURE_EXTENSIONS = { ".jpg", ".tga", ".png", ".dds", ".pcx" };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using CodeImp.DoomBuilder;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.GZBuilder.Data;
|
||||
|
@ -25,12 +27,6 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
|
|||
mde.ModelNames.CopyTo(modelNames);
|
||||
mde.TextureNames.CopyTo(textureNames);
|
||||
|
||||
//should never happen
|
||||
/*if (modelNames.Length != textureNames.Length || textureNames.Length == 0 || modelNames.Length == 0) {
|
||||
General.ErrorLogger.Add(ErrorType.Warning, "MD3Reader: wrong parse params! (modelPaths=" + modelNames.ToString() + "; texturePaths=" + textureNames.ToString() + ")");
|
||||
return;
|
||||
}*/
|
||||
|
||||
mde.Model = new GZModel();
|
||||
mde.Model.NUM_MESHES = (byte)modelNames.Length;
|
||||
|
||||
|
@ -41,7 +37,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
|
|||
|
||||
if (reader.FileExists(modelPath)) {
|
||||
MemoryStream stream = reader.LoadFile(modelPath);
|
||||
General.WriteLogLine("MD3Reader: loading '" + modelPath + "'");
|
||||
General.WriteLogLine("ModelLoader: loading '" + modelPath + "'");
|
||||
|
||||
//mesh
|
||||
string ext = modelNames[i].Substring(modelNames[i].Length - 4);
|
||||
|
@ -56,20 +52,41 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
|
|||
string texturePath = Path.Combine(mde.Path, textureNames[i]);
|
||||
|
||||
if (textureNames[i] != TextureData.INVALID_TEXTURE && reader.FileExists(texturePath)) {
|
||||
mde.Model.Textures.Add(Texture.FromStream(D3DDevice, reader.LoadFile(texturePath)));
|
||||
if (Path.GetExtension(texturePath) == ".pcx") { //pcx format requires special handling...
|
||||
FileImageReader fir = new FileImageReader();
|
||||
Bitmap bitmap = fir.ReadAsBitmap(reader.LoadFile(texturePath));
|
||||
|
||||
if (bitmap != null) {
|
||||
BitmapData bmlock = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, bitmap.PixelFormat);
|
||||
Texture texture = new Texture(D3DDevice, bitmap.Width, bitmap.Height, 1, Usage.None, Format.A8R8G8B8, Pool.Managed);
|
||||
|
||||
DataRectangle textureLock = texture.LockRectangle(0, LockFlags.None);
|
||||
textureLock.Data.WriteRange(bmlock.Scan0, bmlock.Height * bmlock.Stride);
|
||||
|
||||
bitmap.UnlockBits(bmlock);
|
||||
texture.UnlockRectangle(0);
|
||||
|
||||
mde.Model.Textures.Add(texture);
|
||||
} else {
|
||||
mde.Model.Textures.Add(General.Map.Data.UnknownTexture3D.Texture);
|
||||
GZBuilder.GZGeneral.LogAndTraceWarning("ModelLoader: unable to load texture '" + texturePath + "'");
|
||||
}
|
||||
} else {
|
||||
mde.Model.Textures.Add(Texture.FromStream(D3DDevice, reader.LoadFile(texturePath)));
|
||||
}
|
||||
} else {
|
||||
mde.Model.Textures.Add(General.Map.Data.UnknownTexture3D.Texture);
|
||||
if (textureNames[i] != TextureData.INVALID_TEXTURE)
|
||||
GZBuilder.GZGeneral.LogAndTraceWarning("MD3Reader: unable to load texture '" + texturePath + "' - no such file");
|
||||
GZBuilder.GZGeneral.LogAndTraceWarning("ModelLoader: unable to load texture '" + texturePath + "' - no such file");
|
||||
}
|
||||
} else {
|
||||
GZBuilder.GZGeneral.LogAndTraceWarning("MD3Reader: error while loading " + modelPath + ": " + error);
|
||||
GZBuilder.GZGeneral.LogAndTraceWarning("ModelLoader: error while loading " + modelPath + ": " + error);
|
||||
mde.Model.NUM_MESHES--;
|
||||
}
|
||||
stream.Dispose();
|
||||
|
||||
} else {
|
||||
GZBuilder.GZGeneral.LogAndTraceWarning("MD3Reader: unable to load model '" + modelPath + "' - no such file");
|
||||
GZBuilder.GZGeneral.LogAndTraceWarning("ModelLoader: unable to load model '" + modelPath + "' - no such file");
|
||||
mde.Model.NUM_MESHES--;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
|
|||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("GZDoom Builder")]
|
||||
[assembly: AssemblyDescription("Doom, Heretic and Hexen map editor")]
|
||||
[assembly: AssemblyDescription("GZDoom map editor")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("CodeImp, MaxED")]
|
||||
[assembly: AssemblyProduct("GZDoom Builder")]
|
||||
|
@ -29,4 +29,4 @@ using System.Runtime.InteropServices;
|
|||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.1.2.1556")]
|
||||
[assembly: AssemblyVersion("2.1.2.1557")]
|
Loading…
Reference in a new issue