-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from hsp-iit/impl/sicad_devel
Use devel branch of superimpose-mesh-lib.
- Loading branch information
Showing
17 changed files
with
3,174 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright (C) 2022 Istituto Italiano di Tecnologia (IIT) | ||
* | ||
* This software may be modified and distributed under the terms of the | ||
* GPL-2+ license. See the accompanying LICENSE file for details. | ||
* | ||
* | ||
* Part of this code is taken from https://github.com/robotology/superimpose-mesh-lib/commits/impl/depth | ||
* | ||
* This is the original BSD 3-Clause LICENSE the original code was provided with: | ||
* | ||
* Copyright (c) 2016-2019, Istituto Italiano di Tecnologia (IIT) All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
* - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
* - Redistributions in binary form must reproduce the above copyright notice this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* - Neither the name of the organization nor the names of its contributors may be used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CLAUDIO FANTACCI BE LIABLE FOR ANY DIRECT, | ||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#ifndef ROFT_SICAD_MODEL_H | ||
#define ROFT_SICAD_MODEL_H | ||
|
||
#include <SuperimposeMesh/Model.h> | ||
|
||
#include <ROFT/SICADShader.h> | ||
|
||
#include <istream> | ||
|
||
namespace ROFT { | ||
class SICADModel; | ||
} | ||
|
||
|
||
class ROFT::SICADModel | ||
{ | ||
public: | ||
SICADModel(const GLchar* path); | ||
|
||
SICADModel(const std::basic_istream<char>* model_stream); | ||
|
||
void Draw(ROFT::SICADShader shader); | ||
|
||
bool has_texture(); | ||
|
||
protected: | ||
void loadModel(std::string path); | ||
|
||
void loadModel(const std::basic_istream<char>* model_stream); | ||
|
||
void processNode(aiNode* node, const aiScene* scene); | ||
|
||
Mesh processMesh(aiMesh* mesh, const aiScene* scene); | ||
|
||
GLint TextureFromFile(const char* path, std::string directory); | ||
|
||
std::vector<Mesh::Texture> loadMaterialTextures(aiMaterial* mat, aiTextureType type, std::string typeName); | ||
|
||
private: | ||
std::vector<Mesh> meshes_; | ||
|
||
std::string directory_; | ||
|
||
std::vector<Mesh::Texture> textures_loaded_; | ||
}; | ||
|
||
#endif /* ROFT_SICAD_MODEL_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright (C) 2022 Istituto Italiano di Tecnologia (IIT) | ||
* | ||
* This software may be modified and distributed under the terms of the | ||
* GPL-2+ license. See the accompanying LICENSE file for details. | ||
* | ||
* | ||
* Part of this code is taken from https://github.com/robotology/superimpose-mesh-lib/commits/impl/depth | ||
* | ||
* This is the original BSD 3-Clause LICENSE the original code was provided with: | ||
* | ||
* Copyright (c) 2016-2019, Istituto Italiano di Tecnologia (IIT) All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
* - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
* - Redistributions in binary form must reproduce the above copyright notice this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* - Neither the name of the organization nor the names of its contributors may be used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CLAUDIO FANTACCI BE LIABLE FOR ANY DIRECT, | ||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#ifndef ROFT_SICAD_SHADER_H | ||
#define ROFT_SICAD_SHADER_H | ||
|
||
#include <exception> | ||
#include <string> | ||
|
||
#include <GL/glew.h> | ||
|
||
namespace ROFT { | ||
class SICADShader; | ||
} | ||
|
||
|
||
class ROFT::SICADShader | ||
{ | ||
public: | ||
/** | ||
* Create a shader program with given vertex and fragment shader paths. | ||
*/ | ||
SICADShader(const std::string& vertex_shader_path, const std::string& fragment_shader_path); | ||
|
||
/** | ||
* Activate the shader program. | ||
*/ | ||
void install(); | ||
|
||
/** | ||
* Deactivate the shader program. | ||
*/ | ||
void uninstall(); | ||
|
||
|
||
inline const GLuint get_program() | ||
{ | ||
return shader_program_id_; | ||
} | ||
|
||
private: | ||
/** | ||
* The program ID. | ||
*/ | ||
GLuint shader_program_id_; | ||
}; | ||
|
||
#endif /* ROFT_SICAD_SHADER_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (C) 2022 Istituto Italiano di Tecnologia (IIT) | ||
* | ||
* This software may be modified and distributed under the terms of the | ||
* GPL-2+ license. See the accompanying LICENSE file for details. | ||
* | ||
* | ||
* Part of this code is taken from https://github.com/robotology/superimpose-mesh-lib/commits/impl/depth | ||
* | ||
* This is the original BSD 3-Clause LICENSE the original code was provided with: | ||
* | ||
* Copyright (c) 2016-2019, Istituto Italiano di Tecnologia (IIT) All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
* - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
* - Redistributions in binary form must reproduce the above copyright notice this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* - Neither the name of the organization nor the names of its contributors may be used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CLAUDIO FANTACCI BE LIABLE FOR ANY DIRECT, | ||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#version 330 core | ||
|
||
in vec3 ourColor; | ||
in vec2 TexCoord; | ||
|
||
out vec4 color; | ||
|
||
uniform sampler2D ourTexture; | ||
|
||
void main() | ||
{ | ||
color = texture(ourTexture, TexCoord); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (C) 2022 Istituto Italiano di Tecnologia (IIT) | ||
* | ||
* This software may be modified and distributed under the terms of the | ||
* GPL-2+ license. See the accompanying LICENSE file for details. | ||
* | ||
* | ||
* Part of this code is taken from https://github.com/robotology/superimpose-mesh-lib/commits/impl/depth | ||
* | ||
* This is the original BSD 3-Clause LICENSE the original code was provided with: | ||
* | ||
* Copyright (c) 2016-2019, Istituto Italiano di Tecnologia (IIT) All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
* - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
* - Redistributions in binary form must reproduce the above copyright notice this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* - Neither the name of the organization nor the names of its contributors may be used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CLAUDIO FANTACCI BE LIABLE FOR ANY DIRECT, | ||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#version 330 core | ||
|
||
layout (location = 0) in vec2 position; | ||
layout (location = 1) in vec3 color; | ||
layout (location = 2) in vec2 texCoord; | ||
|
||
out vec3 ourColor; | ||
out vec2 TexCoord; | ||
|
||
uniform mat4 projection; | ||
|
||
void main() | ||
{ | ||
gl_Position = projection * vec4(position, -99999.99, 1.0f); | ||
ourColor = color; | ||
TexCoord = vec2(texCoord.x, 1.0f - texCoord.y); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (C) 2022 Istituto Italiano di Tecnologia (IIT) | ||
* | ||
* This software may be modified and distributed under the terms of the | ||
* GPL-2+ license. See the accompanying LICENSE file for details. | ||
* | ||
* | ||
* Part of this code is taken from https://github.com/robotology/superimpose-mesh-lib/commits/impl/depth | ||
* | ||
* This is the original BSD 3-Clause LICENSE the original code was provided with: | ||
* | ||
* Copyright (c) 2016-2019, Istituto Italiano di Tecnologia (IIT) All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
* - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
* - Redistributions in binary form must reproduce the above copyright notice this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* - Neither the name of the organization nor the names of its contributors may be used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CLAUDIO FANTACCI BE LIABLE FOR ANY DIRECT, | ||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#version 330 core | ||
|
||
in vec3 vert_color; | ||
|
||
out vec4 frag_color; | ||
|
||
void main() | ||
{ | ||
frag_color = vec4(vert_color, 1.0f); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (C) 2022 Istituto Italiano di Tecnologia (IIT) | ||
* | ||
* This software may be modified and distributed under the terms of the | ||
* GPL-2+ license. See the accompanying LICENSE file for details. | ||
* | ||
* | ||
* Part of this code is taken from https://github.com/robotology/superimpose-mesh-lib/commits/impl/depth | ||
* | ||
* This is the original BSD 3-Clause LICENSE the original code was provided with: | ||
* | ||
* Copyright (c) 2016-2019, Istituto Italiano di Tecnologia (IIT) All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
* - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
* - Redistributions in binary form must reproduce the above copyright notice this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* - Neither the name of the organization nor the names of its contributors may be used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CLAUDIO FANTACCI BE LIABLE FOR ANY DIRECT, | ||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#version 330 core | ||
|
||
layout (location = 0) in vec3 position; | ||
layout (location = 1) in vec3 color; | ||
|
||
out vec3 vert_color; | ||
|
||
uniform mat4 model; | ||
uniform mat4 view; | ||
uniform mat4 projection; | ||
|
||
void main() | ||
{ | ||
gl_Position = projection * view * model * vec4(position, 1.0f); | ||
vert_color = color; | ||
} |
Oops, something went wrong.