Changes

Jump to: navigation, search

XB PointStream

4,235 bytes removed, 18:07, 14 February 2011
no edit summary
[http://scotland.proximity.on.ca/asalga/releases/0.1.zip XBPS 0.1]<br />
===XB PointStream Dev Development Links===
[http://scotland.proximity.on.ca/asalga/ 3D Image Gallery]<br />
[http://en.wordpress.com/tag/xb-pointstream/ Blogs]<br />
[http://twitter.com/XBPointStream Twitter]<br />
[http://www.youtube.com/results?search_query=xb+pointstream&aq=f YouTube Videos]<br />
  <!---'''Sample Files'''<br />[http://wwwzenit.fastscan3dsenecac.com/download/samples/ OBJ Sample Files]<br />--> ===Parser Interface=== There will be cases in which users have their own file formatwhich they want to render with XB PointStream (for example,.ARA or on.XML). We need to give users the ability to write theirown parser and hook it into the library. Users would write their JavaScript code which would implementthe methods below. Once they do that, they would register theirparser with the library by passing in an extension and their parser. The library would then take care of the rest by creating an instanceof their parser, call its methods and return a point cloud object. <pre>ca/* The constructor of the parser.  @param {Object} obj - collection of named functions  These functions pass the parser back to the library since the library could be working with many parsers simultaneously.  start - must occur exactly once. Has one argument, the parser itself end - must occur exactly once. Has one argument, the parser itself parse - may occur one or many times. Has two arguments, the parser itself and a named collection of value types.  See below for an example *wiki/Constructor(obj) /* Begins to load the resourceindex @param {String} path - path to resource*php/load(path)  XB_PointStream////// Getters /* Get the version of this parser. @returns {String} parser version*/version /* Get the number of points which have been parsed.  @returns {Number} the number of points parsed so far by the parser.*/numParsedPoints /* Get the total number of points in the point cloud, including points which have not yet been parsed.  @returns {Number} the total number of points in the resource or -1 if unknown.*/numTotalPoints /* Get the progress of the parser, how much it has parsed so far.  @returns {Number} value between 0 to 1 or -1 if unknown.*/progress /* The size of the resource in bytes.  @returns {Number} the number of bytes in the resource or -1 if unknown.*/fileSizeextending_xbps Extending XBPS]<br /pre> <pre>/* The following example demonstrates how XB PointStream might use a particular parser.*/ var parser; function startCallback(parser){ // started} function parseCallback(parser, attributes){ parser.version; parser.numParsedPoints; parser.numTotalPoints; parser.progress; parser.fileSize;} function finishCallback(parser){ // finished} // create a hypothetical parser and set the callbacksparser = new XYZParser({ start: startCallback, parse: parseCallback, end: finishCallback});// load some resourceparser.load("pointcloud.xyz");</pre===Extending XB PointStream===Using the internal XB PointStream parser and shader If you decide to use the internal XB PointStream parser and shader, you can have a script displaying your point cloud in about 10 lines of JavaScript. However, you will be required to send in your point cloud as an .ASC file as that is the only format we currently support. Also, the built-in shader will only draw the minimum necessary for you point cloud. That is, it will only render vertex positions and colors. Using the internal XB PointStream parser with a custom shader It is possible to create shader effects on point cloud objects to add effect such as mirroring, etc. If you decide to use the internal .ASC parser and write a custom shader, you'll need to ensure your vertex shader uses the correct uniform and attribute variable names which XB PointStream refers to. The built-in .ASC parser only reads in vertex position and colors, so you must use the following names to refer to those attributes in your vertex shader: vec3 ps_Vertexvec4 ps_Color XB PointStream will refer to the following uniforms: For transformations:mat4 ps_ModelViewMatrixmat4 ps_ProjectionMatrix For point size:float ps_PointSizevec3 ps_Attenuation Using the internal XB PointStream shader with a custom parser If your point cloud is in a format other than .ASC, but you want to use the built-in shader, you'll need to make sure your parser writes to the correct attribute names*insert URL to example* "ps_Vertex""ps_Color" Your script must also register your parser with XB PointStream with:ps.registerParser("XYZ", Your_XYZ_Parser_Name); Using a custom shader and parser
1
edit

Navigation menu