/kaleido3d

Next Generation Renderer for Cross Platform Engine Development

Primary LanguageC++MIT LicenseMIT

Introduction

kaleido3d is a cross-platform graphics library.

  • Modern Graphics Renderer (Metal, Vulkan, Direct3D 12)
  • Task-Oriented, support multi-thread rendering
  • Support Windows/UWP, Android, iOS, MacOS & Linux.

Prerequisites

Windows & UWP & Android MacOS/iOS/Linux
CI Status Build status Circle CI
IDE VS2015+ & Android Studio 3.0+ Xcode 8.1+
OS Requirements Win10 & Android 7.+ MacOS Sierra
  • Python 2.7
  • CMake 3.x

Wikis


NGFX Snippets

Draw a triangle

void DrawFrame()
{
  auto currentImage = m_pSwapChain->GetCurrentTexture();
  auto ImageDesc = currentImage->GetDesc();
  k3d::ColorAttachmentDesc ColorAttach;
  ColorAttach.pTexture = currentImage;
  // specify renderpass action, optimize for mobile platform's PLS (Pixel Local Storage)
  ColorAttach.LoadAction = k3d::ELA_Clear;
  ColorAttach.StoreAction = k3d::ESA_Store;
  ColorAttach.ClearColor = Vec4f(1, 1, 1, 1);

  k3d::RenderPassDesc Desc;
  Desc.ColorAttachments.Append(ColorAttach);

  auto commandBuffer = m_pQueue->ObtainCommandBuffer(k3d::ECMDUsage_OneShot);
  // command encoder is similar to apple's metal, look up renderpass object from cache
  // for vulkan, it performs the call "BeginRenderPass"
  auto renderCmd = commandBuffer->RenderCommandEncoder(Desc);
  renderCmd->SetBindingGroup(m_BindingGroup);
  k3d::Rect rect{ 0, 0, ImageDesc.TextureDesc.Width, ImageDesc.TextureDesc.Height };
  renderCmd->SetScissorRect(rect);
  renderCmd->SetViewport(k3d::ViewportDesc(ImageDesc.TextureDesc.Width, ImageDesc.TextureDesc.Height));
  renderCmd->SetPipelineState(0, m_pPso);
  renderCmd->SetIndexBuffer(m_TriMesh->IBO());
  renderCmd->SetVertexBuffer(0, m_TriMesh->VBO());
  renderCmd->DrawIndexedInstanced(k3d::DrawIndexedInstancedParam(3, 1));
  renderCmd->EndEncode();

  commandBuffer->Present(m_pSwapChain, m_pFence);
  commandBuffer->Commit(m_pFence);
}

RHI Objects were found here.


Unit Tests

1.Triangle(Basic)

Triangle Screenshot

2.TexturedCube(Basic)

Cube Screenshot

3.Compute Particles(Intermediate)

Compute Sample


Contact

If you have any suggestion, please contact me via email .


Discuss Join the chat at https://gitter.im/TsinStudio/kaleido3d

Please join the gitter chat or QQ Group to discuss on this project. Framework development discussions and thorough bug reports are collected on Issues.


Credits

ThirdParty Libraries:

  • OpenSSL (Core)
  • PCRE2 (Core)
  • Snappy (Core)
  • ZLib (Core)
  • Vulkan Memory Allocator (NGFX)
  • FreeType (ShaderCompiler)
  • Glslang (ShaderCompiler)
  • SPIRV-CROSS (ShaderCompiler)
  • SPIRV-TOOLS (ShaderCompiler)
  • LLVM (Reflection)
  • Clang (Reflection)
  • GoogleV8 (Script)
  • GoogleTest (Unit Test)
  • rapidjson
  • imobiledevice (MobileDevice)