Commit 706e3b25 authored by Aron Helser's avatar Aron Helser

Avatar: add torso and forearms

Torso says below head, according to input param UpVector.
Orientation matches head around the UpVector.

Forearms are rigidly attached to hands, for now.
parent 7ceeea64
......@@ -52,6 +52,20 @@ vtkAvatar::vtkAvatar()
this->LeftHandOrientation[0] = 0.0;
this->LeftHandOrientation[1] = 0.0;
this->LeftHandOrientation[2] = 0.0;
for (int i = 0; i < NUM_BODY; ++i) {
this->BodyPosition[i][0] = 0.0;
this->BodyPosition[i][1] = 0.0;
this->BodyPosition[i][2] = 0.0;
this->BodyOrientation[i][0] = 0.0;
this->BodyOrientation[i][1] = 0.0;
this->BodyOrientation[i][2] = 0.0;
}
this->UpVector[0] = 0.0;
this->UpVector[1] = 1.0;
this->UpVector[2] = 0.0;
}
//------------------------------------------------------------------------------
......
......@@ -51,6 +51,8 @@ public:
vtkGetVector3Macro(RightHandOrientation, double);
vtkSetVector3Macro(RightHandOrientation, double);
vtkGetVector3Macro(UpVector, double);
vtkSetVector3Macro(UpVector, double);
protected:
vtkAvatar();
~vtkAvatar() override;
......@@ -61,7 +63,18 @@ protected:
double LeftHandOrientation[3];
double RightHandPosition[3];
double RightHandOrientation[3];
enum {
TORSO,
LEFT_FORE,
RIGHT_FORE,
LEFT_UPPER,
RIGHT_UPPER,
NUM_BODY,
};
double BodyPosition[NUM_BODY][3];
double BodyOrientation[NUM_BODY][3];
double UpVector[3];
private:
vtkAvatar(const vtkAvatar&) = delete;
void operator=(const vtkAvatar&) = delete;
......
......@@ -46,6 +46,9 @@ set(geometry_files
data/vtkAvatarHead.vtp
data/vtkAvatarLeftHand.vtp
data/vtkAvatarRightHand.vtp
data/vtkAvatarTorso.vtp
data/vtkAvatarLeftForeArm.vtp
data/vtkAvatarRightForeArm.vtp
)
unset(geometry_h_files)
foreach(file ${geometry_files})
......
......@@ -76,26 +76,26 @@ int TestAvatar(int argc, char *argv[])
actor->SetMapper(mapper);
vtkNew<vtkAvatar> avatar;
avatar->SetHeadPosition(-1.4, 0.2, 0);
avatar->SetHeadOrientation(0, 0, 0);
avatar->SetHeadPosition(-2.4, 0.2, 0);
avatar->SetHeadOrientation(20, 20, 0);
avatar->SetLeftHandPosition(-0.6, -0.3, -0.5);
avatar->SetLeftHandOrientation(0, 0, 30);
avatar->SetRightHandPosition(-0.6, -0.4, 0.5);
avatar->SetRightHandOrientation(0, 0, 0);
avatar->GetProperty()->SetColor(0.8, 1.0, 0.8);
avatar->SetScale(0.9);
// avatar->SetScale(0.3);
renderer->AddActor(avatar);
renderer->GetActiveCamera()->SetPosition(0.0, 0.25, 4.0);
renderer->GetActiveCamera()->SetFocalPoint(0.0, 0.25, 0.0);
renderer->GetActiveCamera()->SetPosition(-1.0, 0.25, 4.0);
renderer->GetActiveCamera()->SetFocalPoint(-1.0, 0.25, 0.0);
renderer->GetActiveCamera()->SetViewAngle(60.0);
renderer->GetActiveCamera()->Zoom(1.1);
renderer->GetActiveCamera()->Azimuth(0);
renderer->GetActiveCamera()->Elevation(15);
// renderer->GetActiveCamera()->Roll(-10);
renderer->SetBackground(0.6,0.7,1.0);
renderer->SetClippingRangeExpansion(0.3);
renderer->ResetCameraClippingRange();
renderer->SetClippingRangeExpansion(1.5);
renderWindow->Render();
......
This diff is collapsed.
<?xml version="1.0"?>
<VTKFile type="PolyData" version="1.0" byte_order="LittleEndian" header_type="UInt64" compressor="vtkLZMADataCompressor">
<PolyData>
<FieldData>
<Array type="String" Name="MaterialNames" NumberOfTuples="1" format="appended" offset="0" />
</FieldData>
<Piece NumberOfPoints="474" NumberOfVerts="0" NumberOfLines="0" NumberOfStrips="0" NumberOfPolys="141" >
<PointData Normals="Normals">
<DataArray type="Float32" Name="Normals" NumberOfComponents="3" format="appended" RangeMin="0.99992657637" RangeMax="1.0000267295" offset="124" >
<InformationKey name="L2_NORM_RANGE" location="vtkDataArray" length="2">
<Value index="0">
0.99992657637
</Value>
<Value index="1">
1.0000267295
</Value>
</InformationKey>
<InformationKey name="L2_NORM_FINITE_RANGE" location="vtkDataArray" length="2">
<Value index="0">
0.99992657637
</Value>
<Value index="1">
1.0000267295
</Value>
</InformationKey>
</DataArray>
</PointData>
<CellData>
<DataArray type="Int32" Name="MaterialIds" format="appended" RangeMin="0" RangeMax="0" offset="1592" >
</DataArray>
</CellData>
<Points>
<DataArray type="Float32" Name="Points" NumberOfComponents="3" format="appended" RangeMin="0.078548331922" RangeMax="0.95287416741" offset="1740" >
<InformationKey name="L2_NORM_RANGE" location="vtkDataArray" length="2">
<Value index="0">
0.078548331922
</Value>
<Value index="1">
0.95287416741
</Value>
</InformationKey>
<InformationKey name="L2_NORM_FINITE_RANGE" location="vtkDataArray" length="2">
<Value index="0">
0.078548331922
</Value>
<Value index="1">
0.95287416741
</Value>
</InformationKey>
</DataArray>
</Points>
<Verts>
<DataArray type="Int64" Name="connectivity" format="appended" RangeMin="" RangeMax="" offset="3208" />
<DataArray type="Int64" Name="offsets" format="appended" RangeMin="" RangeMax="" offset="3240" />
</Verts>
<Lines>
<DataArray type="Int64" Name="connectivity" format="appended" RangeMin="" RangeMax="" offset="3272" />
<DataArray type="Int64" Name="offsets" format="appended" RangeMin="" RangeMax="" offset="3304" />
</Lines>
<Strips>
<DataArray type="Int64" Name="connectivity" format="appended" RangeMin="" RangeMax="" offset="3336" />
<DataArray type="Int64" Name="offsets" format="appended" RangeMin="" RangeMax="" offset="3368" />
</Strips>
<Polys>
<DataArray type="Int64" Name="connectivity" format="appended" RangeMin="" RangeMax="" offset="3400" />
<DataArray type="Int64" Name="offsets" format="appended" RangeMin="" RangeMax="" offset="4020" />
</Polys>
</Piece>
</PolyData>
<AppendedData encoding="base64">
_AQAAAAAAAAAAgAAAAAAAAAUAAAAAAAAAPAAAAAAAAAA=/Td6WFoAAAFpIt42AsAJBSEBHAAWZs77AQAETm9uZQAAAAAAqI9nGAABGQW86OzLkEKZDQEAAAAAAVlaAQAAAAAAAAAAgAAAAAAAADgWAAAAAAAALAQAAAAAAAA=/Td6WFoAAAFpIt42A8DzB7gsIQEcA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td6WFoAAAFpIt42A8D2AtAdIQEcAAAAoXANdeAOzwFuXQAAan67FG8bQTG6mEVMcczeEzxc7fUuDAQjQ9EQFkBrxTQUUuzs+iNN8xeAJaNREMIzPuM8Zx3ljlRrHsyydxKqzRU8FUNX+chnU1o0mQctL91QVqQyyMlQLnqdEGbKCOZ2n9vquKQpFevpDwO7DxdGfc3jXh5TxYBOnW83zC5V4s9TH1m/7PNx4fYWqHHmNL5vqfVRREGziJ+IIJ09CgP8G47LQdaM0D72zoCaCcmKRreOny24AgqxIw6QrZ6vpwx7BFHH1FikVAY+jfdMH6j2No68RWAmy4hfS+x+xp0ryQ/LgxcLlZPo97NsUUFSzYijczSMRovmxlAVHnCehvz28PwYnPCFhYd1HboXSEyk2Ieok0i49VbFc2Y7Aj6E8DOSbjHwTjS+I0bj6XpsnlH1UewBTxmVcjnesLz5ep0aeIuKgXjXzrCYkzS3SBpVyDbiGU7prV6C0kfl+4huUAYonnFtqbyuNlhlFNnEA/8AAAD7tVlEAAGKA9AdAAAJEHQJPjANiwIAAAAAAVlaAQAAAAAAAAAAgAAAAAAAAGgEAAAAAAAA5AAAAAAAAAA=/Td6WFoAAAFpIt42A8CpAegIIQEcAAAAAGpRZ+AEZwChXQACADfhzisBmsxAFINLPWnkPMJCINIW4LRoDRp2MuIdtPTBq7sp6d6EYPbS2uh7Eff4958hHZEG8zwxQJLImI88nIh+ggL0MWo87p3KtRMy651uupwJPhXhlrNd+y9aclLNBko745HthzqveF8+3uZO97yMmdxITdLoQooQUPAA7WWqPwXp6eRagG7OClhWUfc7DGvsuyZZwtmhmpkVEpof6gAAAACXepCfAAG9AegIAACpxblFPjANiwIAAAAAAVla
</AppendedData>
</VTKFile>
<?xml version="1.0"?>
<VTKFile type="PolyData" version="1.0" byte_order="LittleEndian" header_type="UInt64" compressor="vtkLZMADataCompressor">
<PolyData>
<FieldData>
<Array type="String" Name="MaterialNames" NumberOfTuples="1" format="appended" offset="0" />
</FieldData>
<Piece NumberOfPoints="474" NumberOfVerts="0" NumberOfLines="0" NumberOfStrips="0" NumberOfPolys="141" >
<PointData Normals="Normals">
<DataArray type="Float32" Name="Normals" NumberOfComponents="3" format="appended" RangeMin="0.99990717655" RangeMax="1.0000420511" offset="124" >
<InformationKey name="L2_NORM_RANGE" location="vtkDataArray" length="2">
<Value index="0">
0.99990717655
</Value>
<Value index="1">
1.0000420511
</Value>
</InformationKey>
<InformationKey name="L2_NORM_FINITE_RANGE" location="vtkDataArray" length="2">
<Value index="0">
0.99990717655
</Value>
<Value index="1">
1.0000420511
</Value>
</InformationKey>
</DataArray>
</PointData>
<CellData>
<DataArray type="Int32" Name="MaterialIds" format="appended" RangeMin="0" RangeMax="0" offset="1760" >
</DataArray>
</CellData>
<Points>
<DataArray type="Float32" Name="Points" NumberOfComponents="3" format="appended" RangeMin="0.084743827416" RangeMax="0.96397369405" offset="1908" >
<InformationKey name="L2_NORM_RANGE" location="vtkDataArray" length="2">
<Value index="0">
0.084743827416
</Value>
<Value index="1">
0.96397369405
</Value>
</InformationKey>
<InformationKey name="L2_NORM_FINITE_RANGE" location="vtkDataArray" length="2">
<Value index="0">
0.084743827416
</Value>
<Value index="1">
0.96397369405
</Value>
</InformationKey>
</DataArray>
</Points>
<Verts>
<DataArray type="Int64" Name="connectivity" format="appended" RangeMin="" RangeMax="" offset="3488" />
<DataArray type="Int64" Name="offsets" format="appended" RangeMin="" RangeMax="" offset="3520" />
</Verts>
<Lines>
<DataArray type="Int64" Name="connectivity" format="appended" RangeMin="" RangeMax="" offset="3552" />
<DataArray type="Int64" Name="offsets" format="appended" RangeMin="" RangeMax="" offset="3584" />
</Lines>
<Strips>
<DataArray type="Int64" Name="connectivity" format="appended" RangeMin="" RangeMax="" offset="3616" />
<DataArray type="Int64" Name="offsets" format="appended" RangeMin="" RangeMax="" offset="3648" />
</Strips>
<Polys>
<DataArray type="Int64" Name="connectivity" format="appended" RangeMin="" RangeMax="" offset="3680" />
<DataArray type="Int64" Name="offsets" format="appended" RangeMin="" R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tqbyuNlhlFNnEA/8AAAD7tVlEAAGKA9AdAAAJEHQJPjANiwIAAAAAAVlaAQAAAAAAAAAAgAAAAAAAAGgEAAAAAAAA5AAAAAAAAAA=/Td6WFoAAAFpIt42A8CpAegIIQEcAAAAAGpRZ+AEZwChXQACADfhzisBmsxAFINLPWnkPMJCINIW4LRoDRp2MuIdtPTBq7sp6d6EYPbS2uh7Eff4958hHZEG8zwxQJLImI88nIh+ggL0MWo87p3KtRMy651uupwJPhXhlrNd+y9aclLNBko745HthzqveF8+3uZO97yMmdxITdLoQooQUPAA7WWqPwXp6eRagG7OClhWUfc7DGvsuyZZwtmhmpkVEpof6gAAAACXepCfAAG9AegIAACpxblFPjANiwIAAAAAAVla
</AppendedData>
</VTKFile>
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -32,17 +32,19 @@
#include "vtkAvatarHead.h" // geometry for head
#include "vtkAvatarLeftHand.h" // geometry for hand
#include "vtkAvatarRightHand.h" // geometry for hand
#include "vtkAvatarTorso.h" // geometry for torso
#include "vtkAvatarLeftForeArm.h" // geometry for torso
#include "vtkAvatarRightForeArm.h" // geometry for torso
#include <cmath>
vtkStandardNewMacro(vtkOpenGLAvatar);
vtkOpenGLAvatar::vtkOpenGLAvatar()
{
vtkNew<vtkXMLPolyDataReader> reader;
reader->SetReadFromInputString(true);
reader->SetInputString(vtkAvatarHead);
reader->SetInputString(std::string(vtkAvatarHead, vtkAvatarHead + sizeof vtkAvatarHead));
reader->Update();
this->HeadMapper->SetInputData(reader->GetOutput());
......@@ -51,18 +53,33 @@ vtkOpenGLAvatar::vtkOpenGLAvatar()
vtkNew<vtkXMLPolyDataReader> reader2;
reader2->SetReadFromInputString(true);
reader2->SetInputString(vtkAvatarLeftHand);
reader2->SetInputString(std::string(vtkAvatarLeftHand, vtkAvatarLeftHand + sizeof vtkAvatarLeftHand));
reader2->Update();
this->LeftHandMapper->SetInputData(reader2->GetOutput());
this->LeftHandActor->SetMapper(this->LeftHandMapper);
vtkNew<vtkXMLPolyDataReader> reader3;
reader3->SetReadFromInputString(true);
reader3->SetInputString(vtkAvatarRightHand);
reader3->SetInputString(std::string(vtkAvatarRightHand, vtkAvatarRightHand + sizeof vtkAvatarRightHand));
reader3->Update();
this->RightHandMapper->SetInputData(reader3->GetOutput());
this->RightHandActor->SetMapper(this->RightHandMapper);
const unsigned char *models[NUM_BODY] = {
vtkAvatarTorso,
vtkAvatarLeftForeArm,
vtkAvatarRightForeArm,
nullptr,
nullptr,
};
size_t modelSize[NUM_BODY] = {
sizeof vtkAvatarTorso,
sizeof vtkAvatarLeftForeArm,
sizeof vtkAvatarRightForeArm,
0,
0,
};
this->GetProperty()->SetDiffuse(0.7);
this->GetProperty()->SetAmbient(0.3);
this->GetProperty()->SetSpecular(0.0);
......@@ -70,6 +87,19 @@ vtkOpenGLAvatar::vtkOpenGLAvatar()
this->HeadActor->SetProperty(this->GetProperty());
this->LeftHandActor->SetProperty(this->GetProperty());
this->RightHandActor->SetProperty(this->GetProperty());
for (int i = 0; i < NUM_BODY; ++i) {
if (!models[i]) continue;
vtkNew<vtkXMLPolyDataReader> reader4;
reader4->SetReadFromInputString(true);
reader4->SetInputString(std::string(models[i], models[i] + modelSize[i]));
reader4->Update();
this->BodyMapper[i]->SetInputData(reader4->GetOutput());
this->BodyActor[i]->SetMapper(this->BodyMapper[i]);
this->BodyActor[i]->SetProperty(this->GetProperty());
}
}
vtkOpenGLAvatar::~vtkOpenGLAvatar() = default;
......@@ -79,6 +109,8 @@ void vtkOpenGLAvatar::Render(vtkRenderer *ren, vtkMapper *mapper)
{
vtkOpenGLClearErrorMacro();
this->CalcBody();
this->HeadActor->SetScale(this->GetScale());
this->HeadActor->SetPosition(this->HeadPosition);
this->HeadActor->SetOrientation(this->HeadOrientation);
......@@ -94,10 +126,45 @@ void vtkOpenGLAvatar::Render(vtkRenderer *ren, vtkMapper *mapper)
mapper->Render(ren, this->HeadActor);
this->LeftHandMapper->Render(ren, this->LeftHandActor);
this->RightHandMapper->Render(ren, this->RightHandActor);
for (int i = 0; i <= RIGHT_FORE; ++i) {
this->BodyActor[i]->SetScale(this->GetScale());
this->BodyActor[i]->SetPosition(this->BodyPosition[i]);
this->BodyActor[i]->SetOrientation(this->BodyOrientation[i]);
this->BodyMapper[i]->Render(ren, this->BodyActor[i]);
}
vtkOpenGLCheckErrorMacro("failed after Render");
}
void vtkOpenGLAvatar::CalcBody()
{
this->BodyPosition[TORSO][0] = this->HeadPosition[0];
this->BodyPosition[TORSO][1] = this->HeadPosition[1];
this->BodyPosition[TORSO][2] = this->HeadPosition[2];
// keep the head orientation in the direction of the up vector.
this->BodyOrientation[TORSO][0] = this->HeadOrientation[0] * this->UpVector[0];
this->BodyOrientation[TORSO][1] = this->HeadOrientation[1] * this->UpVector[1];
this->BodyOrientation[TORSO][2] = this->HeadOrientation[2] * this->UpVector[2];
// Initial try - keep forearm rigidly attached to hand.
this->BodyPosition[LEFT_FORE][0] = this->LeftHandPosition[0];
this->BodyPosition[LEFT_FORE][1] = this->LeftHandPosition[1];
this->BodyPosition[LEFT_FORE][2] = this->LeftHandPosition[2];
this->BodyOrientation[LEFT_FORE][0] = this->LeftHandOrientation[0];
this->BodyOrientation[LEFT_FORE][1] = this->LeftHandOrientation[1];
this->BodyOrientation[LEFT_FORE][2] = this->LeftHandOrientation[2];
this->BodyPosition[RIGHT_FORE][0] = this->RightHandPosition[0];
this->BodyPosition[RIGHT_FORE][1] = this->RightHandPosition[1];
this->BodyPosition[RIGHT_FORE][2] = this->RightHandPosition[2];
this->BodyOrientation[RIGHT_FORE][0] = this->RightHandOrientation[0];
this->BodyOrientation[RIGHT_FORE][1] = this->RightHandOrientation[1];
this->BodyOrientation[RIGHT_FORE][2] = this->RightHandOrientation[2];
}
//----------------------------------------------------------------------------
void vtkOpenGLAvatar::PrintSelf(ostream& os, vtkIndent indent)
{
......
......@@ -47,12 +47,17 @@ protected:
vtkOpenGLAvatar();
~vtkOpenGLAvatar() override;
// move the torso and arms based on head/hand inputs.
void CalcBody();
vtkNew<vtkOpenGLPolyDataMapper> HeadMapper;
vtkNew<vtkOpenGLActor> HeadActor;
vtkNew<vtkOpenGLPolyDataMapper> LeftHandMapper;
vtkNew<vtkOpenGLActor> LeftHandActor;
vtkNew<vtkOpenGLPolyDataMapper> RightHandMapper;
vtkNew<vtkOpenGLActor> RightHandActor;
vtkNew<vtkOpenGLPolyDataMapper> BodyMapper[NUM_BODY];
vtkNew<vtkOpenGLActor> BodyActor[NUM_BODY];
private:
vtkOpenGLAvatar(const vtkOpenGLAvatar&) = delete;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment