Skip to content

Commit

Permalink
Merge pull request #11 from yuki-koyama/update-libraries
Browse files Browse the repository at this point in the history
Update external libraries
  • Loading branch information
yuki-koyama authored Dec 27, 2020
2 parents d6fe258 + 0085a18 commit 07687b0
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "external/bigg"]
path = external/bigg
url = https://github.com/JoshuaBrookover/bigg.git
url = https://github.com/Josh4428/bigg.git
[submodule "external/tinyobjloader"]
path = external/tinyobjloader
url = https://github.com/syoyo/tinyobjloader.git
url = https://github.com/tinyobjloader/tinyobjloader.git
[submodule "external/rand-util"]
path = external/rand-util
url = https://github.com/yuki-koyama/rand-util.git
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ set(GLFW_VULKAN_STATIC OFF CACHE INTERNAL "" FORCE)
set(LIB_SUFFIX "" CACHE INTERNAL "" FORCE)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/bigg)

# Note: This was necessary to avoid a run-time error on macOS/OpenGL. Without
# this option, the NSOpenGLViewContext's setView method was called from a
# wrong (?) thread during bgfx::init and then the app crashes. This needs to be
# investigated further.
target_compile_definitions(bgfx PUBLIC BGFX_CONFIG_MULTITHREADED=0)

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/rand-util)

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/string-util)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ This library, named `bigger`, is a prototype-oriented middleware library for 3D

## Dependencies

- bigg <https://github.com/JoshuaBrookover/bigg> [Unlicense]
- bgfx.cmake <https://github.com/JoshuaBrookover/bgfx.cmake> [CC0 1.0 Universal]
- bigg <https://github.com/Josh4428/bigg> [Unlicense]
- bgfx.cmake <https://github.com/widberg/bgfx.cmake> [CC0 1.0 Universal]
- bgfx <https://github.com/bkaradzic/bgfx> [BSD 2-Clause]
- bimg <https://github.com/bkaradzic/bimg> [BSD 2-Clause]
- bx <https://github.com/bkaradzic/bx> [BSD 2-Clause]
Expand All @@ -25,7 +25,7 @@ This library, named `bigger`, is a prototype-oriented middleware library for 3D
- GLM <https://github.com/g-truc/glm> [MIT]
- random-util <https://github.com/yuki-koyama/rand-util> [MIT]
- string-util <https://github.com/yuki-koyama/string-util> [MIT]
- tinyobjloader <https://github.com/syoyo/tinyobjloader> [MIT]
- tinyobjloader <https://github.com/tinyobjloader/tinyobjloader/> [MIT]

## Main Classes

Expand Down
8 changes: 4 additions & 4 deletions examples/cubes/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <bigger/materials/blinnphong-material.hpp>
#include <bigger/primitives/cube-primitive.hpp>
#include <glm/glm.hpp>
#include <glm/ext.hpp>
#include <glm/ext/matrix_transform.hpp>

class CubeObject;

Expand Down Expand Up @@ -58,7 +58,7 @@ class CubeObject final : public bigger::SceneObject
{
// Update transform
const float t = m_app->m_time;
m_rotate_matrix = glm::rotate(t, glm::vec3(m_x, m_y, 1.0f));
m_rotate_matrix = glm::rotate(glm::mat4(1.0), t, glm::vec3(m_x, m_y, 1.0f));

// Update visibility
m_is_visible = std::max(std::abs(m_x), std::abs(m_y)) <= m_app->m_massive_level;
Expand Down Expand Up @@ -108,8 +108,8 @@ void CubesApp::initialize(int argc, char** argv)
{
auto cube_object = std::make_shared<CubeObject>(this, x, y, m_cube_material, m_cube_primitive);

cube_object->m_translate_matrix = glm::translate(glm::vec3(x, y, 0.0f));
cube_object->m_scale_matrix = glm::scale(glm::vec3(std::pow(3.0f, - 0.5f)));
cube_object->m_translate_matrix = glm::translate(glm::mat4(1.0), glm::vec3(x, y, 0.0f));
cube_object->m_scale_matrix = glm::scale(glm::mat4(1.0), glm::vec3(std::pow(3.0f, - 0.5f)));

addSceneObject(cube_object);
}
Expand Down
4 changes: 2 additions & 2 deletions examples/mesh/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <bigger/materials/blinnphong-material.hpp>
#include <bigger/primitives/mesh-primitive.hpp>
#include <glm/glm.hpp>
#include <glm/ext.hpp>
#include <glm/ext/matrix_transform.hpp>

class MeshObject;

Expand Down Expand Up @@ -52,7 +52,7 @@ class MeshObject final : public bigger::SceneObject
{
// Update transform
const float t = m_app->m_time;
m_rotate_matrix = glm::rotate(t, glm::vec3(0.0f, 1.0f, 0.0f));
m_rotate_matrix = glm::rotate(glm::mat4(1.0f), t, glm::vec3(0.0f, 1.0f, 0.0f));
}

void draw(const glm::mat4& parent_transform_matrix = glm::mat4(1.0f)) override
Expand Down
2 changes: 1 addition & 1 deletion external/bigg
Submodule bigg updated from 8bad04 to e714c7
2 changes: 1 addition & 1 deletion external/tinyobjloader
Submodule tinyobjloader updated 54 files
+1 −0 .github/ISSUE_TEMPLATE/config.yml
+28 −0 .github/ISSUE_TEMPLATE/issue-report.md
+4 −0 .gitignore
+21 −7 CMakeLists.txt
+1 −1 LICENSE
+74 −19 README.md
+1 −1 appveyor.yml
+159 −0 azure-pipelines.yml
+21 −0 cmake_uninstall.cmake.in
+5 −1 examples/obj_sticher/obj_sticher.cc
+2 −0 examples/skin_weight/Makefile
+7 −0 examples/skin_weight/README.md
+103 −0 examples/skin_weight/main.cc
+3 −0 examples/viewer/README.md
+3 −3 examples/viewer/viewer.cc
+17 −17 experimental/viewer.cc
+4 −2 loader_example.cc
+21 −0 models/issue-235-usemtl-then-o.obj
+11 −0 models/issue-235.mtl
+22 −0 models/issue-244-mtl-searchpaths.obj
+4 −0 models/issue-246-usemtl-whitespace.mtl
+17 −0 models/issue-246-usemtl-whitespace.obj
+25 −0 models/issue-248-texres-texopt.mtl
+32 −0 models/issue-248-texres-texopt.obj
+5 −0 models/leading-decimal-dot-issue-201.mtl
+7 −0 models/leading-decimal-dot-issue-201.obj
+5 −0 models/leading-zero-in-exponent-notation-issue-210.mtl
+7 −0 models/leading-zero-in-exponent-notation-issue-210.obj
+1 −1 models/line-prim.obj
+4 −0 models/mtl filename with whitespace issue46.mtl
+31 −0 models/mtl filename with whitespace issue46.obj
+15 −0 models/points-prim.obj
+43 −0 models/skin-weight.obj
+21 −0 python/LICENSE
+6 −0 python/MANIFEST.in
+7 −0 python/Makefile
+85 −0 python/README.md
+0 −2 python/TODO.md
+163 −0 python/bindings.cc
+0 −581 python/cornell_box_multimaterial_output.json
+0 −9 python/howto.py
+0 −212 python/main.cpp
+2 −0 python/pyproject.toml
+78 −0 python/sample.py
+103 −7 python/setup.py
+6 −0 python/tiny_obj_loader.cc
+22 −0 tests/LICENSE.acutest.txt
+6 −5 tests/Makefile
+1,514 −0 tests/acutest.h
+11 −0 tests/assets/issue-244.mtl
+0 −10,445 tests/catch.hpp
+544 −217 tests/tester.cc
+662 −128 tiny_obj_loader.h
+0 −10 wercker.yml
12 changes: 6 additions & 6 deletions include/bigger/primitive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ namespace bigger
glm::vec3 position;
glm::vec3 normal;

static bgfx::VertexDecl getVertexDecl()
static bgfx::VertexLayout getVertexLayout()
{
bgfx::VertexDecl vertex_decl;
vertex_decl.begin()
bgfx::VertexLayout vertex_layout;
vertex_layout.begin()
.add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float)
.add(bgfx::Attrib::Normal, 3, bgfx::AttribType::Float)
.end();
return vertex_decl;
return vertex_layout;
}
};

Expand Down Expand Up @@ -56,8 +56,8 @@ namespace bigger
assert(!m_vertices.empty());
assert(!m_triangle_list.empty());

const bgfx::VertexDecl vertex_decl = PositionNormalVertex::getVertexDecl();
m_vertex_buffer_handle = bgfx::createVertexBuffer(bgfx::makeRef(m_vertices.data(), sizeof(PositionNormalVertex) * m_vertices.size()), vertex_decl);
const bgfx::VertexLayout vertex_layout = PositionNormalVertex::getVertexLayout();
m_vertex_buffer_handle = bgfx::createVertexBuffer(bgfx::makeRef(m_vertices.data(), sizeof(PositionNormalVertex) * m_vertices.size()), vertex_layout);
m_index_buffer_handle = bgfx::createIndexBuffer(bgfx::makeRef(m_triangle_list.data(), sizeof(uint16_t) * m_triangle_list.size()));

m_is_initialized = true;
Expand Down
2 changes: 1 addition & 1 deletion include/bigger/screen-shot-callback.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace bigger
enum class ImageType { Png, Tga };

virtual ~ScreenShotCallback() {}
virtual void fatal(bgfx::Fatal::Enum, const char*) override {}
virtual void fatal(const char*, uint16_t, bgfx::Fatal::Enum, const char*) override {}
virtual void traceVargs(const char*, uint16_t, const char*, va_list) override {}
virtual void profilerBegin(const char*, uint32_t, const char*, uint16_t) override {}
virtual void profilerBeginLiteral(const char*, uint32_t, const char*, uint16_t) override {}
Expand Down
4 changes: 2 additions & 2 deletions src/dynamic-mesh-primitive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ void bigger::DynamicMeshPrimitive::initializePrimitive()
assert(!m_vertices.empty());
assert(!m_triangle_list.empty());

const bgfx::VertexDecl vertex_decl = PositionNormalVertex::getVertexDecl();
m_dynamic_vertex_buffer_handle = bgfx::createDynamicVertexBuffer(bgfx::makeRef(m_vertices.data(), sizeof(PositionNormalVertex) * m_vertices.size()), vertex_decl);
const bgfx::VertexLayout vertex_layout = PositionNormalVertex::getVertexLayout();
m_dynamic_vertex_buffer_handle = bgfx::createDynamicVertexBuffer(bgfx::makeRef(m_vertices.data(), sizeof(PositionNormalVertex) * m_vertices.size()), vertex_layout);
m_index_buffer_handle = bgfx::createIndexBuffer(bgfx::makeRef(m_triangle_list.data(), sizeof(uint16_t) * m_triangle_list.size()));

m_is_initialized = true;
Expand Down

0 comments on commit 07687b0

Please sign in to comment.