-
Notifications
You must be signed in to change notification settings - Fork 6
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
Yuki Shimada
committed
Feb 28, 2019
1 parent
55228ba
commit d6c3ad5
Showing
34 changed files
with
168 additions
and
8 deletions.
There are no files selected for viewing
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
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
File renamed without changes.
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 |
---|---|---|
@@ -1,8 +1,12 @@ | ||
{ | ||
"e2e": [ | ||
"test_e2e": [ | ||
"DataTextureInstancedDrawingWebGL1", | ||
"DataTextureInstancedDrawingWebGL2", | ||
"Gltf2Importer", | ||
"UBOInstancedDrawing" | ||
], | ||
"simple": [ | ||
"Effekseer", | ||
"SparkGear" | ||
] | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added
BIN
+46.8 KB
..._snapshots__/__diff_output__/test-js-regression-test-gltf-2-importer-1-diff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...DataTextureInstancedDrawingWebGL1/test.js → ...DataTextureInstancedDrawingWebGL1/test.js
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
File renamed without changes
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...DataTextureInstancedDrawingWebGL2/test.js → ...DataTextureInstancedDrawingWebGL2/test.js
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
Binary file added
BIN
+4.72 KB
...Importer/__image_snapshots__/test-js-regression-test-gltf-2-importer-1-snap.png
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,43 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Gltf2Importer</title> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, user-scalable=no" /> | ||
<meta name="apple-mobile-web-app-capable" content="yes" /> | ||
<style> | ||
main { | ||
display: flex; | ||
} | ||
section { | ||
background-color: darkgray; | ||
padding: 10px; | ||
margin: 20px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<header> | ||
<h1 class="header-title">Rhodonite E2E Test - Gltf2Importer</h1> | ||
</header> | ||
<main> | ||
<section class="test"> | ||
<h2>Rendering Test Image</h2> | ||
<canvas id="world" width="600" height="600"></canvas> | ||
<div> | ||
<button onclick="window.isAnimating = true;">Animate</button> | ||
</div> | ||
</section> | ||
<section class="correct"> | ||
<h2>Correct PNG Image</h2> | ||
<img src="__image_snapshots__/test-js-regression-test-gltf-2-importer-1-snap.png" /> | ||
</section> | ||
</main> | ||
<script src="../../assets/navigate.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.26.0/polyfill.min.js"></script> | ||
<script src="../../../dist/rhodonite.js"></script> | ||
<script src="main.js"></script> | ||
</body> | ||
|
||
</html> |
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,103 @@ | ||
|
||
let p = null; | ||
|
||
const load = async function(time){ | ||
await Rn.ModuleManager.getInstance().loadModule('webgl'); | ||
await Rn.ModuleManager.getInstance().loadModule('pbr'); | ||
const importer = Rn.Gltf2Importer.getInstance(); | ||
const system = Rn.System.getInstance(); | ||
const gl = system.setProcessApproachAndCanvas(Rn.ProcessApproach.UniformWebGL1, document.getElementById('world')); | ||
|
||
const entityRepository = Rn.EntityRepository.getInstance(); | ||
|
||
// Camera | ||
const cameraEntity = entityRepository.createEntity([Rn.TransformComponent, Rn.SceneGraphComponent, Rn.CameraComponent, Rn.CameraControllerComponent]) | ||
const cameraComponent = cameraEntity.getComponent(Rn.CameraComponent); | ||
//cameraComponent.type = Rn.CameraTyp]e.Orthographic; | ||
cameraComponent.parameters = new Rn.Vector4(0.1, 1000, 90, 1); | ||
cameraEntity.getTransform().translate = new Rn.Vector3(0.0, 0, 0.5); | ||
|
||
|
||
// Lights | ||
const lightEntity = entityRepository.createEntity([Rn.TransformComponent, Rn.SceneGraphComponent, Rn.LightComponent]) | ||
lightEntity.getTransform().translate = new Rn.Vector3(1.0, 100000.0, 1.0); | ||
lightEntity.getComponent(Rn.LightComponent).intensity = new Rn.Vector3(1, 1, 1); | ||
//lightEntity2.getTransform().rotate = new Rn.Vector3(Math.PI/2, 0, 0); | ||
//lightEntity2.getComponent(Rn.LightComponent).type = Rn.LightType.Directional; | ||
|
||
|
||
const response = await importer.import('../../../assets/gltf/2.0/BoxAnimated/glTF/BoxAnimated.gltf'); | ||
const modelConverter = Rn.ModelConverter.getInstance(); | ||
const rootGroup = modelConverter.convertToRhodoniteObject(response); | ||
//rootGroup.getTransform().translate = new Rn.Vector3(1.0, 0, 0); | ||
rootGroup.getTransform().rotate = new Rn.Vector3(0, 1.0, 0.0); | ||
|
||
|
||
// CameraComponent | ||
const cameraControllerComponent = cameraEntity.getComponent(Rn.CameraControllerComponent); | ||
cameraControllerComponent.setTarget(rootGroup); | ||
|
||
// Env Map | ||
const specularCubeTexture = new Rn.CubeTexture(); | ||
specularCubeTexture.baseUriToLoad = '../../../assets/ibl/specular/specular'; | ||
specularCubeTexture.mipmapLevelNumber = 10; | ||
const diffuseCubeTexture = new Rn.CubeTexture(); | ||
diffuseCubeTexture.baseUriToLoad = '../../../assets/ibl/diffuse/diffuse'; | ||
diffuseCubeTexture.mipmapLevelNumber = 1; | ||
const componentRepository = Rn.ComponentRepository.getInstance(); | ||
const meshRendererComponents = componentRepository.getComponentsWithType(Rn.MeshRendererComponent); | ||
for (let meshRendererComponent of meshRendererComponents) { | ||
meshRendererComponent.specularCubeMap = specularCubeTexture; | ||
meshRendererComponent.diffuseCubeMap = diffuseCubeTexture; | ||
} | ||
|
||
|
||
Rn.CameraComponent.main = 0; | ||
let startTime = Date.now(); | ||
const rotationVec3 = Rn.MutableVector3.one(); | ||
let count = 0; | ||
const draw = function(time) { | ||
|
||
if (p == null && count > 0) { | ||
if (response != null) { | ||
|
||
gl.enable(gl.DEPTH_TEST); | ||
gl.viewport(0, 0, 600, 600); | ||
gl.clearColor(0.8, 0.8, 0.8, 1.0); | ||
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); | ||
} | ||
|
||
p = document.createElement('p'); | ||
p.setAttribute("id", "rendered"); | ||
p.innerText = 'Rendered.'; | ||
document.body.appendChild(p); | ||
|
||
} | ||
|
||
if (window.isAnimating) { | ||
const date = new Date(); | ||
const rotation = 0.001 * (date.getTime() - startTime); | ||
//rotationVec3.v[0] = 0.1; | ||
//rotationVec3.v[1] = rotation; | ||
//rotationVec3.v[2] = 0.1; | ||
const time = (date.getTime() - startTime) / 1000; | ||
Rn.AnimationComponent.globalTime = time; | ||
if (time > Rn.AnimationComponent.endInputValue) { | ||
startTime = date.getTime(); | ||
} | ||
//console.log(time); | ||
// rootGroup.getTransform().scale = rotationVec3; | ||
//rootGroup.getTransform().translate = rootGroup.getTransform().translate; | ||
} | ||
|
||
system.process(); | ||
count++; | ||
|
||
requestAnimationFrame(draw); | ||
} | ||
|
||
draw(); | ||
} | ||
|
||
document.body.onload = load; | ||
|
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,10 @@ | ||
test('regression test Gltf2Importer', async () => { | ||
jest.setTimeout(60000); | ||
const page = await browser.newPage(); | ||
await page.goto('http://localhost:8082/samples/test_e2e/Gltf2Importer'); | ||
await page.setViewport({width: 1000, height: 1000}); | ||
await page.waitForSelector('p#rendered', {timeout: 60000}); | ||
const canvasElement = await page.$('#world'); | ||
const image = await canvasElement.screenshot(); | ||
expect(image).toMatchImageSnapshot(); | ||
}); |
File renamed without changes
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...TransformFeedbackInstancedDrawing/test.js → ...TransformFeedbackInstancedDrawing/test.js
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
File renamed without changes
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
test/e2e/UBOInstancedDrawing/test.js → samples/test_e2e/UBOInstancedDrawing/test.js
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