-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46a8379
commit 73408f5
Showing
42 changed files
with
3,539 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
Oops, something went wrong.