mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-07 16:20:50 +02:00
(✿◠‿◠)
This commit is contained in:
parent
3eac2cf1d6
commit
de90c5088c
15 changed files with 230 additions and 192 deletions
|
@ -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);
|
||||||
|
|
|
@ -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 };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -372,120 +372,125 @@ namespace scriptable {
|
||||||
obj.setProperty("opacity", material.opacity);
|
obj.setProperty("opacity", material.opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::GLOSSY_VAL_BIT)) {
|
|
||||||
obj.setProperty("roughness", FALLTHROUGH);
|
|
||||||
} else if (material.key.isGlossy()) {
|
|
||||||
obj.setProperty("roughness", material.roughness);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::METALLIC_VAL_BIT)) {
|
|
||||||
obj.setProperty("metallic", FALLTHROUGH);
|
|
||||||
} else if (material.key.isMetallic()) {
|
|
||||||
obj.setProperty("metallic", material.metallic);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::SCATTERING_VAL_BIT)) {
|
|
||||||
obj.setProperty("scattering", FALLTHROUGH);
|
|
||||||
} else if (material.key.isScattering()) {
|
|
||||||
obj.setProperty("scattering", material.scattering);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::UNLIT_VAL_BIT)) {
|
|
||||||
obj.setProperty("unlit", FALLTHROUGH);
|
|
||||||
} else if (material.key.isUnlit()) {
|
|
||||||
obj.setProperty("unlit", material.unlit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::EMISSIVE_VAL_BIT)) {
|
|
||||||
obj.setProperty("emissive", FALLTHROUGH);
|
|
||||||
} else if (material.key.isEmissive()) {
|
|
||||||
obj.setProperty("emissive", vec3ColorToScriptValue(engine, material.emissive));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::ALBEDO_VAL_BIT)) {
|
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::ALBEDO_VAL_BIT)) {
|
||||||
obj.setProperty("albedo", FALLTHROUGH);
|
obj.setProperty("albedo", FALLTHROUGH);
|
||||||
} else if (material.key.isAlbedo()) {
|
} else if (material.key.isAlbedo()) {
|
||||||
obj.setProperty("albedo", vec3ColorToScriptValue(engine, material.albedo));
|
obj.setProperty("albedo", vec3ColorToScriptValue(engine, material.albedo));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::EMISSIVE_MAP_BIT)) {
|
if (material.model.toStdString() == graphics::Material::HIFI_PBR) {
|
||||||
obj.setProperty("emissiveMap", FALLTHROUGH);
|
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::GLOSSY_VAL_BIT)) {
|
||||||
} else if (!material.emissiveMap.isEmpty()) {
|
obj.setProperty("roughness", FALLTHROUGH);
|
||||||
obj.setProperty("emissiveMap", material.emissiveMap);
|
} else if (material.key.isGlossy()) {
|
||||||
}
|
obj.setProperty("roughness", material.roughness);
|
||||||
|
}
|
||||||
|
|
||||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::ALBEDO_MAP_BIT)) {
|
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::METALLIC_VAL_BIT)) {
|
||||||
obj.setProperty("albedoMap", FALLTHROUGH);
|
obj.setProperty("metallic", FALLTHROUGH);
|
||||||
} else if (!material.albedoMap.isEmpty()) {
|
} else if (material.key.isMetallic()) {
|
||||||
obj.setProperty("albedoMap", material.albedoMap);
|
obj.setProperty("metallic", material.metallic);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!material.opacityMap.isEmpty()) {
|
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::SCATTERING_VAL_BIT)) {
|
||||||
obj.setProperty("opacityMap", material.opacityMap);
|
obj.setProperty("scattering", FALLTHROUGH);
|
||||||
}
|
} else if (material.key.isScattering()) {
|
||||||
|
obj.setProperty("scattering", material.scattering);
|
||||||
|
}
|
||||||
|
|
||||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::OCCLUSION_MAP_BIT)) {
|
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::UNLIT_VAL_BIT)) {
|
||||||
obj.setProperty("occlusionMap", FALLTHROUGH);
|
obj.setProperty("unlit", FALLTHROUGH);
|
||||||
} else if (!material.occlusionMap.isEmpty()) {
|
} else if (material.key.isUnlit()) {
|
||||||
obj.setProperty("occlusionMap", material.occlusionMap);
|
obj.setProperty("unlit", material.unlit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::LIGHTMAP_MAP_BIT)) {
|
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::EMISSIVE_VAL_BIT)) {
|
||||||
obj.setProperty("lightmapMap", FALLTHROUGH);
|
obj.setProperty("emissive", FALLTHROUGH);
|
||||||
} else if (!material.lightmapMap.isEmpty()) {
|
} else if (material.key.isEmissive()) {
|
||||||
obj.setProperty("lightmapMap", material.lightmapMap);
|
obj.setProperty("emissive", vec3ColorToScriptValue(engine, material.emissive));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::SCATTERING_MAP_BIT)) {
|
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::EMISSIVE_MAP_BIT)) {
|
||||||
obj.setProperty("scatteringMap", FALLTHROUGH);
|
obj.setProperty("emissiveMap", FALLTHROUGH);
|
||||||
} else if (!material.scatteringMap.isEmpty()) {
|
} else if (!material.emissiveMap.isEmpty()) {
|
||||||
obj.setProperty("scatteringMap", material.scatteringMap);
|
obj.setProperty("emissiveMap", material.emissiveMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only set one of each of these
|
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::ALBEDO_MAP_BIT)) {
|
||||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::METALLIC_MAP_BIT)) {
|
obj.setProperty("albedoMap", FALLTHROUGH);
|
||||||
obj.setProperty("metallicMap", FALLTHROUGH);
|
} else if (!material.albedoMap.isEmpty()) {
|
||||||
} else if (!material.metallicMap.isEmpty()) {
|
obj.setProperty("albedoMap", material.albedoMap);
|
||||||
obj.setProperty("metallicMap", material.metallicMap);
|
}
|
||||||
} else if (!material.specularMap.isEmpty()) {
|
|
||||||
obj.setProperty("specularMap", material.specularMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::ROUGHNESS_MAP_BIT)) {
|
if (!material.opacityMap.isEmpty()) {
|
||||||
obj.setProperty("roughnessMap", FALLTHROUGH);
|
obj.setProperty("opacityMap", material.opacityMap);
|
||||||
} else if (!material.roughnessMap.isEmpty()) {
|
}
|
||||||
obj.setProperty("roughnessMap", material.roughnessMap);
|
|
||||||
} else if (!material.glossMap.isEmpty()) {
|
|
||||||
obj.setProperty("glossMap", material.glossMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::NORMAL_MAP_BIT)) {
|
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::OCCLUSION_MAP_BIT)) {
|
||||||
obj.setProperty("normalMap", FALLTHROUGH);
|
obj.setProperty("occlusionMap", FALLTHROUGH);
|
||||||
} else if (!material.normalMap.isEmpty()) {
|
} else if (!material.occlusionMap.isEmpty()) {
|
||||||
obj.setProperty("normalMap", material.normalMap);
|
obj.setProperty("occlusionMap", material.occlusionMap);
|
||||||
} else if (!material.bumpMap.isEmpty()) {
|
}
|
||||||
obj.setProperty("bumpMap", material.bumpMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
// These need to be implemented, but set the fallthrough for now
|
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::LIGHTMAP_MAP_BIT)) {
|
||||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::Material::TEXCOORDTRANSFORM0)) {
|
obj.setProperty("lightmapMap", FALLTHROUGH);
|
||||||
obj.setProperty("texCoordTransform0", FALLTHROUGH);
|
} else if (!material.lightmapMap.isEmpty()) {
|
||||||
} else if (material.texCoordTransforms[0] != mat4()) {
|
obj.setProperty("lightmapMap", material.lightmapMap);
|
||||||
obj.setProperty("texCoordTransform0", mat4toScriptValue(engine, material.texCoordTransforms[0]));
|
}
|
||||||
}
|
|
||||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::Material::TEXCOORDTRANSFORM1)) {
|
|
||||||
obj.setProperty("texCoordTransform1", FALLTHROUGH);
|
|
||||||
} else if (material.texCoordTransforms[1] != mat4()) {
|
|
||||||
obj.setProperty("texCoordTransform1", mat4toScriptValue(engine, material.texCoordTransforms[1]));
|
|
||||||
}
|
|
||||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::Material::LIGHTMAP_PARAMS)) {
|
|
||||||
obj.setProperty("lightmapParams", FALLTHROUGH);
|
|
||||||
}
|
|
||||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::Material::MATERIAL_PARAMS)) {
|
|
||||||
obj.setProperty("materialParams", FALLTHROUGH);
|
|
||||||
}
|
|
||||||
|
|
||||||
obj.setProperty("defaultFallthrough", material.defaultFallthrough);
|
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::SCATTERING_MAP_BIT)) {
|
||||||
|
obj.setProperty("scatteringMap", FALLTHROUGH);
|
||||||
|
} else if (!material.scatteringMap.isEmpty()) {
|
||||||
|
obj.setProperty("scatteringMap", material.scatteringMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only set one of each of these
|
||||||
|
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::METALLIC_MAP_BIT)) {
|
||||||
|
obj.setProperty("metallicMap", FALLTHROUGH);
|
||||||
|
} else if (!material.metallicMap.isEmpty()) {
|
||||||
|
obj.setProperty("metallicMap", material.metallicMap);
|
||||||
|
} else if (!material.specularMap.isEmpty()) {
|
||||||
|
obj.setProperty("specularMap", material.specularMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::ROUGHNESS_MAP_BIT)) {
|
||||||
|
obj.setProperty("roughnessMap", FALLTHROUGH);
|
||||||
|
} else if (!material.roughnessMap.isEmpty()) {
|
||||||
|
obj.setProperty("roughnessMap", material.roughnessMap);
|
||||||
|
} else if (!material.glossMap.isEmpty()) {
|
||||||
|
obj.setProperty("glossMap", material.glossMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::NORMAL_MAP_BIT)) {
|
||||||
|
obj.setProperty("normalMap", FALLTHROUGH);
|
||||||
|
} else if (!material.normalMap.isEmpty()) {
|
||||||
|
obj.setProperty("normalMap", material.normalMap);
|
||||||
|
} else if (!material.bumpMap.isEmpty()) {
|
||||||
|
obj.setProperty("bumpMap", material.bumpMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::Material::TEXCOORDTRANSFORM0)) {
|
||||||
|
obj.setProperty("texCoordTransform0", FALLTHROUGH);
|
||||||
|
} else if (material.texCoordTransforms[0] != mat4()) {
|
||||||
|
obj.setProperty("texCoordTransform0", mat4toScriptValue(engine, material.texCoordTransforms[0]));
|
||||||
|
}
|
||||||
|
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::Material::TEXCOORDTRANSFORM1)) {
|
||||||
|
obj.setProperty("texCoordTransform1", FALLTHROUGH);
|
||||||
|
} else if (material.texCoordTransforms[1] != mat4()) {
|
||||||
|
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)) {
|
||||||
|
obj.setProperty("lightmapParams", FALLTHROUGH);
|
||||||
|
}
|
||||||
|
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::Material::MATERIAL_PARAMS)) {
|
||||||
|
obj.setProperty("materialParams", FALLTHROUGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
obj.setProperty("defaultFallthrough", material.defaultFallthrough);
|
||||||
|
} else if (material.model.toStdString() == graphics::Material::HIFI_SHADER_SIMPLE) {
|
||||||
|
obj.setProperty("procedural", material.procedural);
|
||||||
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,27 +23,32 @@ scriptable::ScriptableMaterial& scriptable::ScriptableMaterial::operator=(const
|
||||||
name = material.name;
|
name = material.name;
|
||||||
model = material.model;
|
model = material.model;
|
||||||
opacity = material.opacity;
|
opacity = material.opacity;
|
||||||
roughness = material.roughness;
|
|
||||||
metallic = material.metallic;
|
|
||||||
scattering = material.scattering;
|
|
||||||
unlit = material.unlit;
|
|
||||||
emissive = material.emissive;
|
|
||||||
albedo = material.albedo;
|
albedo = material.albedo;
|
||||||
emissiveMap = material.emissiveMap;
|
|
||||||
albedoMap = material.albedoMap;
|
|
||||||
opacityMap = material.opacityMap;
|
|
||||||
metallicMap = material.metallicMap;
|
|
||||||
specularMap = material.specularMap;
|
|
||||||
roughnessMap = material.roughnessMap;
|
|
||||||
glossMap = material.glossMap;
|
|
||||||
normalMap = material.normalMap;
|
|
||||||
bumpMap = material.bumpMap;
|
|
||||||
occlusionMap = material.occlusionMap;
|
|
||||||
lightmapMap = material.lightmapMap;
|
|
||||||
scatteringMap = material.scatteringMap;
|
|
||||||
|
|
||||||
defaultFallthrough = material.defaultFallthrough;
|
if (model.toStdString() == graphics::Material::HIFI_PBR) {
|
||||||
propertyFallthroughs = material.propertyFallthroughs;
|
roughness = material.roughness;
|
||||||
|
metallic = material.metallic;
|
||||||
|
scattering = material.scattering;
|
||||||
|
unlit = material.unlit;
|
||||||
|
emissive = material.emissive;
|
||||||
|
emissiveMap = material.emissiveMap;
|
||||||
|
albedoMap = material.albedoMap;
|
||||||
|
opacityMap = material.opacityMap;
|
||||||
|
metallicMap = material.metallicMap;
|
||||||
|
specularMap = material.specularMap;
|
||||||
|
roughnessMap = material.roughnessMap;
|
||||||
|
glossMap = material.glossMap;
|
||||||
|
normalMap = material.normalMap;
|
||||||
|
bumpMap = material.bumpMap;
|
||||||
|
occlusionMap = material.occlusionMap;
|
||||||
|
lightmapMap = material.lightmapMap;
|
||||||
|
scatteringMap = material.scatteringMap;
|
||||||
|
|
||||||
|
defaultFallthrough = material.defaultFallthrough;
|
||||||
|
propertyFallthroughs = material.propertyFallthroughs;
|
||||||
|
} else if (model.toStdString() == graphics::Material::HIFI_SHADER_SIMPLE) {
|
||||||
|
procedural = material.procedural;
|
||||||
|
}
|
||||||
|
|
||||||
key = material.key;
|
key = material.key;
|
||||||
|
|
||||||
|
@ -55,73 +60,78 @@ 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();
|
||||||
roughness = material->getRoughness();
|
|
||||||
metallic = material->getMetallic();
|
|
||||||
scattering = material->getScattering();
|
|
||||||
unlit = material->isUnlit();
|
|
||||||
emissive = material->getEmissive();
|
|
||||||
albedo = material->getAlbedo();
|
albedo = material->getAlbedo();
|
||||||
defaultFallthrough = material->getDefaultFallthrough();
|
|
||||||
propertyFallthroughs = material->getPropertyFallthroughs();
|
|
||||||
key = material->getKey();
|
|
||||||
|
|
||||||
auto map = material->getTextureMap(graphics::Material::MapChannel::EMISSIVE_MAP);
|
if (model.toStdString() == graphics::Material::HIFI_PBR) {
|
||||||
if (map && map->getTextureSource()) {
|
roughness = material->getRoughness();
|
||||||
emissiveMap = map->getTextureSource()->getUrl().toString();
|
metallic = material->getMetallic();
|
||||||
}
|
scattering = material->getScattering();
|
||||||
|
unlit = material->isUnlit();
|
||||||
|
emissive = material->getEmissive();
|
||||||
|
defaultFallthrough = material->getDefaultFallthrough();
|
||||||
|
propertyFallthroughs = material->getPropertyFallthroughs();
|
||||||
|
key = material->getKey();
|
||||||
|
|
||||||
map = material->getTextureMap(graphics::Material::MapChannel::ALBEDO_MAP);
|
auto map = material->getTextureMap(graphics::Material::MapChannel::EMISSIVE_MAP);
|
||||||
if (map && map->getTextureSource()) {
|
if (map && map->getTextureSource()) {
|
||||||
albedoMap = map->getTextureSource()->getUrl().toString();
|
emissiveMap = map->getTextureSource()->getUrl().toString();
|
||||||
if (map->useAlphaChannel()) {
|
|
||||||
opacityMap = albedoMap;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
map = material->getTextureMap(graphics::Material::MapChannel::METALLIC_MAP);
|
map = material->getTextureMap(graphics::Material::MapChannel::ALBEDO_MAP);
|
||||||
if (map && map->getTextureSource()) {
|
if (map && map->getTextureSource()) {
|
||||||
if (map->getTextureSource()->getType() == image::TextureUsage::Type::METALLIC_TEXTURE) {
|
albedoMap = map->getTextureSource()->getUrl().toString();
|
||||||
metallicMap = map->getTextureSource()->getUrl().toString();
|
if (map->useAlphaChannel()) {
|
||||||
} else if (map->getTextureSource()->getType() == image::TextureUsage::Type::SPECULAR_TEXTURE) {
|
opacityMap = albedoMap;
|
||||||
specularMap = map->getTextureSource()->getUrl().toString();
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
map = material->getTextureMap(graphics::Material::MapChannel::ROUGHNESS_MAP);
|
map = material->getTextureMap(graphics::Material::MapChannel::METALLIC_MAP);
|
||||||
if (map && map->getTextureSource()) {
|
if (map && map->getTextureSource()) {
|
||||||
if (map->getTextureSource()->getType() == image::TextureUsage::Type::ROUGHNESS_TEXTURE) {
|
if (map->getTextureSource()->getType() == image::TextureUsage::Type::METALLIC_TEXTURE) {
|
||||||
roughnessMap = map->getTextureSource()->getUrl().toString();
|
metallicMap = map->getTextureSource()->getUrl().toString();
|
||||||
} else if (map->getTextureSource()->getType() == image::TextureUsage::Type::GLOSS_TEXTURE) {
|
} else if (map->getTextureSource()->getType() == image::TextureUsage::Type::SPECULAR_TEXTURE) {
|
||||||
glossMap = map->getTextureSource()->getUrl().toString();
|
specularMap = map->getTextureSource()->getUrl().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
map = material->getTextureMap(graphics::Material::MapChannel::NORMAL_MAP);
|
map = material->getTextureMap(graphics::Material::MapChannel::ROUGHNESS_MAP);
|
||||||
if (map && map->getTextureSource()) {
|
if (map && map->getTextureSource()) {
|
||||||
if (map->getTextureSource()->getType() == image::TextureUsage::Type::NORMAL_TEXTURE) {
|
if (map->getTextureSource()->getType() == image::TextureUsage::Type::ROUGHNESS_TEXTURE) {
|
||||||
normalMap = map->getTextureSource()->getUrl().toString();
|
roughnessMap = map->getTextureSource()->getUrl().toString();
|
||||||
} else if (map->getTextureSource()->getType() == image::TextureUsage::Type::BUMP_TEXTURE) {
|
} else if (map->getTextureSource()->getType() == image::TextureUsage::Type::GLOSS_TEXTURE) {
|
||||||
bumpMap = map->getTextureSource()->getUrl().toString();
|
glossMap = map->getTextureSource()->getUrl().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
map = material->getTextureMap(graphics::Material::MapChannel::OCCLUSION_MAP);
|
map = material->getTextureMap(graphics::Material::MapChannel::NORMAL_MAP);
|
||||||
if (map && map->getTextureSource()) {
|
if (map && map->getTextureSource()) {
|
||||||
occlusionMap = map->getTextureSource()->getUrl().toString();
|
if (map->getTextureSource()->getType() == image::TextureUsage::Type::NORMAL_TEXTURE) {
|
||||||
}
|
normalMap = map->getTextureSource()->getUrl().toString();
|
||||||
|
} else if (map->getTextureSource()->getType() == image::TextureUsage::Type::BUMP_TEXTURE) {
|
||||||
|
bumpMap = map->getTextureSource()->getUrl().toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
map = material->getTextureMap(graphics::Material::MapChannel::LIGHTMAP_MAP);
|
map = material->getTextureMap(graphics::Material::MapChannel::OCCLUSION_MAP);
|
||||||
if (map && map->getTextureSource()) {
|
if (map && map->getTextureSource()) {
|
||||||
lightmapMap = map->getTextureSource()->getUrl().toString();
|
occlusionMap = map->getTextureSource()->getUrl().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
map = material->getTextureMap(graphics::Material::MapChannel::SCATTERING_MAP);
|
map = material->getTextureMap(graphics::Material::MapChannel::LIGHTMAP_MAP);
|
||||||
if (map && map->getTextureSource()) {
|
if (map && map->getTextureSource()) {
|
||||||
scatteringMap = map->getTextureSource()->getUrl().toString();
|
lightmapMap = map->getTextureSource()->getUrl().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < graphics::Material::NUM_TEXCOORD_TRANSFORMS; i++) {
|
map = material->getTextureMap(graphics::Material::MapChannel::SCATTERING_MAP);
|
||||||
texCoordTransforms[i] = material->getTexCoordTransform(i);
|
if (map && map->getTextureSource()) {
|
||||||
|
scatteringMap = map->getTextureSource()->getUrl().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < graphics::Material::NUM_TEXCOORD_TRANSFORMS; i++) {
|
||||||
|
texCoordTransforms[i] = material->getTexCoordTransform(i);
|
||||||
|
}
|
||||||
|
} else if (model.toStdString() == graphics::Material::HIFI_SHADER_SIMPLE) {
|
||||||
|
procedural = material->getProceduralString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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()) {
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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() : "");
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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 });
|
||||||
|
|
|
@ -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 };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue