守望者--AIR技术交流

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
热搜: ANE FlasCC 炼金术
查看: 1003|回复: 0

libtess2 利用炼金术编译成swc

[复制链接]
  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

    Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18

    威望
    562
    贡献
    29
    金币
    51792
    钢镚
    1422

    开源英雄守望者

    发表于 2015-4-10 09:45:07 | 显示全部楼层 |阅读模式
    应用下载
    应用名称: libtess2.swc
    支持64位:
    当前版本: 未知
    运行平台: Windows 
    开发语言: C++ ActionScript 3 其他 
    应用类别: ANE-C/C++
    应用简介: libtess2 (GLU libtess refactored) compiled to ActionScript 3 via Adobe CrossBridge
    libtess2.swc

    This is the tesselation library libtess2, compiled to ActionScript 3 via Adobe CrossBridge.

    Quoting the original README:

    This is refactored version of the original libtess which comes with the GLU reference implementation. The code is good quality polygon tesselator and triangulator. The original code comes with rather horrible interface and its performance suffers from lots of small memory allocations. The main point of the refactoring has been the interface and memory allocation scheme.
    A lot of the GLU tesselator documentation applies to Libtess2 too (apart from the API), check outhttp://www.glprogramming.com/red/chapter11.html
    Simple bucketed memory allocator (see Graphics Gems III for reference) was added which speeds up the code by order of magnitude (tests showed 15 to 50 times improvement depending on data). The API allows the user to pass his own allocator to the library. It is possible to configure the library so that the library runs on predefined chunk of memory.
    The API was changed to loosely resemble the OpenGL vertex array API. The processed data can be accessed via getter functions. The code is able to output contours, polygons and connected polygons. The output of the tesselator can be also used as input for new run. I.e. the user may first want to calculate an union all the input contours and the triangulate them.

    The code is released under SGI FREE SOFTWARE LICENSE B Version 2.0.

    The original author is Mikko Mononen.

    Getting started

    A simple example:

    1. import com.codeazur.libtess2.Tesselator;

    2. var pathOuter:Vector.<Number> = Vector.<Number>([0, 0,   200, 0,  200, 200, 0, 200]);
    3. var pathInner:Vector.<Number> = Vector.<Number>([50, 50, 150, 50, 150, 150, 50, 150]);

    4. var t:Tesselator = new Tesselator();
    5. t.newTess(1024 * 1024);
    6. t.addContour(pathOuter, pathOuter.length / 2, 2);
    7. t.addContour(pathInner, pathInner.length / 2, 2);
    8. t.tesselate(Tesselator.WINDING_ODD, Tesselator.ELEMENT_TYPE_POLYGONS, 3, 2);
    9. var vertices:Vector.<Number> = t.getVertices();
    10. var vertexCount:int = t.getVertexCount();
    11. var elements:Vector.<int> = t.getElements();
    12. var elementCount:int = t.getElementCount();
    13. t.deleteTess();
    复制代码


    APIThe ActionScript API is kept close to the original C API.
    1. newTess(size)
    复制代码
    Creates a new tesselator.
    • size - The memory, in bytes, to allocate.
      1. deleteTess()
      复制代码
      Deletes a tesselator.
    1. addContour(vertices, count, size)
    复制代码
    Adds a contour (a closed subpath of the shape) to be tesselated.
    • vertices - A Vector.<Number> containing the vertices of the contour to add.
    • count - The number of vertices in the contour.
    • size - The number of coordinates per vertex. Must be 2 or 3.
      1. tesselate(windingRule, elementType, polySize, vertexSize)
      复制代码
      Tesselates the contours.
      • windingRule - The winding rule used for tesselation. Seehttp://www.glprogramming.com/red/chapter11.html.
        • Tesselator.WINDING_ODD
        • Tesselator.WINDING_NONZERO
        • Tesselator.WINDING_POSITIVE
        • Tesselator.WINDING_NEGATIVE
        • Tesselator.WINDING_ABS_GEQ_TWO
      • elementType - The tesselation result element type.
        • Tesselator.ELEMENT_TYPE_POLYGONS
        • Tesselator.ELEMENT_TYPE_CONNECTED_POLYGONS
        • Tesselator.ELEMENT_TYPE_BOUNDARY_CONTOURS
      • polySize - The maximum number of vertices per polygons if the output is polygons.
      • vertexSize - The number of coordinates in tesselation result vertex, must be 2 or 3.
      Returns 1 (success) or 0 (error)
      1. getVertexCount()
      复制代码
      Returns the number of vertices in the tesselated output.
      1. getVertices()
      复制代码
      Returns a Vector.<Number> containig the vertices.
      1. getVertexIndices()
      复制代码
      Returns a Vector.<int> containig the vertex indices.Vertex indices can be used to map the generated vertices to the original vertices. Every point added usingaddContour() will get a new index starting at 0. New vertices generated at the intersections of segments are assigned value 0.
      1. getElementCount()
      复制代码
      Returns the number of elements in the tesselated output.
      1. getElements()
      复制代码
      Returns a Vector.<int> containig the element indices.For ELEMENT_TYPE_BOUNDARY_CONTOURS, returns a tuple per element, where the first value is the start vertex index, and the second value is the number of vertices that make up the element (here: boundary polygon).BuildIn order to build libtess2.swc from source, you need to have Adobe CrossBridge installed.Then call make CB_SDK=/path/to/crossbridge/sdk.





      相关链接:
      https://github.com/claus/libtess2.swc


    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有帐号?立即注册

    x
    守望者AIR技术交流社区(www.airmyth.com)
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    
    关闭

    站长推荐上一条 /4 下一条

    QQ|手机版|Archiver|网站地图|小黑屋|守望者 ( 京ICP备14061876号

    GMT+8, 2019-11-23 01:20 , Processed in 0.048649 second(s), 40 queries .

    守望者AIR

    守望者AIR技术交流社区

    本站成立于 2014年12月31日

    快速回复 返回顶部 返回列表