mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 04:53:25 +02:00
cleanup; formalize data structures
This commit is contained in:
parent
fe9b67344b
commit
4fd3d9bf7b
6 changed files with 11 additions and 21 deletions
|
@ -669,5 +669,7 @@ scriptable::ScriptableModelBase ModelOverlay::getScriptableModel(bool* ok) {
|
||||||
if (!_model || !_model->isLoaded()) {
|
if (!_model || !_model->isLoaded()) {
|
||||||
return Base3DOverlay::getScriptableModel(ok);
|
return Base3DOverlay::getScriptableModel(ok);
|
||||||
}
|
}
|
||||||
return _model->getScriptableModel(ok);
|
auto result = _model->getScriptableModel(ok);
|
||||||
|
result.objectID = getID();
|
||||||
|
return result;
|
||||||
}
|
}
|
|
@ -184,10 +184,7 @@ scriptable::ScriptableModelBase Shape3DOverlay::getScriptableModel(bool* ok) {
|
||||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||||
auto vertexColor = ColorUtils::toVec3(_color);
|
auto vertexColor = ColorUtils::toVec3(_color);
|
||||||
scriptable::ScriptableModelBase result;
|
scriptable::ScriptableModelBase result;
|
||||||
result.metadata = {
|
result.objectID = getID();
|
||||||
{ "origin", "Shape3DOverlay::"+shapeStrings[_shape] },
|
|
||||||
{ "overlayID", getID() },
|
|
||||||
};
|
|
||||||
result.append(geometryCache->meshFromShape(_shape, vertexColor), {{ "shape", shapeStrings[_shape] }});
|
result.append(geometryCache->meshFromShape(_shape, vertexColor), {{ "shape", shapeStrings[_shape] }});
|
||||||
if (ok) {
|
if (ok) {
|
||||||
*ok = true;
|
*ok = true;
|
||||||
|
|
|
@ -1801,12 +1801,7 @@ scriptable::ScriptableModelBase Avatar::getScriptableModel(bool* ok) {
|
||||||
}
|
}
|
||||||
scriptable::ScriptableModelBase result = _skeletonModel->getScriptableModel(ok);
|
scriptable::ScriptableModelBase result = _skeletonModel->getScriptableModel(ok);
|
||||||
result.objectID = getSessionUUID();
|
result.objectID = getSessionUUID();
|
||||||
result.mixin({
|
result.mixin({{ "textures", _skeletonModel->getTextures() }});
|
||||||
{ "avatarID", getSessionUUID().toString() },
|
|
||||||
{ "url", _skeletonModelURL.toString() },
|
|
||||||
{ "origin", "Avatar/avatar::" + _displayName },
|
|
||||||
{ "textures", _skeletonModel->getTextures() },
|
|
||||||
});
|
|
||||||
// FIXME: for now access to attachment models are merged into the main avatar ScriptableModel set
|
// FIXME: for now access to attachment models are merged into the main avatar ScriptableModel set
|
||||||
for (int i = 0; i < (int)_attachmentModels.size(); i++) {
|
for (int i = 0; i < (int)_attachmentModels.size(); i++) {
|
||||||
auto& model = _attachmentModels.at(i);
|
auto& model = _attachmentModels.at(i);
|
||||||
|
|
|
@ -968,7 +968,9 @@ scriptable::ScriptableModelBase render::entities::ModelEntityRenderer::getScript
|
||||||
return scriptable::ModelProvider::modelUnavailableError(ok);
|
return scriptable::ModelProvider::modelUnavailableError(ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _model->getScriptableModel(ok);
|
auto result = _model->getScriptableModel(ok);
|
||||||
|
result.objectID = getEntity()->getID();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool render::entities::ModelEntityRenderer::replaceScriptableModelMeshPart(scriptable::ScriptableModelBasePointer newModel, int meshIndex, int partIndex) {
|
bool render::entities::ModelEntityRenderer::replaceScriptableModelMeshPart(scriptable::ScriptableModelBasePointer newModel, int meshIndex, int partIndex) {
|
||||||
|
|
|
@ -1459,6 +1459,7 @@ scriptable::ScriptableModelBase RenderablePolyVoxEntityItem::getScriptableModel(
|
||||||
bool success = false;
|
bool success = false;
|
||||||
glm::mat4 transform = voxelToLocalMatrix();
|
glm::mat4 transform = voxelToLocalMatrix();
|
||||||
scriptable::ScriptableModelBase result;
|
scriptable::ScriptableModelBase result;
|
||||||
|
result.objectID = getThisPointer()->getID();
|
||||||
withReadLock([&] {
|
withReadLock([&] {
|
||||||
gpu::BufferView::Index numVertices = (gpu::BufferView::Index)_mesh->getNumVertices();
|
gpu::BufferView::Index numVertices = (gpu::BufferView::Index)_mesh->getNumVertices();
|
||||||
if (!_meshReady) {
|
if (!_meshReady) {
|
||||||
|
|
|
@ -166,11 +166,7 @@ void ShapeEntityRenderer::doRender(RenderArgs* args) {
|
||||||
|
|
||||||
scriptable::ScriptableModelBase ShapeEntityRenderer::getScriptableModel(bool* ok) {
|
scriptable::ScriptableModelBase ShapeEntityRenderer::getScriptableModel(bool* ok) {
|
||||||
scriptable::ScriptableModelBase result;
|
scriptable::ScriptableModelBase result;
|
||||||
result.metadata = {
|
result.objectID = getEntity()->getID();
|
||||||
{ "entityID", getEntity()->getID().toString() },
|
|
||||||
{ "shape", entity::stringFromShape(_shape) },
|
|
||||||
{ "userData", getEntity()->getUserData() },
|
|
||||||
};
|
|
||||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||||
auto geometryShape = geometryCache->getShapeForEntityShape(_shape);
|
auto geometryShape = geometryCache->getShapeForEntityShape(_shape);
|
||||||
glm::vec3 vertexColor;
|
glm::vec3 vertexColor;
|
||||||
|
@ -179,10 +175,7 @@ scriptable::ScriptableModelBase ShapeEntityRenderer::getScriptableModel(bool* ok
|
||||||
}
|
}
|
||||||
auto success = false;
|
auto success = false;
|
||||||
if (auto mesh = geometryCache->meshFromShape(geometryShape, vertexColor)) {
|
if (auto mesh = geometryCache->meshFromShape(geometryShape, vertexColor)) {
|
||||||
scriptable::ScriptableMeshBase base{ mesh, {
|
result.append({ mesh, {{ "shape", entity::stringFromShape(_shape) }}});
|
||||||
{ "shape", entity::stringFromShape(_shape) },
|
|
||||||
}};
|
|
||||||
result.append(base);
|
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
if (ok) {
|
if (ok) {
|
||||||
|
|
Loading…
Reference in a new issue