This repository has been archived by the owner on Apr 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nicolay B. aka RD_AAOW
committed
May 25, 2020
1 parent
6e3f80a
commit 2d7fe27
Showing
9 changed files
with
978 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Make CST changes log | ||
|
||
Version 1.5u: | ||
• Application namespace, icon and development environment have been unified; | ||
• Publication on GitHub | ||
|
||
Version 1.4 | ||
• Added support for direct extraction of model's shape from DFF (not for all versions for now) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,29 @@ | ||
# MakeCST | ||
# MakeCST v 1.5u | ||
|
||
A tool for converting DFF models and QHullOFF objects to GTA Vice city collision scripts | ||
|
||
Инструмент для преобразования моделей DFF и объектов QHullOFF в скрипты столкновений GTA Vice city | ||
|
||
# | ||
|
||
Version 1.4 supports direct extraction of model's shape from DFF (not for all versions | ||
for now) and immediate creation of GTA Vice city CST script. But as so as before it is | ||
possible to generate CST from QHull OFF object that can be retrieved from DFF | ||
|
||
Версия 1.4 поддерживает прямое извлечение формы модели из DFF (пока не для всех версий) | ||
и немедленное создание скрипта CST GTA Vice city. Но, как и раньше, можно генерировать | ||
CST из объекта QHull OFF, который можно получить из DFF | ||
|
||
# | ||
|
||
We've formalized our [Applications development policy (ADP)](https://vk.com/@rdaaow_fupl-adp). | ||
We're strongly recommend reading it before using our products. | ||
|
||
Мы формализовали нашу [Политику разработки приложений (ADP)](https://vk.com/@rdaaow_fupl-adp). | ||
Настоятельно рекомендуем ознакомиться с ней перед использованием наших продуктов. | ||
|
||
# | ||
|
||
Needs Windows XP and newer, Framework 4.0 and newer. Interface languages: en_us | ||
|
||
Требуется ОС Windows XP и новее, Framework 4.0 и новее. Языки интерфейса: en_us |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.IO; | ||
|
||
namespace RD_AAOW | ||
{ | ||
/// <summary> | ||
/// Класс описывает спецификации форматов CST1 и CST2 | ||
/// </summary> | ||
public class CSTWriter | ||
{ | ||
// Переменные | ||
|
||
// Определитель формата чисел | ||
private static CultureInfo cie = new CultureInfo ("en-us"); | ||
|
||
/// <summary> | ||
/// Расширение формата файла | ||
/// </summary> | ||
public const string MasterExtension = "cst"; | ||
|
||
/// <summary> | ||
/// Метод создаёт CST-скрипт по указанным точкам | ||
/// </summary> | ||
/// <param name="FileName">Имя создаваемого файла</param> | ||
/// <param name="Points">Вершины модели</param> | ||
/// <param name="Triangles">Треугольники модели</param> | ||
/// <returns>Возвращает true в случае успеха</returns> | ||
public static bool WriteCST (string FileName, List<Point3D> Points, List<Triangle3D> Triangles) | ||
{ | ||
return WriteCST (FileName, false, Points, Triangles); | ||
} | ||
|
||
/// <summary> | ||
/// Метод создаёт CST-скрипт по указанным точкам | ||
/// </summary> | ||
/// <param name="FileName">Имя создаваемого файла</param> | ||
/// <param name="CST1">Флаг указывает на необходимость записи скрипта первой версии</param> | ||
/// <param name="Points">Вершины модели</param> | ||
/// <param name="Triangles">Треугольники модели</param> | ||
/// <returns>Возвращает true в случае успеха</returns> | ||
public static bool WriteCST (string FileName, bool CST1, List<Point3D> Points, List<Triangle3D> Triangles) | ||
{ | ||
FileStream FS = null; | ||
try | ||
{ | ||
FS = new FileStream (FileName + MasterExtension, FileMode.Create); | ||
} | ||
catch | ||
{ | ||
return false; | ||
} | ||
StreamWriter SW = new StreamWriter (FS); | ||
|
||
// Заголовок и пустые поля | ||
SW.WriteLine ("# Converted with " + ProgramDescription.AssemblyDescription + "\n"); | ||
if (CST1) | ||
{ | ||
SW.WriteLine ("=> Spheres: 0\n"); | ||
SW.WriteLine ("=> Boxes: 0\n"); | ||
} | ||
else | ||
{ | ||
SW.WriteLine ("CST2\n"); | ||
} | ||
|
||
// Запись точек | ||
if (CST1) | ||
{ | ||
SW.WriteLine ("=> Vertex count: " + Points.Count.ToString ()); | ||
} | ||
else | ||
{ | ||
SW.WriteLine (Points.Count.ToString () + ", Vertex"); | ||
} | ||
|
||
for (int p = 0; p < Points.Count; p++) | ||
{ | ||
if (CST1) | ||
{ | ||
SW.WriteLine ("V " + p.ToString ("D03") + ": " + Points[p].X.ToString (cie.NumberFormat) + "; " + | ||
Points[p].Y.ToString (cie.NumberFormat) + "; " + Points[p].Z.ToString (cie.NumberFormat)); | ||
} | ||
else | ||
{ | ||
SW.WriteLine (Points[p].X.ToString (cie.NumberFormat) + ", " + | ||
Points[p].Y.ToString (cie.NumberFormat) + ", " + Points[p].Z.ToString (cie.NumberFormat)); | ||
} | ||
} | ||
|
||
// Запись треугольников | ||
if (CST1) | ||
{ | ||
SW.WriteLine ("\n=> Face count: " + Triangles.Count.ToString ()); | ||
} | ||
else | ||
{ | ||
SW.WriteLine ("\n" + Triangles.Count.ToString () + ", Face"); | ||
} | ||
|
||
for (int t = 0; t < Triangles.Count; t++) | ||
{ | ||
// Непрямой порядок треугольников требуется для того, чтобы избежать "выворачивания" модели | ||
if (CST1) | ||
{ | ||
SW.WriteLine ("F " + t.ToString ("D03") + ": " + Triangles[t].Point2ArrayPosition.ToString () + "; " + | ||
Triangles[t].Point1ArrayPosition.ToString () + "; " + Triangles[t].Point3ArrayPosition.ToString () + | ||
" | [0]"); | ||
} | ||
else | ||
{ | ||
SW.WriteLine (Triangles[t].Point2ArrayPosition.ToString () + ", " + | ||
Triangles[t].Point1ArrayPosition.ToString () + ", " + Triangles[t].Point3ArrayPosition.ToString () + | ||
", 0, 0, 0, 0"); | ||
} | ||
} | ||
|
||
// Завершение | ||
SW.Close (); | ||
FS.Close (); | ||
return true; | ||
} | ||
} | ||
} |
Oops, something went wrong.