Skip to content

Commit 99d8e81

Browse files
committed
[RELEASE] v0.226.0
2 parents bc367a9 + 59430bd commit 99d8e81

File tree

125 files changed

+6300
-3043
lines changed

Some content is hidden

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

125 files changed

+6300
-3043
lines changed

.eslintrc.json

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
{
2+
"parserOptions": {
3+
"ecmaVersion": 5,
4+
"sourceType": "script",
5+
"ecmaFeatures": {}
6+
},
7+
// Rules reference: https://eslint.org/docs/rules/
8+
"rules": {
9+
// Possible Errors
10+
"for-direction": "error",
11+
"getter-return": "error",
12+
"no-await-in-loop": "off",
13+
"no-compare-neg-zero": "error",
14+
"no-cond-assign": "error",
15+
"no-console": "off",
16+
"no-constant-condition": "off",
17+
"no-control-regex": "off",
18+
"no-debugger": "error",
19+
"no-dupe-args": "error",
20+
"no-dupe-keys": "error",
21+
"no-duplicate-case": "error",
22+
"no-empty": [
23+
"error", {
24+
"allowEmptyCatch": true
25+
}
26+
],
27+
"no-empty-character-class": "off",
28+
"no-ex-assign": "error",
29+
"no-extra-semi": "error",
30+
"no-func-assign": "error",
31+
"no-invalid-regexp": "error",
32+
"no-irregular-whitespace": "error",
33+
"no-obj-calls": "error",
34+
"no-regex-spaces": "error",
35+
"no-sparse-arrays": "error",
36+
"no-unexpected-multiline": "error",
37+
"no-unreachable": "error",
38+
"no-unsafe-finally": "error",
39+
"no-unsafe-negation": "off",
40+
"use-isnan": "error",
41+
"valid-jsdoc": [
42+
"error", {
43+
"prefer": {
44+
"return": "returns"
45+
},
46+
"preferType": {
47+
"boolean": "Boolean",
48+
"function": "Function",
49+
"number": "Number",
50+
"object": "Object",
51+
"string": "String"
52+
},
53+
"requireReturn": false
54+
}
55+
],
56+
"valid-typeof": "error",
57+
58+
// Best Practices
59+
"accessor-pairs": "error",
60+
"no-floating-decimal": "error",
61+
"no-labels": "error",
62+
"no-lone-blocks": "error",
63+
"no-octal": "error",
64+
"no-redeclare": "error",
65+
"no-unmodified-loop-condition": "error",
66+
"no-useless-concat": "error",
67+
"no-useless-return": "error",
68+
69+
// Variables
70+
"no-undef-init": "error",
71+
72+
// Stylistic Issues
73+
"brace-style": "error",
74+
"comma-dangle": [
75+
"error", "never"
76+
],
77+
"comma-style": ["error", "last"],
78+
"func-call-spacing": ["error", "never"],
79+
"indent": [
80+
"error", 4, {
81+
"SwitchCase": 1,
82+
"CallExpression": {
83+
"arguments": "first"
84+
},
85+
"ignoreComments": true
86+
}
87+
],
88+
"key-spacing": [
89+
"error", {
90+
"beforeColon": false,
91+
"afterColon": true
92+
}
93+
],
94+
"keyword-spacing": "error",
95+
"no-tabs": "error",
96+
"no-trailing-spaces": "error",
97+
"no-whitespace-before-property": "error",
98+
"operator-linebreak": ["error", "after"],
99+
"semi-spacing": [ "error", { "before": false, "after": true } ],
100+
"semi-style": ["error", "last"],
101+
"space-infix-ops": [
102+
"off", {
103+
"int32Hint": false
104+
}
105+
],
106+
"space-unary-ops": [
107+
"off", {
108+
"words": true,
109+
"nonwords": false,
110+
"overrides": {
111+
}
112+
}]
113+
},
114+
"env": {
115+
"browser": true,
116+
"node": true
117+
}
118+
}

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fixes #
2+
3+
I confirm I have signed the [Contributor License Agreement](https://docs.google.com/a/playcanvas.com/forms/d/1Ih69zQfJG-QDLIEpHr6CsaAs6fPORNOVnMv5nuo0cjk/viewform).

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2011-2017 PlayCanvas Ltd.
1+
Copyright (c) 2011-2018 PlayCanvas Ltd.
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.225.2
1+
0.226.0

build/dependencies.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
../src/core/color.js
66
../src/core/guid.js
77
../src/core/time.js
8+
../src/core/hash.js
89
../src/core/uri.js
910
../src/core/log.js
1011
../src/core/inheritance.js
@@ -53,11 +54,8 @@
5354
../src/graphics/program-lib/chunks/generated-shader-chunks.js
5455
../src/graphics/program-lib/program-lib.js
5556
../src/graphics/program-lib/basic.js
56-
../src/graphics/program-lib/depth.js
57-
../src/graphics/program-lib/depth-rgba.js
5857
../src/graphics/program-lib/particle.js
5958
../src/graphics/program-lib/standard.js
60-
../src/graphics/program-lib/pick.js
6159
../src/graphics/program-lib/skybox.js
6260
../src/graphics/post-effect.js
6361
../src/scene/scene.js
@@ -78,6 +76,8 @@
7876
../src/scene/pick.js
7977
../src/scene/procedural.js
8078
../src/scene/default-material.js
79+
../src/scene/layer.js
80+
../src/scene/layer-composition.js
8181
../src/scene/sprite.js
8282
../src/scene/texture-atlas.js
8383
../src/scene/stencil-parameters.js
@@ -119,6 +119,7 @@
119119
../src/framework/components/camera/system.js
120120
../src/framework/components/camera/data.js
121121
../src/framework/components/camera/post-effect-queue.js
122+
../src/framework/components/camera/post-effect-pass.js
122123
../src/framework/components/light/component.js
123124
../src/framework/components/light/system.js
124125
../src/framework/components/light/data.js

examples/layers/index.html

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<script src="../../build/output/playcanvas-latest.js"></script>
5+
<link href="../style.css" rel="stylesheet" />
6+
</head>
7+
8+
<body>
9+
<!-- The canvas element -->
10+
<canvas id="application-canvas"></canvas>
11+
12+
<!-- The script -->
13+
<script>
14+
var canvas = document.getElementById("application-canvas");
15+
16+
// Create the app and start the update loop
17+
var app = new pc.Application(canvas);
18+
app.start();
19+
20+
// Set the canvas to fill the window and automatically change resolution to be the same as the canvas size
21+
app.setCanvasFillMode(pc.FILLMODE_FILL_WINDOW);
22+
app.setCanvasResolution(pc.RESOLUTION_AUTO);
23+
24+
app.scene.ambientLight = new pc.Color(0.2, 0.2, 0.2);
25+
26+
var entity, light, camera;
27+
28+
// Create a new layer to put in front of everything
29+
var layer = new pc.Layer({
30+
name: "Front Layer"
31+
});
32+
33+
// get the world layer index
34+
var worldLayer = app.scene.layers.getLayerByName("World");
35+
var idx = app.scene.layers.getTransparentIndex(worldLayer);
36+
37+
// insert the new layer after the world layer
38+
app.scene.layers.insert(layer, idx+1);
39+
40+
// Create an Entity with a camera component
41+
// Make sure it renders both World and Front Layer
42+
var camera = new pc.Entity();
43+
camera.addComponent("camera", {
44+
clearColor: new pc.Color(0.4, 0.45, 0.5),
45+
layers: [worldLayer.id, layer.id]
46+
});
47+
camera.translate(0, 0, 24);
48+
app.root.addChild(camera);
49+
50+
// Create an Entity with a point light component
51+
// Make sure it lights both World and Front Layer
52+
var light = new pc.Entity();
53+
light.addComponent("light", {
54+
type: "point",
55+
color: new pc.Color(1, 1, 1),
56+
range: 100,
57+
layers: [worldLayer.id, layer.id]
58+
});
59+
light.translate(5, 0, 15);
60+
app.root.addChild(light);
61+
62+
// red material is semi-transparent
63+
var red = new pc.StandardMaterial();
64+
red.diffuse.set(1,0,0);
65+
red.blendType = pc.BLEND_NORMAL;
66+
red.opacity = 0.5;
67+
red.update();
68+
69+
// blue material does not test the existing depth buffer
70+
var blue = new pc.StandardMaterial();
71+
blue.diffuse.set(0,0,1);
72+
blue.depthTest = false;
73+
blue.update();
74+
75+
// red box is rendered first in World layer
76+
var redBox = new pc.Entity();
77+
redBox.addComponent('model', {
78+
type: 'box'
79+
});
80+
redBox.model.material = red;
81+
redBox.setLocalScale(5,5,5);
82+
app.root.addChild(redBox);
83+
84+
// blue box is rendered in the Front Layer which is after World
85+
// because it does not test for depth
86+
// and is in a later layer
87+
// it is visible even though it should be inside the red box
88+
var blueBox = new pc.Entity();
89+
blueBox.addComponent('model', {
90+
type: 'box',
91+
layers: [layer.id] // try removing this line, the blue box will appear inside the red one
92+
});
93+
blueBox.model.material = blue;
94+
blueBox.setLocalScale(2.5,2.5,2.5);
95+
app.root.addChild(blueBox);
96+
97+
app.on("update", function (dt) {
98+
if (redBox) {
99+
redBox.rotate(0,10*dt,0);
100+
}
101+
if (blueBox) {
102+
blueBox.rotate(0,-10*dt,0);
103+
}
104+
105+
blueBox.model.meshInstances[0].layer = 10;
106+
});
107+
</script>
108+
</body>
109+
</html>

package.json

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -23,77 +23,6 @@
2323
"optionalDependencies": {
2424
"jsdom": "^11.5.1"
2525
},
26-
"eslintConfig": {
27-
"parserOptions": {
28-
"ecmaVersion": 5,
29-
"sourceType": "script",
30-
"ecmaFeatures": {}
31-
},
32-
"rules": {
33-
"accessor-pairs": "error",
34-
"comma-dangle": [
35-
"error", "never"
36-
],
37-
"for-direction": "error",
38-
"getter-return": "error",
39-
"no-compare-neg-zero": "error",
40-
"no-cond-assign": "error",
41-
"no-debugger": "error",
42-
"no-dupe-args": "error",
43-
"no-dupe-keys": "error",
44-
"no-duplicate-case": "error",
45-
"no-empty": [
46-
"error", {
47-
"allowEmptyCatch": true
48-
}
49-
],
50-
"no-ex-assign": "error",
51-
"no-extra-boolean-cast": "error",
52-
"no-extra-semi": "error",
53-
"no-floating-decimal": "error",
54-
"no-func-assign": "error",
55-
"no-irregular-whitespace": "error",
56-
"no-invalid-regexp": "error",
57-
"no-labels": "error",
58-
"no-lone-blocks": "error",
59-
"no-obj-calls": "error",
60-
"no-octal": "error",
61-
"no-redeclare": "error",
62-
"no-regex-spaces": "error",
63-
"no-sparse-arrays": "error",
64-
"no-tabs": "error",
65-
"no-trailing-spaces": "error",
66-
"no-unexpected-multiline": "error",
67-
"no-unmodified-loop-condition": "error",
68-
"no-undef-init": "error",
69-
"no-unsafe-negation": "error",
70-
"no-unreachable": "error",
71-
"no-unsafe-finally": "error",
72-
"no-useless-return": "error",
73-
"no-useless-concat": "error",
74-
"use-isnan": "error",
75-
"valid-jsdoc": [
76-
"error", {
77-
"prefer": {
78-
"return": "returns"
79-
},
80-
"preferType": {
81-
"boolean": "Boolean",
82-
"function": "Function",
83-
"number": "Number",
84-
"object": "Object",
85-
"string": "String"
86-
},
87-
"requireReturn": false
88-
}
89-
],
90-
"valid-typeof": "error"
91-
},
92-
"env": {
93-
"browser": true,
94-
"node": true
95-
}
96-
},
9726
"devDependencies": {
9827
"eslint": "^4.19.0",
9928
"fs-extra": "^3.0.1",

src/asset/asset-registry.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ pc.extend(pc, function () {
510510
done(null, materials);
511511
};
512512

513-
for(i = 0; i < mapping.mapping.length; i++) {
513+
for (i = 0; i < mapping.mapping.length; i++) {
514514
var path = mapping.mapping[i].path;
515515
if (path) {
516516
self.loadFromUrl(pc.path.join(dir, path), "material", onLoadAsset);
@@ -650,7 +650,7 @@ pc.extend(pc, function () {
650650
*/
651651
filter: function (callback) {
652652
var items = [ ];
653-
for(var i = 0, len = this._assets.length; i < len; i++) {
653+
for (var i = 0, len = this._assets.length; i < len; i++) {
654654
if (callback(this._assets[i]))
655655
items.push(this._assets[i]);
656656
}

src/asset/asset-variants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pc.extend(pc, function () {
4646
defineVariantProperty('etc1');
4747

4848
AssetVariants.prototype.clear = function() {
49-
for(var i = 0; i < properties.length; i++)
49+
for (var i = 0; i < properties.length; i++)
5050
this[properties[i]] = null;
5151
};
5252

src/asset/asset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ pc.extend(pc, function () {
269269
this.variants.clear();
270270

271271
if (value.variants) {
272-
for(key in value.variants) {
272+
for (key in value.variants) {
273273
if (! value.variants[key])
274274
continue;
275275

0 commit comments

Comments
 (0)