mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +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()) {
|
||||
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 vertexColor = ColorUtils::toVec3(_color);
|
||||
scriptable::ScriptableModelBase result;
|
||||
result.metadata = {
|
||||
{ "origin", "Shape3DOverlay::"+shapeStrings[_shape] },
|
||||
{ "overlayID", getID() },
|
||||
};
|
||||
result.objectID = getID();
|
||||
result.append(geometryCache->meshFromShape(_shape, vertexColor), {{ "shape", shapeStrings[_shape] }});
|
||||
if (ok) {
|
||||
*ok = true;
|
||||
|
|
|
@ -1801,12 +1801,7 @@ scriptable::ScriptableModelBase Avatar::getScriptableModel(bool* ok) {
|
|||
}
|
||||
scriptable::ScriptableModelBase result = _skeletonModel->getScriptableModel(ok);
|
||||
result.objectID = getSessionUUID();
|
||||
result.mixin({
|
||||
{ "avatarID", getSessionUUID().toString() },
|
||||
{ "url", _skeletonModelURL.toString() },
|
||||
{ "origin", "Avatar/avatar::" + _displayName },
|
||||
{ "textures", _skeletonModel->getTextures() },
|
||||
});
|
||||
result.mixin({{ "textures", _skeletonModel->getTextures() }});
|
||||
// FIXME: for now access to attachment models are merged into the main avatar ScriptableModel set
|
||||
for (int i = 0; i < (int)_attachmentModels.size(); i++) {
|
||||
auto& model = _attachmentModels.at(i);
|
||||
|
|
|
@ -968,7 +968,9 @@ scriptable::ScriptableModelBase render::entities::ModelEntityRenderer::getScript
|
|||
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) {
|
||||
|
|
|
@ -1459,6 +1459,7 @@ scriptable::ScriptableModelBase RenderablePolyVoxEntityItem::getScriptableModel(
|
|||
bool success = false;
|
||||
glm::mat4 transform = voxelToLocalMatrix();
|
||||
scriptable::ScriptableModelBase result;
|
||||
result.objectID = getThisPointer()->getID();
|
||||
withReadLock([&] {
|
||||
gpu::BufferView::Index numVertices = (gpu::BufferView::Index)_mesh->getNumVertices();
|
||||
if (!_meshReady) {
|
||||
|
|
|
@ -166,11 +166,7 @@ void ShapeEntityRenderer::doRender(RenderArgs* args) {
|
|||
|
||||
scriptable::ScriptableModelBase ShapeEntityRenderer::getScriptableModel(bool* ok) {
|
||||
scriptable::ScriptableModelBase result;
|
||||
result.metadata = {
|
||||
{ "entityID", getEntity()->getID().toString() },
|
||||
{ "shape", entity::stringFromShape(_shape) },
|
||||
{ "userData", getEntity()->getUserData() },
|
||||
};
|
||||
result.objectID = getEntity()->getID();
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto geometryShape = geometryCache->getShapeForEntityShape(_shape);
|
||||
glm::vec3 vertexColor;
|
||||
|
@ -179,10 +175,7 @@ scriptable::ScriptableModelBase ShapeEntityRenderer::getScriptableModel(bool* ok
|
|||
}
|
||||
auto success = false;
|
||||
if (auto mesh = geometryCache->meshFromShape(geometryShape, vertexColor)) {
|
||||
scriptable::ScriptableMeshBase base{ mesh, {
|
||||
{ "shape", entity::stringFromShape(_shape) },
|
||||
}};
|
||||
result.append(base);
|
||||
result.append({ mesh, {{ "shape", entity::stringFromShape(_shape) }}});
|
||||
success = true;
|
||||
}
|
||||
if (ok) {
|
||||
|
|
Loading…
Reference in a new issue