mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Merge branch 'gfx-work' into sim
This commit is contained in:
53
Model3d.cpp
53
Model3d.cpp
@@ -740,7 +740,8 @@ void TSubModel::InitialRotate(bool doit)
|
||||
}
|
||||
else if (Global.iConvertModels & 2) {
|
||||
// optymalizacja jest opcjonalna
|
||||
if ((iFlags & 0xC000) == 0x8000) // o ile nie ma animacji
|
||||
if ( ((iFlags & 0xC000) == 0x8000) // o ile nie ma animacji
|
||||
&& ( false == is_emitter() ) ) // don't optimize smoke emitter attachment points
|
||||
{ // jak nie ma potomnych, można wymnożyć przez transform i wyjedynkować go
|
||||
float4x4 *mat = GetMatrix(); // transform submodelu
|
||||
if( false == Vertices.empty() ) {
|
||||
@@ -847,6 +848,26 @@ TSubModel::find_replacable4() {
|
||||
return std::make_tuple( nullptr, false );
|
||||
}
|
||||
|
||||
// locates particle emitter submodels and adds them to provided list
|
||||
void
|
||||
TSubModel::find_smoke_sources( nameoffset_sequence &Sourcelist ) const {
|
||||
|
||||
auto const name { ToLower( pName ) };
|
||||
|
||||
if( ( eType == TP_ROTATOR )
|
||||
&& ( pName.find( "smokesource_" ) == 0 ) ) {
|
||||
Sourcelist.emplace_back( pName, offset() );
|
||||
}
|
||||
|
||||
if( Next != nullptr ) {
|
||||
Next->find_smoke_sources( Sourcelist );
|
||||
}
|
||||
|
||||
if( Child != nullptr ) {
|
||||
Child->find_smoke_sources( Sourcelist );
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t TSubModel::FlagsCheck()
|
||||
{ // analiza koniecznych zmian pomiędzy submodelami
|
||||
// samo pomijanie glBindTexture() nie poprawi wydajności
|
||||
@@ -1086,7 +1107,7 @@ void TSubModel::RaAnimation(glm::mat4 &m, TAnimType a)
|
||||
}
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TSubModel::serialize_geometry( std::ostream &Output ) const {
|
||||
|
||||
@@ -1171,6 +1192,14 @@ void TSubModel::ColorsSet( glm::vec3 const &Ambient, glm::vec3 const &Diffuse, g
|
||||
*/
|
||||
};
|
||||
|
||||
bool
|
||||
TSubModel::is_emitter() const {
|
||||
|
||||
return (
|
||||
( eType == TP_ROTATOR )
|
||||
&& ( ToLower( pName ).find( "smokesource_" ) == 0 ) );
|
||||
}
|
||||
|
||||
// pobranie transformacji względem wstawienia modelu
|
||||
void TSubModel::ParentMatrix( float4x4 *m ) const {
|
||||
|
||||
@@ -1269,8 +1298,9 @@ TModel3d::~TModel3d() {
|
||||
}
|
||||
};
|
||||
|
||||
TSubModel *TModel3d::AddToNamed(const char *Name, TSubModel *SubModel)
|
||||
{
|
||||
TSubModel *
|
||||
TModel3d::AddToNamed(const char *Name, TSubModel *SubModel) {
|
||||
|
||||
TSubModel *sm = Name ? GetFromName(Name) : nullptr;
|
||||
if( ( sm == nullptr )
|
||||
&& ( Name != nullptr ) && ( std::strcmp( Name, "none" ) != 0 ) ) {
|
||||
@@ -1282,6 +1312,7 @@ TSubModel *TModel3d::AddToNamed(const char *Name, TSubModel *SubModel)
|
||||
|
||||
// jedyny poprawny sposób dodawania submodeli, inaczej mogą zginąć przy zapisie E3D
|
||||
void TModel3d::AddTo(TSubModel *tmp, TSubModel *SubModel) {
|
||||
|
||||
if (tmp) {
|
||||
// jeśli znaleziony, podłączamy mu jako potomny
|
||||
tmp->ChildAdd(SubModel);
|
||||
@@ -1308,6 +1339,18 @@ TSubModel *TModel3d::GetFromName(std::string const &Name) const
|
||||
}
|
||||
};
|
||||
|
||||
// locates particle source submodels and stores them on internal list
|
||||
nameoffset_sequence const &
|
||||
TModel3d::find_smoke_sources() {
|
||||
|
||||
m_smokesources.clear();
|
||||
if( Root != nullptr ) {
|
||||
Root->find_smoke_sources( m_smokesources );
|
||||
}
|
||||
|
||||
return smoke_sources();
|
||||
}
|
||||
|
||||
// returns offset vector from root
|
||||
glm::vec3
|
||||
TSubModel::offset( float const Geometrytestoffsetthreshold ) const {
|
||||
@@ -1954,6 +1997,8 @@ void TModel3d::Init()
|
||||
asBinary = ""; // zablokowanie powtórnego zapisu
|
||||
}
|
||||
}
|
||||
// check if the model contains particle emitters
|
||||
find_smoke_sources();
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user