Skip to content

Xsens2bvh #84

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

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
affichage du bvh wsh wsh
  • Loading branch information
DarkySquid committed Jan 6, 2023
commit a529cca2678fec3426db4188279788a0c29cd1d1
23 changes: 23 additions & 0 deletions SIA_Projet_2/bvh_gui/.qmake.stash
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
QMAKE_CXX.QT_COMPILER_STDCXX = 201703L
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 11
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 3
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
QMAKE_CXX.COMPILER_MACROS = \
QT_COMPILER_STDCXX \
QMAKE_GCC_MAJOR_VERSION \
QMAKE_GCC_MINOR_VERSION \
QMAKE_GCC_PATCH_VERSION
QMAKE_CXX.INCDIRS = \
/usr/include/c++/11 \
/usr/include/x86_64-linux-gnu/c++/11 \
/usr/include/c++/11/backward \
/usr/lib/gcc/x86_64-linux-gnu/11/include \
/usr/local/include \
/usr/include/x86_64-linux-gnu \
/usr/include
QMAKE_CXX.LIBDIRS = \
/usr/lib/gcc/x86_64-linux-gnu/11 \
/usr/lib/x86_64-linux-gnu \
/usr/lib \
/lib/x86_64-linux-gnu \
/lib
64 changes: 64 additions & 0 deletions SIA_Projet_2/bvh_gui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required(VERSION 3.16)
project(cube LANGUAGES CXX)

if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/cube")

find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets)

qt_standard_project_setup()

qt_add_executable(cube
geometryengine.cpp geometryengine.h
main.cpp
mainwidget.cpp mainwidget.h
)

set_target_properties(cube PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)

target_link_libraries(cube PRIVATE
Qt6::Core
Qt6::Gui
Qt6::OpenGL
Qt6::OpenGLWidgets
Qt6::Widgets
)

# Resources:
set(shaders_resource_files
"fshader.glsl"
"vshader.glsl"
)

qt6_add_resources(cube "shaders"
PREFIX
"/"
FILES
${shaders_resource_files}
)

set(textures_resource_files
"cube.png"
)

qt6_add_resources(cube "textures"
PREFIX
"/"
FILES
${textures_resource_files}
)

install(TARGETS cube
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
Binary file added SIA_Projet_2/bvh_gui/cube
Binary file not shown.
Binary file added SIA_Projet_2/bvh_gui/cube.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions SIA_Projet_2/bvh_gui/cube.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
QT += core gui widgets opengl

TARGET = cube
TEMPLATE = app

SOURCES += main.cpp

SOURCES += \
mainwidget.cpp \
geometryengine.cpp

HEADERS += \
mainwidget.h \
geometryengine.h

RESOURCES += \
shaders.qrc \
textures.qrc

# install
target.path = $$[QT_INSTALL_EXAMPLES]/opengl/cube
INSTALLS += target
18 changes: 18 additions & 0 deletions SIA_Projet_2/bvh_gui/fshader.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifdef GL_ES
// Set default precision to medium
precision mediump int;
precision mediump float;
#endif

uniform sampler2D texture;

varying vec2 v_texcoord;

//! [0]
void main()
{
// Set fragment color from texture
gl_FragColor = texture2D(texture, v_texcoord);
}
//! [0]

203 changes: 203 additions & 0 deletions SIA_Projet_2/bvh_gui/geometryengine.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#include "geometryengine.h"
#include "../joint.h"

#include <QVector2D>
#include <QVector3D>

struct VertexData
{
QVector3D position;
QVector2D texCoord;
};

//! [0]
GeometryEngine::GeometryEngine(Joint *root)
: indexBuf(QOpenGLBuffer::IndexBuffer)
{
initializeOpenGLFunctions();

// Generate 2 VBOs
arrayBuf.create();
indexBuf.create();

// Initializes cube geometry and transfers it to VBOs
//initCubeGeometry();
initLineGeometry(root);
}

GeometryEngine::~GeometryEngine()
{
arrayBuf.destroy();
indexBuf.destroy();
}
//! [0]

void GeometryEngine::initCubeGeometry()
{
// For cube we would need only 8 vertices but we have to
// duplicate vertex for each face because texture coordinate
// is different.
VertexData vertices[] = {
// Vertex data for face 0
{QVector3D(-1.0f, -1.0f, 1.0f), QVector2D(0.0f, 0.0f)}, // v0
{QVector3D( 1.0f, -1.0f, 1.0f), QVector2D(0.33f, 0.0f)}, // v1
{QVector3D(-1.0f, 1.0f, 1.0f), QVector2D(0.0f, 0.5f)}, // v2
{QVector3D( 1.0f, 1.0f, 1.0f), QVector2D(0.33f, 0.5f)}, // v3

// Vertex data for face 1
{QVector3D( 1.0f, -1.0f, 1.0f), QVector2D( 0.0f, 0.5f)}, // v4
{QVector3D( 1.0f, -1.0f, -1.0f), QVector2D(0.33f, 0.5f)}, // v5
{QVector3D( 1.0f, 1.0f, 1.0f), QVector2D(0.0f, 1.0f)}, // v6
{QVector3D( 1.0f, 1.0f, -1.0f), QVector2D(0.33f, 1.0f)}, // v7

// Vertex data for face 2
{QVector3D( 1.0f, -1.0f, -1.0f), QVector2D(0.66f, 0.5f)}, // v8
{QVector3D(-1.0f, -1.0f, -1.0f), QVector2D(1.0f, 0.5f)}, // v9
{QVector3D( 1.0f, 1.0f, -1.0f), QVector2D(0.66f, 1.0f)}, // v10
{QVector3D(-1.0f, 1.0f, -1.0f), QVector2D(1.0f, 1.0f)}, // v11

// Vertex data for face 3
{QVector3D(-1.0f, -1.0f, -1.0f), QVector2D(0.66f, 0.0f)}, // v12
{QVector3D(-1.0f, -1.0f, 1.0f), QVector2D(1.0f, 0.0f)}, // v13
{QVector3D(-1.0f, 1.0f, -1.0f), QVector2D(0.66f, 0.5f)}, // v14
{QVector3D(-1.0f, 1.0f, 1.0f), QVector2D(1.0f, 0.5f)}, // v15

// Vertex data for face 4
{QVector3D(-1.0f, -1.0f, -1.0f), QVector2D(0.33f, 0.0f)}, // v16
{QVector3D( 1.0f, -1.0f, -1.0f), QVector2D(0.66f, 0.0f)}, // v17
{QVector3D(-1.0f, -1.0f, 1.0f), QVector2D(0.33f, 0.5f)}, // v18
{QVector3D( 1.0f, -1.0f, 1.0f), QVector2D(0.66f, 0.5f)}, // v19

// Vertex data for face 5
{QVector3D(-1.0f, 1.0f, 1.0f), QVector2D(0.33f, 0.5f)}, // v20
{QVector3D( 1.0f, 1.0f, 1.0f), QVector2D(0.66f, 0.5f)}, // v21
{QVector3D(-1.0f, 1.0f, -1.0f), QVector2D(0.33f, 1.0f)}, // v22
{QVector3D( 1.0f, 1.0f, -1.0f), QVector2D(0.66f, 1.0f)} // v23
};

// Indices for drawing cube faces using triangle strips.
// Triangle strips can be connected by duplicating indices
// between the strips. If connecting strips have opposite
// vertex order then last index of the first strip and first
// index of the second strip needs to be duplicated. If
// connecting strips have same vertex order then only last
// index of the first strip needs to be duplicated.
GLushort indices[] = {
0, 1, 2, 3, 3, // Face 0 - triangle strip ( v0, v1, v2, v3)
4, 4, 5, 6, 7, 7, // Face 1 - triangle strip ( v4, v5, v6, v7)
8, 8, 9, 10, 11, 11, // Face 2 - triangle strip ( v8, v9, v10, v11)
12, 12, 13, 14, 15, 15, // Face 3 - triangle strip (v12, v13, v14, v15)
16, 16, 17, 18, 19, 19, // Face 4 - triangle strip (v16, v17, v18, v19)
20, 20, 21, 22, 23 // Face 5 - triangle strip (v20, v21, v22, v23)
};

//! [1]
// Transfer vertex data to VBO 0
arrayBuf.bind();
arrayBuf.allocate(vertices, 24 * sizeof(VertexData));

// Transfer index data to VBO 1
indexBuf.bind();
indexBuf.allocate(indices, 34 * sizeof(GLushort));
//! [1]
}

double divider = 300.0;

void getPos(Joint *jnt, std::vector<VertexData> *vec){
if(jnt->_children.empty() == false){
for(Joint *child : jnt->_children){
getPos(child, vec);
vec->push_back({QVector3D(jnt->_curTx/divider, jnt->_curTy/divider, jnt->_curTz/divider), QVector2D(0.0f, 0.0f)});
vec->push_back({QVector3D(child->_curTx/divider, child->_curTy/divider, child->_curTz/divider), QVector2D(0.0f, 0.0f)});
}
}
}

void GeometryEngine::initLineGeometry(Joint *root)
{
std::vector<VertexData> vec;
getPos(root, &vec);
VertexData *vertices = &vec[0];
int lenVec = vec.size();

std::cout << lenVec << std::endl;

std::vector<GLushort> indVec;
for(int i = 0 ; i < lenVec-1 ; i++){
indVec.push_back(i);
indVec.push_back(i+1);
}
GLushort *indices = &indVec[0];

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));

lenPts = lenVec;
}

//! [2]
void GeometryEngine::drawCubeGeometry(QOpenGLShaderProgram *program)
{
// Tell OpenGL which VBOs to use
arrayBuf.bind();
indexBuf.bind();

// Offset for position
quintptr offset = 0;

// Tell OpenGL programmable pipeline how to locate vertex position data
int vertexLocation = program->attributeLocation("a_position");
program->enableAttributeArray(vertexLocation);
program->setAttributeBuffer(vertexLocation, GL_FLOAT, offset, 3, sizeof(VertexData));

// Offset for texture coordinate
offset += sizeof(QVector3D);

// Tell OpenGL programmable pipeline how to locate vertex texture coordinate data
int texcoordLocation = program->attributeLocation("a_texcoord");
program->enableAttributeArray(texcoordLocation);
program->setAttributeBuffer(texcoordLocation, GL_FLOAT, offset, 2, sizeof(VertexData));

// Draw cube geometry using indices from VBO 1
glDrawElements(GL_TRIANGLE_STRIP, 34, GL_UNSIGNED_SHORT, nullptr);
}
//! [2]

void GeometryEngine::drawLineGeometry(QOpenGLShaderProgram *program)
{
// Tell OpenGL which VBOs to use
arrayBuf.bind();
indexBuf.bind();

// Offset for position
quintptr offset = 0;

// Tell OpenGL programmable pipeline how to locate vertex position data
int vertexLocation = program->attributeLocation("a_position");
program->enableAttributeArray(vertexLocation);
program->setAttributeBuffer(vertexLocation, GL_FLOAT, offset, 3, sizeof(VertexData));

// Offset for texture coordinate
offset += sizeof(QVector3D);

// Tell OpenGL programmable pipeline how to locate vertex texture coordinate data
int texcoordLocation = program->attributeLocation("a_texcoord");
program->enableAttributeArray(texcoordLocation);
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);
}
32 changes: 32 additions & 0 deletions SIA_Projet_2/bvh_gui/geometryengine.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#ifndef GEOMETRYENGINE_H
#define GEOMETRYENGINE_H

#include <QOpenGLFunctions>
#include <QOpenGLShaderProgram>
#include <QOpenGLBuffer>

#include "../joint.h"

class GeometryEngine : protected QOpenGLFunctions
{
public:
GeometryEngine(Joint *root);
virtual ~GeometryEngine();

void drawCubeGeometry(QOpenGLShaderProgram *program);
void drawLineGeometry(QOpenGLShaderProgram *program);

int lenPts;

private:
void initCubeGeometry();
void initLineGeometry(Joint *root);

QOpenGLBuffer arrayBuf;
QOpenGLBuffer indexBuf;
};

#endif // GEOMETRYENGINE_H
Loading