Permalink
Browse files

minor

  • Loading branch information...
1 parent fbbc083 commit 7fd2b804d295d8a347bf71d597b7cdc0eb7eadba Nicolas Cannasse committed Nov 9, 2012
Showing with 37 additions and 4 deletions.
  1. +2 −0 .gitignore
  2. +30 −0 README.md
  3. +4 −2 h3d/prim/Polygon.hx
  4. +1 −2 samples/Test.hx
View
@@ -0,0 +1,2 @@
+
+/engine.swf
View
@@ -0,0 +1,30 @@
+Haxe 3D Engine
+=========
+
+A lightweight 3D Engine for Haxe.
+
+Currently only supports Flash/Stage3D, but is abstracted to support other backends in the near future.
+
+In order to setup the engine, you can do :
+
+> var engine = new h3d.Engine();
+> engine.onReady = startMyApp;
+> engine.init();
+
+Then in your render loop you can do :
+
+> engine.begin();
+> ... render objects ...
+> engine.end()
+
+Objects can be created using a combination of a `h3d.mat.Material` (shader and blendmode) and `h3d.prim.Primitive` (geometry).
+
+You can look at available examples in `samples` directory.
+
+2D GPU Engine
+-------------
+
+The `h2d` package contains classes that provides a complete 2D API that is built on top of `h3d`, and is then GPU accelerated.
+
+It contains an object hierarchy which base class is `h2d.Sprite` and root is `h2d.Scene`
+
View
@@ -6,7 +6,7 @@ class Polygon extends Primitive {
public var normals : Array<Point>;
public var tangents : Array<Point>;
public var tcoords : Array<UV>;
- public var idx : Array<UInt>;
+ public var idx : Array<Int>;
public function new( points, ?idx ) {
this.points = points;
@@ -49,8 +49,10 @@ class Polygon extends Primitive {
}
buffer = engine.mem.allocVector(buf, size, idx == null ? 3 : 0);
- if( idx != null )
+ if( idx != null ) {
+ var idx : Array<UInt> = cast idx;
indexes = engine.mem.allocIndex(flash.Vector.ofArray(idx));
+ }
}
View
@@ -45,8 +45,7 @@ class Test {
obj = new h3d.Object(prim, new h3d.mat.Material(rgb));
var bmp = new flash.display.BitmapData(256, 256);
bmp.perlinNoise(64, 64, 3, 0, true, true, 7);
- rgb.tex = e.mem.allocTexture(bmp.width, bmp.height);
- rgb.tex.uploadMipMap(bmp);
+ rgb.tex = e.mem.makeTexture(bmp);
bmp.dispose();
}

0 comments on commit 7fd2b80

Please sign in to comment.