mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:49:24 +02:00
add getName passthrough to ObjecdtMotionState, don't compute model shapes until the model has been simulated
This commit is contained in:
parent
fabff7fdf4
commit
fe14202f51
5 changed files with 20 additions and 2 deletions
|
@ -278,6 +278,11 @@ bool RenderableModelEntityItem::isReadyToComputeShape() {
|
||||||
return false; // hmm...
|
return false; // hmm...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_needsInitialSimulation) {
|
||||||
|
// the _model's offset will be wrong until _needsInitialSimulation is false
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
assert(!_model->getCollisionURL().isEmpty());
|
assert(!_model->getCollisionURL().isEmpty());
|
||||||
|
|
||||||
if (_model->getURL().isEmpty()) {
|
if (_model->getURL().isEmpty()) {
|
||||||
|
|
|
@ -484,7 +484,7 @@ FBXGeometry OBJReader::readOBJ(QIODevice* device, const QVariantHash& mapping, Q
|
||||||
meshPart._material->setShininess(material->shininess);
|
meshPart._material->setShininess(material->shininess);
|
||||||
meshPart._material->setOpacity(material->opacity);
|
meshPart._material->setOpacity(material->opacity);
|
||||||
}
|
}
|
||||||
qCDebug(modelformat) << "OBJ Reader part:" << meshPartCount << "name:" << leadFace.groupName << "material:" << groupMaterialName << "diffuse:" << meshPart._material->getDiffuse() << "faces:" << faceGroup.count() << "triangle indices will start with:" << mesh.vertices.count();
|
// qCDebug(modelformat) << "OBJ Reader part:" << meshPartCount << "name:" << leadFace.groupName << "material:" << groupMaterialName << "diffuse:" << meshPart._material->getDiffuse() << "faces:" << faceGroup.count() << "triangle indices will start with:" << mesh.vertices.count();
|
||||||
foreach(OBJFace face, faceGroup) {
|
foreach(OBJFace face, faceGroup) {
|
||||||
glm::vec3 v0 = vertices[face.vertexIndices[0]];
|
glm::vec3 v0 = vertices[face.vertexIndices[0]];
|
||||||
glm::vec3 v1 = vertices[face.vertexIndices[1]];
|
glm::vec3 v1 = vertices[face.vertexIndices[1]];
|
||||||
|
@ -526,7 +526,7 @@ FBXGeometry OBJReader::readOBJ(QIODevice* device, const QVariantHash& mapping, Q
|
||||||
mesh.meshExtents.addPoint(vertex);
|
mesh.meshExtents.addPoint(vertex);
|
||||||
geometry.meshExtents.addPoint(vertex);
|
geometry.meshExtents.addPoint(vertex);
|
||||||
}
|
}
|
||||||
fbxDebugDump(geometry);
|
// fbxDebugDump(geometry);
|
||||||
} catch(const std::exception& e) {
|
} catch(const std::exception& e) {
|
||||||
qCDebug(modelformat) << "OBJ reader fail: " << e.what();
|
qCDebug(modelformat) << "OBJ reader fail: " << e.what();
|
||||||
}
|
}
|
||||||
|
|
|
@ -502,3 +502,12 @@ void EntityMotionState::setMotionType(MotionType motionType) {
|
||||||
ObjectMotionState::setMotionType(motionType);
|
ObjectMotionState::setMotionType(motionType);
|
||||||
resetMeasuredBodyAcceleration();
|
resetMeasuredBodyAcceleration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// virtual
|
||||||
|
QString EntityMotionState::getName() {
|
||||||
|
if (_entity) {
|
||||||
|
return _entity->getName();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
|
@ -81,6 +81,8 @@ public:
|
||||||
void resetMeasuredBodyAcceleration();
|
void resetMeasuredBodyAcceleration();
|
||||||
void measureBodyAcceleration();
|
void measureBodyAcceleration();
|
||||||
|
|
||||||
|
virtual QString getName();
|
||||||
|
|
||||||
friend class PhysicalEntitySimulation;
|
friend class PhysicalEntitySimulation;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -119,6 +119,8 @@ public:
|
||||||
virtual QUuid getSimulatorID() const = 0;
|
virtual QUuid getSimulatorID() const = 0;
|
||||||
virtual void bump() = 0;
|
virtual void bump() = 0;
|
||||||
|
|
||||||
|
virtual QString getName() { return ""; }
|
||||||
|
|
||||||
friend class PhysicsEngine;
|
friend class PhysicsEngine;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in a new issue