Skip to content

Commit a7dabc8

Browse files
committed
Merge branch 'master' of https://github.com/playcanvas/engine into node-material
2 parents 29f03bb + e53818f commit a7dabc8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+2412
-1379
lines changed

README-zh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ PlayCanvas 是一款使用 HTML5 和 WebGL 技术运行游戏以及其他 3D 内
3131

3232
许多行业龙头公司在不同领域(广告,电子游戏以及产品可视化等)均适用了 PlayCanvas:
3333

34-
**Animech, ARM, Disney, Facebook, IGT, King, Miniclip, Leapfrog, Mozilla, Nickelodeon, Nordeus, PikPok, PlaySide Studios, Polaris, Product Madness, Samsung, Snap, Spry Fox, Zeptolab, Zynga**
34+
**Animech, Arm, Disney, Facebook, IGT, King, Miniclip, Leapfrog, Mozilla, Nickelodeon, Nordeus, PikPok, PlaySide Studios, Polaris, Product Madness, Samsung, Snap, Spry Fox, Zeptolab, Zynga**
3535

3636
## 特点
3737

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ You can see more games on the [PlayCanvas website](https://playcanvas.com/explor
3232
## Users
3333

3434
PlayCanvas is used by leading companies in video games, advertising and visualization such as:
35-
**Animech, ARM, Disney, Facebook, IGT, King, Miniclip, Leapfrog, Mozilla, Nickelodeon, Nordeus, PikPok, PlaySide Studios, Polaris, Product Madness, Samsung, Snap, Spry Fox, Zeptolab, Zynga**
35+
**Animech, Arm, Disney, Facebook, IGT, King, Miniclip, Leapfrog, Mozilla, Nickelodeon, Nordeus, PikPok, PlaySide Studios, Polaris, Product Madness, Samsung, Snap, Spry Fox, Zeptolab, Zynga**
3636

3737
## Features
3838

examples/examples.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ var categories = [
4646
"shader-burn",
4747
"shader-toon",
4848
"shader-wobble",
49-
"texture-basis"
49+
"texture-basis",
50+
"transform-feedback"
5051
]
5152
}, {
5253
name: "loaders",
@@ -102,6 +103,7 @@ var categories = [
102103
'ar-hit-test',
103104
'vr-basic',
104105
'vr-controllers',
106+
'vr-hands',
105107
'vr-movement',
106108
'xr-picking'
107109
]

examples/graphics/hardware-instancing.html

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -87,38 +87,40 @@
8787
// add the box entity to the hierarchy
8888
app.root.addChild(box);
8989

90-
// number of instances to render
91-
var instanceCount = 1000;
92-
93-
// store matrices for individual instances into array
94-
var matrices = new Float32Array(instanceCount * 16);
95-
var matrixIndex = 0;
96-
97-
var radius = 5;
98-
var pos = new pc.Vec3();
99-
var rot = new pc.Quat();
100-
var scl = new pc.Vec3();
101-
var matrix = new pc.Mat4();
102-
103-
for (var i = 0; i < instanceCount; i++) {
104-
// generate random positions / scales and rotations
105-
pos.set(Math.random() * radius - radius * 0.5, Math.random() * radius - radius * 0.5, Math.random() * radius - radius * 0.5);
106-
scl.set(0.1 + Math.random() * 0.1, 0.1 + Math.random() * 0.3, 0.1 + Math.random() * 0.1);
107-
rot.setFromEulerAngles(i * 30, i * 50, i * 70);
108-
matrix.setTRS(pos, rot, scl);
109-
110-
// copy matrix elements into array of floats
111-
for (var m = 0; m < 16; m++)
112-
matrices[matrixIndex++] = matrix.data[m];
90+
if (this.app.graphicsDevice.supportsInstancing) {
91+
// number of instances to render
92+
var instanceCount = 1000;
93+
94+
// store matrices for individual instances into array
95+
var matrices = new Float32Array(instanceCount * 16);
96+
var matrixIndex = 0;
97+
98+
var radius = 5;
99+
var pos = new pc.Vec3();
100+
var rot = new pc.Quat();
101+
var scl = new pc.Vec3();
102+
var matrix = new pc.Mat4();
103+
104+
for (var i = 0; i < instanceCount; i++) {
105+
// generate random positions / scales and rotations
106+
pos.set(Math.random() * radius - radius * 0.5, Math.random() * radius - radius * 0.5, Math.random() * radius - radius * 0.5);
107+
scl.set(0.1 + Math.random() * 0.1, 0.1 + Math.random() * 0.3, 0.1 + Math.random() * 0.1);
108+
rot.setFromEulerAngles(i * 30, i * 50, i * 70);
109+
matrix.setTRS(pos, rot, scl);
110+
111+
// copy matrix elements into array of floats
112+
for (var m = 0; m < 16; m++)
113+
matrices[matrixIndex++] = matrix.data[m];
114+
}
115+
116+
// create static vertex buffer containing the matrices
117+
var vertexBuffer = new pc.VertexBuffer(this.app.graphicsDevice, pc.VertexFormat.defaultInstancingFormat, instanceCount, pc.BUFFER_STATIC, matrices);
118+
119+
// initialise instancing using the vertex buffer on meshInstance of the created box
120+
var boxMeshInst = box.model.meshInstances[0];
121+
boxMeshInst.setInstancing(vertexBuffer);
113122
}
114123

115-
// create static vertex buffer containing the matrices
116-
var vertexBuffer = new pc.VertexBuffer(this.app.graphicsDevice, pc.VertexFormat.defaultInstancingFormat, instanceCount, pc.BUFFER_STATIC, matrices);
117-
118-
// initialise instancing using the vertex buffer on meshInstance of the created box
119-
var boxMeshInst = box.model.meshInstances[0];
120-
boxMeshInst.setInstancing(vertexBuffer);
121-
122124
// Set an update function on the app's update event
123125
var angle = 0;
124126
app.on("update", function (dt) {

examples/graphics/lights-baked.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
nearClip: 0.05
9999
});
100100
app.root.addChild(camera);
101-
camera.setLocalPosition(0, 0, 5);
101+
camera.setLocalPosition(0, 0, 8);
102102

103103
app.scene.lightmapMode = pc.BAKE_COLOR;
104104
app.scene.lightmapMaxResolution = 2048;

examples/graphics/shader-burn.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
</script>
3838

3939
<script id="fshader" type="x-shader/x-fragment">
40-
precision highp float;
40+
precision mediump float;
4141

4242
varying vec2 vUv0;
4343

examples/graphics/shader-toon.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
</script>
6464

6565
<script id="fshader" type="x-shader/x-fragment">
66-
precision highp float;
66+
precision mediump float;
6767
uniform sampler2D uTexture;
6868
varying float vertOutTexCoord;
6969
varying vec2 texCoord;

examples/graphics/shader-wobble.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
</script>
4141

4242
<script id="fshader" type="x-shader/x-fragment">
43-
precision highp float;
43+
precision mediump float;
4444

4545
uniform sampler2D uDiffuseMap;
4646

0 commit comments

Comments
 (0)