Code Monkey home page Code Monkey logo

minecube's Introduction

titlebar

MineCube

A sample voxel editor based on OpenGL 3.3+, inspired by MagicaVoxel.

Support Windows 10 currently.

A final project originally of 5 undergraduate students for the course Computer Graphics, SYSU.

A good OpenGL learning example for the green hand in Computer Graphics, while maybe not the best practice in the related field.

Create any small stuff you like!

presentation

More Image Examples

Mastersword

warrior

diglett

Dependences

  1. OpenGL 3.3+
  2. GLAD

From LearnOpenGL:

Go to the web service, make sure the language is set to C++ and in the API section, select an OpenGL version of at least 3.3 (which is what we'll be using for this repo; higher versions may be fine as well). Also make sure the profile is set to Core and that the Generate a loader option is ticked. Ignore the extensions (for now) and click Generate to produce the resulting library files.

Chinese Version: 打开GLAD的在线服务,将语言(Language)设置为C/C++,在API选项中,选择3.3以上的OpenGL(gl)版本(本仓库中将使用3.3版本,但更新的版本应该也能正常工作)。之后将模式(Profile)设置为Core,并且保证生成加载器(Generate a loader)的选项是选中的。现在可以先(暂时)忽略拓展(Extensions)中的内容。都选择完之后,点击生成(Generate)按钮来生成库文件。

  1. GLFW Master 3.2.1 GLFW Master branch
  2. GLM 0.9.8.5
  3. imgui v1.60
  4. nlohmann::json v3.1.2 , 只需要下载 json.hpp 的 release 文件。
  5. freetype 2.9.1 , 建议下载 ft291.zip 并解压 , 然后将 freetype-2.9.1 文件夹更名为 freetype 添加至 3rd_party

How to Run Demo

1. Download the Binary File in Release

Release List

2. Build from the Source

  1. Create a new directory 3rd_party at root directory.
  2. Download and unzip glad, glfw, glm, imgui dependences following the URL above.
  3. Rename all the dependences' directories without certain version number.
  4. Download nlohmann/json.hpp file from the URL above.
  5. Follow the steps above to add freetype library.

Now your 3rd_party looks like:

3rd_party/
----glad/
----glfw/
----glm/
----imgui/
----nlohmann/json.hpp
----freetype
  1. Use Cmake to generate your project file.

2.1 Windows (Visual Studio 2015 or higher)

  1. Use Cmake-gui to generate the build/ dir.
  2. Open it in Visual Studio, set MineCube as Startup Project.
  3. Compile it and run the program.

You might need to modify the shaders' path in demo.cpp

2.2 Mac OS

Still need to be developed.

2.3 Linux(Ubuntu)

Still need to be developed.

Contributors

More about MineCube

Read wiki for more technical details.

Bugs Report

Feel free to new issues.

minecube's People

Contributors

15331335 avatar bowenwu1 avatar jianjieluo avatar mgsweet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minecube's Issues

Include <windows.h> ?

My output:

Scanning dependencies of target glfw
[ 3%] Building C object 3rd_party/glfw/src/CMakeFiles/glfw.dir/context.c.o
[ 6%] Building C object 3rd_party/glfw/src/CMakeFiles/glfw.dir/init.c.o
[ 10%] Building C object 3rd_party/glfw/src/CMakeFiles/glfw.dir/input.c.o
[ 13%] Building C object 3rd_party/glfw/src/CMakeFiles/glfw.dir/monitor.c.o
[ 17%] Building C object 3rd_party/glfw/src/CMakeFiles/glfw.dir/vulkan.c.o
[ 20%] Building C object 3rd_party/glfw/src/CMakeFiles/glfw.dir/window.c.o
[ 24%] Building C object 3rd_party/glfw/src/CMakeFiles/glfw.dir/cocoa_init.m.o
[ 27%] Building C object 3rd_party/glfw/src/CMakeFiles/glfw.dir/cocoa_joystick.m.o
[ 31%] Building C object 3rd_party/glfw/src/CMakeFiles/glfw.dir/cocoa_monitor.m.o
[ 34%] Building C object 3rd_party/glfw/src/CMakeFiles/glfw.dir/cocoa_window.m.o
[ 37%] Building C object 3rd_party/glfw/src/CMakeFiles/glfw.dir/cocoa_time.c.o
[ 41%] Building C object 3rd_party/glfw/src/CMakeFiles/glfw.dir/posix_thread.c.o
[ 44%] Building C object 3rd_party/glfw/src/CMakeFiles/glfw.dir/nsgl_context.m.o
[ 48%] Building C object 3rd_party/glfw/src/CMakeFiles/glfw.dir/egl_context.c.o
[ 51%] Building C object 3rd_party/glfw/src/CMakeFiles/glfw.dir/osmesa_context.c.o
[ 55%] Linking C static library libglfw3.a
[ 55%] Built target glfw
Scanning dependencies of target MineCube
[ 58%] Building CXX object CMakeFiles/MineCube.dir/src/Camera.cpp.o
[ 62%] Building CXX object CMakeFiles/MineCube.dir/src/CraftManager.cpp.o
[ 65%] Building CXX object CMakeFiles/MineCube.dir/src/Global.cpp.o
[ 68%] Building CXX object CMakeFiles/MineCube.dir/src/Gui.cpp.o
[ 72%] Building CXX object CMakeFiles/MineCube.dir/src/Shader.cpp.o
[ 75%] Building CXX object CMakeFiles/MineCube.dir/src/demo.cpp.o
/Users/wubowen/Documents/MineCube/src/demo.cpp:7:10: fatal error: 'windows.h' file not found
#include <windows.h>
^~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/MineCube.dir/src/demo.cpp.o] Error 1
make[1]: *** [CMakeFiles/MineCube.dir/all] Error 2
make: *** [all] Error 2

Display Text support

@15331335

在展示前提供一个 bonus 的 display text support.

例如,显示一下提醒 “Press 'V' to view your art !”

Error when make

[ 55%] Built target glfw
[ 58%] Building C object CMakeFiles/MineCube.dir/3rd_party/glad/src/glad.c.o
[ 62%] Linking CXX executable MineCube
clang: error: no such file or directory: 'CMakeFiles/MineCube.dir/3rd_party/glad/src/glad.c.o'
make[2]: *** [MineCube] Error 1
make[1]: *** [CMakeFiles/MineCube.dir/all] Error 2
make: *** [all] Error 2

CMake on MacOS

My output:
➜ MineCube git:(dev) ✗ cmake .
-- The CXX compiler identification is AppleClang 9.0.0.9000039
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The C compiler identification is AppleClang 9.0.0.9000039
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Could NOT find Vulkan (missing: VULKAN_LIBRARY VULKAN_INCLUDE_DIR)
-- Using Cocoa for window creation
-- Configuring done
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_C_COMPILE_OBJECT
-- Generating done
-- Build files have been written to: /Users/wubowen/Documents/MineCube

关于底部增加一层透明正方体的可能性讨论

现在有个问题,就是我将所有方块都删除了的话,就执行不了添加的功能了(因为pick不到任何面)
我在想

  1. 是不是在创建一个3 * 3 * 3 的方体时,底层能默认创建多一层得到一个3 * 3 * 4的方体,但对外声称只有3 * 3 * 3,那个多出来的一层不能添加删除改颜色但能被hover和select
  2. 是否存在渲染出 透明的却能被pick到的方块 的可能性

底层透明方块可能性请教 @longjj @Bowenwu1

能否pick到透明方块请教 @Ace-0

Unelegant path hard code.

snipaste_2018-07-11_09-03-21

We need to remove the tempory unelegant path hard code.

Or we need to remind TA of setting their own path if they use OS X operating system.

可以使用 GUI 修改整个大立方体的 numPerEdge

@mgsweet @Ace-0

参考 magicVoxel, 是有一个地方可以直接修改整个长方体的长宽高的。

snipaste_2018-06-25_14-23-00

应该输入就会重新生成一个符合该长宽高的长发体,方便重新开始。

GUI 界面应该提供一个可以改size的接口和逻辑。可以的话也可以提供一个填满的按钮,方便重新编辑。现在我们想要重新开始编辑,需要退出重开。

(这个可以放到展示后再做)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.