Giter VIP home page Giter VIP logo

dxviewer's Introduction

DXViewer

Overview

DXViewer is a DirectX 12 framework for physics simulation. This viewer makes it easy to visualize your simulation.

Usage

Use the contents in the DXViewer-x.x.x folder. The files in the example folder show how to use them.

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd)
{
    // Simulation init
    AdhocSimulation* fluidsim = new AdhocSimulation();

    // DirectX init
    DX12App* dxapp = new DX12App();
    dxapp->setCameraProperties(
        PROJ::PERSPECTIVE, 
        2.0f, 0.0f, 0.0f);  // radius, theta, phi
    /*dxapp->setCameraProperties(
        PROJ::ORTHOGRAPHIC,
        0.0032f,               // orthogonal distance
        2.0f, 0.0f, 0.0f);  // radius, theta, phi     */
    dxapp->setBackgroundColor(DirectX::Colors::LightSlateGray);
    dxapp->setLightPosition(1.0f, 1.0f, 1.0f);

    // Window init
    Win32App winApp(500, 500);
    winApp.setWinName(L"Adhoc Simulation");
    winApp.setWinOffset(400, 200);
    winApp.initialize(hInstance, dxapp, fluidsim);

    return winApp.run();
}

ISimulation

ISimulation is an interface that makes your simulation class compatible with DXViewer. You should implement this interface using your simulation class. The following is the abstract methods that should be implemented. More details are described in ISimulation.h and example files.

Simulation methods

  • void iUpdate()
  • void iResetSimulationState(std::vector& constantBuffer)

Mesh methods

  • std::vector& iGetVertices()
  • std::vector& iGetIndices()
  • UINT iGetVertexBufferSize()
  • UINT iGetIndexBufferSize()
  • DirectX::XMINT3 iGetObjectCount()
  • DirectX::XMFLOAT3 iGetObjectSize()
  • DirectX::XMFLOAT3 iGetObjectPositionOffset()

DirectX methods

  • void iCreateObject(std::vector& constantBuffer)
  • void iUpdateConstantBuffer(std::vector& constantBuffer, int i)
  • void iDraw(Microsoft::WRL::ComPtr& mCommandList, int size, UINT indexCount, int i)
  • void iSetDXApp(DX12App* dxApp)
  • UINT iGetConstantBufferSize()
  • bool iIsUpdated()

WndProc methods

  • void iWMCreate(HWND hwnd, HINSTANCE hInstance)
  • void iWMCommand(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, HINSTANCE hInstance)
  • void iWMHScroll(HWND hwnd, WPARAM wParam, LPARAM lParam, HINSTANCE hInstance)
  • void iWMTimer(HWND hwnd)
  • void iWMDestory(HWND hwnd)

Build

This repo was developed in the following environment:

  • Windows 10 64-bit
  • Microsoft Visual Studio 2019 on x64 platform (C++14)
  • CMake 3.19.0

There are already built files(.lib, .dll and .cso) in the DXViewer-x.x.x folder, so use them.

Application

GridLiquid2D
FLIPEngine3D
CrystalGrowth
PBDEnergyProjection

Reference

  • Frank Luna. 2016. Introduction to 3D Game Programming with DirectX 12. Mercury Learning and Information.

dxviewer's People

Contributors

jklae avatar

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.