mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 22:07:55 +01:00
2edf9c410d
* feat(render): the Vulkan renderer keeps the vertex streams of E4D models as they are, 28 bytes a vertex
Stage 3 of the E4D model format. A model loaded from .e4d (modelformat e4d) reaches the Vulkan renderer as its compact
streams: positions (12 B), attributes (QTangent snorm16x4 + uv f32x2, 16 B), user data and indices, without the 48-byte
gfx::basic_vertex in between.
- gfx: gfx::compact_attributes, geometry_bank::create_compact() and GfxRenderer->Insert_Compact(). The default of
Insert_Compact decodes to basic_vertex, so the OpenGL 4.6 and the null renderers get the models as before. The CPU
readers of a chunk (pantograph, bounds, picking, the editor) get basic_vertex made from the streams the first time they
read it; a chunk which is changed (replace, append) turns into basic_vertex first.
- Vulkan: a bank whose chunks are all compact keeps positions, user data, attributes and indices in buffers of their own;
vertex_kind::scene_compact reads them (location 5 the quaternion as R16G16B16A16_SNORM). A program gets a COMPACT_VERTEX
variant the first time a compact chunk is drawn with it, in the background with gfx.vulkan.asyncresources, as the
MODEL_DRAWS one; the variant of the multi draws makes a compact one of its own. Only vertex.vert and cabprobe.vert
decode the normal (compact_frame() in common.glsl); the shaders of shadows, prepass, picking and cube shadows read
position and uv as before.
- Ray tracing: the BLAS of a compact chunk reads the positions with a stride of 12, and the reflections read the normal
and uv from the attributes (RT_FLAG_COMPACT in the record). Not tried with ray tracing on.
- The loader hands the streams of the file to Insert_Compact as they are; the stars keep their colours in the normals
of basic_vertex and go as before.
Measured on Vulkan (self-test, 250 models of the game, runs alternating with legacy): device memory 1.60-1.64 GiB
against 1.89 GiB, GPU time a frame 1.27-1.39 ms against 1.37-1.57 ms, the same frame time and load time, the picture
within 1/255 of the legacy one, no errors of Vulkan in the log. Unit tests 1189/1189; -e4d diff gives the same results
through the new decode. Not built with GCC here.
* refactor(model): the new model format is EU07M (.eu07m), not E4D
E4D read as the next version of E3D, which the format isn't meant to be tied to; EU07M goes with the world format .eu07.
The format isn't released, so nothing reads the old name.
- The extension .eu07m, the magic EU7M (the four bytes of the header), model/eu07m/ with eu07m_*.{h,cpp},
namespace eu07m, docs/eu07m-format.md, tests/unit/test_eu07m.cpp.
- The command line -eu07m convert|dump|validate|diff, TModel3d::LoadFromEU07M, and the key modelformat eu07m|legacy
of eu07.ini (Global.modelformat_eu07m).
- Nothing else changes: the sections, the records and the components are the same, so a converted file needs only its
magic and its extension changed.
Unit tests 1189/1189.
* fix(render): EU07M review of #537: no whole vertices kept for the bounds, the compact variant checked by CI and given up when it fails
- The bounding radius, offset() and MaxY() read the positions of a chunk alone (Positions(), geometry_bank::positions()):
on Vulkan the compact streams are no longer decoded into basic_vertex and kept for the life of the bank as every model
loads, so the host memory of EU07M models stays below that of E3D. What still needs whole vertices (the editor, the
picking, the export) decodes them on first use as before.
- A COMPACT_VERTEX variant which doesn't compile is told once in the log and the banks of EU07M models go back to
basic_vertex (compact_layout_failed()), those built already when they are drawn next, instead of the models being left
out for the session.
- The shader validator compiles the vk14 shaders which have COMPACT_VERTEX with it, alone and with MODEL_DRAWS, as the
renderer makes the variants.
* feat(model): the EU07M model files take the .r3a extension, the switch is modelformat r3a
The model files of the format are named .r3a in place of .eu07m, and eu07.ini selects them with modelformat r3a in place of
modelformat eu07m. The format keeps its name (EU07M), its magic and the -eu07m command line tool. Neither the extension nor
the key has been released, so nothing reads the old ones.
* feat(model): the EU07M model files take the .ng3d extension, the switch is modelformat ng3d
In place of .r3a (2fe1064f9): the model files are .ng3d and eu07.ini selects them with modelformat ng3d. The format keeps its name (EU07M), its magic and the -eu07m command line tool. Neither name has been released.
364 lines
18 KiB
C++
364 lines
18 KiB
C++
/*
|
|
This Source Code Form is subject to the
|
|
terms of the Mozilla Public License, v.
|
|
2.0. If a copy of the MPL was not
|
|
distributed with this file, You can
|
|
obtain one at
|
|
http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "utilities/Classes.h"
|
|
#include "utilities/Float3d.h"
|
|
#include "rendering/geometrybank.h"
|
|
#include "model/material.h"
|
|
|
|
#include <string_view>
|
|
|
|
#define EU07_USE_GEOMETRYINDEXING
|
|
|
|
// Ra: specjalne typy submodeli, poza tym GL_TRIANGLES itp.
|
|
const int TP_ROTATOR = 256;
|
|
const int TP_FREESPOTLIGHT = 257;
|
|
const int TP_STARS = 258;
|
|
const int TP_TEXT = 259;
|
|
|
|
enum class TAnimType // rodzaj animacji
|
|
{
|
|
at_None, // brak
|
|
at_Rotate, // obrót względem wektora o kąt
|
|
at_RotateXYZ, // obrót względem osi o kąty
|
|
at_Translate, // przesunięcie
|
|
at_SecondsJump, // sekundy z przeskokiem
|
|
at_MinutesJump, // minuty z przeskokiem
|
|
at_HoursJump, // godziny z przeskokiem 12h/360°
|
|
at_Hours24Jump, // godziny z przeskokiem 24h/360°
|
|
at_Seconds, // sekundy płynnie
|
|
at_Minutes, // minuty płynnie
|
|
at_Hours, // godziny płynnie 12h/360°
|
|
at_Hours24, // godziny płynnie 24h/360°
|
|
at_Billboard, // obrót w pionie do kamery
|
|
at_Wind, // ruch pod wpływem wiatru
|
|
at_Sky, // animacja nieba
|
|
at_Digital, // dziesięciocyfrowy licznik mechaniczny (z cylindrami)
|
|
at_DigiClk, // zegar cyfrowy jako licznik na dziesięciościanach
|
|
at_Undefined // animacja chwilowo nieokreślona
|
|
};
|
|
|
|
namespace scene {
|
|
class shape_node;
|
|
}
|
|
|
|
class TModel3d;
|
|
using nameoffset_sequence = std::vector<std::pair<std::string, glm::vec3>>;
|
|
|
|
class TSubModel
|
|
{ // klasa submodelu - pojedyncza siatka, punkt świetlny albo grupa punktów
|
|
//m7todo: zrobić normalną serializację
|
|
|
|
friend opengl46_renderer;
|
|
friend TModel3d; // temporary workaround. TODO: clean up class content/hierarchy
|
|
friend TDynamicObject; // temporary etc
|
|
friend scene::shape_node; // temporary etc
|
|
|
|
public:
|
|
enum normalization {
|
|
none = 0,
|
|
rescale,
|
|
normalize
|
|
};
|
|
struct geometry_data {
|
|
gfx::geometry_handle handle;
|
|
int vertex_offset;
|
|
int vertex_count;
|
|
int index_offset;
|
|
int index_count;
|
|
};
|
|
|
|
public:
|
|
int iNext{ 0 };
|
|
int iChild{ 0 };
|
|
int eType{ TP_ROTATOR }; // Ra: modele binarne dają więcej możliwości niż mesh złożony z trójkątów
|
|
int iName{ -1 }; // numer łańcucha z nazwą submodelu, albo -1 gdy anonimowy
|
|
public: // chwilowo
|
|
TAnimType b_Anim{ TAnimType::at_None };
|
|
|
|
bool HasAnyVertexUserData() const;
|
|
|
|
public:
|
|
uint32_t iFlags{ 0x0200 }; // bit 9=1: submodel został utworzony a nie ustawiony na wczytany plik
|
|
// flagi informacyjne:
|
|
// bit 0: =1 faza rysowania zależy od wymiennej tekstury 0
|
|
// bit 1: =1 faza rysowania zależy od wymiennej tekstury 1
|
|
// bit 2: =1 faza rysowania zależy od wymiennej tekstury 2
|
|
// bit 3: =1 faza rysowania zależy od wymiennej tekstury 3
|
|
// bit 4: =1 rysowany w fazie nieprzezroczystych (stała tekstura albo brak)
|
|
// bit 5: =1 rysowany w fazie przezroczystych (stała tekstura)
|
|
// bit 7: =1 ta sama tekstura, co poprzedni albo nadrzędny
|
|
// bit 8: =1 wierzchołki wyświetlane z indeksów
|
|
// bit 9: =1 wczytano z pliku tekstowego (jest właścicielem tablic)
|
|
// bit 13: =1 wystarczy przesunięcie zamiast mnożenia macierzy (trzy jedynki)
|
|
// bit 14: =1 wymagane przechowanie macierzy (animacje)
|
|
// bit 15: =1 wymagane przechowanie macierzy (transform niejedynkowy)
|
|
// the pass bits (0x30) weren't in the file but guessed on load from the material (BinInit); a converter keeps them out,
|
|
// so the guess is made again with the real material where the model is drawn
|
|
bool m_passguessed{false};
|
|
union
|
|
{ // transform, nie każdy submodel musi mieć
|
|
float4x4 *fMatrix = nullptr; // pojedyncza precyzja wystarcza
|
|
int iMatrix; // w pliku binarnym jest numer matrycy
|
|
};
|
|
float transformscalestack { 1.0f }; // tolerancescale used in calculate_indices for whole matrix chain
|
|
int iTexture { 0 }; // numer nazwy tekstury, -1 wymienna, 0 brak
|
|
float fLight { -1.0f }; // próg jasności światła do zadziałania selfillum
|
|
glm::vec4
|
|
f4Ambient { 1.0f,1.0f,1.0f,1.0f },
|
|
f4Diffuse { 1.0f,1.0f,1.0f,1.0f },
|
|
f4Specular { 0.0f,0.0f,0.0f,1.0f },
|
|
f4Emision { 1.0f,1.0f,1.0f,1.0f };
|
|
glm::vec3 DiffuseOverride { -1.f };
|
|
normalization m_normalizenormals { normalization::none }; // indicates vectors need to be normalized due to scaling etc
|
|
float fHotspotPower { 1.0f }; // natężenie światła punktowego (hotspotpower/100), kolor określa tylko f4Diffuse
|
|
float fWireSize { 0.0f }; // nie używane, ale wczytywane
|
|
float fSquareMaxDist { 10000.0f * 10000.0f };
|
|
float fSquareMinDist { 0.0f };
|
|
// McZapkie-050702: parametry dla swiatla:
|
|
float fNearAttenStart { 40.0f };
|
|
float fNearAttenEnd { 80.0f };
|
|
bool bUseNearAtten { false }; // te 3 zmienne okreslaja rysowanie aureoli wokol zrodla swiatla
|
|
int iFarAttenDecay { 0 }; // ta zmienna okresla typ zaniku natezenia swiatla (0:brak, 1,2: potega 1/R)
|
|
float fFarDecayRadius { 100.0f }; // normalizacja j.w.
|
|
float fCosFalloffAngle { 0.5f }; // cosinus kąta stożka pod którym widać światło
|
|
float fCosHotspotAngle { 0.3f }; // cosinus kąta stożka pod którym widać aureolę i zwiększone natężenie światła
|
|
// opcjonalne parametry światła punktowego (np. z eksportu z blendera):
|
|
float fLightRadius { 0.0f }; // promień kuli świecącej (radius:), metry; 0 to punkt. świeci powierzchnia kuli, więc środek może być np. wewnątrz klosza
|
|
bool bShadeSelf { false }; // cienie światła rzuca także model, do którego ono należy (shadeself:)
|
|
bool bCastShadows { true }; // światło rzuca cienie (castshadows:)
|
|
bool bSoftFalloff { false }; // natężenie maleje jak 1 / (d^2 + r^2), jak przy soft falloff blendera, zamiast świecenia z powierzchni kuli (softfalloff:)
|
|
bool bLightOnly { false }; // tylko oświetlenie: bez świecącego punktu i poświaty, widocznych z daleka (lightonly:)
|
|
float fCosViewAngle { 0.0f }; // cos kata pod jakim sie teraz patrzy
|
|
|
|
bool m_rotation_init_done = false;
|
|
|
|
public:
|
|
TSubModel *Next { nullptr };
|
|
TSubModel *Child { nullptr };
|
|
public:
|
|
material_handle m_material { null_handle }; // numer tekstury, -1 wymienna, 0 brak
|
|
// index of the top level branch of the model this submodel belongs to. submodels sharing a branch
|
|
// also share the texture variant picked for them, so a multi-mesh load chunk stays consistent
|
|
int m_variantgroup { 0 };
|
|
bool bWire { false }; // nie używane, ale wczytywane
|
|
float Opacity { 1.0f };
|
|
float f_Angle { 0.0f };
|
|
float3 v_RotateAxis { 0.0f, 0.0f, 0.0f };
|
|
float3 v_Angles { 0.0f, 0.0f, 0.0f };
|
|
|
|
public: // chwilowo
|
|
float3 v_TransVector { 0.0f, 0.0f, 0.0f };
|
|
geometry_data m_geometry { /*this,*/ { 0, 0 }, 0, 0, 0, 0 };
|
|
gfx::vertex_array Vertices;
|
|
gfx::userdata_array Userdata;
|
|
gfx::index_array Indices;
|
|
// the compact streams of a submodel loaded from EU07M, in place of Vertices till they go to the renderer (Insert_Compact())
|
|
gfx::position_array CompactPositions;
|
|
gfx::compact_array CompactAttributes;
|
|
float m_boundingradius { 0 };
|
|
std::uintptr_t iAnimOwner{ 0 }; // roboczy numer egzemplarza, który ustawił animację
|
|
TAnimType b_aAnim{ TAnimType::at_None }; // kody animacji oddzielnie, bo zerowane
|
|
std::shared_ptr<float4x4> mAnimMatrix; // macierz do animacji kwaternionowych
|
|
// text display (TP_TEXT) data, filled on first use
|
|
std::unordered_map<char32_t, TSubModel *> m_letters; // sub-models of the available characters, by unicode code point
|
|
bool m_lettersready { false }; // whether the character lookup was built yet
|
|
// transparent hasher, so the text layouts can be looked up with any string type without a temporary std::string
|
|
struct text_hash {
|
|
using is_transparent = void;
|
|
std::size_t operator()( std::string_view const Text ) const noexcept { return std::hash<std::string_view>{}( Text ); }
|
|
};
|
|
std::unordered_map<std::string, std::vector<TSubModel *>, text_hash, std::equal_to<>> m_textlayouts; // sub-models of consecutive characters, for each text shown
|
|
TSubModel *Parent{ nullptr }; // nadrzędny, np. do wymnażania macierzy
|
|
int iVisible { 1 }; // roboczy stan widoczności
|
|
float fVisible { 1.f }; // visibility level
|
|
std::string m_materialname; // robocza nazwa tekstury do zapisania w pliku binarnym
|
|
std::string pName; // robocza nazwa
|
|
public:
|
|
int SeekFaceNormal( std::vector<unsigned int> const &Masks, int const Startface, unsigned int const Mask, glm::vec3 const &Position, gfx::vertex_array const &Vertices );
|
|
void RaAnimation(TAnimType a);
|
|
void RaAnimation(glm::mat4 &m, TAnimType a);
|
|
// returns true if the submodel is a smoke emitter attachment point, false otherwise
|
|
bool is_emitter() const;
|
|
|
|
public:
|
|
// the state of the walk drawing a model: per thread, as the vulkan renderer walks the passes of the scene on several of them at
|
|
// once (gfx.vulkan.parallelpasses)
|
|
static thread_local size_t iInstance; // identyfikator egzemplarza, który aktualnie renderuje model
|
|
// seed of the currently rendered model instance, combined with m_variantgroup it picks
|
|
// texture variants for materials which declare them. 0 for instances without own seed
|
|
static thread_local std::uint32_t iVariantSeed;
|
|
static thread_local material_handle const *ReplacableSkinId;
|
|
static thread_local int iAlpha; // maska bitowa dla danego przebiegu
|
|
static thread_local float fSquareDist;
|
|
static thread_local TModel3d *pRoot;
|
|
static thread_local std::string *pasText; // tekst dla wyświetlacza (!!!! do przemyślenia)
|
|
TSubModel() = default;
|
|
~TSubModel();
|
|
std::pair<int, int> Load(cParser &Parser, /*TModel3d *Model, int Pos,*/ bool dynamic);
|
|
void ChildAdd(TSubModel *SubModel);
|
|
void NextAdd(TSubModel *SubModel);
|
|
TSubModel * NextGet() { return Next; };
|
|
TSubModel * ChildGet() { return Child; };
|
|
int count_siblings();
|
|
int count_children();
|
|
// locates submodel mapped with replacable -4
|
|
std::tuple<TSubModel *, bool> find_replacable4();
|
|
// locates particle emitter submodels and adds them to provided list
|
|
void find_smoke_sources( nameoffset_sequence &Sourcelist ) const;
|
|
#ifndef EU07_USE_GEOMETRYINDEXING
|
|
int TriangleAdd(TModel3d *m, material_handle tex, int tri);
|
|
#endif
|
|
void SetRotate(float3 vNewRotateAxis, float fNewAngle);
|
|
void SetRotateXYZ(glm::vec3 vNewAngles);
|
|
void SetRotateXYZ(float3 vNewAngles);
|
|
void SetTranslate(glm::vec3 vNewTransVector);
|
|
void SetTranslate(float3 vNewTransVector);
|
|
void SetRotateIK1(float3 vNewAngles);
|
|
TSubModel * GetFromName( std::string const &search, bool i = true );
|
|
// text display (TP_TEXT): returns sub-models of the characters to draw for provided text, in drawing order
|
|
std::vector<TSubModel *> const & text_letters( std::string const &Text );
|
|
inline float4x4 * GetMatrix() { return fMatrix; };
|
|
inline float4x4 const * GetMatrix() const { return fMatrix; };
|
|
// returns offset vector from root
|
|
glm::vec3 offset( float const Geometrytestoffsetthreshold = 0.f ) const;
|
|
inline void Hide() { iVisible = 0; };
|
|
|
|
void create_geometry( std::size_t &Indexoffset, std::size_t &Vertexoffset, gfx::geometrybank_handle const &Bank );
|
|
uint32_t FlagsCheck();
|
|
void WillBeAnimated() {
|
|
iFlags |= 0x4000; };
|
|
void InitialRotate(bool doit);
|
|
void BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t, std::vector<std::string> *n, bool dynamic);
|
|
static void ReplacableSet(material_handle const *r, int a) {
|
|
ReplacableSkinId = r;
|
|
iAlpha = a; };
|
|
// returns id of texture variant to use for provided submodel of the currently rendered instance
|
|
static std::uint32_t VariantId(TSubModel const *Submodel);
|
|
void Name_Material( std::string const &Name );
|
|
void Name( std::string const &Name );
|
|
// Ra: funkcje do budowania terenu z E3D
|
|
uint32_t Flags() const { return iFlags; };
|
|
void UnFlagNext() { iFlags &= 0x00FFFFFF; };
|
|
void ColorsSet( glm::vec3 const &Ambient, glm::vec3 const &Diffuse, glm::vec3 const &Specular );
|
|
// sets rgb components of diffuse color override to specified value
|
|
void SetDiffuseOverride( glm::vec3 const &Color, bool const Includechildren = false, bool const Includesiblings = false );
|
|
// gets rgb components of any freespot diffuse color (searches also in children)
|
|
std::optional<glm::vec3> GetDiffuse( float Includesiblings = false );
|
|
// sets visibility level (alpha component) to specified value
|
|
void SetVisibilityLevel( float const Level, bool const Includechildren = false, bool const Includesiblings = false );
|
|
// sets light level (alpha component of illumination color) to specified value
|
|
void SetLightLevel( glm::vec4 const &Level, bool const Includechildren = false, bool const Includesiblings = false );
|
|
// sets activation threshold of self-illumination to specitied value
|
|
void SetSelfIllum( float const Threshold, bool const Includechildren = false, bool const Includesiblings = false );
|
|
inline float3 Translation1Get() {
|
|
return fMatrix ? *fMatrix->TranslationGet() + v_TransVector : v_TransVector; }
|
|
inline float3 Translation2Get() {
|
|
return *fMatrix->TranslationGet() + Child->Translation1Get(); }
|
|
material_handle GetMaterial() const {
|
|
return m_material; }
|
|
void ParentMatrix(float4x4 *m) const;
|
|
void ReplaceMatrix(const glm::mat4 &mat);
|
|
void ReplaceMaterial(const std::string &name);
|
|
float MaxY( float4x4 const &m );
|
|
std::shared_ptr<std::vector<glm::vec2>> screen_touch_list; // for python screen touching
|
|
glm::mat4 future_transform;
|
|
|
|
void deserialize(std::istream&);
|
|
void serialize(std::ostream&,
|
|
std::vector<TSubModel*>&,
|
|
std::vector<std::string>&,
|
|
std::vector<std::string>&,
|
|
std::vector<float4x4>&);
|
|
void serialize_geometry( std::ostream &Output, bool const Packed, bool const Indexed, bool const UserData ) const;
|
|
int index_size() const;
|
|
void serialize_indices( std::ostream &Output, int const Size ) const;
|
|
// places contained geometry in provided ground node
|
|
};
|
|
|
|
class TModel3d
|
|
{
|
|
friend opengl46_renderer;
|
|
|
|
public:
|
|
// submodels which scenery instances of the model refer to by name
|
|
struct instance_submodels {
|
|
std::array<TSubModel *, 8> lights_on {}; // Light_On00 - Light_On07
|
|
std::array<TSubModel *, 8> lights_off {}; // Light_Off00 - Light_Off07
|
|
std::array<TSubModel *, 4> variants {}; // winter_variant, spring_variant, summer_variant, autumn_variant
|
|
};
|
|
TSubModel *Root { nullptr }; // drzewo submodeli
|
|
uint32_t iFlags { 0 }; // Ra: czy submodele mają przezroczyste tekstury
|
|
public: // Ra: tymczasowo
|
|
gfx::geometrybank_handle m_geometrybank;
|
|
int m_indexcount { 0 };
|
|
int m_vertexcount { 0 }; // ilość wierzchołków
|
|
private:
|
|
std::vector<std::string> Textures; // nazwy tekstur
|
|
std::vector<std::string> Names; // nazwy submodeli
|
|
std::vector<float4x4> Matrices; // submodel matrices
|
|
int iSubModelsCount { 0 }; // Ra: używane do tworzenia binarnych
|
|
std::string asBinary; // nazwa pod którą zapisać model binarny
|
|
std::string m_filename;
|
|
nameoffset_sequence m_smokesources; // list of particle sources defined in the model
|
|
instance_submodels m_instancesubmodels; // filled on first use, see instance_parts()
|
|
bool m_instancesubmodelslocated { false };
|
|
std::vector<float> m_lodbounds; // filled on first use, see lod_bounds()
|
|
bool m_lodboundsfound { false };
|
|
std::uint32_t m_stateversion { 0 }; // see state_version()
|
|
|
|
void finish_binary( bool dynamic, bool hastangents );
|
|
|
|
public:
|
|
TModel3d() = default;
|
|
~TModel3d();
|
|
float bounding_radius() const {
|
|
return Root ? Root->m_boundingradius : 0.f; }
|
|
inline TSubModel * GetSMRoot() { return Root; };
|
|
TSubModel * GetFromName(std::string const &Name) const;
|
|
// returns submodels which scenery instances of the model refer to by name. the search for a name goes through the whole
|
|
// submodel tree, so it's done once for the model instead of once for each of its instances
|
|
instance_submodels const & instance_parts();
|
|
// returns the distinct bounds of the visibility ranges of the submodels (fSquareMinDist and fSquareMaxDist, squared), sorted:
|
|
// they split the distance into bands in which the same submodels are drawn. found once for the model, like instance_parts()
|
|
std::vector<float> const & lod_bounds();
|
|
// the submodels of the model are shared by everything drawn with it, which sets their state (lights, animations, visibility)
|
|
// before it's drawn. the version changes when something which may set it differently than the last time did, or the submodels
|
|
// changed, so the renderer can tell whether what it worked out from them still holds
|
|
std::uint32_t state_version() const {
|
|
return m_stateversion; }
|
|
void state_changed() {
|
|
++m_stateversion; }
|
|
TSubModel * AddToNamed(const char *Name, TSubModel *SubModel);
|
|
nameoffset_sequence const & find_smoke_sources();
|
|
void AddTo(TSubModel *tmp, TSubModel *SubModel);
|
|
void LoadFromTextFile(std::string const &FileName, bool dynamic);
|
|
void LoadFromBinFile(std::string const &FileName, bool dynamic);
|
|
// the model from an EU07M file (model/eu07m/eu07m_load.cpp), as LoadFromBinFile builds it from E3D. returns false, with the reason
|
|
// in the log and nothing loaded, when the file can't be read or isn't valid
|
|
bool LoadFromEU07M(std::string const &FileName, bool dynamic);
|
|
bool LoadFromFile(std::string const &FileName, bool dynamic);
|
|
TSubModel *AppendChildFromGeometry(const std::string &name, const std::string &parent, const gfx::vertex_array &vertices, const gfx::index_array &indices);
|
|
void SaveToBinFile(std::string const &FileName);
|
|
uint32_t Flags() const { return iFlags; };
|
|
void Init();
|
|
// assigns each top level branch of the model, and everything below it, its own variant group id
|
|
void assign_variant_groups();
|
|
std::string NameGet() const { return m_filename; };
|
|
nameoffset_sequence const & smoke_sources() const {
|
|
return m_smokesources; }
|
|
int TerrainCount() const;
|
|
TSubModel * TerrainSquare(int n);
|
|
void deserialize(std::istream &s, size_t size, bool dynamic);
|
|
};
|
|
|
|
//---------------------------------------------------------------------------
|