(✿◠‿◠)

This commit is contained in:
SamGondelman 2019-05-16 18:50:04 -07:00
parent 3eac2cf1d6
commit de90c5088c
15 changed files with 230 additions and 192 deletions

View file

@ -1325,7 +1325,7 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
// Check for addition // Check for addition
if (_hasModel && !model) { if (_hasModel && !model) {
model = std::make_shared<Model>(nullptr, entity.get()); model = std::make_shared<Model>(nullptr, entity.get(), _created);
connect(model.get(), &Model::requestRenderUpdate, this, &ModelEntityRenderer::requestRenderUpdate); connect(model.get(), &Model::requestRenderUpdate, this, &ModelEntityRenderer::requestRenderUpdate);
connect(model.get(), &Model::setURLFinished, this, [&](bool didVisualGeometryRequestSucceed) { connect(model.get(), &Model::setURLFinished, this, [&](bool didVisualGeometryRequestSucceed) {
setKey(didVisualGeometryRequestSucceed); setKey(didVisualGeometryRequestSucceed);

View file

@ -64,6 +64,7 @@ namespace scriptable {
* @property {string} lightmapParams * @property {string} lightmapParams
* @property {string} materialParams * @property {string} materialParams
* @property {boolean} defaultFallthrough * @property {boolean} defaultFallthrough
* @property {string} procedural
*/ */
class ScriptableMaterial { class ScriptableMaterial {
public: public:
@ -98,6 +99,8 @@ namespace scriptable {
bool defaultFallthrough; bool defaultFallthrough;
std::unordered_map<uint, bool> propertyFallthroughs; // not actually exposed to script std::unordered_map<uint, bool> propertyFallthroughs; // not actually exposed to script
QString procedural;
graphics::MaterialKey key { 0 }; graphics::MaterialKey key { 0 };
}; };

View file

@ -372,6 +372,13 @@ namespace scriptable {
obj.setProperty("opacity", material.opacity); obj.setProperty("opacity", material.opacity);
} }
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::ALBEDO_VAL_BIT)) {
obj.setProperty("albedo", FALLTHROUGH);
} else if (material.key.isAlbedo()) {
obj.setProperty("albedo", vec3ColorToScriptValue(engine, material.albedo));
}
if (material.model.toStdString() == graphics::Material::HIFI_PBR) {
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::GLOSSY_VAL_BIT)) { if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::GLOSSY_VAL_BIT)) {
obj.setProperty("roughness", FALLTHROUGH); obj.setProperty("roughness", FALLTHROUGH);
} else if (material.key.isGlossy()) { } else if (material.key.isGlossy()) {
@ -402,12 +409,6 @@ namespace scriptable {
obj.setProperty("emissive", vec3ColorToScriptValue(engine, material.emissive)); obj.setProperty("emissive", vec3ColorToScriptValue(engine, material.emissive));
} }
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::ALBEDO_VAL_BIT)) {
obj.setProperty("albedo", FALLTHROUGH);
} else if (material.key.isAlbedo()) {
obj.setProperty("albedo", vec3ColorToScriptValue(engine, material.albedo));
}
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::EMISSIVE_MAP_BIT)) { if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::EMISSIVE_MAP_BIT)) {
obj.setProperty("emissiveMap", FALLTHROUGH); obj.setProperty("emissiveMap", FALLTHROUGH);
} else if (!material.emissiveMap.isEmpty()) { } else if (!material.emissiveMap.isEmpty()) {
@ -467,7 +468,6 @@ namespace scriptable {
obj.setProperty("bumpMap", material.bumpMap); obj.setProperty("bumpMap", material.bumpMap);
} }
// These need to be implemented, but set the fallthrough for now
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::Material::TEXCOORDTRANSFORM0)) { if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::Material::TEXCOORDTRANSFORM0)) {
obj.setProperty("texCoordTransform0", FALLTHROUGH); obj.setProperty("texCoordTransform0", FALLTHROUGH);
} else if (material.texCoordTransforms[0] != mat4()) { } else if (material.texCoordTransforms[0] != mat4()) {
@ -478,6 +478,8 @@ namespace scriptable {
} else if (material.texCoordTransforms[1] != mat4()) { } else if (material.texCoordTransforms[1] != mat4()) {
obj.setProperty("texCoordTransform1", mat4toScriptValue(engine, material.texCoordTransforms[1])); obj.setProperty("texCoordTransform1", mat4toScriptValue(engine, material.texCoordTransforms[1]));
} }
// These need to be implemented, but set the fallthrough for now
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::Material::LIGHTMAP_PARAMS)) { if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::Material::LIGHTMAP_PARAMS)) {
obj.setProperty("lightmapParams", FALLTHROUGH); obj.setProperty("lightmapParams", FALLTHROUGH);
} }
@ -486,6 +488,9 @@ namespace scriptable {
} }
obj.setProperty("defaultFallthrough", material.defaultFallthrough); obj.setProperty("defaultFallthrough", material.defaultFallthrough);
} else if (material.model.toStdString() == graphics::Material::HIFI_SHADER_SIMPLE) {
obj.setProperty("procedural", material.procedural);
}
return obj; return obj;
} }

View file

@ -23,12 +23,14 @@ scriptable::ScriptableMaterial& scriptable::ScriptableMaterial::operator=(const
name = material.name; name = material.name;
model = material.model; model = material.model;
opacity = material.opacity; opacity = material.opacity;
albedo = material.albedo;
if (model.toStdString() == graphics::Material::HIFI_PBR) {
roughness = material.roughness; roughness = material.roughness;
metallic = material.metallic; metallic = material.metallic;
scattering = material.scattering; scattering = material.scattering;
unlit = material.unlit; unlit = material.unlit;
emissive = material.emissive; emissive = material.emissive;
albedo = material.albedo;
emissiveMap = material.emissiveMap; emissiveMap = material.emissiveMap;
albedoMap = material.albedoMap; albedoMap = material.albedoMap;
opacityMap = material.opacityMap; opacityMap = material.opacityMap;
@ -44,6 +46,9 @@ scriptable::ScriptableMaterial& scriptable::ScriptableMaterial::operator=(const
defaultFallthrough = material.defaultFallthrough; defaultFallthrough = material.defaultFallthrough;
propertyFallthroughs = material.propertyFallthroughs; propertyFallthroughs = material.propertyFallthroughs;
} else if (model.toStdString() == graphics::Material::HIFI_SHADER_SIMPLE) {
procedural = material.procedural;
}
key = material.key; key = material.key;
@ -55,12 +60,14 @@ scriptable::ScriptableMaterial::ScriptableMaterial(const graphics::MaterialPoint
name = material->getName().c_str(); name = material->getName().c_str();
model = material->getModel().c_str(); model = material->getModel().c_str();
opacity = material->getOpacity(); opacity = material->getOpacity();
albedo = material->getAlbedo();
if (model.toStdString() == graphics::Material::HIFI_PBR) {
roughness = material->getRoughness(); roughness = material->getRoughness();
metallic = material->getMetallic(); metallic = material->getMetallic();
scattering = material->getScattering(); scattering = material->getScattering();
unlit = material->isUnlit(); unlit = material->isUnlit();
emissive = material->getEmissive(); emissive = material->getEmissive();
albedo = material->getAlbedo();
defaultFallthrough = material->getDefaultFallthrough(); defaultFallthrough = material->getDefaultFallthrough();
propertyFallthroughs = material->getPropertyFallthroughs(); propertyFallthroughs = material->getPropertyFallthroughs();
key = material->getKey(); key = material->getKey();
@ -123,6 +130,9 @@ scriptable::ScriptableMaterial::ScriptableMaterial(const graphics::MaterialPoint
for (int i = 0; i < graphics::Material::NUM_TEXCOORD_TRANSFORMS; i++) { for (int i = 0; i < graphics::Material::NUM_TEXCOORD_TRANSFORMS; i++) {
texCoordTransforms[i] = material->getTexCoordTransform(i); texCoordTransforms[i] = material->getTexCoordTransform(i);
} }
} else if (model.toStdString() == graphics::Material::HIFI_SHADER_SIMPLE) {
procedural = material->getProceduralString();
}
} }
} }

View file

@ -24,6 +24,9 @@ const float Material::DEFAULT_METALLIC { 0.0f };
const float Material::DEFAULT_ROUGHNESS { 1.0f }; const float Material::DEFAULT_ROUGHNESS { 1.0f };
const float Material::DEFAULT_SCATTERING { 0.0f }; const float Material::DEFAULT_SCATTERING { 0.0f };
const std::string Material::HIFI_PBR { "hifi_pbr" };
const std::string Material::HIFI_SHADER_SIMPLE { "hifi_shader_simple" };
Material::Material() { Material::Material() {
for (int i = 0; i < NUM_TOTAL_FLAGS; i++) { for (int i = 0; i < NUM_TOTAL_FLAGS; i++) {
_propertyFallthroughs[i] = false; _propertyFallthroughs[i] = false;

View file

@ -346,12 +346,16 @@ public:
virtual bool isProcedural() const { return false; } virtual bool isProcedural() const { return false; }
virtual bool isEnabled() const { return true; } virtual bool isEnabled() const { return true; }
virtual bool isReady() const { return true; } virtual bool isReady() const { return true; }
virtual QString getProceduralString() const { return QString(); }
static const std::string HIFI_PBR;
static const std::string HIFI_SHADER_SIMPLE;
protected: protected:
std::string _name { "" }; std::string _name { "" };
private: private:
std::string _model { "hifi_pbr" }; std::string _model { HIFI_PBR };
mutable MaterialKey _key { 0 }; mutable MaterialKey _key { 0 };
// Material properties // Material properties

View file

@ -201,7 +201,12 @@ public:
bool isProcedural() const override { return true; } bool isProcedural() const override { return true; }
bool isEnabled() const override { return _procedural.isEnabled(); } bool isEnabled() const override { return _procedural.isEnabled(); }
bool isReady() const override { return _procedural.isReady(); } bool isReady() const override { return _procedural.isReady(); }
void setProceduralData(const QString& data) { _procedural.setProceduralData(ProceduralData::parse(data)); } QString getProceduralString() const override { return _proceduralString; }
void setProceduralData(const QString& data) {
_proceduralString = data;
_procedural.setProceduralData(ProceduralData::parse(data));
}
glm::vec4 getColor(const glm::vec4& color) const { return _procedural.getColor(color); } glm::vec4 getColor(const glm::vec4& color) const { return _procedural.getColor(color); }
bool isFading() const { return _procedural.isFading(); } bool isFading() const { return _procedural.isFading(); }
void setIsFading(bool isFading) { _procedural.setIsFading(isFading); } void setIsFading(bool isFading) { _procedural.setIsFading(isFading); }
@ -214,6 +219,7 @@ public:
void initializeProcedural(); void initializeProcedural();
private: private:
QString _proceduralString;
Procedural _procedural; Procedural _procedural;
}; };
typedef std::shared_ptr<ProceduralMaterial> ProceduralMaterialPointer; typedef std::shared_ptr<ProceduralMaterial> ProceduralMaterialPointer;

View file

@ -172,9 +172,7 @@ std::pair<std::string, std::shared_ptr<NetworkMaterial>> NetworkMaterialResource
std::string name = ""; std::string name = "";
std::shared_ptr<NetworkMaterial> networkMaterial; std::shared_ptr<NetworkMaterial> networkMaterial;
static const std::string HIFI_PBR = "hifi_pbr"; std::string modelString = graphics::Material::HIFI_PBR;
static const std::string HIFI_SHADER_SIMPLE = "hifi_shader_simple";
std::string modelString = HIFI_PBR;
auto modelJSONIter = materialJSON.find("model"); auto modelJSONIter = materialJSON.find("model");
if (modelJSONIter != materialJSON.end() && modelJSONIter.value().isString()) { if (modelJSONIter != materialJSON.end() && modelJSONIter.value().isString()) {
modelString = modelJSONIter.value().toString().toStdString(); modelString = modelJSONIter.value().toString().toStdString();
@ -182,7 +180,7 @@ std::pair<std::string, std::shared_ptr<NetworkMaterial>> NetworkMaterialResource
std::array<glm::mat4, graphics::Material::NUM_TEXCOORD_TRANSFORMS> texcoordTransforms; std::array<glm::mat4, graphics::Material::NUM_TEXCOORD_TRANSFORMS> texcoordTransforms;
if (modelString == HIFI_PBR) { if (modelString == graphics::Material::HIFI_PBR) {
auto material = std::make_shared<NetworkMaterial>(); auto material = std::make_shared<NetworkMaterial>();
const QString FALLTHROUGH("fallthrough"); const QString FALLTHROUGH("fallthrough");
for (auto& key : materialJSON.keys()) { for (auto& key : materialJSON.keys()) {
@ -424,7 +422,7 @@ std::pair<std::string, std::shared_ptr<NetworkMaterial>> NetworkMaterialResource
} }
} }
networkMaterial = material; networkMaterial = material;
} else if (modelString == HIFI_SHADER_SIMPLE) { } else if (modelString == graphics::Material::HIFI_SHADER_SIMPLE) {
auto material = std::make_shared<graphics::ProceduralMaterial>(); auto material = std::make_shared<graphics::ProceduralMaterial>();
const QString FALLTHROUGH("fallthrough"); const QString FALLTHROUGH("fallthrough");
for (auto& key : materialJSON.keys()) { for (auto& key : materialJSON.keys()) {

View file

@ -18,8 +18,9 @@
using namespace render; using namespace render;
CauterizedMeshPartPayload::CauterizedMeshPartPayload(ModelPointer model, int meshIndex, int partIndex, int shapeIndex, const Transform& transform, const Transform& offsetTransform) CauterizedMeshPartPayload::CauterizedMeshPartPayload(ModelPointer model, int meshIndex, int partIndex, int shapeIndex,
: ModelMeshPartPayload(model, meshIndex, partIndex, shapeIndex, transform, offsetTransform) {} const Transform& transform, const Transform& offsetTransform, const uint64_t& created)
: ModelMeshPartPayload(model, meshIndex, partIndex, shapeIndex, transform, offsetTransform, created) {}
void CauterizedMeshPartPayload::updateClusterBuffer(const std::vector<glm::mat4>& clusterMatrices, void CauterizedMeshPartPayload::updateClusterBuffer(const std::vector<glm::mat4>& clusterMatrices,
const std::vector<glm::mat4>& cauterizedClusterMatrices) { const std::vector<glm::mat4>& cauterizedClusterMatrices) {

View file

@ -13,7 +13,7 @@
class CauterizedMeshPartPayload : public ModelMeshPartPayload { class CauterizedMeshPartPayload : public ModelMeshPartPayload {
public: public:
CauterizedMeshPartPayload(ModelPointer model, int meshIndex, int partIndex, int shapeIndex, const Transform& transform, const Transform& offsetTransform); CauterizedMeshPartPayload(ModelPointer model, int meshIndex, int partIndex, int shapeIndex, const Transform& transform, const Transform& offsetTransform, const uint64_t& created);
// matrix palette skinning // matrix palette skinning
void updateClusterBuffer(const std::vector<glm::mat4>& clusterMatrices, void updateClusterBuffer(const std::vector<glm::mat4>& clusterMatrices,

View file

@ -88,7 +88,7 @@ void CauterizedModel::createRenderItemSet() {
for (int partIndex = 0; partIndex < numParts; partIndex++) { for (int partIndex = 0; partIndex < numParts; partIndex++) {
initializeBlendshapes(hfmModel.meshes[i], i); initializeBlendshapes(hfmModel.meshes[i], i);
auto ptr = std::make_shared<CauterizedMeshPartPayload>(shared_from_this(), i, partIndex, shapeID, transform, offset); auto ptr = std::make_shared<CauterizedMeshPartPayload>(shared_from_this(), i, partIndex, shapeID, transform, offset, _created);
_modelMeshRenderItems << std::static_pointer_cast<ModelMeshPartPayload>(ptr); _modelMeshRenderItems << std::static_pointer_cast<ModelMeshPartPayload>(ptr);
auto material = getGeometry()->getShapeMaterial(shapeID); auto material = getGeometry()->getShapeMaterial(shapeID);
_modelMeshMaterialNames.push_back(material ? material->getName() : ""); _modelMeshMaterialNames.push_back(material ? material->getName() : "");

View file

@ -52,7 +52,9 @@ template <> void payloadRender(const MeshPartPayload::Pointer& payload, RenderAr
} }
} }
MeshPartPayload::MeshPartPayload(const std::shared_ptr<const graphics::Mesh>& mesh, int partIndex, graphics::MaterialPointer material) { MeshPartPayload::MeshPartPayload(const std::shared_ptr<const graphics::Mesh>& mesh, int partIndex, graphics::MaterialPointer material, const uint64_t& created) :
_created(created)
{
updateMeshPart(mesh, partIndex); updateMeshPart(mesh, partIndex);
addMaterial(graphics::MaterialLayer(material, 0)); addMaterial(graphics::MaterialLayer(material, 0));
} }
@ -172,7 +174,7 @@ void MeshPartPayload::render(RenderArgs* args) {
auto& schema = _drawMaterials.getSchemaBuffer().get<graphics::MultiMaterial::Schema>(); auto& schema = _drawMaterials.getSchemaBuffer().get<graphics::MultiMaterial::Schema>();
glm::vec4 outColor = glm::vec4(ColorUtils::tosRGBVec3(schema._albedo), schema._opacity); glm::vec4 outColor = glm::vec4(ColorUtils::tosRGBVec3(schema._albedo), schema._opacity);
outColor = procedural->getColor(outColor); outColor = procedural->getColor(outColor);
procedural->prepare(batch, _drawTransform.getTranslation(), _drawTransform.getScale(), _drawTransform.getRotation(), 0, // FIXME: pass in _created procedural->prepare(batch, _drawTransform.getTranslation(), _drawTransform.getScale(), _drawTransform.getRotation(), _created,
ProceduralProgramKey(outColor.a < 1.0f)); ProceduralProgramKey(outColor.a < 1.0f));
batch._glColor4f(outColor.r, outColor.g, outColor.b, outColor.a); batch._glColor4f(outColor.r, outColor.g, outColor.b, outColor.a);
} else { } else {
@ -220,7 +222,8 @@ template <> void payloadRender(const ModelMeshPartPayload::Pointer& payload, Ren
} }
ModelMeshPartPayload::ModelMeshPartPayload(ModelPointer model, int meshIndex, int partIndex, int shapeIndex, const Transform& transform, const Transform& offsetTransform) : ModelMeshPartPayload::ModelMeshPartPayload(ModelPointer model, int meshIndex, int partIndex, int shapeIndex,
const Transform& transform, const Transform& offsetTransform, const uint64_t& created) :
_meshIndex(meshIndex), _meshIndex(meshIndex),
_shapeID(shapeIndex) { _shapeID(shapeIndex) {
@ -272,6 +275,7 @@ ModelMeshPartPayload::ModelMeshPartPayload(ModelPointer model, int meshIndex, in
} }
#endif #endif
_created = created;
} }
void ModelMeshPartPayload::initCache(const ModelPointer& model) { void ModelMeshPartPayload::initCache(const ModelPointer& model) {
@ -468,7 +472,7 @@ void ModelMeshPartPayload::render(RenderArgs* args) {
auto& schema = _drawMaterials.getSchemaBuffer().get<graphics::MultiMaterial::Schema>(); auto& schema = _drawMaterials.getSchemaBuffer().get<graphics::MultiMaterial::Schema>();
glm::vec4 outColor = glm::vec4(ColorUtils::tosRGBVec3(schema._albedo), schema._opacity); glm::vec4 outColor = glm::vec4(ColorUtils::tosRGBVec3(schema._albedo), schema._opacity);
outColor = procedural->getColor(outColor); outColor = procedural->getColor(outColor);
procedural->prepare(batch, _drawTransform.getTranslation(), _drawTransform.getScale(), _drawTransform.getRotation(), 0,// FIXME: pass in _created procedural->prepare(batch, _drawTransform.getTranslation(), _drawTransform.getScale(), _drawTransform.getRotation(), _created,
ProceduralProgramKey(outColor.a < 1.0f, _shapeKey.isDeformed(), _shapeKey.isDualQuatSkinned())); ProceduralProgramKey(outColor.a < 1.0f, _shapeKey.isDeformed(), _shapeKey.isDualQuatSkinned()));
batch._glColor4f(outColor.r, outColor.g, outColor.b, outColor.a); batch._glColor4f(outColor.r, outColor.g, outColor.b, outColor.a);
} else { } else {

View file

@ -27,7 +27,7 @@ class Model;
class MeshPartPayload { class MeshPartPayload {
public: public:
MeshPartPayload() = default; MeshPartPayload() = default;
MeshPartPayload(const std::shared_ptr<const graphics::Mesh>& mesh, int partIndex, graphics::MaterialPointer material); MeshPartPayload(const std::shared_ptr<const graphics::Mesh>& mesh, int partIndex, graphics::MaterialPointer material, const uint64_t& created);
virtual ~MeshPartPayload() = default; virtual ~MeshPartPayload() = default;
typedef render::Payload<MeshPartPayload> Payload; typedef render::Payload<MeshPartPayload> Payload;
@ -77,6 +77,7 @@ public:
protected: protected:
render::ItemKey _itemKey{ render::ItemKey::Builder::opaqueShape().build() }; render::ItemKey _itemKey{ render::ItemKey::Builder::opaqueShape().build() };
uint64_t _created;
}; };
namespace render { namespace render {
@ -88,7 +89,7 @@ namespace render {
class ModelMeshPartPayload : public MeshPartPayload { class ModelMeshPartPayload : public MeshPartPayload {
public: public:
ModelMeshPartPayload(ModelPointer model, int meshIndex, int partIndex, int shapeIndex, const Transform& transform, const Transform& offsetTransform); ModelMeshPartPayload(ModelPointer model, int meshIndex, int partIndex, int shapeIndex, const Transform& transform, const Transform& offsetTransform, const uint64_t& created);
typedef render::Payload<ModelMeshPartPayload> Payload; typedef render::Payload<ModelMeshPartPayload> Payload;
typedef Payload::DataPointer Pointer; typedef Payload::DataPointer Pointer;

View file

@ -48,7 +48,7 @@ int normalTypeVecTypeId = qRegisterMetaType<QVector<NormalType>>("QVector<Normal
float Model::FAKE_DIMENSION_PLACEHOLDER = -1.0f; float Model::FAKE_DIMENSION_PLACEHOLDER = -1.0f;
#define HTTP_INVALID_COM "http://invalid.com" #define HTTP_INVALID_COM "http://invalid.com"
Model::Model(QObject* parent, SpatiallyNestable* spatiallyNestableOverride) : Model::Model(QObject* parent, SpatiallyNestable* spatiallyNestableOverride, uint64_t created) :
QObject(parent), QObject(parent),
_renderGeometry(), _renderGeometry(),
_renderWatcher(_renderGeometry), _renderWatcher(_renderGeometry),
@ -62,7 +62,8 @@ Model::Model(QObject* parent, SpatiallyNestable* spatiallyNestableOverride) :
_snapModelToRegistrationPoint(false), _snapModelToRegistrationPoint(false),
_snappedToRegistrationPoint(false), _snappedToRegistrationPoint(false),
_url(HTTP_INVALID_COM), _url(HTTP_INVALID_COM),
_renderItemKeyGlobalFlags(render::ItemKey::Builder().withVisible().withTagBits(render::hifi::TAG_ALL_VIEWS).build()) _renderItemKeyGlobalFlags(render::ItemKey::Builder().withVisible().withTagBits(render::hifi::TAG_ALL_VIEWS).build()),
_created(created)
{ {
// we may have been created in the network thread, but we live in the main thread // we may have been created in the network thread, but we live in the main thread
if (_viewState) { if (_viewState) {
@ -1495,7 +1496,7 @@ void Model::createRenderItemSet() {
int numParts = (int)mesh->getNumParts(); int numParts = (int)mesh->getNumParts();
for (int partIndex = 0; partIndex < numParts; partIndex++) { for (int partIndex = 0; partIndex < numParts; partIndex++) {
initializeBlendshapes(hfmModel.meshes[i], i); initializeBlendshapes(hfmModel.meshes[i], i);
_modelMeshRenderItems << std::make_shared<ModelMeshPartPayload>(shared_from_this(), i, partIndex, shapeID, transform, offset); _modelMeshRenderItems << std::make_shared<ModelMeshPartPayload>(shared_from_this(), i, partIndex, shapeID, transform, offset, _created);
auto material = getGeometry()->getShapeMaterial(shapeID); auto material = getGeometry()->getShapeMaterial(shapeID);
_modelMeshMaterialNames.push_back(material ? material->getName() : ""); _modelMeshMaterialNames.push_back(material ? material->getName() : "");
_modelMeshRenderItemShapes.emplace_back(ShapeInfo{ (int)i }); _modelMeshRenderItemShapes.emplace_back(ShapeInfo{ (int)i });

View file

@ -99,7 +99,7 @@ public:
static void setAbstractViewStateInterface(AbstractViewStateInterface* viewState) { _viewState = viewState; } static void setAbstractViewStateInterface(AbstractViewStateInterface* viewState) { _viewState = viewState; }
Model(QObject* parent = nullptr, SpatiallyNestable* spatiallyNestableOverride = nullptr); Model(QObject* parent = nullptr, SpatiallyNestable* spatiallyNestableOverride = nullptr, uint64_t created = 0);
virtual ~Model(); virtual ~Model();
inline ModelPointer getThisPointer() const { inline ModelPointer getThisPointer() const {
@ -511,6 +511,8 @@ protected:
void initializeBlendshapes(const HFMMesh& mesh, int index); void initializeBlendshapes(const HFMMesh& mesh, int index);
uint64_t _created;
private: private:
float _loadingPriority { 0.0f }; float _loadingPriority { 0.0f };