GithubHelp home page GithubHelp logo

hyper-theory / ink3d Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 1.0 23.32 MB

Lightweight framework for 3D rendering.

License: MIT License

C++ 60.22% C 27.63% GLSL 7.69% Roff 2.12% V 2.12% Python 0.11% CMake 0.12%
rendering 3d engine graphics opengl

ink3d's Introduction

Ink 3D

License

Ink 3D is a lightweight and easy to use framework for 3D rendering.

Screenshots

Ink3D - Black Cat.png

Ink3D - Coffee Time.png

Ink3D - Paper Plane.png

Features

  • Forward + Deferred Rendering Pipeline

  • HDR Rendering Pipeline Supported

  • Physically Based Rendering Materials

  • Light System (Directional / Point / Spot / Hemisphere)

  • High Quality Shadows (Hard-Edge / PCF / PCSS)

  • Probes System (Reflection Probe)

  • Global Fog (Linear Fog / Exponential Square Fog)

  • Post-Processing (SSAO, SSR, Bloom, FXAA and more)

  • Built-in Efficient Software Rasterization

Getting Started

  • A few lines of code to render a question block.
#include "ink/utils/Mainloop.h"

#define A "\0\0\0"
#define B "\xEE\xBB\x66"
#define C "\xFF\xDD\xBB"

using namespace Ink;

const char* BLOCK =
A B B B B B B B B B B A B B B B B A A A B B B B B B B B C C C A B B B B
B B B B C C C B B B B B B B B B B A A A B B B B B B B B C C C A A A B B
B B B B C C C C C A A B B B A A A B B C C C A B B C C C A A A C C C A B
B C C C C C C C C C B B B B C C C C C C C B B B A B B B B B B B B B B A;

Scene scene;
Viewer viewer;
Renderer renderer;

void conf(Settings& t) {
    t.title = "Ink3D Example";
    t.show_cursor = false;
    t.lock_cursor = true;
    t.background_color = Vec3(1.0, 0.93, 0.8);
}

void load() {
    Instance* instance = new Instance();
    instance->mesh = new Mesh(BoxMesh::create());
    scene.add(instance);
    
    Image* image = new Image(12, 12, 3);
    std::copy_n(BLOCK, 12 * 12 * 3, &image->data[0]);
    
    Material* material = new Material();
    material->color_map = image;
    scene.set_material("default", material);
    
    HemisphereLight* light = new HemisphereLight(Vec3(1), Vec3(0.5));
    light->direction = Vec3(0, 0, -1);
    scene.add_light(light);
    
    renderer.set_rendering_mode(FORWARD_RENDERING);
    renderer.set_texture_callback([](Gpu::Texture& t) -> void {
        t.set_filters(TEXTURE_NEAREST, TEXTURE_NEAREST);
    });
    renderer.load_scene(scene);
    renderer.set_viewport(Gpu::Rect(960, 540));
    
    viewer = Viewer(new PerspCamera(75 * DEG_TO_RAD, 1.77, 0.05, 500));
    viewer.set_position(Vec3(0, 0, -2));
}

void update(float dt) {
    Renderer::update_scene(scene);
    viewer.update(dt);
    renderer.render(scene, *viewer.get_camera());
}

void quit() {}

Dependencies

  • SDL2 Simple Directmedia Layer

  • stb_image Image loading/decoding from file/memory

  • fmt A modern formatting library

Requirements

  • OpenGL core 4.1 capable GPU

  • 1 GB Graphics memory recommended

ink3d's People

Contributors

hyper-theory avatar

Stargazers

mohamad hani janaty avatar  avatar Raintail avatar  avatar Chenghua avatar Walid Shaker avatar  avatar 我借此火 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

meowboy326

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.