Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xsens2bvh #84

Open
wants to merge 44 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
a8da5a5
sujets
Dec 12, 2022
f631088
codebase
Dec 12, 2022
5b0ba43
bvh parser depuis l'IA3D
Dec 12, 2022
b789b02
bvh parser depuis l'IA3D
Dec 12, 2022
88955fc
le début du parser mais faut faire genre 90% du travail encore
Dec 12, 2022
d835fdd
ca arrive soon
DarkySquid Dec 13, 2022
53f8e7c
oui
DarkySquid Dec 13, 2022
dcb1b78
joueurdefoute
DarkySquid Dec 13, 2022
a9768cf
motion part not working yet
Jan 3, 2023
4ee7d4f
lil fix
Jan 3, 2023
05810a2
joint fixed
Jan 3, 2023
007203a
Clean repo + joint.cpp
Jan 3, 2023
a529cca
affichage du bvh wsh wsh
DarkySquid Jan 6, 2023
a8c19fd
Fixed qmake bug not including joint
Jan 8, 2023
3f9ec7c
Added animation tools
Jan 9, 2023
aa89f57
tpose
Jan 9, 2023
97d082e
added update
Jan 9, 2023
3c7b105
changed exec name
Jan 9, 2023
6e97dd1
les matrixxxxxxxxxxxxxxxx euhhh et le deplacement la de ahmed quil di…
DarkySquid Jan 9, 2023
fbe6017
BRICE FIX STP
DarkySquid Jan 9, 2023
10dba50
oui BRICE FIX TJR STP
DarkySquid Jan 10, 2023
da4715f
BRICE FIX VRMT LA
DarkySquid Jan 10, 2023
05b9bc9
JAI FIX A LA PLACE DE BRICE
DarkySquid Jan 10, 2023
73593b1
enleve les pointeurs de merde
Jan 10, 2023
6543a11
l'affichage est joli
Jan 11, 2023
dc2c6e9
UNLIMITED PARSING AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Jan 13, 2023
adb96bf
l'espacement par frame est bon maintenant
Jan 14, 2023
15d3c37
ca marche enfin
Jan 15, 2023
e561c9e
camera mieux placee
Jan 15, 2023
cea6def
suppr de commentaires
Jan 15, 2023
8689563
suppr les warnings de compil
Jan 15, 2023
c552fbd
Parsing fichers Xsens + testbench Qt compatible
Jan 15, 2023
1ea7436
on parse les fichiers dans le bon ordre c'est mieu
Jan 16, 2023
ff780a9
trucs avec super parser.h
Jan 16, 2023
eaea6ff
on oublie pas le cpp
Jan 16, 2023
6435967
Toujours plus de parsing
Jan 16, 2023
60e4d1f
calcul des weights de fou
DarkySquid Jan 16, 2023
3eb5885
le skin omg
Jan 17, 2023
bc32cae
Merge branch 'dev' of github.com:Alphaganon/SIA_QT into dev
Jan 17, 2023
de325bc
trucs qui marchent pas de fou
Jan 17, 2023
62f07dc
copy
Jan 17, 2023
99499ae
wlh c'est pas si mal
DarkySquid Jan 23, 2023
e48aa6a
Xsens2BVH
Jan 23, 2023
f7bfcae
fixed bvh errors
Jan 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
l'affichage est joli
  • Loading branch information
adamsw committed Jan 11, 2023
commit 6543a11c20b51a2357fcac6bfed95a9ed4d06c18
67 changes: 41 additions & 26 deletions SIA_Projet_2/bvh_gui/geometryengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@
#include <QVector3D>
#include <QVector4D>

struct VertexData
{
QVector3D position;
QVector2D texCoord;
};

//! [0]
GeometryEngine::GeometryEngine(Joint *root)
: indexBuf(QOpenGLBuffer::IndexBuffer)
Expand Down Expand Up @@ -108,21 +102,41 @@ void GeometryEngine::initCubeGeometry()

double divider = 1/300.0;

void getPos(Joint *jnt, std::vector<VertexData> *vec){
if(jnt->_children.empty() == false){
void GeometryEngine::getPos(Joint *jnt, std::vector<VertexData> *vec){
QMatrix4x4 *scale = new QMatrix4x4(divider, 0, 0, 0, 0, divider, 0, 0, 0, 0, divider, 0, 0, 0, 0, 1);
//Add parent
QVector4D *pos = new QVector4D(jnt->_offX, jnt->_offY, jnt->_offZ, 1);
QVector4D *globalPos = new QVector4D();
*globalPos = *scale * *(jnt->_transform) * *pos;
vec->push_back({QVector3D(globalPos->x(), globalPos->y(), globalPos->z()), QVector2D(0.0f, 0.0f)});
if(!(jnt->_children.empty())){
for(Joint *child : jnt->_children){
getPos(child, vec);
//Scale
QMatrix4x4 *scale = new QMatrix4x4(divider, 0, 0, 0, 0, divider, 0, 0, 0, 0, divider, 0, 0, 0, 0, 1);
//Add parent
QVector4D *pos = new QVector4D(jnt->_offX, jnt->_offY, jnt->_offZ, 1);
QVector4D *globalPos = new QVector4D();
*globalPos = *scale * *(jnt->_transform) * *pos;
vec->push_back({QVector3D(globalPos->x(), globalPos->y(), globalPos->z()), QVector2D(0.0f, 0.0f)});
//Add child
pos = new QVector4D(child->_offX, child->_offY, child->_offZ, 1);
*globalPos = *scale * *(child->_transform) * *pos;
vec->push_back({QVector3D(globalPos->x(), globalPos->y(), globalPos->z()), QVector2D(0.0f, 0.0f)});
// pos = new QVector4D(child->_offX, child->_offY, child->_offZ, 1);
// *globalPos = *scale * *(child->_transform) * *pos;
// child->index = vertexIndex++;
// vec->push_back({QVector3D(globalPos->x(), globalPos->y(), globalPos->z()), QVector2D(0.0f, 0.0f)});
}
}
}

void GeometryEngine::setJointIndexes(Joint *jnt, int &vertexIndex){
jnt->index = vertexIndex++;
if(!(jnt->_children.empty())){
for(Joint *child : jnt->_children){
setJointIndexes(child, vertexIndex);
}
}
}

void GeometryEngine::setIndexes(Joint *jnt, std::vector<GLushort> *vec){
if(!(jnt->_children.empty())){
for(Joint *child : jnt->_children){
vec->push_back(jnt->index);
vec->push_back(child->index);
setIndexes(child, vec);
}
}
}
Expand All @@ -134,28 +148,29 @@ void GeometryEngine::initLineGeometry(Joint *root)
VertexData *vertices = &vec[0];
int lenVec = vec.size();

//std::cout << lenVec << std::endl;
int vertexIndex = 0;

setJointIndexes(root, vertexIndex);
std::vector<GLushort> indVec;
for(int i = 0 ; i < lenVec-1 ; i++){
indVec.push_back(i);
indVec.push_back(i+1);
}
setIndexes(root, &indVec);
int lenIdx = indVec.size();

GLushort *indices = &indVec[0];

for(VertexData v : vec){
// for(VertexData v : vec){
//std::cout << v.position.x() << " " << v.position.y() << " " << v.position.z() << std::endl;
}
// }

// Transfer vertex data to VBO 0
arrayBuf.bind();
arrayBuf.allocate(vertices, lenVec * sizeof(VertexData));

// Transfer index data to VBO 1
indexBuf.bind();
indexBuf.allocate(indices, 2 * (lenVec-1) * sizeof(GLushort));
indexBuf.allocate(indices, lenIdx * sizeof(GLushort));

lenPts = lenVec;
lenIndexes = lenIdx;
}

void GeometryEngine::updatePos(Joint *root){
Expand Down Expand Up @@ -224,5 +239,5 @@ void GeometryEngine::drawLineGeometry(QOpenGLShaderProgram *program)
program->setAttributeBuffer(texcoordLocation, GL_FLOAT, offset, 2, sizeof(VertexData));

// Draw cube geometry using indices from VBO 1
glDrawElements(GL_LINE_STRIP, (lenPts-1) * 2, GL_UNSIGNED_SHORT, nullptr);
glDrawElements(GL_LINES, lenIndexes, GL_UNSIGNED_SHORT, nullptr);
}
11 changes: 11 additions & 0 deletions SIA_Projet_2/bvh_gui/geometryengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@

#include "../joint.h"

struct VertexData
{
QVector3D position;
QVector2D texCoord;
};


class GeometryEngine : protected QOpenGLFunctions
{
public:
Expand All @@ -21,8 +28,12 @@ class GeometryEngine : protected QOpenGLFunctions
void updatePos(Joint *root);

int lenPts;
int lenIndexes;

private:
void getPos(Joint *jnt, std::vector<VertexData> *vec);
void setIndexes(Joint *jnt, std::vector<GLushort> *vec);
void setJointIndexes(Joint *jnt, int &vertexIndex);
void initCubeGeometry();
void initLineGeometry(Joint *root);

Expand Down
4 changes: 2 additions & 2 deletions SIA_Projet_2/joint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ void Joint::animate(int iframe)
if(!_dofs[idof].name.compare("Xrotation\r")) _curRx = _dofs[idof]._values[iframe];
}
//std::cout<<_curTx<<" "<<_curTy<<" "<<_curTz<<" "<<_curRz<<" "<<_curRy<<" "<<_curRx<<std::endl;
QMatrix4x4 rotX(1, 0, 0, 0, 0, cos(dTR(_curRx)), -sin(dTR(_curRx)), 0, 0, sin(dTR(_curRx)), cos(dTR(_curRx)), 0, 0, 0, 0, 1);
QMatrix4x4 rotY(cos(dTR(_curRy)), 0, sin(dTR(_curRy)), 0, 0, 1, 0, 0, -sin(dTR(_curRy)), 0, cos(dTR(_curRy)), 0, 0, 0, 0, 1);
QMatrix4x4 rotX(1, 0, 0, 0, 0, cos(dTR(_curRx)), sin(dTR(_curRx)), 0, 0, -sin(dTR(_curRx)), cos(dTR(_curRx)), 0, 0, 0, 0, 1);
QMatrix4x4 rotY(cos(dTR(_curRy)), 0, -sin(dTR(_curRy)), 0, 0, 1, 0, 0, sin(dTR(_curRy)), 0, cos(dTR(_curRy)), 0, 0, 0, 0, 1);
QMatrix4x4 rotZ(cos(dTR(_curRz)), -sin(dTR(_curRz)), 0, 0, sin(dTR(_curRz)), cos(dTR(_curRz)), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
QVector4D trans(_curTx, _curTy, _curTz, 1);
*_transform = rotZ * rotY * rotX;
Expand Down
2 changes: 1 addition & 1 deletion SIA_Projet_2/joint.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public :
std::vector<Joint*> _children; // children of the current joint
bool motion = false;
Joint *parent = NULL;

int index;

public :
// Constructor :
Expand Down