Git Product home page Git Product logo

pointcloud-3's Introduction

pointCloud

This module contains classes used to load and handle point cloud data.

Right now the only exported classes are point cloud loaders for cyclops

TextPointsLoader and BinaryPointsLoader

These classes can be used to load models containing point cloud data in ASCII or binary xyz + RGB format.

Text data format

Each line should contain 7 space-separated numbers represending 3D position and RGBA color. The color is represented as a float in the [0-1] range. Example:

0 0 0 1 1 1 1
0 10 0 0.5 0.5 0.5 1
10 0 0 1 0 0 1
10 10 0 1 1 1 1

Binary data format

Each record contains 7 double precision numbers (8 bytes each) represending 3D position and RGBA color.

To use TextPointsLoader:

from omega import *
from cyclops import *
from pointCloud import *

# Register the points loader
scene = getSceneManager()
scene.addLoader(TextPointsLoader())

# Load a points cloud using the standard loading command
pointCloudData = ModelInfo()
pointCloudData.name = "points"
pointCloudData.path = "points.xyz"
pointCloudData.optimize = True
scene.loadModel(pointCloudData)

# create a static object using the loaded data
object = StaticObject.create('points')

Point shaders

The point clous library comes with a set of shaders to render points as spheres using a geometry shader. The shaders can be loaded as follows:

# The '..' at the beginning is to move up and out of the omega data dir. default shaders for
# pointCloud are inside the modules directory.
shaderPath = "../modules/pointCloud/shaders";
program = ProgramAsset()
program.name = "pointsDepth"
program.vertexShaderName = shaderPath + "/Sphere.vert"
program.fragmentShaderName = shaderPath + "/Sphere.frag"
program.geometryShaderName = shaderPath + "/Sphere.geom"
program.geometryOutVertices = 4
program.geometryInput = PrimitiveType.Points
program.geometryOutput = PrimitiveType.TriangleStrip
scene.addProgram(program)

Applying the shader to a point cloud object can be done with the standard object.getMaterial().setProgram('programName') command, where programName should match the name used by the program above.

pointcloud-3's People

Contributors

arthurnishimoto avatar febret avatar renambot-uic avatar

Watchers

 avatar  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.