Skip to content

Commit

Permalink
readd tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-bateman committed Oct 22, 2014
1 parent 46a8379 commit 73408f5
Show file tree
Hide file tree
Showing 42 changed files with 3,539 additions and 0 deletions.
337 changes: 337 additions & 0 deletions tests/AppHarness.js

Large diffs are not rendered by default.

465 changes: 465 additions & 0 deletions tests/AppHarness.ts

Large diffs are not rendered by default.

Binary file added tests/assets/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/assets/130909wall_big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/assets/256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions tests/assets/CubeTextureTest.cube
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"data":[
{
"id":"posX",
"image":"sky_posX.jpg"
},
{
"id":"negX",
"image":"sky_negX.jpg"
},
{
"id":"posY",
"image":"sky_posY.jpg"
},
{
"id":"negY",
"image":"sky_negY.jpg"
},
{
"id":"posZ",
"image":"sky_posZ.jpg"
},
{
"id":"negZ",
"image":"sky_negZ.jpg"
}
]
}
Binary file added tests/assets/custom_uv_horizontal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/assets/dots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/assets/sky_negX.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/assets/sky_negY.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/assets/sky_negZ.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/assets/sky_posX.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/assets/sky_posY.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/assets/sky_posZ.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions tests/containers/View3DTest.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 82 additions & 0 deletions tests/containers/View3DTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import View = require("awayjs-core/lib/containers/View");
import Mesh = require("awayjs-core/lib/entities/Mesh");
import PointLight = require("awayjs-core/lib/entities/PointLight");
import PrimitiveTorusPrefab = require("awayjs-core/lib/prefabs/PrimitiveTorusPrefab");
import RequestAnimationFrame = require("awayjs-core/lib/utils/RequestAnimationFrame");
import Debug = require("awayjs-core/lib/utils/Debug");

import DefaultRenderer = require("awayjs-stagegl/lib/core/render/DefaultRenderer");
import TriangleMethodMaterial = require("awayjs-stagegl/lib/materials/TriangleMethodMaterial");

class View3DTest
{

private view:View;
private torus:PrimitiveTorusPrefab;

private light:PointLight;
private raf:RequestAnimationFrame;
private meshes:Array<Mesh>;

constructor()
{

Debug.THROW_ERRORS = false;
Debug.LOG_PI_ERRORS = false;

this.meshes = new Array<Mesh>();
this.light = new PointLight();
this.view = new View(new DefaultRenderer())
this.view.camera.z = 0;
this.view.backgroundColor = 0x776655;
this.torus = new PrimitiveTorusPrefab(150 , 50 , 32 , 32 , false);

var l:number = 10;
var radius:number = 1000;
var matB:TriangleMethodMaterial = new TriangleMethodMaterial();

this.torus.material = matB;

for (var c:number = 0; c < l; c++) {

var t:number=Math.PI * 2 * c / l;

var mesh:Mesh = <Mesh> this.torus.getNewObject();
mesh.x = Math.cos(t)*radius;
mesh.y = 0;
mesh.z = Math.sin(t)*radius;

this.view.scene.addChild(mesh);
this.meshes.push(mesh);

}

this.view.scene.addChild(this.light);

this.raf = new RequestAnimationFrame(this.tick , this);
this.raf.start();
this.resize( null );

window.onresize = (e) => this.resize(null);

}

private tick(e)
{

for (var c:number = 0; c < this.meshes.length; c++)
this.meshes[c].rotationY += 2;

this.view.camera.rotationY += .5;
this.view.render();
}

public resize(e)
{
this.view.y = 0;
this.view.x = 0;

this.view.width = window.innerWidth;
this.view.height = window.innerHeight;
}
}
Loading

0 comments on commit 73408f5

Please sign in to comment.