@ -62,14 +62,18 @@ namespace lunarium
mParentPos = glm : : vec3 ( 300.0f , 300.0f , 0.0f ) ;
mParentPos = glm : : vec3 ( 300.0f , 300.0f , 0.0f ) ;
mChildPos = glm : : vec3 ( 250.0f , 0.0f , 0.0f ) ;
mChildPos = glm : : vec3 ( 250.0f , 0.0f , 0.0f ) ;
mChild2Pos = glm : : vec3 ( 100.f , 100.0f , 0.0f ) ;
mParentAngle = 0.0f ;
mParentAngle = 0.0f ;
mChildAngle = 0.0f ;
mChildAngle = 0.0f ;
mChild2Angle = 0.0f ;
mParentPos2 = glm : : vec3 ( 700.0f , 200.0f , 0.0f ) ;
mParentPos2 = glm : : vec3 ( 700.0f , 200.0f , 0.0f ) ;
mChildPos2 = glm : : vec3 ( - 300.0f , 50.0f , 0.0f ) ;
mChildPos2 = glm : : vec3 ( - 300.0f , 50.0f , 0.0f ) ;
mParentPos3 = glm : : vec3 ( 200.0f , 600.0f , 0.0f ) ;
mParentPos3 = glm : : vec3 ( 200.0f , 600.0f , 0.0f ) ;
mChildPos3 = glm : : vec3 ( 150.0f , 100.0f , 0.0f ) ;
mChildPos3 = glm : : vec3 ( 150.0f , 100.0f , 0.0f ) ;
mChildPos3_2 = glm : : vec3 ( 150.0f , 0.0f , 0.0f ) ;
angle = 0.0f ;
angle = 0.0f ;
box_angle = 0.0f ;
box_angle = 0.0f ;
@ -303,21 +307,30 @@ namespace lunarium
g . DrawQuad ( Rectangle ( mParentPos . x , mParentPos . y , 50.0f , 50.0f ) , Color : : Blue ( ) , nullptr , mParentAngle ) ;
g . DrawQuad ( Rectangle ( mParentPos . x , mParentPos . y , 50.0f , 50.0f ) , Color : : Blue ( ) , nullptr , mParentAngle ) ;
glm : : mat4 parent = glm : : mat4 ( 1.0f ) ;
glm : : mat4 parent = glm : : mat4 ( 1.0f ) ;
parent = glm : : translate ( parent , mParentPos ) ;
parent = glm : : translate ( parent , mParentPos ) ;
parent = glm : : rotate ( parent , mParentAngle , glm : : vec3 ( 0.0f , 0.0f , 1.0f ) ) ;
parent = glm : : rotate ( parent , mParentAngle * - 1.0f , glm : : vec3 ( 0.0f , 0.0f , 1.0f ) ) ;
g . DrawQuad ( Rectangle ( mChildPos . x , mChildPos . y , 50.0f , 50.0f ) , Color : : Green ( ) , nullptr , mChildAngle , Rectangle ( - 1 , - 1 , - 1 , - 1 ) , parent ) ;
g . DrawQuad ( Rectangle ( mChildPos . x , mChildPos . y , 50.0f , 50.0f ) , Color : : Green ( ) , nullptr , mChildAngle , Rectangle ( - 1 , - 1 , - 1 , - 1 ) , parent ) ;
g . DrawLine ( glm : : vec2 ( mParentPos . x , mParentPos . y ) , glm : : vec2 ( mParentPos . x + mChildPos . x , mParentPos . y + mChildPos . y ) , Color : : Blue ( ) , 1.5f ) ;
g . DrawLine ( glm : : vec2 ( mParentPos . x , mParentPos . y ) , glm : : vec2 ( mParentPos . x + mChildPos . x , mParentPos . y + mChildPos . y ) , Color : : Blue ( ) , 1.5f ) ;
parent = glm : : translate ( parent , mChildPos ) ;
parent = glm : : rotate ( parent , mChildAngle * - 1.0f , glm : : vec3 ( 0.0f , 0.0f , 1.0f ) ) ;
g . DrawQuad ( Rectangle ( mChild2Pos . x , mChild2Pos . y , 50.0f , 50.0f ) , Color : : Green ( ) , nullptr , mChild2Angle , Rectangle ( - 1 , - 1 , - 1 , - 1 ) , parent ) ;
g . DrawLine ( glm : : vec2 ( mParentPos . x + mChildPos . x , mParentPos . y + mChildPos . y ) , glm : : vec2 ( mParentPos . x + mChildPos . x + mChild2Pos . x , mParentPos . y + mChildPos . y + mChild2Pos . y ) , Color : : Blue ( ) , 1.5f ) ;
// g.DrawQuad(Rectangle(mParentPos2.x, mParentPos2.y, 50.0f, 50.0f), Color::Red());
// parent = glm::mat4(1.0f);
// parent = glm::translate(parent, mParentPos2);
// g.DrawQuad(Rectangle(mChildPos2.x, mChildPos2.y, 50.0f, 50.0f), Color::White(), nullptr, mChildAngle, Rectangle(-1, -1, -1, -1), parent);
// g.DrawLine(glm::vec2(mParentPos2.x, mParentPos2.y), glm::vec2(mParentPos2.x + mChildPos2.x, mParentPos2.y + mChildPos2.y), Color::Red(), 1.5f);
g . DrawQuad ( Rectangle ( mParentPos2 . x , mParentPos2 . y , 50.0f , 50.0f ) , Color : : Red ( ) ) ;
// g.DrawQuad(Rectangle(mParentPos3.x, mParentPos3.y, 50.0f, 50.0f), Color::Black());
parent = glm : : mat4 ( 1.0f ) ;
// parent = glm::mat4(1.0f);
parent = glm : : translate ( parent , mParentPos2 ) ;
// parent = glm::translate(parent, mParentPos3);
g . DrawQuad ( Rectangle ( mChildPos2 . x , mChildPos2 . y , 50.0f , 50.0f ) , Color : : White ( ) , nullptr , mChildAngle , Rectangle ( - 1 , - 1 , - 1 , - 1 ) , parent ) ;
// g.DrawQuad(Rectangle(mChildPos3.x, mChildPos3.y, 50.0f, 50.0f), Color(0.75f, 0.15f, 0.5f, 1.0f), nullptr, mChildAngle, Rectangle(-1, -1, -1, -1), parent);
g . DrawLine ( glm : : vec2 ( mParentPos2 . x , mParentPos2 . y ) , glm : : vec2 ( mParentPos2 . x + mChildPos2 . x , mParentPos2 . y + mChildPos2 . y ) , Color : : Red ( ) , 1.5f ) ;
// g.DrawLine(glm::vec2(mParentPos3.x, mParentPos3.y), glm::vec2(mParentPos3.x + mChildPos3.x, mParentPos3.y + mChildPos3.y), Color::Black(), 1.5f);
g . DrawQuad ( Rectangle ( mParentPos3 . x , mParentPos3 . y , 50.0f , 50.0f ) , Color : : Black ( ) ) ;
// parent = glm::translate(parent, mChildPos3);
parent = glm : : mat4 ( 1.0f ) ;
// g.DrawQuad(Rectangle(mChildPos3_2.x, mChildPos3_2.y, 50.0f, 50.0f), Color(0.75f, 0.15f, 0.5f, 1.0f), nullptr, mChildAngle, Rectangle(-1, -1, -1, -1), parent);
parent = glm : : translate ( parent , mParentPos3 ) ;
// g.DrawLine(glm::vec2(mParentPos3.x + mChildPos3.x, mParentPos3.y + mChildPos3.y), glm::vec2(mParentPos3.x + mChildPos3.x + mChildPos3_2.x, mParentPos3.y + mChildPos3.y + mChildPos3_2.y), Color::Black(), 1.5f);
g . DrawQuad ( Rectangle ( mChildPos3 . x , mChildPos3 . y , 50.0f , 50.0f ) , Color ( 0.75f , 0.15f , 0.5f , 1.0f ) , nullptr , mChildAngle , Rectangle ( - 1 , - 1 , - 1 , - 1 ) , parent ) ;
g . DrawLine ( glm : : vec2 ( mParentPos3 . x , mParentPos3 . y ) , glm : : vec2 ( mParentPos3 . x + mChildPos3 . x , mParentPos3 . y + mChildPos3 . y ) , Color : : Black ( ) , 1.5f ) ;
}
}
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
@ -425,6 +438,7 @@ namespace lunarium
ImGui : : Text ( " Group One: " ) ;
ImGui : : Text ( " Group One: " ) ;
float parent_pos [ 3 ] = { mParentPos . x , mParentPos . y , mParentPos . z } ;
float parent_pos [ 3 ] = { mParentPos . x , mParentPos . y , mParentPos . z } ;
float child_pos [ 3 ] = { mChildPos . x , mChildPos . y , mChildPos . z } ;
float child_pos [ 3 ] = { mChildPos . x , mChildPos . y , mChildPos . z } ;
float child2_pos [ 3 ] = { mChild2Pos . x , mChild2Pos . y , mChild2Pos . z } ;
ImGui : : Text ( " Parent Position: " ) ;
ImGui : : Text ( " Parent Position: " ) ;
ImGui : : SameLine ( ) ;
ImGui : : SameLine ( ) ;
@ -435,7 +449,7 @@ namespace lunarium
ImGui : : Text ( " Parent Angle: " ) ;
ImGui : : Text ( " Parent Angle: " ) ;
ImGui : : SameLine ( ) ;
ImGui : : SameLine ( ) ;
ImGui : : DragFloat ( " ##ParentAngle " , & mParentAngle );
ImGui : : DragFloat ( " ##ParentAngle " , & mParentAngle , 0.1f );
ImGui : : Text ( " Child Position: " ) ;
ImGui : : Text ( " Child Position: " ) ;
ImGui : : SameLine ( ) ;
ImGui : : SameLine ( ) ;
@ -446,46 +460,65 @@ namespace lunarium
ImGui : : Text ( " Child Angle: " ) ;
ImGui : : Text ( " Child Angle: " ) ;
ImGui : : SameLine ( ) ;
ImGui : : SameLine ( ) ;
ImGui : : DragFloat ( " ##ChildAngle " , & mChildAngle );
ImGui : : DragFloat ( " ##ChildAngle " , & mChildAngle , 0.1f );
ImGui : : Text ( " Child 2 Position: " ) ;
// GROUP TWO
ImGui : : Text ( " Group two: " ) ;
float parent_pos2 [ 3 ] = { mParentPos2 . x , mParentPos2 . y , mParentPos2 . z } ;
float child_pos2 [ 3 ] = { mChildPos2 . x , mChildPos2 . y , mChildPos2 . z } ;
ImGui : : Text ( " Parent Position: " ) ;
ImGui : : SameLine ( ) ;
ImGui : : SameLine ( ) ;
if ( ImGui : : DragFloat3 ( " ## ParentPos2" , parent_pos2 ) )
if ( ImGui : : DragFloat3 ( " ##Child2Pos " , child2_pos ) )
{
{
m ParentPos2 = { parent_pos2 [ 0 ] , parent_pos2 [ 1 ] , parent_pos2 [ 2 ] } ;
mChild2Pos = { child2_pos [ 0 ] , child2_pos [ 1 ] , child2_pos [ 2 ] } ;
}
}
ImGui : : Text ( " Child Position :" ) ;
ImGui : : Text ( " Child 2 Angle :" ) ;
ImGui : : SameLine ( ) ;
ImGui : : SameLine ( ) ;
if ( ImGui : : DragFloat3 ( " ##ChildPos2 " , child_pos2 ) )
ImGui : : DragFloat ( " ##Child2Angle " , & mChild2Angle , 0.1f ) ;
{
mChildPos2 = { child_pos2 [ 0 ] , child_pos2 [ 1 ] , child_pos2 [ 2 ] } ;
}
// GROUP THREE
ImGui : : Text ( " Group three: " ) ;
float parent_pos3 [ 3 ] = { mParentPos3 . x , mParentPos3 . y , mParentPos3 . z } ;
float child_pos3 [ 3 ] = { mChildPos3 . x , mChildPos3 . y , mChildPos3 . z } ;
ImGui : : Text ( " Parent Position: " ) ;
// GROUP TWO
ImGui : : SameLine ( ) ;
// ImGui::Text("Group two:");
if ( ImGui : : DragFloat3 ( " ##ParentPos3 " , parent_pos3 ) )
// float parent_pos2[3] = { mParentPos2.x, mParentPos2.y, mParentPos2.z };
{
// float child_pos2[3] = { mChildPos2.x, mChildPos2.y, mChildPos2.z };
mParentPos3 = { parent_pos3 [ 0 ] , parent_pos3 [ 1 ] , parent_pos3 [ 2 ] } ;
}
ImGui : : Text ( " Child Position: " ) ;
// ImGui::Text("Parent Position:");
ImGui : : SameLine ( ) ;
// ImGui::SameLine();
if ( ImGui : : DragFloat3 ( " ##ChildPos3 " , child_pos3 ) )
// if (ImGui::DragFloat3("##ParentPos2", parent_pos2))
{
// {
mChildPos3 = { child_pos3 [ 0 ] , child_pos3 [ 1 ] , child_pos3 [ 2 ] } ;
// mParentPos2 = { parent_pos2[0], parent_pos2[1], parent_pos2[2] };
}
// }
// ImGui::Text("Child Position:");
// ImGui::SameLine();
// if (ImGui::DragFloat3("##ChildPos2", child_pos2))
// {
// mChildPos2 = { child_pos2[0], child_pos2[1], child_pos2[2] };
// }
// // GROUP THREE
// ImGui::Text("Group three:");
// float parent_pos3[3] = { mParentPos3.x, mParentPos3.y, mParentPos3.z };
// float child_pos3[3] = { mChildPos3.x, mChildPos3.y, mChildPos3.z };
// float child_pos3_2[3] = { mChildPos3_2.x, mChildPos3_2.y, mChildPos3_2.z };
// ImGui::Text("Parent Position:");
// ImGui::SameLine();
// if (ImGui::DragFloat3("##ParentPos3", parent_pos3))
// {
// mParentPos3 = { parent_pos3[0], parent_pos3[1], parent_pos3[2] };
// }
// ImGui::Text("Child Position:");
// ImGui::SameLine();
// if (ImGui::DragFloat3("##ChildPos3", child_pos3))
// {
// mChildPos3 = { child_pos3[0], child_pos3[1], child_pos3[2] };
// }
// ImGui::Text("Child Position:");
// ImGui::SameLine();
// if (ImGui::DragFloat3("##ChildPos3_2", child_pos3_2))
// {
// mChildPos3_2 = { child_pos3_2[0], child_pos3_2[1], child_pos3_2[2] };
// }
}
}
ImGui : : EndChild ( ) ;
ImGui : : EndChild ( ) ;