mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 06:44:06 +02:00
More work on importing the version of FBX exported by Blender.
This commit is contained in:
parent
778e432cc4
commit
cd902c5e85
2 changed files with 55 additions and 3 deletions
|
@ -32,7 +32,7 @@ void Body::simulate(float deltaTime) {
|
|||
}
|
||||
|
||||
glm::quat orientation = _owningAvatar->getOrientation();
|
||||
const float MODEL_SCALE = 0.0006f;
|
||||
const float MODEL_SCALE = 0.05f;
|
||||
glm::vec3 scale = glm::vec3(-1.0f, 1.0f, -1.0f) * _owningAvatar->getScale() * MODEL_SCALE;
|
||||
glm::mat4 baseTransform = glm::translate(_owningAvatar->getPosition()) * glm::mat4_cast(orientation) * glm::scale(scale);
|
||||
|
||||
|
@ -56,6 +56,18 @@ bool Body::render(float alpha) {
|
|||
return false;
|
||||
}
|
||||
|
||||
glColor4f(1.0f, 1.0f, 1.0f, alpha);
|
||||
|
||||
for (int i = 0; i < _jointStates.size(); i++) {
|
||||
const JointState& state = _jointStates[i];
|
||||
glPushMatrix();
|
||||
glMultMatrixf((const GLfloat*)&state.transform);
|
||||
|
||||
glutSolidSphere(0.2f, 10, 10);
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -693,7 +693,47 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping)
|
|||
glm::vec3 scalePivot, rotationPivot;
|
||||
Model model = { name };
|
||||
foreach (const FBXNode& subobject, object.children) {
|
||||
if (subobject.name == "Properties70") {
|
||||
if (subobject.name == "Properties60") {
|
||||
foreach (const FBXNode& property, subobject.children) {
|
||||
if (property.name == "Property") {
|
||||
if (property.properties.at(0) == "Lcl Translation") {
|
||||
translation = glm::vec3(property.properties.at(3).value<double>(),
|
||||
property.properties.at(4).value<double>(),
|
||||
property.properties.at(5).value<double>());
|
||||
|
||||
} else if (property.properties.at(0) == "RotationPivot") {
|
||||
rotationPivot = glm::vec3(property.properties.at(3).value<double>(),
|
||||
property.properties.at(4).value<double>(),
|
||||
property.properties.at(5).value<double>());
|
||||
|
||||
} else if (property.properties.at(0) == "PreRotation") {
|
||||
preRotation = glm::vec3(property.properties.at(3).value<double>(),
|
||||
property.properties.at(4).value<double>(),
|
||||
property.properties.at(5).value<double>());
|
||||
|
||||
} else if (property.properties.at(0) == "Lcl Rotation") {
|
||||
rotation = glm::vec3(property.properties.at(3).value<double>(),
|
||||
property.properties.at(4).value<double>(),
|
||||
property.properties.at(5).value<double>());
|
||||
|
||||
} else if (property.properties.at(0) == "PostRotation") {
|
||||
postRotation = glm::vec3(property.properties.at(3).value<double>(),
|
||||
property.properties.at(4).value<double>(),
|
||||
property.properties.at(5).value<double>());
|
||||
|
||||
} else if (property.properties.at(0) == "ScalingPivot") {
|
||||
scalePivot = glm::vec3(property.properties.at(3).value<double>(),
|
||||
property.properties.at(4).value<double>(),
|
||||
property.properties.at(5).value<double>());
|
||||
|
||||
} else if (property.properties.at(0) == "Lcl Scaling") {
|
||||
scale = glm::vec3(property.properties.at(3).value<double>(),
|
||||
property.properties.at(4).value<double>(),
|
||||
property.properties.at(5).value<double>());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (subobject.name == "Properties70") {
|
||||
foreach (const FBXNode& property, subobject.children) {
|
||||
if (property.name == "P") {
|
||||
if (property.properties.at(0) == "Lcl Translation") {
|
||||
|
@ -737,7 +777,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping)
|
|||
}
|
||||
// see FBX documentation, http://download.autodesk.com/us/fbx/20112/FBX_SDK_HELP/index.html
|
||||
model.preRotation = glm::translate(translation) * glm::translate(rotationPivot) *
|
||||
glm::mat4_cast(glm::quat(glm::radians(preRotation)));
|
||||
glm::mat4_cast(glm::quat(glm::radians(preRotation)));
|
||||
model.rotation = glm::quat(glm::radians(rotation));
|
||||
model.postRotation = glm::mat4_cast(glm::quat(glm::radians(postRotation))) * glm::translate(-rotationPivot) *
|
||||
glm::translate(scalePivot) * glm::scale(scale) * glm::translate(-scalePivot);
|
||||
|
|
Loading…
Reference in a new issue