#ifndef ROBOT_BODYPART_H
#define ROBOT_BODYPART_H

#pragma once

enum {PRIMITIVE_BOX, PRIMITIVE_SPHERE, PRIMITIVE_CONE, PRIMITIVE_TORUS, PRIMITIVE_TEAPOT};

#include "robot_vector.h"
#include "robot_matrix.h"

class Cbodypart
{
public:
    int shape_type;                            // shape of the body part
    double color_r, color_g, color_b;          // color of the body part
    
	double scale_x, scale_y, scale_z;              // scale of the box representing the body part
	double translate_x, translate_y, translate_z;  // initial translation on x, y and z of the body part
	double rotate_x, rotate_y, rotate_z;           // initial rotation on x, y and z of the body part

    double pivot_x, pivot_y, pivot_z;           // pivot point of rotation

	Cmatrix transformation_matrix;             // transformation matrix of the body part

    Cmatrix translation_pivot_matrix;          // pivot point translation matrix of the body part
	Cmatrix translation_matrix;                // translation matrix of the body part
	Cmatrix scale_matrix;                      // scale matrix of the body part
	Cmatrix rotation_matrix;                   // rotation matrix of the body part

public:
	Cbodypart(int shape_type = PRIMITIVE_BOX, Cvector color = Cvector(1,1,1), Cvector scale = Cvector(1,1,1), Cvector translate = Cvector(0,0,0), Cvector rotate = Cvector(0,0,0), Cvector pivot = Cvector(0,0,0));
	~Cbodypart();

    void InitTranslationMatrix();           // Init the translation matrix of the body part
    void InitTranslationPivotMatrix();      // Init the pivot translation matrix of the body part
    void InitScaleMatrix();                 // Init the scale matrix of the body part
    void InitRotationMatrix();              // Init the rotation matrix of the body part

    void InitTransformationMatrix();        // Init the combined transformation matrix of the body part
};

#endif
