Skip to content

Commit

Permalink
- redshift rotation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
theseim committed Aug 9, 2018
1 parent 992f235 commit b0962f6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
28 changes: 15 additions & 13 deletions SceneDistribution_Katana/src/Render/src/SceneIterator.cpp
Expand Up @@ -170,21 +170,28 @@ namespace Dreamspace

}





glm::vec3 skew, position, scale;
glm::vec4 persp;
glm::quat _rotation;
glm::quat rotation;

glm::decompose(transform, scale, _rotation, position, skew, persp);

if(sharedState->nodeTypeList[sharedState->nodeTypeList.size()-1] == Dreamspace::Katana::NodeType::CAMERA || sharedState->nodeTypeList[sharedState->nodeTypeList.size()-1] == Dreamspace::Katana::NodeType::LIGHT)

if(sharedState->nodeTypeList[sharedState->nodeTypeList.size()-1] == Dreamspace::Katana::NodeType::CAMERA)
{
glm::vec3 axis(0, 1, 0);
float angle = 3.14;
rotation = glm::rotate(_rotation, angle, axis);
rotation = glm::rotate(_rotation, glm::pi<float>(), glm::vec3(0, 1, 0));
}
else if(sharedState->nodeTypeList[sharedState->nodeTypeList.size()-1] == Dreamspace::Katana::NodeType::LIGHT)
{
_rotation = glm::rotate(_rotation, glm::pi<float>(), glm::vec3(0, 1, 0));

rotation[0] = _rotation[0];
rotation[1] = _rotation[2];
rotation[2] = _rotation[1];
rotation[3] = _rotation[3];

rotation = glm::rotate(rotation, -glm::pi<float>(), glm::vec3(0, 1, 0));
}
else
{
Expand All @@ -204,15 +211,10 @@ namespace Dreamspace
sharedState->node->rotation[2] = rotation[2];
sharedState->node->rotation[3] = rotation[3];


sharedState->node->scale[0] = scale[0];
sharedState->node->scale[1] = scale[1];
sharedState->node->scale[2] = scale[2];





sharedState->node->editable=false;

FnAttribute::IntAttribute editAttr = sgIterator.getAttribute("dreamspace.editable");
Expand Down
19 changes: 11 additions & 8 deletions VPET_Unity/Assets/VPET/Scripts/IO/Modules/NodeBuilderBasic.cs
Expand Up @@ -237,14 +237,17 @@ public static GameObject CreateLight( SceneNodeLight nodeLight, Transform parent
}
else if (nodeLight.lightType == LightType.Spot)
{
}
lightComponent.range *= 10;
objMain.transform.Rotate(new Vector3(0, 180f, 0), Space.Self);
}
else if (nodeLight.lightType == LightType.Area)
{
// TODO: use are lights when supported in unity
lightComponent.type = LightType.Spot;
lightComponent.spotAngle = 120;
}
else
lightComponent.range *= 10;
}
else
{
}

Expand All @@ -257,7 +260,7 @@ public static GameObject CreateLight( SceneNodeLight nodeLight, Transform parent
sco.exposure = nodeLight.exposure;

// Rotate 180 around y-axis because lights and cameras have additional eye space coordinate system
// objMain.transform.Rotate(new Vector3(0, 180f, 0), Space.Self);
//objMain.transform.Rotate(new Vector3(0, 180f, 0), Space.Self);

// TODO: what for ??
objMain.layer = 0;
Expand All @@ -278,9 +281,9 @@ public static GameObject CreateCamera(SceneNodeCam nodeCam, Transform parentTran
Vector3 pos = new Vector3( nodeCam.position[0], nodeCam.position[1], nodeCam.position[2] );
Quaternion rot = new Quaternion( nodeCam.rotation[0], nodeCam.rotation[1], nodeCam.rotation[2], nodeCam.rotation[3] );
Vector3 scl = new Vector3( nodeCam.scale[0], nodeCam.scale[1], nodeCam.scale[2] );
// set up object basics
GameObject objMain = new GameObject();

// set up object basics
GameObject objMain = new GameObject();
objMain.name =Encoding.ASCII.GetString(nodeCam.name);

// add camera data script and set values
Expand All @@ -296,7 +299,7 @@ public static GameObject CreateCamera(SceneNodeCam nodeCam, Transform parentTran
objMain.transform.localScale = scl;

// Rotate 180 around y-axis because lights and cameras have additional eye space coordinate system
// objMain.transform.Rotate(new Vector3(0, 180f, 0), Space.Self);
//objMain.transform.Rotate(new Vector3(0, 180f, 0), Space.Self);

// TODO: what for ??
objMain.layer = 0;
Expand Down

0 comments on commit b0962f6

Please sign in to comment.