kyawakyawa / tubular-cpp

Curves to tube mesh conversion in cpp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tubular-cpp, curves primitive to tubular mesh converter in C++

xpd obj

C++ port of unity-tubular https://github.com/mattatz/unity-tubular

Currently .xpd curve data is supported.

Assume Catmull-Rom curves.

Requirements

  • cmake
  • C++11 compiler(clang recommended)

Supported platform

  • Linux 64bit
  • macOS
  • Windows(Visual Studio 2017 or later)
  • Android(will work)

Supported curve data

Build

Mac or Linux

$ ./bootstrap-clang.sh
$ cd build
$ make

Windows

For command prompt or PowerShell, simply run vcsetup.bat (Use VS2017)

For Git for Windows terminal(mintty bash), run

$ cmd //c vcsetup.bat

Usage

Convert curves data to wavefront .obj. Setting is done in config.json file.

{
    "xpd_filepath": "/path/to/hoge.xpd",
    "cyhair_filepath": "/path/to/cyhair.hair",
    "obj_filepath": "/pat/to/hoge.obj",
    "max_segments": 15,
    "radial_segments": 3,
    "radius_scale": 1.0,
    "user_radius": -1.0,
    "fix_normal": [
        0.0,
        0.0,
        -1.0
    ],
    "one_side_plane": false
}

Input curves can be speficied either xpd_filepath or cyhair_filepath.

  • xpd_filepath Input .xpd file (str)
  • cyhair_filepath Input cyhair .hair file (str)
  • obj_filepath Outout wavefront .obj (str)
  • max_segments The maximum number of segments per strand (int)
  • radial_segments The number of radial segments (int)
  • radius_scale radius scale (float)
  • user_radius Use user supplied radius. If user_radius is negative, tubular uses the thicknesses stored in curves data(cyhair only for now). (float)
  • fix_normal Make faces face the specified direction. (float x 3)
  • one_side_plane When radial_segments is 2, use one side planes. (bool)

How to execute

$ ./tubular-cli /path/to/config.json

TODO

  • Interactive GUI
  • Support more curves format
    • Cyhair
    • Alembic
    • RenderMan RiCurves?

License

tubular-cpp is licensed under MIT license.

Third party licenses

About

Curves to tube mesh conversion in cpp

License:MIT License


Languages

Language:C++ 97.9%Language:C 1.2%Language:CMake 0.9%Language:Shell 0.1%Language:Batchfile 0.0%