mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-12-09 11:11:24 +04:00
drop unused projects
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,14 +0,0 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
Console.WriteLine("Hello, World!");
|
||||
|
||||
using var fs = new FileStream("C:\\ParkanUnpacked\\11_fr_e_brige.msh\\0_fr_e_brige.bin", FileMode.Open);
|
||||
|
||||
byte[] buffer = new byte[38];
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
fs.ReadExactly(buffer);
|
||||
|
||||
Console.WriteLine(string.Join(" ", buffer.Select(x => x.ToString("X2"))));
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,9 +0,0 @@
|
||||
using System.Buffers.Binary;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
// var missionFilePath = "C:\\Program Files (x86)\\Nikita\\Iron Strategy\\MISSIONS\\Autodemo.00\\data.tma";
|
||||
// var missionFilePath = "C:\\Program Files (x86)\\Nikita\\Iron Strategy\\MISSIONS\\Tutorial.01\\data.tma";
|
||||
var missionFilePath = "C:\\Program Files (x86)\\Nikita\\Iron Strategy\\MISSIONS\\CAMPAIGN\\CAMPAIGN.01\\Mission.02\\data.tma";
|
||||
// var missionFilePath = "C:\\Program Files (x86)\\Nikita\\Iron Strategy\\MISSIONS\\Single.01\\data.tma";
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Buffers.Binary;
|
||||
using System.Text;
|
||||
|
||||
// Unfinished
|
||||
|
||||
var fileBytes = File.ReadAllBytes("C:\\Program Files (x86)\\Nikita\\Iron Strategy\\gamefont-1.rlb");
|
||||
|
||||
var header = fileBytes.AsSpan().Slice(0, 32);
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
</Folder>
|
||||
<Project Path="Common\Common.csproj" Type="Classic C#" />
|
||||
<Project Path="CpDatLib\CpDatLib.csproj" Type="Classic C#" />
|
||||
<Project Path="MeshUnpacker/MeshUnpacker.csproj" />
|
||||
<Project Path="MissionDataUnpacker/MissionDataUnpacker.csproj" />
|
||||
<Project Path="MissionTmaLib/MissionTmaLib.csproj" />
|
||||
<Project Path="NLUnpacker/NLUnpacker.csproj" />
|
||||
<Project Path="NResLib/NResLib.csproj" />
|
||||
@@ -16,7 +14,5 @@
|
||||
<Project Path="ParkanPlayground/ParkanPlayground.csproj" />
|
||||
<Project Path="ScrLib/ScrLib.csproj" />
|
||||
<Project Path="TexmLib/TexmLib.csproj" />
|
||||
<Project Path="TextureDecoder/TextureDecoder.csproj" />
|
||||
<Project Path="VarsetLib/VarsetLib.csproj" />
|
||||
<Project Path="Visualisator/Visualisator.csproj" />
|
||||
</Solution>
|
||||
@@ -1,34 +0,0 @@
|
||||
using System.Buffers.Binary;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using TexmLib;
|
||||
|
||||
var folder = "C:\\Projects\\CSharp\\ParkanPlayground\\ParkanPlayground\\bin\\Debug\\net8.0\\ui.lib";
|
||||
|
||||
var files = Directory.EnumerateFiles(folder);
|
||||
|
||||
List<TexmFile> textureFiles = [];
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
try
|
||||
{
|
||||
var fs = new FileStream(file, FileMode.Open);
|
||||
|
||||
var parseResult = TexmParser.ReadFromStream(fs, file);
|
||||
|
||||
textureFiles.Add(parseResult.TexmFile);
|
||||
|
||||
Console.WriteLine($"Successfully read: {file}");
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine($"Failed read: {file}");
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var textureFile in textureFiles)
|
||||
{
|
||||
await textureFile.WriteToFolder("unpacked");
|
||||
Console.WriteLine($"Unpacked {Path.GetFileName(textureFile.FileName)} into folder");
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SixLabors.ImageSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TexmLib\TexmLib.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,180 +0,0 @@
|
||||
// Configure window options
|
||||
|
||||
using System.Buffers.Binary;
|
||||
using System.Numerics;
|
||||
using Silk.NET.OpenGL;
|
||||
using Silk.NET.Windowing;
|
||||
|
||||
public static class Program
|
||||
{
|
||||
private static string vertexShaderSource = @"
|
||||
#version 330 core
|
||||
layout (location = 0) in vec3 aPos;
|
||||
uniform mat4 uMVP;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = uMVP * vec4(aPos, 1.0);
|
||||
gl_PointSize = 8.0;
|
||||
}
|
||||
";
|
||||
|
||||
private static string fragmentShaderSource = @"
|
||||
#version 330 core
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = vec4(1.0, 1.0, 1.0, 1.0); // White points
|
||||
}
|
||||
";
|
||||
|
||||
|
||||
private static IWindow? window;
|
||||
private static GL? gl = null;
|
||||
|
||||
|
||||
private static uint shaderProgram = uint.MaxValue;
|
||||
private static uint vao = uint.MaxValue;
|
||||
private static uint vbo = uint.MaxValue;
|
||||
private static Matrix4x4 mvp = new Matrix4x4();
|
||||
private static float[] points = [];
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var path = "C:\\ParkanUnpacked\\Land.msh\\2_03 00 00 00_Land.bin";
|
||||
var bytes = File.ReadAllBytes(path);
|
||||
|
||||
points = new float[bytes.Length / 4];
|
||||
for (int i = 0; i < bytes.Length / 4; i++)
|
||||
{
|
||||
points[i] = BinaryPrimitives.ReadSingleBigEndian(bytes.AsSpan()[(i * 4)..]);
|
||||
}
|
||||
|
||||
var options = WindowOptions.Default;
|
||||
options.API = new GraphicsAPI(ContextAPI.OpenGL, new APIVersion(3, 3));
|
||||
options.Title = "3D Points with Silk.NET";
|
||||
window = Window.Create(options);
|
||||
|
||||
window.Load += OnLoad;
|
||||
window.Render += OnRender;
|
||||
window.Run();
|
||||
}
|
||||
|
||||
|
||||
unsafe static void OnLoad()
|
||||
{
|
||||
gl = window.CreateOpenGL();
|
||||
// Compile shaders
|
||||
uint vertexShader = gl.CreateShader(ShaderType.VertexShader);
|
||||
gl.ShaderSource(vertexShader, vertexShaderSource);
|
||||
gl.CompileShader(vertexShader);
|
||||
CheckShaderCompile(vertexShader);
|
||||
|
||||
uint fragmentShader = gl.CreateShader(ShaderType.FragmentShader);
|
||||
gl.ShaderSource(fragmentShader, fragmentShaderSource);
|
||||
gl.CompileShader(fragmentShader);
|
||||
CheckShaderCompile(fragmentShader);
|
||||
|
||||
// Create shader program
|
||||
shaderProgram = gl.CreateProgram();
|
||||
gl.AttachShader(shaderProgram, vertexShader);
|
||||
gl.AttachShader(shaderProgram, fragmentShader);
|
||||
gl.LinkProgram(shaderProgram);
|
||||
CheckProgramLink(shaderProgram);
|
||||
|
||||
gl.DeleteShader(vertexShader);
|
||||
gl.DeleteShader(fragmentShader);
|
||||
|
||||
// Create VAO and VBO
|
||||
vao = gl.GenVertexArray();
|
||||
gl.BindVertexArray(vao);
|
||||
|
||||
vbo = gl.GenBuffer();
|
||||
gl.BindBuffer(BufferTargetARB.ArrayBuffer, vbo);
|
||||
unsafe
|
||||
{
|
||||
fixed (float* ptr = points)
|
||||
{
|
||||
gl.BufferData(
|
||||
BufferTargetARB.ArrayBuffer,
|
||||
(nuint) (points.Length * sizeof(float)),
|
||||
ptr,
|
||||
BufferUsageARB.StaticDraw
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
gl.VertexAttribPointer(
|
||||
0,
|
||||
3,
|
||||
VertexAttribPointerType.Float,
|
||||
false,
|
||||
3 * sizeof(float),
|
||||
(void*) 0
|
||||
);
|
||||
gl.EnableVertexAttribArray(0);
|
||||
|
||||
gl.BindVertexArray(0); // Unbind VAO
|
||||
|
||||
gl.Enable(EnableCap.DepthTest);
|
||||
}
|
||||
|
||||
unsafe static void OnRender(double dt)
|
||||
{
|
||||
gl.ClearColor(
|
||||
0.1f,
|
||||
0.1f,
|
||||
0.1f,
|
||||
1.0f
|
||||
);
|
||||
gl.Clear((uint) (ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit));
|
||||
|
||||
// Set up MVP matrix
|
||||
Matrix4x4 view = Matrix4x4.CreateLookAt(
|
||||
new Vector3(100, 100, 40), // Camera position
|
||||
Vector3.Zero, // Look at origin
|
||||
Vector3.UnitY
|
||||
); // Up direction
|
||||
Matrix4x4 projection = Matrix4x4.CreatePerspectiveFieldOfView(
|
||||
(float) Math.PI / 4f, // 45 degrees
|
||||
(float) window.Size.X / window.Size.Y,
|
||||
0.1f,
|
||||
100f
|
||||
);
|
||||
mvp = view * projection;
|
||||
|
||||
gl.UseProgram(shaderProgram);
|
||||
|
||||
// Set MVP matrix (transpose=true for column-major format)
|
||||
int mvpLocation = gl.GetUniformLocation(shaderProgram, "uMVP");
|
||||
|
||||
fixed (Matrix4x4* ptr = &mvp)
|
||||
{
|
||||
gl.UniformMatrix4(
|
||||
mvpLocation,
|
||||
1,
|
||||
true,
|
||||
(float*) ptr
|
||||
);
|
||||
}
|
||||
|
||||
gl.BindVertexArray(vao);
|
||||
gl.DrawArrays(PrimitiveType.Points, 0, (uint) (points.Length / 3));
|
||||
}
|
||||
|
||||
// Error checking methods
|
||||
static void CheckShaderCompile(uint shader)
|
||||
{
|
||||
gl.GetShader(shader, ShaderParameterName.CompileStatus, out int success);
|
||||
if (success == 0)
|
||||
Console.WriteLine(gl.GetShaderInfoLog(shader));
|
||||
}
|
||||
|
||||
static void CheckProgramLink(uint program)
|
||||
{
|
||||
gl.GetProgram(program, ProgramPropertyARB.LinkStatus, out int success);
|
||||
if (success == 0)
|
||||
Console.WriteLine(gl.GetProgramInfoLog(program));
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
|
||||
<PackageReference Include="NativeFileDialogSharp" />
|
||||
<PackageReference Include="Silk.NET" />
|
||||
<PackageReference Include="Silk.NET.OpenGL.Extensions.ImGui" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user