Browse Source

creation of bone class and vertice class

master
Droum 3 years ago
parent
commit
21be511f7a
5 changed files with 97 additions and 1 deletions
  1. +2
    -1
      Makefile
  2. +18
    -0
      bone.cpp
  3. +27
    -0
      bone.h
  4. +3
    -0
      camera.h
  5. +47
    -0
      vertice.h

+ 2
- 1
Makefile View File

@@ -8,7 +8,8 @@ TARGET=IN55.exe

SOURCES=main.cpp\
scene.cpp\
camera.cpp
camera.cpp\
bone.cpp

OBJECTS=$(SOURCES:.cpp=.o)


+ 18
- 0
bone.cpp View File

@@ -0,0 +1,18 @@
#include <bone.h>

Bone::Bone(int id){
ID=id;
nbVertice=0;
verticeIDList=(int*)malloc(nbVertice*sizeof(int));
}

void Bone::addVertice(int vert_id){
int* tmp;
tmp=(int*)realloc(verticeIDList,(nbVertice+1)*sizeof(int));
verticeIDList=tmp;
verticeIDList[nbVertice]=vert_id;
}

int* Bone::getListofVertices(){
return verticeIDList;
}

+ 27
- 0
bone.h View File

@@ -0,0 +1,27 @@
#ifndef __BONE_H__
#define __BONE_H__

#include <iostream>

#include <GL/gl.h>

#include <assimp/cimport.h>
#include <assimp/scene.h>
#include <assimp/postprocess.h>

#include <vectors.h>

class Bone{
private:
int ID;
int* verticeIDList;
int nbVertice;

public:
Bone(int id);

void addVertice(int vert_id);

int* getListofVertices();
};
#endif

+ 3
- 0
camera.h View File

@@ -1,3 +1,5 @@
#ifndef __CAMERA_H__
#define __CAMERA_H__
#include <iostream>

#include <GL/gl.h>
@@ -36,3 +38,4 @@ class Camera
Vec3 getOrient();
};

#endif

+ 47
- 0
vertice.h View File

@@ -0,0 +1,47 @@
#ifndef __VERTICE_H__
#define __VERTICE_H__

#include <iostream>

#include <GL/gl.h>

#include <assimp/cimport.h>
#include <assimp/scene.h>
#include <assimp/postprocess.h>

#include <vectors.h>

class Vertice{
private:
int ID;
Vec3 position;
int[] bonesID = new int[4];
float[] bonesWeight = new float[4];

public:
/* Constructor */
Vertice(int id,Vec3 pos, int* b_id, float* b_wght)
{
ID=id;
position=pos;
bonesID=b_id;
bonesWeight=b_wght;
}

/*seter */
void setPosition(Vec3 pos){position=pos}

/*getter*/
int getID(){return ID}

Vec3 getPosition(){return position}

int* getBonesID(){return bonesID}

float* getBonesWeight(){return bonesWeight}



};

#endif

Loading…
Cancel
Save