删除了analysis相关的

main
LiRen-qiu 4 months ago
parent e55ab7d5ca
commit d039521926

102
node_modules/.package-lock.json generated vendored

@ -91,6 +91,61 @@
"regenerator-runtime": "^0.11.0"
}
},
"node_modules/chart.js": {
"version": "2.9.4",
"resolved": "https://registry.npmmirror.com/chart.js/-/chart.js-2.9.4.tgz",
"integrity": "sha512-B07aAzxcrikjAPyV+01j7BmOpxtQETxTSlQ26BEYJ+3iUkbNKaOJ/nDbT6JjyqYxseM0ON12COHYdU2cTIjC7A==",
"license": "MIT",
"dependencies": {
"chartjs-color": "^2.1.0",
"moment": "^2.10.2"
}
},
"node_modules/chartjs-color": {
"version": "2.4.1",
"resolved": "https://registry.npmmirror.com/chartjs-color/-/chartjs-color-2.4.1.tgz",
"integrity": "sha512-haqOg1+Yebys/Ts/9bLo/BqUcONQOdr/hoEr2LLTRl6C5LXctUdHxsCYfvQVg5JIxITrfCNUDr4ntqmQk9+/0w==",
"license": "MIT",
"dependencies": {
"chartjs-color-string": "^0.6.0",
"color-convert": "^1.9.3"
}
},
"node_modules/chartjs-color-string": {
"version": "0.6.0",
"resolved": "https://registry.npmmirror.com/chartjs-color-string/-/chartjs-color-string-0.6.0.tgz",
"integrity": "sha512-TIB5OKn1hPJvO7JcteW4WY/63v6KwEdt6udfnDE9iCAZgy+V4SrbSxoIbTw/xkUIapjEI4ExGtD0+6D3KyFd7A==",
"license": "MIT",
"dependencies": {
"color-name": "^1.0.0"
}
},
"node_modules/claygl": {
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/claygl/-/claygl-1.3.0.tgz",
"integrity": "sha512-+gGtJjT6SSHD2l2yC3MCubW/sCV40tZuSs5opdtn79vFSGUgp/lH139RNEQ6Jy078/L0aV8odCw8RSrUcMfLaQ=="
},
"node_modules/color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"license": "MIT",
"dependencies": {
"color-name": "1.1.3"
}
},
"node_modules/color-convert/node_modules/color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
"license": "MIT"
},
"node_modules/color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"license": "MIT"
},
"node_modules/core-js": {
"version": "2.6.12",
"resolved": "https://registry.npmmirror.com/core-js/-/core-js-2.6.12.tgz",
@ -115,6 +170,29 @@
"node": ">=0.10.0"
}
},
"node_modules/echarts": {
"version": "5.6.0",
"resolved": "https://registry.npmmirror.com/echarts/-/echarts-5.6.0.tgz",
"integrity": "sha512-oTbVTsXfKuEhxftHqL5xprgLoc0k7uScAwtryCgWF6hPYFLRwOUHiFmHGCBKP5NPFNkDVopOieyUqYGH8Fa3kA==",
"license": "Apache-2.0",
"peer": true,
"dependencies": {
"tslib": "2.3.0",
"zrender": "5.6.1"
}
},
"node_modules/echarts-gl": {
"version": "2.0.9",
"resolved": "https://registry.npmmirror.com/echarts-gl/-/echarts-gl-2.0.9.tgz",
"integrity": "sha512-oKeMdkkkpJGWOzjgZUsF41DOh6cMsyrGGXimbjK2l6Xeq/dBQu4ShG2w2Dzrs/1bD27b2pLTGSaUzouY191gzA==",
"dependencies": {
"claygl": "^1.2.1",
"zrender": "^5.1.1"
},
"peerDependencies": {
"echarts": "^5.1.2"
}
},
"node_modules/element-ui": {
"version": "2.15.14",
"resolved": "https://registry.npmmirror.com/element-ui/-/element-ui-2.15.14.tgz",
@ -132,6 +210,15 @@
"vue": "^2.5.17"
}
},
"node_modules/moment": {
"version": "2.30.1",
"resolved": "https://registry.npmmirror.com/moment/-/moment-2.30.1.tgz",
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==",
"license": "MIT",
"engines": {
"node": "*"
}
},
"node_modules/nanoid": {
"version": "3.3.11",
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.11.tgz",
@ -251,6 +338,12 @@
"node": ">=4"
}
},
"node_modules/tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==",
"license": "0BSD"
},
"node_modules/vue": {
"version": "2.7.16",
"resolved": "https://registry.npmmirror.com/vue/-/vue-2.7.16.tgz",
@ -262,6 +355,15 @@
"@vue/compiler-sfc": "2.7.16",
"csstype": "^3.1.0"
}
},
"node_modules/zrender": {
"version": "5.6.1",
"resolved": "https://registry.npmmirror.com/zrender/-/zrender-5.6.1.tgz",
"integrity": "sha512-OFXkDJKcrlx5su2XbzJvj/34Q3m6PvyCZkVPHGYpcCJ52ek4U/ymZyfuV1nKE23AyBJ51E/6Yr0mhZ7xGTO4ag==",
"license": "BSD-3-Clause",
"dependencies": {
"tslib": "2.3.0"
}
}
}
}

9
node_modules/chart.js/LICENSE.md generated vendored

@ -0,0 +1,9 @@
The MIT License (MIT)
Copyright (c) 2018 Chart.js Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

32
node_modules/chart.js/README.md generated vendored

@ -0,0 +1,32 @@
<p align="center">
<img src="https://www.chartjs.org/media/logo-title.svg"><br/>
Simple yet flexible JavaScript charting for designers & developers
</p>
<p align="center">
<a href="https://www.chartjs.org/docs/latest/getting-started/installation.html"><img src="https://img.shields.io/github/release/chartjs/Chart.js.svg?style=flat-square&maxAge=600" alt="Downloads"></a>
<a href="https://travis-ci.org/chartjs/Chart.js"><img src="https://img.shields.io/travis/chartjs/Chart.js.svg?style=flat-square&maxAge=600" alt="Builds"></a>
<a href="https://coveralls.io/github/chartjs/Chart.js?branch=master"><img src="https://img.shields.io/coveralls/chartjs/Chart.js.svg?style=flat-square&maxAge=600" alt="Coverage"></a>
<a href="https://github.com/chartjs/awesome"><img src="https://awesome.re/badge-flat2.svg" alt="Awesome"></a>
<a href="https://chartjs-slack.herokuapp.com/"><img src="https://img.shields.io/badge/slack-chartjs-blue.svg?style=flat-square&maxAge=3600" alt="Slack"></a>
</p>
## Documentation
- [Introduction](https://www.chartjs.org/docs/latest/)
- [Getting Started](https://www.chartjs.org/docs/latest/getting-started/)
- [General](https://www.chartjs.org/docs/latest/general/)
- [Configuration](https://www.chartjs.org/docs/latest/configuration/)
- [Charts](https://www.chartjs.org/docs/latest/charts/)
- [Axes](https://www.chartjs.org/docs/latest/axes/)
- [Developers](https://www.chartjs.org/docs/latest/developers/)
- [Popular Extensions](https://github.com/chartjs/awesome)
- [Samples](https://www.chartjs.org/samples/)
## Contributing
Instructions on building and testing Chart.js can be found in [the documentation](https://github.com/chartjs/Chart.js/blob/master/docs/developers/contributing.md#building-and-testing). Before submitting an issue or a pull request, please take a moment to look over the [contributing guidelines](https://github.com/chartjs/Chart.js/blob/master/docs/developers/contributing.md) first. For support, please post questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/chartjs) with the `chartjs` tag.
## License
Chart.js is available under the [MIT license](https://opensource.org/licenses/MIT).

16
node_modules/chart.js/bower.json generated vendored

@ -0,0 +1,16 @@
{
"name": "chart.js",
"description": "Simple HTML5 charts using the canvas element.",
"homepage": "https://www.chartjs.org",
"license": "MIT",
"version": "2.9.4",
"main": "./dist/Chart.js",
"ignore": [
".github",
".codeclimate.yml",
".gitignore",
".npmignore",
".travis.yml",
"scripts"
]
}

@ -0,0 +1,26 @@
{
"name": "nnnick/chartjs",
"type": "library",
"description": "Simple HTML5 charts using the canvas element.",
"keywords": [
"chart",
"js"
],
"homepage": "https://www.chartjs.org/",
"license": "MIT",
"authors": [
{
"name": "NICK DOWNIE",
"email": "hello@nickdownie.com"
}
],
"require": {
"php": ">=5.3.3"
},
"minimum-stability": "stable",
"extra": {
"branch-alias": {
"release/2.0": "v2.0-dev"
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -0,0 +1,47 @@
/*
* DOM element rendering detection
* https://davidwalsh.name/detect-node-insertion
*/
@keyframes chartjs-render-animation {
from { opacity: 0.99; }
to { opacity: 1; }
}
.chartjs-render-monitor {
animation: chartjs-render-animation 0.001s;
}
/*
* DOM element resizing detection
* https://github.com/marcj/css-element-queries
*/
.chartjs-size-monitor,
.chartjs-size-monitor-expand,
.chartjs-size-monitor-shrink {
position: absolute;
direction: ltr;
left: 0;
top: 0;
right: 0;
bottom: 0;
overflow: hidden;
pointer-events: none;
visibility: hidden;
z-index: -1;
}
.chartjs-size-monitor-expand > div {
position: absolute;
width: 1000000px;
height: 1000000px;
left: 0;
top: 0;
}
.chartjs-size-monitor-shrink > div {
position: absolute;
width: 200%;
height: 200%;
left: 0;
top: 0;
}

16172
node_modules/chart.js/dist/Chart.js generated vendored

File diff suppressed because it is too large Load Diff

@ -0,0 +1 @@
@keyframes chartjs-render-animation{from{opacity:.99}to{opacity:1}}.chartjs-render-monitor{animation:chartjs-render-animation 1ms}.chartjs-size-monitor,.chartjs-size-monitor-expand,.chartjs-size-monitor-shrink{position:absolute;direction:ltr;left:0;top:0;right:0;bottom:0;overflow:hidden;pointer-events:none;visibility:hidden;z-index:-1}.chartjs-size-monitor-expand>div{position:absolute;width:1000000px;height:1000000px;left:0;top:0}.chartjs-size-monitor-shrink>div{position:absolute;width:200%;height:200%;left:0;top:0}

File diff suppressed because one or more lines are too long

@ -0,0 +1,69 @@
{
"name": "chart.js",
"homepage": "https://www.chartjs.org",
"description": "Simple HTML5 charts using the canvas element.",
"version": "2.9.4",
"license": "MIT",
"jsdelivr": "dist/Chart.min.js",
"unpkg": "dist/Chart.min.js",
"main": "dist/Chart.js",
"keywords": [
"canvas",
"charts",
"data",
"graphs",
"html5",
"responsive"
],
"repository": {
"type": "git",
"url": "https://github.com/chartjs/Chart.js.git"
},
"bugs": {
"url": "https://github.com/chartjs/Chart.js/issues"
},
"files": [
"bower.json",
"composer.json",
"dist/*.css",
"dist/*.js"
],
"devDependencies": {
"clean-css": "^4.2.1",
"coveralls": "^3.0.0",
"eslint": "^5.9.0",
"eslint-config-chartjs": "^0.1.0",
"eslint-plugin-html": "^5.0.0",
"gitbook-cli": "^2.3.2",
"gulp": "^4.0.0",
"gulp-eslint": "^5.0.0",
"gulp-file": "^0.4.0",
"gulp-htmllint": "^0.0.16",
"gulp-replace": "^1.0.0",
"gulp-size": "^3.0.0",
"gulp-streamify": "^1.0.2",
"gulp-terser": "^1.1.6",
"gulp-zip": "^4.2.0",
"jasmine": "^3.3.0",
"jasmine-core": "^3.3.0",
"karma": "^4.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.0.1",
"karma-jasmine": "^2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"karma-rollup-preprocessor": "^7.0.0",
"merge-stream": "^1.0.1",
"pixelmatch": "^4.0.2",
"rollup": "^1.0.0",
"rollup-plugin-commonjs": "^10.0.0",
"rollup-plugin-istanbul": "^2.0.1",
"rollup-plugin-node-resolve": "^5.0.0",
"rollup-plugin-terser": "^5.0.0",
"yargs": "^12.0.5"
},
"dependencies": {
"chartjs-color": "^2.1.0",
"moment": "^2.10.2"
}
}

@ -0,0 +1,12 @@
sudo: false
language: node_js
node_js:
- "node"
deploy:
- provider: npm
email: $NPM_AUTH_EMAIL
api_key: $NPM_AUTH_TOKEN
skip_cleanup: true
on:
tags: true

@ -0,0 +1,11 @@
# 0.3.0
- Fixed: HSL alpha channel ([#16](https://github.com/harthur/color-string/pull/16))
- Fixed: ability to parse signed number ([#15](https://github.com/harthur/color-string/pull/15))
- Removed: component.json
- Removed: browser build
- Added: license field to package.json ([#17](https://github.com/harthur/color-string/pull/17))
---
Check out commit logs for earlier releases

@ -0,0 +1,21 @@
Copyright (c) 2011 Heather Arthur <fayearthur@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -0,0 +1,46 @@
# chartjs-color-string
[![npm](https://img.shields.io/npm/v/chartjs-color-string.svg?style=flat-square&maxAge=600)](https://npmjs.com/package/chartjs-color-string) [![Travis](https://img.shields.io/travis/chartjs/chartjs-color-string.svg?style=flat-square&maxAge=600)](https://travis-ci.org/chartjs/chartjs-color-string)
> library for parsing and generating CSS color strings.
## Install
With [npm](http://npmjs.org/):
```console
$ npm install color-string
```
## Usage
### Parsing
```js
colorString.getRgb("blue") // [0, 0, 255]
colorString.getRgb("#FFF") // [255, 255, 255]
colorString.getRgba("#FFFA") //[255, 255, 255, 0.67]}
colorString.getRgba("#FFFFFFAA") // [255, 255, 255, 0.67]}
colorString.getRgba("rgba(200, 60, 60, 0.3)") // [200, 60, 60, 0.3]
colorString.getRgba("rgb(200, 200, 200)") // [200, 200, 200, 1]
colorString.getHsl("hsl(360, 100%, 50%)") // [360, 100, 50]
colorString.getHsla("hsla(360, 60%, 50%, 0.4)") // [360, 60, 50, 0.4]
colorString.getAlpha("rgba(200, 0, 12, 0.6)") // 0.6
```
### Generation
```js
colorString.hexString([255, 255, 255]) // "#FFFFFF"
colorString.hexString([0, 0, 255, 0.4]) // "#0000FF66"
colorString.hexString([0, 0, 255], 0.4) // "#0000FF66"
colorString.rgbString([255, 255, 255]) // "rgb(255, 255, 255)"
colorString.rgbString([0, 0, 255, 0.4]) // "rgba(0, 0, 255, 0.4)"
colorString.rgbString([0, 0, 255], 0.4) // "rgba(0, 0, 255, 0.4)"
colorString.percentString([0, 0, 255]) // "rgb(0%, 0%, 100%)"
colorString.keyword([255, 255, 0]) // "yellow"
colorString.hslString([360, 100, 100]) // "hsl(360, 100%, 100%)"
```

@ -0,0 +1,237 @@
/* MIT license */
var colorNames = require('color-name');
module.exports = {
getRgba: getRgba,
getHsla: getHsla,
getRgb: getRgb,
getHsl: getHsl,
getHwb: getHwb,
getAlpha: getAlpha,
hexString: hexString,
rgbString: rgbString,
rgbaString: rgbaString,
percentString: percentString,
percentaString: percentaString,
hslString: hslString,
hslaString: hslaString,
hwbString: hwbString,
keyword: keyword
}
function getRgba(string) {
if (!string) {
return;
}
var abbr = /^#([a-fA-F0-9]{3,4})$/i,
hex = /^#([a-fA-F0-9]{6}([a-fA-F0-9]{2})?)$/i,
rgba = /^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i,
per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i,
keyword = /(\w+)/;
var rgb = [0, 0, 0],
a = 1,
match = string.match(abbr),
hexAlpha = "";
if (match) {
match = match[1];
hexAlpha = match[3];
for (var i = 0; i < rgb.length; i++) {
rgb[i] = parseInt(match[i] + match[i], 16);
}
if (hexAlpha) {
a = Math.round((parseInt(hexAlpha + hexAlpha, 16) / 255) * 100) / 100;
}
}
else if (match = string.match(hex)) {
hexAlpha = match[2];
match = match[1];
for (var i = 0; i < rgb.length; i++) {
rgb[i] = parseInt(match.slice(i * 2, i * 2 + 2), 16);
}
if (hexAlpha) {
a = Math.round((parseInt(hexAlpha, 16) / 255) * 100) / 100;
}
}
else if (match = string.match(rgba)) {
for (var i = 0; i < rgb.length; i++) {
rgb[i] = parseInt(match[i + 1]);
}
a = parseFloat(match[4]);
}
else if (match = string.match(per)) {
for (var i = 0; i < rgb.length; i++) {
rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
}
a = parseFloat(match[4]);
}
else if (match = string.match(keyword)) {
if (match[1] == "transparent") {
return [0, 0, 0, 0];
}
rgb = colorNames[match[1]];
if (!rgb) {
return;
}
}
for (var i = 0; i < rgb.length; i++) {
rgb[i] = scale(rgb[i], 0, 255);
}
if (!a && a != 0) {
a = 1;
}
else {
a = scale(a, 0, 1);
}
rgb[3] = a;
return rgb;
}
function getHsla(string) {
if (!string) {
return;
}
var hsl = /^hsla?\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/;
var match = string.match(hsl);
if (match) {
var alpha = parseFloat(match[4]);
var h = scale(parseInt(match[1]), 0, 360),
s = scale(parseFloat(match[2]), 0, 100),
l = scale(parseFloat(match[3]), 0, 100),
a = scale(isNaN(alpha) ? 1 : alpha, 0, 1);
return [h, s, l, a];
}
}
function getHwb(string) {
if (!string) {
return;
}
var hwb = /^hwb\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/;
var match = string.match(hwb);
if (match) {
var alpha = parseFloat(match[4]);
var h = scale(parseInt(match[1]), 0, 360),
w = scale(parseFloat(match[2]), 0, 100),
b = scale(parseFloat(match[3]), 0, 100),
a = scale(isNaN(alpha) ? 1 : alpha, 0, 1);
return [h, w, b, a];
}
}
function getRgb(string) {
var rgba = getRgba(string);
return rgba && rgba.slice(0, 3);
}
function getHsl(string) {
var hsla = getHsla(string);
return hsla && hsla.slice(0, 3);
}
function getAlpha(string) {
var vals = getRgba(string);
if (vals) {
return vals[3];
}
else if (vals = getHsla(string)) {
return vals[3];
}
else if (vals = getHwb(string)) {
return vals[3];
}
}
// generators
function hexString(rgba, a) {
var a = (a !== undefined && rgba.length === 3) ? a : rgba[3];
return "#" + hexDouble(rgba[0])
+ hexDouble(rgba[1])
+ hexDouble(rgba[2])
+ (
(a >= 0 && a < 1)
? hexDouble(Math.round(a * 255))
: ""
);
}
function rgbString(rgba, alpha) {
if (alpha < 1 || (rgba[3] && rgba[3] < 1)) {
return rgbaString(rgba, alpha);
}
return "rgb(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2] + ")";
}
function rgbaString(rgba, alpha) {
if (alpha === undefined) {
alpha = (rgba[3] !== undefined ? rgba[3] : 1);
}
return "rgba(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2]
+ ", " + alpha + ")";
}
function percentString(rgba, alpha) {
if (alpha < 1 || (rgba[3] && rgba[3] < 1)) {
return percentaString(rgba, alpha);
}
var r = Math.round(rgba[0]/255 * 100),
g = Math.round(rgba[1]/255 * 100),
b = Math.round(rgba[2]/255 * 100);
return "rgb(" + r + "%, " + g + "%, " + b + "%)";
}
function percentaString(rgba, alpha) {
var r = Math.round(rgba[0]/255 * 100),
g = Math.round(rgba[1]/255 * 100),
b = Math.round(rgba[2]/255 * 100);
return "rgba(" + r + "%, " + g + "%, " + b + "%, " + (alpha || rgba[3] || 1) + ")";
}
function hslString(hsla, alpha) {
if (alpha < 1 || (hsla[3] && hsla[3] < 1)) {
return hslaString(hsla, alpha);
}
return "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)";
}
function hslaString(hsla, alpha) {
if (alpha === undefined) {
alpha = (hsla[3] !== undefined ? hsla[3] : 1);
}
return "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, "
+ alpha + ")";
}
// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
// (hwb have alpha optional & 1 is default value)
function hwbString(hwb, alpha) {
if (alpha === undefined) {
alpha = (hwb[3] !== undefined ? hwb[3] : 1);
}
return "hwb(" + hwb[0] + ", " + hwb[1] + "%, " + hwb[2] + "%"
+ (alpha !== undefined && alpha !== 1 ? ", " + alpha : "") + ")";
}
function keyword(rgb) {
return reverseNames[rgb.slice(0, 3)];
}
// helpers
function scale(num, min, max) {
return Math.min(Math.max(min, num), max);
}
function hexDouble(num) {
var str = num.toString(16).toUpperCase();
return (str.length < 2) ? "0" + str : str;
}
//create a list of reverse color names
var reverseNames = {};
for (var name in colorNames) {
reverseNames[colorNames[name]] = name;
}

@ -0,0 +1,24 @@
{
"name": "chartjs-color-string",
"description": "Parser and generator for CSS color strings",
"version": "0.6.0",
"author": "Heather Arthur <fayearthur@gmail.com>",
"repository": {
"type": "git",
"url": "https://github.com/chartjs/chartjs-color-string.git"
},
"scripts": {
"test": "node test/basic.js"
},
"license": "MIT",
"main": "./color-string",
"dependencies": {
"color-name": "^1.0.0"
},
"keywords": [
"color",
"colour",
"rgb",
"css"
]
}

@ -0,0 +1,110 @@
var string = require("../color-string");
var assert = require("assert");
assert.deepEqual(string.getRgba("#fef"), [255, 238, 255, 1]);
assert.deepEqual(string.getRgba("#fffFEF"), [255, 255, 239, 1]);
assert.deepEqual(string.getRgba("rgb(244, 233, 100)"), [244, 233, 100, 1]);
assert.deepEqual(string.getRgba("rgb(100%, 30%, 90%)"), [255, 77, 229, 1]);
assert.deepEqual(string.getRgba("transparent"), [0, 0, 0, 0]);
assert.deepEqual(string.getHsla("hsl(240, 100%, 50.5%)"), [240, 100, 50.5, 1]);
assert.deepEqual(string.getHsla("hsl(240deg, 100%, 50.5%)"), [240, 100, 50.5, 1]);
assert.deepEqual(string.getHwb("hwb(240, 100%, 50.5%)"), [240, 100, 50.5, 1]);
assert.deepEqual(string.getHwb("hwb(240deg, 100%, 50.5%)"), [240, 100, 50.5, 1]);
// with sign
assert.deepEqual(string.getRgba("rgb(-244, +233, -100)"), [0, 233, 0, 1]);
assert.deepEqual(string.getHsla("hsl(+240, 100%, 50.5%)"), [240, 100, 50.5, 1]);
assert.deepEqual(string.getRgba("rgba(200, +20, -233, -0.0)"), [200, 20, 0, 0]);
assert.deepEqual(string.getRgba("rgba(200, +20, -233, -0.0)"), [200, 20, 0, 0]);
assert.deepEqual(string.getHsla("hsla(+200, 100%, 50%, -0.2)"), [200, 100, 50, 0]);
assert.deepEqual(string.getHwb("hwb(+240, 100%, 50.5%)"), [240, 100, 50.5, 1]);
assert.deepEqual(string.getHwb("hwb(-240deg, 100%, 50.5%)"), [0, 100, 50.5, 1]);
assert.deepEqual(string.getHwb("hwb(-240deg, 100%, 50.5%, +0.6)"), [0, 100, 50.5, 0.6]);
//subsequent return values should not change array
assert.deepEqual(string.getRgba("blue"), [0, 0, 255, 1]);
assert.deepEqual(string.getRgba("blue"), [0, 0, 255, 1]);
assert.equal(string.getAlpha("rgb(244, 233, 100)"), 1);
assert.equal(string.getAlpha("rgba(244, 233, 100, 0.5)"), 0.5);
assert.equal(string.getAlpha("hsla(244, 100%, 100%, 0.6)"), 0.6);
assert.equal(string.getAlpha("hwb(244, 100%, 100%, 0.6)"), 0.6);
assert.equal(string.getAlpha("hwb(244, 100%, 100%)"), 1);
// alpha
assert.deepEqual(string.getRgba("#feff"), [255, 238, 255, 1]);
assert.deepEqual(string.getRgba("#fef0"), [255, 238, 255, 0]);
assert.deepEqual(string.getRgba("#fefa"), [255, 238, 255, 0.67]);
assert.deepEqual(string.getRgba("#c814e933"), [200, 20, 233, 0.2]);
assert.deepEqual(string.getRgba("#c814e900"), [200, 20, 233, 0]);
assert.deepEqual(string.getRgba("#c814e9ff"), [200, 20, 233, 1]);
assert.deepEqual(string.getRgba("rgba(200, 20, 233, 0.2)"), [200, 20, 233, 0.2]);
assert.deepEqual(string.getRgba("rgba(200, 20, 233, 0)"), [200, 20, 233, 0]);
assert.deepEqual(string.getRgba("rgba(100%, 30%, 90%, 0.2)"), [255, 77, 229, 0.2]);
assert.deepEqual(string.getHsla("hsla(200, 20%, 33%, 0.2)"), [200, 20, 33, 0.2]);
assert.deepEqual(string.getHwb("hwb(200, 20%, 33%, 0.2)"), [200, 20, 33, 0.2]);
// no alpha
assert.deepEqual(string.getRgb("#fef"), [255, 238, 255]);
assert.deepEqual(string.getRgb("rgba(200, 20, 233, 0.2)"), [200, 20, 233]);
assert.deepEqual(string.getHsl("hsl(240, 100%, 50.5%)"), [240, 100, 50.5]);
assert.deepEqual(string.getRgba("rgba(0,0,0,0)"), [0, 0, 0, 0]);
assert.deepEqual(string.getHsla("hsla(0,0%,0%,0)"), [0, 0, 0, 0]);
assert.deepEqual(string.getHwb("hwb(400, 10%, 200%, 0)"), [360, 10, 100, 0]);
// range
assert.deepEqual(string.getRgba("rgba(300, 600, 100, 3)"), [255, 255, 100, 1]);
assert.deepEqual(string.getRgba("rgba(8000%, 100%, 333%, 88)"), [255, 255, 255, 1]);
assert.deepEqual(string.getHsla("hsla(400, 10%, 200%, 10)"), [360, 10, 100, 1]);
assert.deepEqual(string.getHwb("hwb(400, 10%, 200%, 10)"), [360, 10, 100, 1]);
// invalid
assert.strictEqual(string.getRgba("yellowblue"), undefined);
assert.strictEqual(string.getRgba("hsl(100, 10%, 10%)"), undefined);
assert.strictEqual(string.getRgba("hwb(100, 10%, 10%)"), undefined);
assert.strictEqual(string.getRgba("#1"), undefined);
assert.strictEqual(string.getRgba("#f"), undefined);
assert.strictEqual(string.getRgba("#4f"), undefined);
assert.strictEqual(string.getRgba("#45ab4"), undefined);
assert.strictEqual(string.getRgba("#45ab45e"), undefined);
// generators
assert.equal(string.hexString([255, 10, 35]), "#FF0A23");
assert.equal(string.hexString([255, 10, 35, 1]), "#FF0A23");
assert.equal(string.hexString([255, 10, 35], 1), "#FF0A23");
assert.equal(string.hexString([255, 10, 35, 0.3]), "#FF0A234D");
assert.equal(string.hexString([255, 10, 35], 0.3), "#FF0A234D");
assert.equal(string.hexString([255, 10, 35, 0]), "#FF0A2300");
assert.equal(string.hexString([255, 10, 35], 0), "#FF0A2300");
assert.equal(string.rgbString([255, 10, 35]), "rgb(255, 10, 35)");
assert.equal(string.rgbString([255, 10, 35, 0.3]), "rgba(255, 10, 35, 0.3)");
assert.equal(string.rgbString([255, 10, 35], 0.3), "rgba(255, 10, 35, 0.3)");
assert.equal(string.rgbaString([255, 10, 35, 0.3]), "rgba(255, 10, 35, 0.3)");
assert.equal(string.rgbaString([255, 10, 35], 0.3), "rgba(255, 10, 35, 0.3)");
assert.equal(string.rgbaString([255, 10, 35]), "rgba(255, 10, 35, 1)");
assert.equal(string.rgbaString([255, 10, 35, 0]), "rgba(255, 10, 35, 0)");
assert.equal(string.percentString([255, 10, 35]), "rgb(100%, 4%, 14%)");
assert.equal(string.percentString([255, 10, 35, 0.3]), "rgba(100%, 4%, 14%, 0.3)");
assert.equal(string.percentString([255, 10, 35], 0.3), "rgba(100%, 4%, 14%, 0.3)");
assert.equal(string.percentaString([255, 10, 35, 0.3]), "rgba(100%, 4%, 14%, 0.3)");
assert.equal(string.percentaString([255, 10, 35], 0.3), "rgba(100%, 4%, 14%, 0.3)");
assert.equal(string.percentaString([255, 10, 35]), "rgba(100%, 4%, 14%, 1)");
assert.equal(string.hslString([280, 40, 60]), "hsl(280, 40%, 60%)");
assert.equal(string.hslString([280, 40, 60, 0.3]), "hsla(280, 40%, 60%, 0.3)");
assert.equal(string.hslString([280, 40, 60], 0.3), "hsla(280, 40%, 60%, 0.3)");
assert.equal(string.hslaString([280, 40, 60, 0.3]), "hsla(280, 40%, 60%, 0.3)");
assert.equal(string.hslaString([280, 40, 60], 0.3), "hsla(280, 40%, 60%, 0.3)");
assert.equal(string.hslaString([280, 40, 60], 0), "hsla(280, 40%, 60%, 0)");
assert.equal(string.hslaString([280, 40, 60]), "hsla(280, 40%, 60%, 1)");
assert.equal(string.hwbString([280, 40, 60]), "hwb(280, 40%, 60%)");
assert.equal(string.hwbString([280, 40, 60, 0.3]), "hwb(280, 40%, 60%, 0.3)");
assert.equal(string.hwbString([280, 40, 60], 0.3), "hwb(280, 40%, 60%, 0.3)");
assert.equal(string.hwbString([280, 40, 60], 0), "hwb(280, 40%, 60%, 0)");
assert.equal(string.keyword([255, 255, 0]), "yellow");
assert.equal(string.keyword([100, 255, 0]), undefined);

@ -0,0 +1,35 @@
# 0.11.1 - 2016-01-03
- Fixed: three tests being ignored `if() -> it()`
- Changed: moved to XO standard
# 0.11.0 - 2016-01-02
- Fixed: Hue modulo when specifying values < 0 or > 360
([#76](https://github.com/MoOx/color/pull/76))
- Corrected some package.json information
# 0.10.1 - 2015-07-02
- Fixed: handling of 0% mix
([#65](https://github.com/harthur/color/pull/65))
# 0.10.0 - 2015-07-02
- Fixed: `mix()` works with a 0..1 range (instead of 0..100 since 0.9.0)
([#64](https://github.com/harthur/color/pull/64))
# 0.9.0 - 2015-06-21
- Fixed: `mix()` implementation is now the same as in Sass
([#60](https://github.com/harthur/color/pull/60))
# 0.8.0 - 2015-03-03
- Removed: bower support
- Removed: component(1) support
- Changed: Upgrade to color-string 0.3
---
Check out commit logs for older releases

@ -0,0 +1,21 @@
Copyright (c) 2012 Heather Arthur
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -0,0 +1,126 @@
# chartjs-color
[![npm](https://img.shields.io/npm/v/chartjs-color.svg?style=flat-square)](https://npmjs.com/package/chartjs-color) [![Travis](https://img.shields.io/travis/chartjs/chartjs-color.svg?style=flat-square)](https://travis-ci.org/chartjs/chartjs-color)
> JavaScript library for color conversion and manipulation with support for CSS color strings.
```js
var color = Color("#7743CE");
color.alpha(0.5).lighten(0.5);
console.log(color.hslString()); // "hsla(262, 59%, 81%, 0.5)"
```
## Install
```console
$ npm install color
```
## Usage
```js
var Color = require("color")
```
### Setters
```js
var color = Color("rgb(255, 255, 255)")
var color = Color({r: 255, g: 255, b: 255})
var color = Color().rgb(255, 255, 255)
var color = Color().rgb([255, 255, 255])
```
Pass any valid CSS color string into `Color()` or a hash of values. Also load in color values with `rgb()`, `hsl()`, `hsv()`, `hwb()`, and `cmyk()`.
```js
color.red(120)
```
Set the values for individual channels with `alpha`, `red`, `green`, `blue`, `hue`, `saturation` (hsl), `saturationv` (hsv), `lightness`, `whiteness`, `blackness`, `cyan`, `magenta`, `yellow`, `black`
### Getters
```js
color.rgb() // {r: 255, g: 255, b: 255}
```
Get a hash of the rgb values with `rgb()`, similarly for `hsl()`, `hsv()`, and `cmyk()`
```js
color.rgbArray() // [255, 255, 255]
```
Get an array of the values with `rgbArray()`, `hslArray()`, `hsvArray()`, and `cmykArray()`.
```js
color.red() // 255
```
Get the value for an individual channel.
### CSS Strings
```js
color.hslString() // "hsl(320, 50%, 100%)"
```
Different CSS String formats for the color are on `hexString`, `rgbString`, `percentString`, `hslString`, `hwbString`, and `keyword` (undefined if it's not a keyword color). `"rgba"` and `"hsla"` are used if the current alpha value of the color isn't `1`.
### Luminosity
```js
color.luminosity(); // 0.412
```
The [WCAG luminosity](http://www.w3.org/TR/WCAG20/#relativeluminancedef) of the color. 0 is black, 1 is white.
```js
color.contrast(Color("blue")) // 12
```
The [WCAG contrast ratio](http://www.w3.org/TR/WCAG20/#contrast-ratiodef) to another color, from 1 (same color) to 21 (contrast b/w white and black).
```js
color.light(); // true
color.dark(); // false
```
Get whether the color is "light" or "dark", useful for deciding text color.
### Manipulation
```js
color.negate() // rgb(0, 100, 255) -> rgb(255, 155, 0)
color.lighten(0.5) // hsl(100, 50%, 50%) -> hsl(100, 50%, 75%)
color.darken(0.5) // hsl(100, 50%, 50%) -> hsl(100, 50%, 25%)
color.saturate(0.5) // hsl(100, 50%, 50%) -> hsl(100, 75%, 50%)
color.desaturate(0.5) // hsl(100, 50%, 50%) -> hsl(100, 25%, 50%)
color.greyscale() // #5CBF54 -> #969696
color.whiten(0.5) // hwb(100, 50%, 50%) -> hwb(100, 75%, 50%)
color.blacken(0.5) // hwb(100, 50%, 50%) -> hwb(100, 50%, 75%)
color.clearer(0.5) // rgba(10, 10, 10, 0.8) -> rgba(10, 10, 10, 0.4)
color.opaquer(0.5) // rgba(10, 10, 10, 0.8) -> rgba(10, 10, 10, 1.0)
color.rotate(180) // hsl(60, 20%, 20%) -> hsl(240, 20%, 20%)
color.rotate(-90) // hsl(60, 20%, 20%) -> hsl(330, 20%, 20%)
color.mix(Color("yellow")) // cyan -> rgb(128, 255, 128)
color.mix(Color("yellow"), 0.3) // cyan -> rgb(77, 255, 179)
// chaining
color.green(100).greyscale().lighten(0.6)
```
### Clone
You can can create a copy of an existing color object using `clone()`:
```js
color.clone() // -> New color object
```
And more to come...
## Propers
The API was inspired by [color-js](https://github.com/brehaut/color-js). Manipulation functions by CSS tools like Sass, LESS, and Stylus.

485
node_modules/chartjs-color/index.js generated vendored

@ -0,0 +1,485 @@
/* MIT license */
var convert = require('color-convert');
var string = require('chartjs-color-string');
var Color = function (obj) {
if (obj instanceof Color) {
return obj;
}
if (!(this instanceof Color)) {
return new Color(obj);
}
this.valid = false;
this.values = {
rgb: [0, 0, 0],
hsl: [0, 0, 0],
hsv: [0, 0, 0],
hwb: [0, 0, 0],
cmyk: [0, 0, 0, 0],
alpha: 1
};
// parse Color() argument
var vals;
if (typeof obj === 'string') {
vals = string.getRgba(obj);
if (vals) {
this.setValues('rgb', vals);
} else if (vals = string.getHsla(obj)) {
this.setValues('hsl', vals);
} else if (vals = string.getHwb(obj)) {
this.setValues('hwb', vals);
}
} else if (typeof obj === 'object') {
vals = obj;
if (vals.r !== undefined || vals.red !== undefined) {
this.setValues('rgb', vals);
} else if (vals.l !== undefined || vals.lightness !== undefined) {
this.setValues('hsl', vals);
} else if (vals.v !== undefined || vals.value !== undefined) {
this.setValues('hsv', vals);
} else if (vals.w !== undefined || vals.whiteness !== undefined) {
this.setValues('hwb', vals);
} else if (vals.c !== undefined || vals.cyan !== undefined) {
this.setValues('cmyk', vals);
}
}
};
Color.prototype = {
isValid: function () {
return this.valid;
},
rgb: function () {
return this.setSpace('rgb', arguments);
},
hsl: function () {
return this.setSpace('hsl', arguments);
},
hsv: function () {
return this.setSpace('hsv', arguments);
},
hwb: function () {
return this.setSpace('hwb', arguments);
},
cmyk: function () {
return this.setSpace('cmyk', arguments);
},
rgbArray: function () {
return this.values.rgb;
},
hslArray: function () {
return this.values.hsl;
},
hsvArray: function () {
return this.values.hsv;
},
hwbArray: function () {
var values = this.values;
if (values.alpha !== 1) {
return values.hwb.concat([values.alpha]);
}
return values.hwb;
},
cmykArray: function () {
return this.values.cmyk;
},
rgbaArray: function () {
var values = this.values;
return values.rgb.concat([values.alpha]);
},
hslaArray: function () {
var values = this.values;
return values.hsl.concat([values.alpha]);
},
alpha: function (val) {
if (val === undefined) {
return this.values.alpha;
}
this.setValues('alpha', val);
return this;
},
red: function (val) {
return this.setChannel('rgb', 0, val);
},
green: function (val) {
return this.setChannel('rgb', 1, val);
},
blue: function (val) {
return this.setChannel('rgb', 2, val);
},
hue: function (val) {
if (val) {
val %= 360;
val = val < 0 ? 360 + val : val;
}
return this.setChannel('hsl', 0, val);
},
saturation: function (val) {
return this.setChannel('hsl', 1, val);
},
lightness: function (val) {
return this.setChannel('hsl', 2, val);
},
saturationv: function (val) {
return this.setChannel('hsv', 1, val);
},
whiteness: function (val) {
return this.setChannel('hwb', 1, val);
},
blackness: function (val) {
return this.setChannel('hwb', 2, val);
},
value: function (val) {
return this.setChannel('hsv', 2, val);
},
cyan: function (val) {
return this.setChannel('cmyk', 0, val);
},
magenta: function (val) {
return this.setChannel('cmyk', 1, val);
},
yellow: function (val) {
return this.setChannel('cmyk', 2, val);
},
black: function (val) {
return this.setChannel('cmyk', 3, val);
},
hexString: function () {
return string.hexString(this.values.rgb);
},
rgbString: function () {
return string.rgbString(this.values.rgb, this.values.alpha);
},
rgbaString: function () {
return string.rgbaString(this.values.rgb, this.values.alpha);
},
percentString: function () {
return string.percentString(this.values.rgb, this.values.alpha);
},
hslString: function () {
return string.hslString(this.values.hsl, this.values.alpha);
},
hslaString: function () {
return string.hslaString(this.values.hsl, this.values.alpha);
},
hwbString: function () {
return string.hwbString(this.values.hwb, this.values.alpha);
},
keyword: function () {
return string.keyword(this.values.rgb, this.values.alpha);
},
rgbNumber: function () {
var rgb = this.values.rgb;
return (rgb[0] << 16) | (rgb[1] << 8) | rgb[2];
},
luminosity: function () {
// http://www.w3.org/TR/WCAG20/#relativeluminancedef
var rgb = this.values.rgb;
var lum = [];
for (var i = 0; i < rgb.length; i++) {
var chan = rgb[i] / 255;
lum[i] = (chan <= 0.03928) ? chan / 12.92 : Math.pow(((chan + 0.055) / 1.055), 2.4);
}
return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
},
contrast: function (color2) {
// http://www.w3.org/TR/WCAG20/#contrast-ratiodef
var lum1 = this.luminosity();
var lum2 = color2.luminosity();
if (lum1 > lum2) {
return (lum1 + 0.05) / (lum2 + 0.05);
}
return (lum2 + 0.05) / (lum1 + 0.05);
},
level: function (color2) {
var contrastRatio = this.contrast(color2);
if (contrastRatio >= 7.1) {
return 'AAA';
}
return (contrastRatio >= 4.5) ? 'AA' : '';
},
dark: function () {
// YIQ equation from http://24ways.org/2010/calculating-color-contrast
var rgb = this.values.rgb;
var yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000;
return yiq < 128;
},
light: function () {
return !this.dark();
},
negate: function () {
var rgb = [];
for (var i = 0; i < 3; i++) {
rgb[i] = 255 - this.values.rgb[i];
}
this.setValues('rgb', rgb);
return this;
},
lighten: function (ratio) {
var hsl = this.values.hsl;
hsl[2] += hsl[2] * ratio;
this.setValues('hsl', hsl);
return this;
},
darken: function (ratio) {
var hsl = this.values.hsl;
hsl[2] -= hsl[2] * ratio;
this.setValues('hsl', hsl);
return this;
},
saturate: function (ratio) {
var hsl = this.values.hsl;
hsl[1] += hsl[1] * ratio;
this.setValues('hsl', hsl);
return this;
},
desaturate: function (ratio) {
var hsl = this.values.hsl;
hsl[1] -= hsl[1] * ratio;
this.setValues('hsl', hsl);
return this;
},
whiten: function (ratio) {
var hwb = this.values.hwb;
hwb[1] += hwb[1] * ratio;
this.setValues('hwb', hwb);
return this;
},
blacken: function (ratio) {
var hwb = this.values.hwb;
hwb[2] += hwb[2] * ratio;
this.setValues('hwb', hwb);
return this;
},
greyscale: function () {
var rgb = this.values.rgb;
// http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
var val = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
this.setValues('rgb', [val, val, val]);
return this;
},
clearer: function (ratio) {
var alpha = this.values.alpha;
this.setValues('alpha', alpha - (alpha * ratio));
return this;
},
opaquer: function (ratio) {
var alpha = this.values.alpha;
this.setValues('alpha', alpha + (alpha * ratio));
return this;
},
rotate: function (degrees) {
var hsl = this.values.hsl;
var hue = (hsl[0] + degrees) % 360;
hsl[0] = hue < 0 ? 360 + hue : hue;
this.setValues('hsl', hsl);
return this;
},
/**
* Ported from sass implementation in C
* https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
*/
mix: function (mixinColor, weight) {
var color1 = this;
var color2 = mixinColor;
var p = weight === undefined ? 0.5 : weight;
var w = 2 * p - 1;
var a = color1.alpha() - color2.alpha();
var w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
var w2 = 1 - w1;
return this
.rgb(
w1 * color1.red() + w2 * color2.red(),
w1 * color1.green() + w2 * color2.green(),
w1 * color1.blue() + w2 * color2.blue()
)
.alpha(color1.alpha() * p + color2.alpha() * (1 - p));
},
toJSON: function () {
return this.rgb();
},
clone: function () {
// NOTE(SB): using node-clone creates a dependency to Buffer when using browserify,
// making the final build way to big to embed in Chart.js. So let's do it manually,
// assuming that values to clone are 1 dimension arrays containing only numbers,
// except 'alpha' which is a number.
var result = new Color();
var source = this.values;
var target = result.values;
var value, type;
for (var prop in source) {
if (source.hasOwnProperty(prop)) {
value = source[prop];
type = ({}).toString.call(value);
if (type === '[object Array]') {
target[prop] = value.slice(0);
} else if (type === '[object Number]') {
target[prop] = value;
} else {
console.error('unexpected color value:', value);
}
}
}
return result;
}
};
Color.prototype.spaces = {
rgb: ['red', 'green', 'blue'],
hsl: ['hue', 'saturation', 'lightness'],
hsv: ['hue', 'saturation', 'value'],
hwb: ['hue', 'whiteness', 'blackness'],
cmyk: ['cyan', 'magenta', 'yellow', 'black']
};
Color.prototype.maxes = {
rgb: [255, 255, 255],
hsl: [360, 100, 100],
hsv: [360, 100, 100],
hwb: [360, 100, 100],
cmyk: [100, 100, 100, 100]
};
Color.prototype.getValues = function (space) {
var values = this.values;
var vals = {};
for (var i = 0; i < space.length; i++) {
vals[space.charAt(i)] = values[space][i];
}
if (values.alpha !== 1) {
vals.a = values.alpha;
}
// {r: 255, g: 255, b: 255, a: 0.4}
return vals;
};
Color.prototype.setValues = function (space, vals) {
var values = this.values;
var spaces = this.spaces;
var maxes = this.maxes;
var alpha = 1;
var i;
this.valid = true;
if (space === 'alpha') {
alpha = vals;
} else if (vals.length) {
// [10, 10, 10]
values[space] = vals.slice(0, space.length);
alpha = vals[space.length];
} else if (vals[space.charAt(0)] !== undefined) {
// {r: 10, g: 10, b: 10}
for (i = 0; i < space.length; i++) {
values[space][i] = vals[space.charAt(i)];
}
alpha = vals.a;
} else if (vals[spaces[space][0]] !== undefined) {
// {red: 10, green: 10, blue: 10}
var chans = spaces[space];
for (i = 0; i < space.length; i++) {
values[space][i] = vals[chans[i]];
}
alpha = vals.alpha;
}
values.alpha = Math.max(0, Math.min(1, (alpha === undefined ? values.alpha : alpha)));
if (space === 'alpha') {
return false;
}
var capped;
// cap values of the space prior converting all values
for (i = 0; i < space.length; i++) {
capped = Math.max(0, Math.min(maxes[space][i], values[space][i]));
values[space][i] = Math.round(capped);
}
// convert to all the other color spaces
for (var sname in spaces) {
if (sname !== space) {
values[sname] = convert[space][sname](values[space]);
}
}
return true;
};
Color.prototype.setSpace = function (space, args) {
var vals = args[0];
if (vals === undefined) {
// color.rgb()
return this.getValues(space);
}
// color.rgb(10, 10, 10)
if (typeof vals === 'number') {
vals = Array.prototype.slice.call(args);
}
this.setValues(space, vals);
return this;
};
Color.prototype.setChannel = function (space, index, val) {
var svalues = this.values[space];
if (val === undefined) {
// color.red()
return svalues[index];
} else if (val === svalues[index]) {
// color.red(color.red())
return this;
}
// color.red(100)
svalues[index] = val;
this.setValues(space, svalues);
return this;
};
if (typeof window !== 'undefined') {
window.Color = Color;
}
module.exports = Color;

@ -0,0 +1,57 @@
{
"name": "chartjs-color",
"version": "2.4.1",
"description": "Color conversion and manipulation with CSS string support",
"keywords": [
"color",
"colour",
"css"
],
"authors": [
"Heather Arthur <fayearthur@gmail.com>",
"Maxime Thirouin",
"Josh Junon"
],
"license": "MIT",
"repository": "chartjs/chartjs-color",
"xo": {
"envs": [
"browser",
"node"
],
"rules": {
"one-var": [
2,
{
"initialized": "never"
}
],
"linebreak-style": 0,
"no-cond-assign": 0,
"new-cap": 0
}
},
"files": [
"CHANGELOG.md",
"LICENSE",
"index.js"
],
"scripts": {
"pretest": "xo",
"test": "mocha"
},
"dependencies": {
"color-convert": "^1.9.3",
"chartjs-color-string": "^0.6.0"
},
"devDependencies": {
"browserify": "^16.2.3",
"gulp": "^4.0.0",
"gulp-rename": "^1.4.0",
"gulp-uglify": "^3.0.2",
"gulp-streamify": "^1.0.2",
"mocha": "^6.0.2",
"vinyl-source-stream": "^2.0.0",
"xo": "^0.12.1"
}
}

@ -0,0 +1,3 @@
src/claygl.js
src/util/dds.js
src/util/delaunay.js

69
node_modules/claygl/.jshintrc generated vendored

@ -0,0 +1,69 @@
{
"bitwise": false,
"camelcase": true,
"curly": true,
"esversion": 6,
"eqeqeq": false,
"forin": false,
"immed": true,
"latedef": false,
"newcap": true,
"noarg": false,
"noempty": true,
"nonew": true,
"plusplus": false,
"quotmark": "single",
"regexp": false,
"undef": true,
"unused": "vars",
"strict": false,
"trailing": false,
"maxparams": 20,
"asi": false,
"boss": false,
"debug": false,
"eqnull": true,
"esnext": false,
"evil": true,
"expr": true,
"funcscope": false,
"globalstrict": false,
"iterator": false,
"lastsemic": false,
"laxbreak": true,
"laxcomma": false,
"loopfunc": false,
"multistr": false,
"onecase": false,
"proto": false,
"regexdash": false,
"scripturl": false,
"smarttabs": false,
"shadow": true,
"sub": true,
"supernew": false,
"validthis": true,
"browser": true,
"couch": false,
"devel": true,
"dojo": false,
"jquery": true,
"mootools": false,
"node": false,
"nonstandard": false,
"prototypejs": false,
"rhino": false,
"wsh": false,
"nomen": false,
"onevar": false,
"passfail": false,
"white": false,
"predef": [
"define",
"require"
]
}

23
node_modules/claygl/LICENSE generated vendored

@ -0,0 +1,23 @@
Copyright (c) 2014, Yi Shen
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

211
node_modules/claygl/README.md generated vendored

@ -0,0 +1,211 @@
<h1><img src="./asset/logo.svg" style="height:30px"> ClayGL</h1>
<img width="100%" src="./screenshot/claygl-logo.jpg" />
[![NPM Version](https://img.shields.io/npm/v/claygl.svg)](https://github.com/pissang/claygl)
[![Circle CI](https://circleci.com/gh/pissang/claygl.svg?style=shield)](https://circleci.com/gh/pissang/claygl)
ClayGL is a WebGL graphic library for building scalable Web3D applications.
It's easy to use, configurable for high-quality graphics. Benefit from the modularity and tree shaking, it can be scaled down to 22k(gzipped) for a basic 3D application.
#### [Download](https://github.com/pissang/claygl/releases)
#### [API](http://docs.claygl.xyz/api)
#### [Examples](http://examples.claygl.xyz)
## Projects
[ECharts GL](https://github.com/ecomfe/echarts-gl)
<a href="https://github.com/ecomfe/echarts-gl" target="_blank">
<img src="./screenshot/echarts-gl.jpg" width="500" />
</a>
[Clay Viewer](https://github.com/pissang/clay-viewer)
<a href="https://github.com/pissang/clay-viewer" target="_blank">
<img src="./screenshot/clay-viewer.jpg" width="500" />
</a>
[DOTA2 Hero Viewer](https://github.com/pissang/dota2hero)
<a href="https://github.com/pissang/dota2hero" target="_blank">
<img src="./screenshot/dota2hero.jpg" width="500" />
</a>
[Paper Cut Art Generator](https://github.com/pissang/papercut-box-art)
<a href="https://github.com/pissang/papercut-box-art" target="_blank">
<img src="https://github.com/pissang/papercut-box-art/blob/master/screenshots/3.jpg" width="500" alt="">
</a>
[Little Big City](https://github.com/pissang/little-big-city)
<a href="https://github.com/pissang/little-big-city" target="_blank">
<img src="https://github.com/pissang/little-big-city/blob/gh-pages/asset/screenshot.png" width="500" alt="">
</a>
## Quick Start
##### Create a rotating cube
```html
<!DOCTYPE html>
<html lang="en">
<head>
<script src="lib/claygl.js"></script>
</head>
<body>
<canvas id="main"></canvas>
<script>
clay.application.create('#main', {
width: window.innerWidth,
height: window.innerHeight,
init(app) {
// Create camera
this._camera = app.createCamera([0, 2, 5], [0, 0, 0]);
// Create a RED cube
this._cube = app.createCube({
color: '#f00'
});
// Create light
this._mainLight = app.createDirectionalLight([-1, -1, -1]);
},
loop(app) {
this._cube.rotation.rotateY(app.frameTime / 1000);
}
});
</script>
</body>
</html>
```
#### Minimum bundle example
This example is about 22k(gzipped) after bundled by webpack 4.0. It draws a triangle on the screen.
```js
import { Renderer, GeometryBase, Shader, Material } from 'claygl';
const vsCode = `
attribute vec3 position: POSITION;
void main() {
gl_Position = vec4(position, 1.0);
}
`;
const fsCode = `
void main() {
gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);
}
`;
const renderer = new Renderer({
canvas: document.getElementById('main')
});
renderer.resize(400, 400);
const geometry = new GeometryBase();
geometry.createAttribute('position', 'float', 3);
// Add triangle vertices to position attribute.
geometry.attributes.position.fromArray([
[-0.5, -0.5, 0],
[0.5, -0.5, 0],
[0, 0.5, 0]
]);
const material = new Material({
shader: new Shader(vsCode, fsCode)
});
renderer.renderPass([ { geometry, material } ]);
```
<!--
## Current Features
+ Scene graph based management of lights, meshes, cameras, materials and shaders
+ Basic primitive geometry procedural generate
+ Cube, sphere, cylinder, cone, plane
+ Phong and lambert buildin shaders which support normal map and environment map
+ Point, directional, spot light
+ Orthographic, perspective camera
+ Graph based post processing
+ High quality shadow
+ PCF or VSM soft shadow
+ PSSM for sun light in large scene
+ Omni light shadow support
+ High performance geometry processing
+ GPU based skinning
+ Support 1D and 2D animation blending with blend tree
+ First person camera control, orbit camera control
+ Skybox, skydom
+ Particle System
+ Support both ray picking and GPU Picking
+ Loader
+ glTF loader
+ Timeline based animation, support spline interpolation between keyframes.
+ Full deferred pipeline.
+ Physically based rendering, Full HDR pipeline.
+ Stereo rendering, VR ready.
-->
### FBX to glTF2.0 Converter
[Get it](https://github.com/pissang/claygl/blob/master/tools/fbx2gltf.py)
Needs [python3.3](https://www.python.org/download/releases/3.3.0/) and [FBX SDK 2018.1.1](http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=26416130).
```
usage: fbx2gltf.py [-h] [-e EXCLUDE] [-t TIMERANGE] [-o OUTPUT]
[-f FRAMERATE] [-p POSE] [-q] [-b]
file
FBX to glTF converter
positional arguments:
file
optional arguments:
-h, --help show this help message and exit
-e EXCLUDE, --exclude EXCLUDE
Data excluded. Can be: scene,animation
-t TIMERANGE, --timerange TIMERANGE
Export animation time, in format
'startSecond,endSecond'
-o OUTPUT, --output OUTPUT
Ouput glTF file path
-f FRAMERATE, --framerate FRAMERATE
Animation frame per second
-p POSE, --pose POSE Start pose time
-q, --quantize Quantize accessors with WEB3D_quantized_attributes
extension
-b, --binary Export glTF-binary
--beautify Beautify json output.
--noflipv If not flip v in texcoord.
```
Input:
+ FBX
+ COLLADA
+ OBJ
Output:
+ Scene hierarchy
+ Mesh and camera
+ PBR material
+ Texture
+ Skin
+ Animation

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="186px" height="49px" viewBox="0 0 186 49" enable-background="new 0 0 186 49" xml:space="preserve">
<path d="M28.404,40.339h-20V8.679h20c2.209,0,4-1.791,4-4s-1.791-4-4-4h-24c-2.209,0-4,1.791-4,4v39
c0,0.112,0.024,0.219,0.033,0.329c-0.009,0.11-0.033,0.218-0.033,0.33c0,2.209,1.791,4,4,4h24c2.209,0,4-1.791,4-4
S30.613,40.339,28.404,40.339z"/>
<path d="M56.697,40.339h-12V4.679c0-2.209-1.791-4-4-4c-2.209,0-4,1.791-4,4v39.1c0,0.097,0.021,0.187,0.028,0.279
c-0.007,0.096-0.028,0.186-0.028,0.28c0,2.209,1.791,4,4,4h16c2.209,0,4-1.791,4-4S58.906,40.339,56.697,40.339z"/>
<path d="M182.096,40.156h-12V4.861c0-2.209-1.791-4-4-4s-4,1.791-4,4v39.1c0,0.033,0.01,0.064,0.01,0.098s-0.01,0.064-0.01,0.099
c0,2.209,1.791,4,4,4h16c2.209,0,4-1.791,4-4S184.305,40.156,182.096,40.156z"/>
<path d="M157.725,24.598c0-2.209-1.791-4-4-4h-9.022c-2.209,0-4,1.791-4,4c0,2.208,1.791,4,4,4h5.022v11.56h-18.002V8.861h22
c2.209,0,4-1.791,4-4s-1.791-4-4-4h-26c-2.209,0-4,1.791-4,4v39c0,0.051,0.014,0.098,0.016,0.146
c-0.002,0.051-0.016,0.098-0.016,0.146c0,2.21,1.791,4,4,4h26h0.002l0,0c2.209,0,4-1.79,4-4V24.725c0-0.022-0.006-0.042-0.007-0.064
C157.719,24.64,157.725,24.62,157.725,24.598z"/>
<path fill="#20A5DE" d="M114.891,9.35c-1.189,0-2.351-0.479-3.189-1.319c-0.83-0.83-1.311-1.99-1.311-3.181
c0-1.18,0.479-2.34,1.311-3.18c0.84-0.84,2-1.32,3.189-1.32c1.18,0,2.34,0.48,3.18,1.32c0.83,0.84,1.32,2,1.32,3.18
c0,1.181-0.49,2.34-1.32,3.181C117.229,8.87,116.068,9.35,114.891,9.35z"/>
<path d="M111.641,10.95c-1.957-1.018-4.375-0.259-5.396,1.7l-4.335,8.326L92.551,3.003c-1.02-1.96-3.437-2.72-5.395-1.7
c-1.959,1.02-2.721,3.436-1.701,5.395l12.429,23.87v13.578c0,2.209,1.791,4,4,4s4-1.791,4-4V30.665l7.456-14.32
C114.361,14.386,113.6,11.97,111.641,10.95z"/>
<path fill="#ED1C5E" d="M89,48.65c-1.18,0-2.34-0.48-3.18-1.32c-0.84-0.84-1.32-2-1.32-3.18c0-1.19,0.48-2.352,1.32-3.182
c0.84-0.84,2-1.318,3.18-1.318c1.19,0,2.35,0.479,3.189,1.318c0.83,0.83,1.311,1.99,1.311,3.182c0,1.18-0.48,2.34-1.311,3.18
C91.35,48.17,90.19,48.65,89,48.65z"/>
<path d="M87.521,32.271L72.562,3.028L72.553,3.03c-0.614-1.383-1.994-2.351-3.604-2.351c-2.179,0-3.946,1.767-3.946,3.947v0.228
v6.658v32.659c0,2.209,1.791,4,4,4s4-1.791,4-4V21.454L80.4,35.915c0.708,1.384,2.11,2.181,3.564,2.181
c0.613,0,1.235-0.143,1.818-0.441C87.748,36.648,88.527,34.238,87.521,32.271z"/>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

8
node_modules/claygl/circle.yml generated vendored

@ -0,0 +1,8 @@
machine:
node:
version: 8.8.0
test:
override:
- npm run test:cov
post:
- bash <(curl -s https://codecov.io/bash)

125
node_modules/claygl/claygl.todo generated vendored

@ -0,0 +1,125 @@
☐ Slot when multiple uniform use same texture.
☐ clear, viewport 等属性移出来作为 render 参数,去掉 saveClear, restoreClear
☐ Renderer 实现状态资源管理GC
☐ SKINNING 应该跟 shader 和 material 无关?
☐ Add a skinning demo, including split.
☐ Add a mesh merge demo.
☐ Add a PSSM demo
☐ StaticGeometry => Geometry
✔ Texture width, height 与 image 同步, 自动 mark dirty @done (17-06-28 10:48)
☐ Shadow map alpha test
☐ 所有 cache 放入 instance 中,比如 compositor 的 texturePool
☐ directional shadow 摄像机裁剪计算有问题skinned 的 mesh boundingbox 计算不正确
Fixed bounding box ?
✔ getVertexNumber => vertexCount @done (16-08-18 13:04)
✔ Shadow map in Directional light @done (13-07-01 18:26)
✔ PCF @done (13-07-01 18:26)
☐ Program cache
☐ Remove attachShader, use shader setter instead
☐ Texture leak from other materials if texture is null
☐ normal and roughness texture sRGB
☐ fbx2gltf 对 dae 好像会忽略最顶层对象的变换
☐ fbx2gltf 对于在有变换的节点下的 joints 支持有问题
☐ loose context handling
☐ 参数统一都是 gl 或者 renderer(现在是 gl有些必须要是 renderer 的时候才是 renderer)
☐ gbuffer binary search seems useless
✔ buildin > qtek @done (16-09-07 20:06)
☐ GLTF 只导入导出动画
☐ 同步 qtek, zrender Clip 对象,单个 clip 继续和暂停
✔ Dispose !!! @done (13-10-10 13:31)
✔ Shadow Map Dispose @done (13-10-29 17:47)
☐ Compositor dispose
☐ Dispose the unused light shadow map
☐ Shadow map handling after node disposed
✔ Shadow map of point light (map distance to 0 - 1) @done (13-10-10 13:32)
✔ Skinning 也有点问题 @done (13-09-20 21:44)
✔ Quaternion to euler
✔ slow in chrome !!!! @done (13-09-20 21:44)
✔ transparent, depth test, depth write, @done (13-08-04 18:47)
✔ skybox, reflection map @done (13-08-18 15:52)
✔ frustum culling @done (13-11-13 21:15)
✔ particle system @done (13-11-12 15:44)
✔ Bounding Box @done (13-11-13 21:15)
✔ Performance @done (13-11-22 16:33)
✔ Texture load error handling @done (13-12-19 13:27)
✔ Parse Defines @done (13-12-02 11:03)
✔ Sphere noramls wrong @done (13-11-30 14:12)
✔ Rewrite Skybox @done (13-11-30 14:11)
✔ FX Loader auto fit width and height @done (13-12-19 13:27)
✔ Orbit Control @done (13-12-11 10:56)
✔ dds loader @done (13-12-19 13:27)
✔ frustum culling problem @done (13-12-24 17:28)
✔ !!!Eearly z culling @done (14-01-01 21:22)
✔ !!!Physically based shading @done (14-01-01 21:22)
✔ InstantGeometry needs to be removed @done (13-12-31 14:06)
✔ Viewport get and set, clear push and pop @done (14-01-08 13:32)
✔ Early z culling support skinning @done (14-01-08 13:32)
Directly skipped skinned mesh
✔ Loader load multiple resources!!!!! @done (14-01-08 13:32)
Use promise on request
Decide one resource on loader
✔ Cascade Shadow Map @done (14-01-08 13:33)
✔ !!!fbx2gltf new spec @done (14-02-17 11:13)
✔ GLTF Converter Split Mesh By Material and support deformer @done (14-02-17 11:14)
✔ Ray Intersection @done (14-02-17 11:14)
✔ !!!Hemisphere light @done (14-02-17 11:14)
✔ !!!firefox some control bug, first person control and scroll in orbit control @done (14-02-17 11:14)
✔ !!!!BLEND CLIP TEST @done (14-02-17 11:14)
☐ GPU Morphing
✔ Frustum culling 优化 cubes demo) @done(18-04-21 16:08)
☐ Environment map fresnel
☐ EnvironmentMapPass problem in Window
☐ Relative Viewport
☐ Camera animation helper
☐ qtek log
☐ GL Parameters like MAX_TEXTURE_SIZE
☐ ShadowMap Review, pass in scene, renderer, camera on create
☐ Geometry attributes manipulation interface
✔ Parallax corrected cubemap @done(18-04-21 16:08)
☐ Sub mesh
☐ Tessellation
☐ TGA Loader
✔ pcf kernel size and blur size, bleedBias @done (16-11-08 15:34)
☐ Shader uniform parse:
uniform float a, b, c;
☐ mirror
☐ decals
☐ !!!transparent shadow
☐ Playback speed control
☐ LOD
☐ Handle the situation when mesh change from receive shadow to not receive
☐ Compositor group rewrite
✔ Renderer.disposeNode consider the sharing shader and material @done (15-01-02 13:22)
☐ Particle dispose
☐ Node.queryNode
☐ Particle Loader
☐ Resource package loader
☐ Particle renderer can use billboard and point cloud
☐ Animation memory cost
☐ 完善的浏览器判断
☐ !!!!在用 compositor 渲染的时候不要直接绑定 FrameBuffer
☐ !!!!DDS loader test
☐ TransparentMaterial
☐ Emmisive texture
TEST:
✔ Test util functions @done (14-02-17 11:15)
✔ Ray.intersectPlane, Ray.mirrorAgainstPlane, Plane.applyTransform, Plane.projectPoint @done (14-02-25 11:17)
☐ Compositor test on referenceence
☐ Static methods of Vector and Matrix
✔ Light, Camera, Renderable clone @done (15-01-02 13:21)
✔ Async @done (14-05-28 09:43)
PENDING:
☐ Blend Clip output ?????????
☐ Point light and spot light attenuation
☐ Transform pivot
☐ enableAttributes ?????
☐ 去掉多 context 支持?
Problems:
✔ Material will use other texture when its texture is not renderable @done (14-02-10 15:15)
✔ depth func @done (13-12-03 13:56)
✔ face culling @done (13-11-13 21:16)
✔ Frustum culling of plane @done (14-02-10 15:15)
☐ Compositor : optimize the node not in the rendering chain, the reference will still be added and will not be removed
☐ Unprojection ??????

File diff suppressed because one or more lines are too long

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Fixture reports</title>
<body>
<table border="1">
<tr>
<th style="width:200px">title</th>
<th style="width:400px">expected</th>
<th style="width:400px">actual</th>
</tr>
</table>
</body>
</html>

@ -0,0 +1,213 @@
body, html {
margin:0; padding: 0;
height: 100%;
}
body {
font-family: Helvetica Neue, Helvetica, Arial;
font-size: 14px;
color:#333;
}
.small { font-size: 12px; }
*, *:after, *:before {
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
}
h1 { font-size: 20px; margin: 0;}
h2 { font-size: 14px; }
pre {
font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
margin: 0;
padding: 0;
-moz-tab-size: 2;
-o-tab-size: 2;
tab-size: 2;
}
a { color:#0074D9; text-decoration:none; }
a:hover { text-decoration:underline; }
.strong { font-weight: bold; }
.space-top1 { padding: 10px 0 0 0; }
.pad2y { padding: 20px 0; }
.pad1y { padding: 10px 0; }
.pad2x { padding: 0 20px; }
.pad2 { padding: 20px; }
.pad1 { padding: 10px; }
.space-left2 { padding-left:55px; }
.space-right2 { padding-right:20px; }
.center { text-align:center; }
.clearfix { display:block; }
.clearfix:after {
content:'';
display:block;
height:0;
clear:both;
visibility:hidden;
}
.fl { float: left; }
@media only screen and (max-width:640px) {
.col3 { width:100%; max-width:100%; }
.hide-mobile { display:none!important; }
}
.quiet {
color: #7f7f7f;
color: rgba(0,0,0,0.5);
}
.quiet a { opacity: 0.7; }
.fraction {
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
font-size: 10px;
color: #555;
background: #E8E8E8;
padding: 4px 5px;
border-radius: 3px;
vertical-align: middle;
}
div.path a:link, div.path a:visited { color: #333; }
table.coverage {
border-collapse: collapse;
margin: 10px 0 0 0;
padding: 0;
}
table.coverage td {
margin: 0;
padding: 0;
vertical-align: top;
}
table.coverage td.line-count {
text-align: right;
padding: 0 5px 0 20px;
}
table.coverage td.line-coverage {
text-align: right;
padding-right: 10px;
min-width:20px;
}
table.coverage td span.cline-any {
display: inline-block;
padding: 0 5px;
width: 100%;
}
.missing-if-branch {
display: inline-block;
margin-right: 5px;
border-radius: 3px;
position: relative;
padding: 0 4px;
background: #333;
color: yellow;
}
.skip-if-branch {
display: none;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: #ccc;
color: white;
}
.missing-if-branch .typ, .skip-if-branch .typ {
color: inherit !important;
}
.coverage-summary {
border-collapse: collapse;
width: 100%;
}
.coverage-summary tr { border-bottom: 1px solid #bbb; }
.keyline-all { border: 1px solid #ddd; }
.coverage-summary td, .coverage-summary th { padding: 10px; }
.coverage-summary tbody { border: 1px solid #bbb; }
.coverage-summary td { border-right: 1px solid #bbb; }
.coverage-summary td:last-child { border-right: none; }
.coverage-summary th {
text-align: left;
font-weight: normal;
white-space: nowrap;
}
.coverage-summary th.file { border-right: none !important; }
.coverage-summary th.pct { }
.coverage-summary th.pic,
.coverage-summary th.abs,
.coverage-summary td.pct,
.coverage-summary td.abs { text-align: right; }
.coverage-summary td.file { white-space: nowrap; }
.coverage-summary td.pic { min-width: 120px !important; }
.coverage-summary tfoot td { }
.coverage-summary .sorter {
height: 10px;
width: 7px;
display: inline-block;
margin-left: 0.5em;
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
}
.coverage-summary .sorted .sorter {
background-position: 0 -20px;
}
.coverage-summary .sorted-desc .sorter {
background-position: 0 -10px;
}
.status-line { height: 10px; }
/* dark red */
.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
.low .chart { border:1px solid #C21F39 }
/* medium red */
.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
/* light red */
.low, .cline-no { background:#FCE1E5 }
/* light green */
.high, .cline-yes { background:rgb(230,245,208) }
/* medium green */
.cstat-yes { background:rgb(161,215,106) }
/* dark green */
.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
.high .chart { border:1px solid rgb(77,146,33) }
/* dark yellow (gold) */
.medium .chart { border:1px solid #f9cd0b; }
.status-line.medium, .medium .cover-fill { background: #f9cd0b; }
/* light yellow */
.medium { background: #fff4c2; }
/* light gray */
span.cline-neutral { background: #eaeaea; }
.cbranch-no { background: yellow !important; color: #111; }
.cstat-skip { background: #ddd; color: #111; }
.fstat-skip { background: #ddd; color: #111 !important; }
.cbranch-skip { background: #ddd !important; color: #111; }
.cover-fill, .cover-empty {
display:inline-block;
height: 12px;
}
.chart {
line-height: 0;
}
.cover-empty {
background: white;
}
.cover-full {
border-right: none !important;
}
pre.prettyprint {
border: none !important;
padding: 0 !important;
margin: 0 !important;
}
.com { color: #999 !important; }
.ignore-none { color: #999; font-weight: normal; }
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -48px;
}
.footer, .push {
height: 48px;
}

@ -0,0 +1,418 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for All files</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="prettify.css" />
<link rel="stylesheet" href="base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
/
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">40.74% </span>
<span class="quiet">Statements</span>
<span class='fraction'>5380/13206</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">28.25% </span>
<span class="quiet">Branches</span>
<span class='fraction'>1280/4531</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">31.84% </span>
<span class="quiet">Functions</span>
<span class='fraction'>560/1759</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">40.94% </span>
<span class="quiet">Lines</span>
<span class='fraction'>5250/12825</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file medium" data-value="src/"><a href="src/index.html">src/</a></td>
<td data-value="59.87" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 59%;"></div><div class="cover-empty" style="width:41%;"></div></div></td>
<td data-value="59.87" class="pct medium">59.87%</td>
<td data-value="3195" class="abs medium">1913/3195</td>
<td data-value="45.81" class="pct low">45.81%</td>
<td data-value="1622" class="abs low">743/1622</td>
<td data-value="55.01" class="pct medium">55.01%</td>
<td data-value="449" class="abs medium">247/449</td>
<td data-value="59.84" class="pct medium">59.84%</td>
<td data-value="3187" class="abs medium">1907/3187</td>
</tr>
<tr>
<td class="file low" data-value="src/animation/"><a href="src/animation/index.html">src/animation/</a></td>
<td data-value="25.31" class="pic low"><div class="chart"><div class="cover-fill" style="width: 25%;"></div><div class="cover-empty" style="width:75%;"></div></div></td>
<td data-value="25.31" class="pct low">25.31%</td>
<td data-value="818" class="abs low">207/818</td>
<td data-value="20.25" class="pct low">20.25%</td>
<td data-value="400" class="abs low">81/400</td>
<td data-value="18.42" class="pct low">18.42%</td>
<td data-value="114" class="abs low">21/114</td>
<td data-value="25.68" class="pct low">25.68%</td>
<td data-value="806" class="abs low">207/806</td>
</tr>
<tr>
<td class="file low" data-value="src/async/"><a href="src/async/index.html">src/async/</a></td>
<td data-value="13.64" class="pic low"><div class="chart"><div class="cover-fill" style="width: 13%;"></div><div class="cover-empty" style="width:87%;"></div></div></td>
<td data-value="13.64" class="pct low">13.64%</td>
<td data-value="154" class="abs low">21/154</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="54" class="abs low">0/54</td>
<td data-value="3.57" class="pct low">3.57%</td>
<td data-value="28" class="abs low">1/28</td>
<td data-value="13.64" class="pct low">13.64%</td>
<td data-value="154" class="abs low">21/154</td>
</tr>
<tr>
<td class="file high" data-value="src/camera/"><a href="src/camera/index.html">src/camera/</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="32" class="abs high">32/32</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="6" class="abs high">6/6</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="32" class="abs high">32/32</td>
</tr>
<tr>
<td class="file low" data-value="src/compositor/"><a href="src/compositor/index.html">src/compositor/</a></td>
<td data-value="14.75" class="pic low"><div class="chart"><div class="cover-fill" style="width: 14%;"></div><div class="cover-empty" style="width:86%;"></div></div></td>
<td data-value="14.75" class="pct low">14.75%</td>
<td data-value="366" class="abs low">54/366</td>
<td data-value="6.77" class="pct low">6.77%</td>
<td data-value="192" class="abs low">13/192</td>
<td data-value="14.29" class="pct low">14.29%</td>
<td data-value="63" class="abs low">9/63</td>
<td data-value="14.75" class="pct low">14.75%</td>
<td data-value="366" class="abs low">54/366</td>
</tr>
<tr>
<td class="file low" data-value="src/core/"><a href="src/core/index.html">src/core/</a></td>
<td data-value="35.17" class="pic low"><div class="chart"><div class="cover-fill" style="width: 35%;"></div><div class="cover-empty" style="width:65%;"></div></div></td>
<td data-value="35.17" class="pct low">35.17%</td>
<td data-value="526" class="abs low">185/526</td>
<td data-value="18.79" class="pct low">18.79%</td>
<td data-value="298" class="abs low">56/298</td>
<td data-value="44.59" class="pct low">44.59%</td>
<td data-value="74" class="abs low">33/74</td>
<td data-value="35.65" class="pct low">35.65%</td>
<td data-value="519" class="abs low">185/519</td>
</tr>
<tr>
<td class="file medium" data-value="src/core/mixin/"><a href="src/core/mixin/index.html">src/core/mixin/</a></td>
<td data-value="69.83" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 69%;"></div><div class="cover-empty" style="width:31%;"></div></div></td>
<td data-value="69.83" class="pct medium">69.83%</td>
<td data-value="116" class="abs medium">81/116</td>
<td data-value="58.82" class="pct medium">58.82%</td>
<td data-value="68" class="abs medium">40/68</td>
<td data-value="81.25" class="pct high">81.25%</td>
<td data-value="16" class="abs high">13/16</td>
<td data-value="69.3" class="pct medium">69.3%</td>
<td data-value="114" class="abs medium">79/114</td>
</tr>
<tr>
<td class="file low" data-value="src/deferred/"><a href="src/deferred/index.html">src/deferred/</a></td>
<td data-value="4.7" class="pic low"><div class="chart"><div class="cover-fill" style="width: 4%;"></div><div class="cover-empty" style="width:96%;"></div></div></td>
<td data-value="4.7" class="pct low">4.7%</td>
<td data-value="468" class="abs low">22/468</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="179" class="abs low">0/179</td>
<td data-value="5.41" class="pct low">5.41%</td>
<td data-value="37" class="abs low">2/37</td>
<td data-value="4.7" class="pct low">4.7%</td>
<td data-value="468" class="abs low">22/468</td>
</tr>
<tr>
<td class="file low" data-value="src/dep/"><a href="src/dep/index.html">src/dep/</a></td>
<td data-value="44.28" class="pic low"><div class="chart"><div class="cover-fill" style="width: 44%;"></div><div class="cover-empty" style="width:56%;"></div></div></td>
<td data-value="44.28" class="pct low">44.28%</td>
<td data-value="2114" class="abs low">936/2114</td>
<td data-value="33.91" class="pct low">33.91%</td>
<td data-value="115" class="abs low">39/115</td>
<td data-value="30.39" class="pct low">30.39%</td>
<td data-value="181" class="abs low">55/181</td>
<td data-value="46.31" class="pct low">46.31%</td>
<td data-value="1816" class="abs low">841/1816</td>
</tr>
<tr>
<td class="file high" data-value="src/geometry/"><a href="src/geometry/index.html">src/geometry/</a></td>
<td data-value="81.2" class="pic high"><div class="chart"><div class="cover-fill" style="width: 81%;"></div><div class="cover-empty" style="width:19%;"></div></div></td>
<td data-value="81.2" class="pct high">81.2%</td>
<td data-value="266" class="abs high">216/266</td>
<td data-value="42.11" class="pct low">42.11%</td>
<td data-value="38" class="abs low">16/38</td>
<td data-value="84.62" class="pct high">84.62%</td>
<td data-value="13" class="abs high">11/13</td>
<td data-value="80.99" class="pct high">80.99%</td>
<td data-value="263" class="abs high">213/263</td>
</tr>
<tr>
<td class="file high" data-value="src/gpu/"><a href="src/gpu/index.html">src/gpu/</a></td>
<td data-value="83.04" class="pic high"><div class="chart"><div class="cover-fill" style="width: 83%;"></div><div class="cover-empty" style="width:17%;"></div></div></td>
<td data-value="83.04" class="pct high">83.04%</td>
<td data-value="230" class="abs high">191/230</td>
<td data-value="69.47" class="pct medium">69.47%</td>
<td data-value="95" class="abs medium">66/95</td>
<td data-value="95" class="pct high">95%</td>
<td data-value="20" class="abs high">19/20</td>
<td data-value="83.04" class="pct high">83.04%</td>
<td data-value="230" class="abs high">191/230</td>
</tr>
<tr>
<td class="file low" data-value="src/light/"><a href="src/light/index.html">src/light/</a></td>
<td data-value="44.58" class="pic low"><div class="chart"><div class="cover-fill" style="width: 44%;"></div><div class="cover-empty" style="width:56%;"></div></div></td>
<td data-value="44.58" class="pct low">44.58%</td>
<td data-value="83" class="abs low">37/83</td>
<td data-value="50" class="pct medium">50%</td>
<td data-value="8" class="abs medium">4/8</td>
<td data-value="34.38" class="pct low">34.38%</td>
<td data-value="32" class="abs low">11/32</td>
<td data-value="44.58" class="pct low">44.58%</td>
<td data-value="83" class="abs low">37/83</td>
</tr>
<tr>
<td class="file low" data-value="src/loader/"><a href="src/loader/index.html">src/loader/</a></td>
<td data-value="1.2" class="pic low"><div class="chart"><div class="cover-fill" style="width: 1%;"></div><div class="cover-empty" style="width:99%;"></div></div></td>
<td data-value="1.2" class="pct low">1.2%</td>
<td data-value="499" class="abs low">6/499</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="388" class="abs low">0/388</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="53" class="abs low">0/53</td>
<td data-value="1.21" class="pct low">1.21%</td>
<td data-value="494" class="abs low">6/494</td>
</tr>
<tr>
<td class="file low" data-value="src/math/"><a href="src/math/index.html">src/math/</a></td>
<td data-value="35.15" class="pic low"><div class="chart"><div class="cover-fill" style="width: 35%;"></div><div class="cover-empty" style="width:65%;"></div></div></td>
<td data-value="35.15" class="pct low">35.15%</td>
<td data-value="1977" class="abs low">695/1977</td>
<td data-value="20.17" class="pct low">20.17%</td>
<td data-value="233" class="abs low">47/233</td>
<td data-value="15.73" class="pct low">15.73%</td>
<td data-value="464" class="abs low">73/464</td>
<td data-value="34.62" class="pct low">34.62%</td>
<td data-value="1938" class="abs low">671/1938</td>
</tr>
<tr>
<td class="file low" data-value="src/particle/"><a href="src/particle/index.html">src/particle/</a></td>
<td data-value="10.13" class="pic low"><div class="chart"><div class="cover-fill" style="width: 10%;"></div><div class="cover-empty" style="width:90%;"></div></div></td>
<td data-value="10.13" class="pct low">10.13%</td>
<td data-value="158" class="abs low">16/158</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="44" class="abs low">0/44</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="19" class="abs low">0/19</td>
<td data-value="10.13" class="pct low">10.13%</td>
<td data-value="158" class="abs low">16/158</td>
</tr>
<tr>
<td class="file low" data-value="src/picking/"><a href="src/picking/index.html">src/picking/</a></td>
<td data-value="7.06" class="pic low"><div class="chart"><div class="cover-fill" style="width: 7%;"></div><div class="cover-empty" style="width:93%;"></div></div></td>
<td data-value="7.06" class="pct low">7.06%</td>
<td data-value="170" class="abs low">12/170</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="78" class="abs low">0/78</td>
<td data-value="5" class="pct low">5%</td>
<td data-value="20" class="abs low">1/20</td>
<td data-value="7.06" class="pct low">7.06%</td>
<td data-value="170" class="abs low">12/170</td>
</tr>
<tr>
<td class="file low" data-value="src/plugin/"><a href="src/plugin/index.html">src/plugin/</a></td>
<td data-value="13.8" class="pic low"><div class="chart"><div class="cover-fill" style="width: 13%;"></div><div class="cover-empty" style="width:87%;"></div></div></td>
<td data-value="13.8" class="pct low">13.8%</td>
<td data-value="500" class="abs low">69/500</td>
<td data-value="4.07" class="pct low">4.07%</td>
<td data-value="221" class="abs low">9/221</td>
<td data-value="15.85" class="pct low">15.85%</td>
<td data-value="82" class="abs low">13/82</td>
<td data-value="13.8" class="pct low">13.8%</td>
<td data-value="500" class="abs low">69/500</td>
</tr>
<tr>
<td class="file medium" data-value="src/prePass/"><a href="src/prePass/index.html">src/prePass/</a></td>
<td data-value="71.84" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 71%;"></div><div class="cover-empty" style="width:29%;"></div></div></td>
<td data-value="71.84" class="pct medium">71.84%</td>
<td data-value="451" class="abs medium">324/451</td>
<td data-value="57.04" class="pct medium">57.04%</td>
<td data-value="142" class="abs medium">81/142</td>
<td data-value="77.42" class="pct medium">77.42%</td>
<td data-value="31" class="abs medium">24/31</td>
<td data-value="72" class="pct medium">72%</td>
<td data-value="450" class="abs medium">324/450</td>
</tr>
<tr>
<td class="file high" data-value="src/shader/"><a href="src/shader/index.html">src/shader/</a></td>
<td data-value="90.2" class="pic high"><div class="chart"><div class="cover-fill" style="width: 90%;"></div><div class="cover-empty" style="width:10%;"></div></div></td>
<td data-value="90.2" class="pct high">90.2%</td>
<td data-value="51" class="abs high">46/51</td>
<td data-value="75" class="pct medium">75%</td>
<td data-value="4" class="abs medium">3/4</td>
<td data-value="57.14" class="pct medium">57.14%</td>
<td data-value="7" class="abs medium">4/7</td>
<td data-value="90.2" class="pct high">90.2%</td>
<td data-value="51" class="abs high">46/51</td>
</tr>
<tr>
<td class="file high" data-value="src/shader/source/"><a href="src/shader/source/index.html">src/shader/source/</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="8" class="abs high">8/8</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="8" class="abs high">8/8</td>
</tr>
<tr>
<td class="file high" data-value="src/shader/source/compositor/"><a href="src/shader/source/compositor/index.html">src/shader/source/compositor/</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="16" class="abs high">16/16</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="16" class="abs high">16/16</td>
</tr>
<tr>
<td class="file high" data-value="src/shader/source/deferred/"><a href="src/shader/source/deferred/index.html">src/shader/source/deferred/</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="11" class="abs high">11/11</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="11" class="abs high">11/11</td>
</tr>
<tr>
<td class="file high" data-value="src/shader/source/header/"><a href="src/shader/source/header/index.html">src/shader/source/header/</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="7" class="abs high">7/7</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="7" class="abs high">7/7</td>
</tr>
<tr>
<td class="file low" data-value="src/util/"><a href="src/util/index.html">src/util/</a></td>
<td data-value="31.6" class="pic low"><div class="chart"><div class="cover-fill" style="width: 31%;"></div><div class="cover-empty" style="width:69%;"></div></div></td>
<td data-value="31.6" class="pct low">31.6%</td>
<td data-value="848" class="abs low">268/848</td>
<td data-value="25.15" class="pct low">25.15%</td>
<td data-value="326" class="abs low">82/326</td>
<td data-value="42.5" class="pct low">42.5%</td>
<td data-value="40" class="abs low">17/40</td>
<td data-value="31.83" class="pct low">31.83%</td>
<td data-value="842" class="abs low">268/842</td>
</tr>
<tr>
<td class="file high" data-value="src/util/shader/"><a href="src/util/shader/index.html">src/util/shader/</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="2" class="abs high">2/2</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="2" class="abs high">2/2</td>
</tr>
<tr>
<td class="file low" data-value="src/vr/"><a href="src/vr/index.html">src/vr/</a></td>
<td data-value="3.57" class="pic low"><div class="chart"><div class="cover-fill" style="width: 3%;"></div><div class="cover-empty" style="width:97%;"></div></div></td>
<td data-value="3.57" class="pct low">3.57%</td>
<td data-value="140" class="abs low">5/140</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="26" class="abs low">0/26</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="10" class="abs low">0/10</td>
<td data-value="3.57" class="pct low">3.57%</td>
<td data-value="140" class="abs low">5/140</td>
</tr>
</tbody>
</table>
</div><div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="sorter.js"></script>
</body>
</html>

@ -0,0 +1 @@
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

@ -0,0 +1,158 @@
var addSorting = (function () {
"use strict";
var cols,
currentSort = {
index: 0,
desc: false
};
// returns the summary table element
function getTable() { return document.querySelector('.coverage-summary'); }
// returns the thead element of the summary table
function getTableHeader() { return getTable().querySelector('thead tr'); }
// returns the tbody element of the summary table
function getTableBody() { return getTable().querySelector('tbody'); }
// returns the th element for nth column
function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; }
// loads all columns
function loadColumns() {
var colNodes = getTableHeader().querySelectorAll('th'),
colNode,
cols = [],
col,
i;
for (i = 0; i < colNodes.length; i += 1) {
colNode = colNodes[i];
col = {
key: colNode.getAttribute('data-col'),
sortable: !colNode.getAttribute('data-nosort'),
type: colNode.getAttribute('data-type') || 'string'
};
cols.push(col);
if (col.sortable) {
col.defaultDescSort = col.type === 'number';
colNode.innerHTML = colNode.innerHTML + '<span class="sorter"></span>';
}
}
return cols;
}
// attaches a data attribute to every tr element with an object
// of data values keyed by column name
function loadRowData(tableRow) {
var tableCols = tableRow.querySelectorAll('td'),
colNode,
col,
data = {},
i,
val;
for (i = 0; i < tableCols.length; i += 1) {
colNode = tableCols[i];
col = cols[i];
val = colNode.getAttribute('data-value');
if (col.type === 'number') {
val = Number(val);
}
data[col.key] = val;
}
return data;
}
// loads all row data
function loadData() {
var rows = getTableBody().querySelectorAll('tr'),
i;
for (i = 0; i < rows.length; i += 1) {
rows[i].data = loadRowData(rows[i]);
}
}
// sorts the table using the data for the ith column
function sortByIndex(index, desc) {
var key = cols[index].key,
sorter = function (a, b) {
a = a.data[key];
b = b.data[key];
return a < b ? -1 : a > b ? 1 : 0;
},
finalSorter = sorter,
tableBody = document.querySelector('.coverage-summary tbody'),
rowNodes = tableBody.querySelectorAll('tr'),
rows = [],
i;
if (desc) {
finalSorter = function (a, b) {
return -1 * sorter(a, b);
};
}
for (i = 0; i < rowNodes.length; i += 1) {
rows.push(rowNodes[i]);
tableBody.removeChild(rowNodes[i]);
}
rows.sort(finalSorter);
for (i = 0; i < rows.length; i += 1) {
tableBody.appendChild(rows[i]);
}
}
// removes sort indicators for current column being sorted
function removeSortIndicators() {
var col = getNthColumn(currentSort.index),
cls = col.className;
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
col.className = cls;
}
// adds sort indicators for current column being sorted
function addSortIndicators() {
getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted';
}
// adds event listeners for all sorter widgets
function enableUI() {
var i,
el,
ithSorter = function ithSorter(i) {
var col = cols[i];
return function () {
var desc = col.defaultDescSort;
if (currentSort.index === i) {
desc = !currentSort.desc;
}
sortByIndex(i, desc);
removeSortIndicators();
currentSort.index = i;
currentSort.desc = desc;
addSortIndicators();
};
};
for (i =0 ; i < cols.length; i += 1) {
if (cols[i].sortable) {
// add the click event handler on the th so users
// dont have to click on those tiny arrows
el = getNthColumn(i).querySelector('.sorter').parentElement;
if (el.addEventListener) {
el.addEventListener('click', ithSorter(i));
} else {
el.attachEvent('onclick', ithSorter(i));
}
}
}
}
// adds sorting functionality to the UI
return function () {
if (!getTable()) {
return;
}
cols = loadColumns();
loadData(cols);
addSortIndicators();
enableUI();
};
})();
window.addEventListener('load', addSorting);

@ -0,0 +1,437 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/Camera.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../index.html">all files</a> / <a href="index.html">src/</a> Camera.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>34/34</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">50% </span>
<span class="quiet">Branches</span>
<span class='fraction'>1/2</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>9/9</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>34/34</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">62×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">62×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">145×</span>
<span class="cline-any cline-yes">145×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">145×</span>
<span class="cline-any cline-yes">145×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">145×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Node from './Node';
import Matrix4 from './math/Matrix4';
import Frustum from './math/Frustum';
import Ray from './math/Ray';
&nbsp;
import glMatrix from './dep/glmatrix';
var vec3 = glMatrix.vec3;
var vec4 = glMatrix.vec4;
&nbsp;
/**
* @constructor clay.Camera
* @extends clay.Node
*/
var Camera = Node.extend(function () {
return /** @lends clay.Camera# */ {
/**
* Camera projection matrix
* @type {clay.Matrix4}
*/
projectionMatrix: new Matrix4(),
&nbsp;
/**
* Inverse of camera projection matrix
* @type {clay.Matrix4}
*/
invProjectionMatrix: new Matrix4(),
&nbsp;
/**
* View matrix, equal to inverse of camera's world matrix
* @type {clay.Matrix4}
*/
viewMatrix: new Matrix4(),
&nbsp;
/**
* Camera frustum in view space
* @type {clay.Frustum}
*/
frustum: new Frustum()
};
}, function () {
this.update(true);
},
/** @lends clay.Camera.prototype */
{
&nbsp;
update: function (force) {
Node.prototype.update.call(this, force);
Matrix4.invert(this.viewMatrix, this.worldTransform);
&nbsp;
this.updateProjectionMatrix();
Matrix4.invert(this.invProjectionMatrix, this.projectionMatrix);
&nbsp;
this.frustum.setFromProjection(this.projectionMatrix);
},
&nbsp;
/**
* Set camera view matrix
*/
setViewMatrix: function (viewMatrix) {
Matrix4.copy(this.viewMatrix, viewMatrix);
Matrix4.invert(this.worldTransform, viewMatrix);
this.decomposeWorldTransform();
},
&nbsp;
/**
* Decompose camera projection matrix
*/
decomposeProjectionMatrix: function () {},
&nbsp;
/**
* Set camera projection matrix
* @param {clay.Matrix4} projectionMatrix
*/
setProjectionMatrix: function (projectionMatrix) {
Matrix4.copy(this.projectionMatrix, projectionMatrix);
Matrix4.invert(this.invProjectionMatrix, projectionMatrix);
this.decomposeProjectionMatrix();
},
/**
* Update projection matrix, called after update
*/
updateProjectionMatrix: function () {},
&nbsp;
/**
* Cast a picking ray from camera near plane to far plane
* @function
* @param {clay.Vector2} ndc
* @param {clay.Ray} [out]
* @return {clay.Ray}
*/
castRay: (function () {
var v4 = vec4.create();
return function (ndc, out) {
var ray = out !== undefined ? out : <span class="branch-1 cbranch-no" title="branch not covered" >new Ray();</span>
var x = ndc.array[0];
var y = ndc.array[1];
vec4.set(v4, x, y, -1, 1);
vec4.transformMat4(v4, v4, this.invProjectionMatrix.array);
vec4.transformMat4(v4, v4, this.worldTransform.array);
vec3.scale(ray.origin.array, v4, 1 / v4[3]);
&nbsp;
vec4.set(v4, x, y, 1, 1);
vec4.transformMat4(v4, v4, this.invProjectionMatrix.array);
vec4.transformMat4(v4, v4, this.worldTransform.array);
vec3.scale(v4, v4, 1 / v4[3]);
vec3.sub(ray.direction.array, v4, ray.origin.array);
&nbsp;
vec3.normalize(ray.direction.array, ray.direction.array);
ray.direction._dirty = true;
ray.origin._dirty = true;
&nbsp;
return ray;
};
})(),
&nbsp;
/**
* @function
* @name clone
* @return {clay.Camera}
* @memberOf clay.Camera.prototype
*/
});
&nbsp;
export default Camera;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,152 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/Joint.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../index.html">all files</a> / <a href="index.html">src/</a> Joint.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>1/1</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>1/1</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Base from './core/Base';
&nbsp;
/**
* @constructor clay.Joint
* @extends clay.core.Base
*/
var Joint = Base.extend(
/** @lends clay.Joint# */
{
// https://github.com/KhronosGroup/glTF/issues/193#issuecomment-29216576
/**
* Joint name
* @type {string}
*/
name: '',
/**
* Index of joint in the skeleton
* @type {number}
*/
index: -1,
&nbsp;
/**
* Scene node attached to
* @type {clay.Node}
*/
node: null
});
&nbsp;
export default Joint;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

@ -0,0 +1,266 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/Light.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../index.html">all files</a> / <a href="index.html">src/</a> Light.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">25% </span>
<span class="quiet">Statements</span>
<span class='fraction'>2/8</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">50% </span>
<span class="quiet">Functions</span>
<span class='fraction'>1/2</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">25% </span>
<span class="quiet">Lines</span>
<span class='fraction'>2/8</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">14×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Node from './Node';
&nbsp;
/**
* @constructor clay.Light
* @extends clay.Node
*/
var Light = Node.extend(function(){
return /** @lends clay.Light# */ {
/**
* Light RGB color
* @type {number[]}
*/
color: [1, 1, 1],
&nbsp;
/**
* Light intensity
* @type {number}
*/
intensity: 1.0,
&nbsp;
// Config for shadow map
/**
* If light cast shadow
* @type {boolean}
*/
castShadow: true,
&nbsp;
/**
* Shadow map size
* @type {number}
*/
shadowResolution: 512,
&nbsp;
/**
* Light group, shader with same `lightGroup` will be affected
*
* Only useful in forward rendering
* @type {number}
*/
group: 0
};
},
/** @lends clay.Light.prototype. */
{
/**
* Light type
* @type {string}
* @memberOf clay.Light#
*/
type: '',
&nbsp;
/**
* @return {clay.Light}
* @memberOf clay.Light.prototype
*/
clone: function() <span class="fstat-no" title="function not covered" >{</span>
var light = <span class="cstat-no" title="statement not covered" >Node.prototype.clone.call(this);</span>
<span class="cstat-no" title="statement not covered" > light.color = Array.prototype.slice.call(this.color);</span>
<span class="cstat-no" title="statement not covered" > light.intensity = this.intensity;</span>
<span class="cstat-no" title="statement not covered" > light.castShadow = this.castShadow;</span>
<span class="cstat-no" title="statement not covered" > light.shadowResolution = this.shadowResolution;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > return light;</span>
}
});
&nbsp;
export default Light;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,287 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/Mesh.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../index.html">all files</a> / <a href="index.html">src/</a> Mesh.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">91.3% </span>
<span class="quiet">Statements</span>
<span class='fraction'>21/23</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">33.33% </span>
<span class="quiet">Branches</span>
<span class='fraction'>3/9</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">75% </span>
<span class="quiet">Functions</span>
<span class='fraction'>3/4</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">91.3% </span>
<span class="quiet">Lines</span>
<span class='fraction'>21/23</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">32×</span>
<span class="cline-any cline-yes">32×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">249×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Renderable from './Renderable';
import glenum from './core/glenum';
import Texture2D from './Texture2D';
&nbsp;
/**
* @constructor clay.Mesh
* @extends clay.Renderable
*/
var Mesh = Renderable.extend(/** @lends clay.Mesh# */ {
/**
* Used when it is a skinned mesh
* @type {clay.Skeleton}
*/
skeleton: null,
/**
* Joints indices Meshes can share the one skeleton instance and each mesh can use one part of joints. Joints indices indicate the index of joint in the skeleton instance
* @type {number[]}
*/
joints: null,
&nbsp;
/**
* If store the skin matrices in vertex texture
* @type {bool}
*/
useSkinMatricesTexture: false
&nbsp;
}, function () {
<span class="missing-if-branch" title="else path not taken" >E</span>if (!this.joints) {
this.joints = [];
}
}, {
&nbsp;
isSkinnedMesh: function () {
return !!(this.skeleton &amp;&amp; <span class="branch-1 cbranch-no" title="branch not covered" >this.joints </span>&amp;&amp; <span class="branch-2 cbranch-no" title="branch not covered" >this.joints.length &gt; 0)</span>;
},
&nbsp;
getSkinMatricesTexture: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._skinMatricesTexture = this._skinMatricesTexture || new Texture2D({</span>
type: glenum.FLOAT,
minFilter: glenum.NEAREST,
magFilter: glenum.NEAREST,
useMipmap: false,
flipY: false
});
&nbsp;
<span class="cstat-no" title="statement not covered" > return this._skinMatricesTexture;</span>
},
&nbsp;
clone: function () {
var mesh = Renderable.prototype.clone.call(this);
mesh.skeleton = this.skeleton;
<span class="missing-if-branch" title="else path not taken" >E</span>if (this.joints) {
mesh.joints = this.joints.slice();
}
return mesh;
}
});
&nbsp;
// Enums
Mesh.POINTS = glenum.POINTS;
Mesh.LINES = glenum.LINES;
Mesh.LINE_LOOP = glenum.LINE_LOOP;
Mesh.LINE_STRIP = glenum.LINE_STRIP;
Mesh.TRIANGLES = glenum.TRIANGLES;
Mesh.TRIANGLE_STRIP = glenum.TRIANGLE_STRIP;
Mesh.TRIANGLE_FAN = glenum.TRIANGLE_FAN;
&nbsp;
Mesh.BACK = glenum.BACK;
Mesh.FRONT = glenum.FRONT;
Mesh.FRONT_AND_BACK = glenum.FRONT_AND_BACK;
Mesh.CW = glenum.CW;
Mesh.CCW = glenum.CCW;
&nbsp;
export default Mesh;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,695 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/Renderable.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../index.html">all files</a> / <a href="index.html">src/</a> Renderable.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">96.43% </span>
<span class="quiet">Statements</span>
<span class='fraction'>27/28</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">81.82% </span>
<span class="quiet">Branches</span>
<span class='fraction'>9/11</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>6/6</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">96.43% </span>
<span class="quiet">Lines</span>
<span class='fraction'>27/28</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">45×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">12×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Node from './Node';
import glenum from './core/glenum';
&nbsp;
/**
* @constructor
* @alias clay.Renderable
* @extends clay.Node
*/
var Renderable = Node.extend(/** @lends clay.Renderable# */ {
/**
* @type {clay.Material}
*/
material: null,
&nbsp;
/**
* @type {clay.Geometry}
*/
geometry: null,
&nbsp;
/**
* @type {number}
*/
mode: glenum.TRIANGLES,
&nbsp;
_renderInfo: null
},
/** @lends clay.Renderable.prototype */
{
&nbsp;
__program: null,
&nbsp;
/**
* Group of received light.
*/
lightGroup: 0,
/**
* Render order, Nodes with smaller value renders before nodes with larger values.
* @type {Number}
*/
renderOrder: 0,
/**
* Used when mode is LINES, LINE_STRIP or LINE_LOOP
* @type {number}
*/
lineWidth: 1,
&nbsp;
/**
* If enable culling
* @type {boolean}
*/
culling: true,
/**
* Specify which side of polygon will be culled.
* Possible values:
* + {@link clay.Renderable.BACK}
* + {@link clay.Renderable.FRONT}
* + {@link clay.Renderable.FRONT_AND_BACK}
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/cullFace
* @type {number}
*/
cullFace: glenum.BACK,
/**
* Specify which side is front face.
* Possible values:
* + {@link clay.Renderable.CW}
* + {@link clay.Renderable.CCW}
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/frontFace
* @type {number}
*/
frontFace: glenum.CCW,
&nbsp;
/**
* If enable software frustum culling
* @type {boolean}
*/
frustumCulling: true,
/**
* @type {boolean}
*/
receiveShadow: true,
/**
* @type {boolean}
*/
castShadow: true,
/**
* @type {boolean}
*/
ignorePicking: false,
/**
* @type {boolean}
*/
ignorePreZ: false,
&nbsp;
/**
* @type {boolean}
*/
ignoreGBuffer: false,
&nbsp;
/**
* @return {boolean}
*/
isRenderable: function() {
// TODO Shader ?
return this.geometry &amp;&amp; this.material &amp;&amp; this.material.shader &amp;&amp; !this.invisible
&amp;&amp; this.geometry.vertexCount &gt; 0;
},
&nbsp;
/**
* Before render hook
* @type {Function}
*/
beforeRender: function (_gl) {},
&nbsp;
/**
* Before render hook
* @type {Function}
*/
afterRender: function (_gl, renderStat) {},
&nbsp;
getBoundingBox: function (filter, out) {
out = Node.prototype.getBoundingBox.call(this, filter, out);
<span class="missing-if-branch" title="else path not taken" >E</span>if (this.geometry &amp;&amp; this.geometry.boundingBox) {
out.union(this.geometry.boundingBox);
}
&nbsp;
return out;
},
&nbsp;
/**
* Clone a new renderable
* @function
* @return {clay.Renderable}
*/
clone: (function() {
var properties = [
'castShadow', 'receiveShadow',
'mode', 'culling', 'cullFace', 'frontFace',
'frustumCulling',
'renderOrder', 'lineWidth',
'ignorePicking', 'ignorePreZ', 'ignoreGBuffer'
];
return function() {
var renderable = Node.prototype.clone.call(this);
&nbsp;
renderable.geometry = this.geometry;
renderable.material = this.material;
&nbsp;
for (var i = 0; i &lt; properties.length; i++) {
var name = properties[i];
// Try not to overwrite the prototype property
<span class="missing-if-branch" title="if path not taken" >I</span>if (renderable[name] !== this[name]) {
<span class="cstat-no" title="statement not covered" > renderable[name] = this[name];</span>
}
}
&nbsp;
return renderable;
};
})()
});
&nbsp;
/**
* @type {number}
*/
Renderable.POINTS = glenum.POINTS;
/**
* @type {number}
*/
Renderable.LINES = glenum.LINES;
/**
* @type {number}
*/
Renderable.LINE_LOOP = glenum.LINE_LOOP;
/**
* @type {number}
*/
Renderable.LINE_STRIP = glenum.LINE_STRIP;
/**
* @type {number}
*/
Renderable.TRIANGLES = glenum.TRIANGLES;
/**
* @type {number}
*/
Renderable.TRIANGLE_STRIP = glenum.TRIANGLE_STRIP;
/**
* @type {number}
*/
Renderable.TRIANGLE_FAN = glenum.TRIANGLE_FAN;
/**
* @type {number}
*/
Renderable.BACK = glenum.BACK;
/**
* @type {number}
*/
Renderable.FRONT = glenum.FRONT;
/**
* @type {number}
*/
Renderable.FRONT_AND_BACK = glenum.FRONT_AND_BACK;
/**
* @type {number}
*/
Renderable.CW = glenum.CW;
/**
* @type {number}
*/
Renderable.CCW = glenum.CCW;
&nbsp;
export default Renderable;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,914 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/Skeleton.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../index.html">all files</a> / <a href="index.html">src/</a> Skeleton.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">5.71% </span>
<span class="quiet">Statements</span>
<span class='fraction'>6/105</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/32</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">7.14% </span>
<span class="quiet">Functions</span>
<span class='fraction'>1/14</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">5.71% </span>
<span class="quiet">Lines</span>
<span class='fraction'>6/105</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Base from './core/Base';
import Joint from './Joint';
&nbsp;
import glMatrix from './dep/glmatrix';
var quat = glMatrix.quat;
var vec3 = glMatrix.vec3;
var mat4 = glMatrix.mat4;
&nbsp;
/**
* @constructor clay.Skeleton
*/
var Skeleton = Base.extend(function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return /** @lends clay.Skeleton# */{</span>
&nbsp;
/**
* Relative root node that not affect transform of joint.
* @type {clay.Node}
*/
relativeRootNode: null,
/**
* @type {string}
*/
name: '',
&nbsp;
/**
* joints
* @type {Array.&lt;clay.Joint&gt;}
*/
joints: [],
&nbsp;
_clips: [],
&nbsp;
// Matrix to joint space (relative to root joint)
_invBindPoseMatricesArray: null,
&nbsp;
// Use subarray instead of copy back each time computing matrix
// http://jsperf.com/subarray-vs-copy-for-array-transform/5
_jointMatricesSubArrays: [],
&nbsp;
// jointMatrix * currentPoseMatrix
// worldTransform is relative to the root bone
// still in model space not world space
_skinMatricesArray: null,
&nbsp;
_skinMatricesSubArrays: [],
&nbsp;
_subSkinMatricesArray: {}
};
},
/** @lends clay.Skeleton.prototype */
{
&nbsp;
/**
* Add a skinning clip and create a map between clip and skeleton
* @param {clay.animation.SkinningClip} clip
* @param {Object} [mapRule] Map between joint name in skeleton and joint name in clip
*/
addClip: function (clip, mapRule) <span class="fstat-no" title="function not covered" >{</span>
// Clip have been exists in
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this._clips.length; i++) {</span>
<span class="cstat-no" title="statement not covered" > if (this._clips[i].clip === clip) {</span>
<span class="cstat-no" title="statement not covered" > return;</span>
}
}
// Map the joint index in skeleton to joint pose index in clip
var maps = <span class="cstat-no" title="statement not covered" >[];</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.joints.length; i++) {</span>
<span class="cstat-no" title="statement not covered" > maps[i] = -1;</span>
}
// Create avatar
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; clip.tracks.length; i++) {</span>
<span class="cstat-no" title="statement not covered" > for (var j = 0; j &lt; this.joints.length; j++) {</span>
var joint = <span class="cstat-no" title="statement not covered" >this.joints[j];</span>
var track = <span class="cstat-no" title="statement not covered" >clip.tracks[i];</span>
var jointName = <span class="cstat-no" title="statement not covered" >joint.name;</span>
<span class="cstat-no" title="statement not covered" > if (mapRule) {</span>
<span class="cstat-no" title="statement not covered" > jointName = mapRule[jointName];</span>
}
<span class="cstat-no" title="statement not covered" > if (track.name === jointName) {</span>
<span class="cstat-no" title="statement not covered" > maps[j] = i;</span>
<span class="cstat-no" title="statement not covered" > break;</span>
}
}
}
&nbsp;
<span class="cstat-no" title="statement not covered" > this._clips.push({</span>
maps: maps,
clip: clip
});
&nbsp;
<span class="cstat-no" title="statement not covered" > return this._clips.length - 1;</span>
},
&nbsp;
/**
* @param {clay.animation.SkinningClip} clip
*/
removeClip: function (clip) <span class="fstat-no" title="function not covered" >{</span>
var idx = <span class="cstat-no" title="statement not covered" >-1;</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this._clips.length; i++) {</span>
<span class="cstat-no" title="statement not covered" > if (this._clips[i].clip === clip) {</span>
<span class="cstat-no" title="statement not covered" > idx = i;</span>
<span class="cstat-no" title="statement not covered" > break;</span>
}
}
<span class="cstat-no" title="statement not covered" > if (idx &gt; 0) {</span>
<span class="cstat-no" title="statement not covered" > this._clips.splice(idx, 1);</span>
}
},
/**
* Remove all clips
*/
removeClipsAll: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._clips = [];</span>
},
&nbsp;
/**
* Get clip by index
* @param {number} index
*/
getClip: function (index) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (this._clips[index]) {</span>
<span class="cstat-no" title="statement not covered" > return this._clips[index].clip;</span>
}
},
&nbsp;
/**
* @return {number}
*/
getClipNumber: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return this._clips.length;</span>
},
&nbsp;
/**
* Calculate joint matrices from node transform
* @function
*/
updateJointMatrices: (function () {
&nbsp;
var m4 = mat4.create();
&nbsp;
return function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._invBindPoseMatricesArray = new Float32Array(this.joints.length * 16);</span>
<span class="cstat-no" title="statement not covered" > this._skinMatricesArray = new Float32Array(this.joints.length * 16);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.joints.length; i++) {</span>
var joint = <span class="cstat-no" title="statement not covered" >this.joints[i];</span>
<span class="cstat-no" title="statement not covered" > mat4.copy(m4, joint.node.worldTransform.array);</span>
<span class="cstat-no" title="statement not covered" > mat4.invert(m4, m4);</span>
&nbsp;
var offset = <span class="cstat-no" title="statement not covered" >i * 16;</span>
<span class="cstat-no" title="statement not covered" > for (var j = 0; j &lt; 16; j++) {</span>
<span class="cstat-no" title="statement not covered" > this._invBindPoseMatricesArray[offset + j] = m4[j];</span>
}
}
&nbsp;
<span class="cstat-no" title="statement not covered" > this.updateMatricesSubArrays();</span>
};
})(),
&nbsp;
setJointMatricesArray: function (arr) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._invBindPoseMatricesArray = arr;</span>
<span class="cstat-no" title="statement not covered" > this._skinMatricesArray = new Float32Array(arr.length);</span>
<span class="cstat-no" title="statement not covered" > this.updateMatricesSubArrays();</span>
},
&nbsp;
updateMatricesSubArrays: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.joints.length; i++) {</span>
<span class="cstat-no" title="statement not covered" > this._jointMatricesSubArrays[i] = this._invBindPoseMatricesArray.subarray(i * 16, (i+1) * 16);</span>
<span class="cstat-no" title="statement not covered" > this._skinMatricesSubArrays[i] = this._skinMatricesArray.subarray(i * 16, (i+1) * 16);</span>
}
},
&nbsp;
/**
* Update skinning matrices
*/
update: function () <span class="fstat-no" title="function not covered" >{</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this._setPose();</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.joints.length; i++) {</span>
var joint = <span class="cstat-no" title="statement not covered" >this.joints[i];</span>
<span class="cstat-no" title="statement not covered" > mat4.multiply(</span>
this._skinMatricesSubArrays[i],
joint.node.worldTransform.array,
this._jointMatricesSubArrays[i]
);
}
},
&nbsp;
getSubSkinMatrices: function (meshId, joints) <span class="fstat-no" title="function not covered" >{</span>
var subArray = <span class="cstat-no" title="statement not covered" >this._subSkinMatricesArray[meshId];</span>
<span class="cstat-no" title="statement not covered" > if (!subArray) {</span>
<span class="cstat-no" title="statement not covered" > subArray</span>
= this._subSkinMatricesArray[meshId]
= new Float32Array(joints.length * 16);
}
var cursor = <span class="cstat-no" title="statement not covered" >0;</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; joints.length; i++) {</span>
var idx = <span class="cstat-no" title="statement not covered" >joints[i];</span>
<span class="cstat-no" title="statement not covered" > for (var j = 0; j &lt; 16; j++) {</span>
<span class="cstat-no" title="statement not covered" > subArray[cursor++] = this._skinMatricesArray[idx * 16 + j];</span>
}
}
<span class="cstat-no" title="statement not covered" > return subArray;</span>
},
&nbsp;
_setPose: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (this._clips[0]) {</span>
var clip = <span class="cstat-no" title="statement not covered" >this._clips[0].clip;</span>
var maps = <span class="cstat-no" title="statement not covered" >this._clips[0].maps;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.joints.length; i++) {</span>
var joint = <span class="cstat-no" title="statement not covered" >this.joints[i];</span>
<span class="cstat-no" title="statement not covered" > if (maps[i] === -1) {</span>
<span class="cstat-no" title="statement not covered" > continue;</span>
}
var pose = <span class="cstat-no" title="statement not covered" >clip.tracks[maps[i]];</span>
&nbsp;
// Not update if there is no data.
// PENDING If sync pose.position, pose.rotation, pose.scale
<span class="cstat-no" title="statement not covered" > if (pose.channels.position) {</span>
<span class="cstat-no" title="statement not covered" > vec3.copy(joint.node.position.array, pose.position);</span>
}
<span class="cstat-no" title="statement not covered" > if (pose.channels.rotation) {</span>
<span class="cstat-no" title="statement not covered" > quat.copy(joint.node.rotation.array, pose.rotation);</span>
}
<span class="cstat-no" title="statement not covered" > if (pose.channels.scale) {</span>
<span class="cstat-no" title="statement not covered" > vec3.copy(joint.node.scale.array, pose.scale);</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > joint.node.position._dirty = true;</span>
<span class="cstat-no" title="statement not covered" > joint.node.rotation._dirty = true;</span>
<span class="cstat-no" title="statement not covered" > joint.node.scale._dirty = true;</span>
}
}
},
&nbsp;
clone: function (clonedNodesMap) <span class="fstat-no" title="function not covered" >{</span>
var skeleton = <span class="cstat-no" title="statement not covered" >new Skeleton();</span>
<span class="cstat-no" title="statement not covered" > skeleton.name = this.name;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.joints.length; i++) {</span>
var newJoint = <span class="cstat-no" title="statement not covered" >new Joint();</span>
var joint = <span class="cstat-no" title="statement not covered" >this.joints[i];</span>
<span class="cstat-no" title="statement not covered" > newJoint.name = joint.name;</span>
<span class="cstat-no" title="statement not covered" > newJoint.index = joint.index;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > if (clonedNodesMap) {</span>
var newNode = <span class="cstat-no" title="statement not covered" >clonedNodesMap[joint.node.__uid__];</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > if (!newNode) {</span>
// PENDING
<span class="cstat-no" title="statement not covered" > console.warn('Can\'t find node');</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > newJoint.node = newNode || joint.node;</span>
}
else {
<span class="cstat-no" title="statement not covered" > newJoint.node = joint.node;</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > skeleton.joints.push(newJoint);</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > if (this._invBindPoseMatricesArray) {</span>
var len = <span class="cstat-no" title="statement not covered" >this._invBindPoseMatricesArray.length;</span>
<span class="cstat-no" title="statement not covered" > skeleton._invBindPoseMatricesArray = new Float32Array(len);</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; len; i++) {</span>
<span class="cstat-no" title="statement not covered" > skeleton._invBindPoseMatricesArray[i] = this._invBindPoseMatricesArray[i];</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > skeleton._skinMatricesArray = new Float32Array(len);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > skeleton.updateMatricesSubArrays();</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > skeleton.update();</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > return skeleton;</span>
}
});
&nbsp;
export default Skeleton;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

@ -0,0 +1,935 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/StandardMaterial.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../index.html">all files</a> / <a href="index.html">src/</a> StandardMaterial.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">70.37% </span>
<span class="quiet">Statements</span>
<span class='fraction'>38/54</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">35% </span>
<span class="quiet">Branches</span>
<span class='fraction'>7/20</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">87.5% </span>
<span class="quiet">Functions</span>
<span class='fraction'>14/16</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">70.37% </span>
<span class="quiet">Lines</span>
<span class='fraction'>38/54</span>
</div>
</div>
</div>
<div class='status-line medium'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">6×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6×</span>
<span class="cline-any cline-yes">6×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">9×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">18×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">10×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">74×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">28×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">9×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">9×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">8×</span>
<span class="cline-any cline-yes">8×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">61×</span>
<span class="cline-any cline-yes">61×</span>
<span class="cline-any cline-yes">14×</span>
<span class="cline-any cline-yes">14×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">47×</span>
<span class="cline-any cline-yes">47×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Material from './Material';
&nbsp;
import Shader from './Shader';
import standardEssl from './shader/source/standard.glsl.js';
import util from './core/util';
&nbsp;
// Import standard shader
Shader['import'](standardEssl);
&nbsp;
var TEXTURE_PROPERTIES = ['diffuseMap', 'normalMap', 'roughnessMap', 'metalnessMap', 'emissiveMap', 'environmentMap', 'brdfLookup', 'ssaoMap', 'aoMap'];
var SIMPLE_PROPERTIES = ['color', 'emission', 'emissionIntensity', 'alpha', 'roughness', 'metalness', 'uvRepeat', 'uvOffset', 'aoIntensity', 'alphaCutoff'];
var PROPERTIES_CHANGE_SHADER = ['linear', 'encodeRGBM', 'decodeRGBM', 'doubleSided', 'alphaTest', 'roughnessChannel', 'metalnessChannel', 'environmentMapPrefiltered'];
&nbsp;
var NUM_DEFINE_MAP = {
'roughnessChannel': 'ROUGHNESS_CHANNEL',
'metalnessChannel': 'METALNESS_CHANNEL'
};
var BOOL_DEFINE_MAP = {
'linear': 'SRGB_DECODE',
'encodeRGBM': 'RGBM_ENCODE',
'decodeRGBM': 'RGBM_DECODE',
'doubleSided': 'DOUBLE_SIDED',
'alphaTest': 'ALPHA_TEST',
'environmentMapPrefiltered': 'ENVIRONMENTMAP_PREFILTER'
}
&nbsp;
&nbsp;
var standardShader;
/**
* Standard material without custom shader.
* @constructor clay.StandardMaterial
* @extends clay.Base
* @example
* var mat = new clay.StandardMaterial({
* color: [1, 1, 1],
* diffuseMap: diffuseTexture
* });
* mat.roughness = 1;
*/
var StandardMaterial = Material.extend(function () {
if (!standardShader) {
standardShader = new Shader(Shader.source('clay.standard.vertex'), Shader.source('clay.standard.fragment'));
}
return /** @lends clay.StandardMaterial# */ {
shader: standardShader
};
}, function (option) {
// PENDING
util.extend(this, option);
// Extend after shader is created.
util.defaults(this, /** @lends clay.StandardMaterial# */ {
/**
* @type {Array.&lt;number&gt;}
* @default [1, 1, 1]
*/
color: [1, 1, 1],
&nbsp;
/**
* @type {Array.&lt;number&gt;}
* @default [0, 0, 0]
*/
emission: [0, 0, 0],
&nbsp;
/**
* @type {number}
* @default 0
*/
emissionIntensity: 0,
&nbsp;
/**
* @type {number}
* @default 0.5
*/
roughness: 0.5,
&nbsp;
/**
* @type {number}
* @default 0
*/
metalness: 0,
&nbsp;
/**
* @type {number}
* @default 1
*/
alpha: 1,
&nbsp;
/**
* @type {boolean}
*/
alphaTest: false,
&nbsp;
/**
* Cutoff threshold for alpha test
* @type {number}
*/
alphaCutoff: 0.9,
&nbsp;
/**
* @type {boolean}
*/
// TODO Must disable culling.
doubleSided: false,
&nbsp;
/**
* @type {clay.Texture2D}
*/
&nbsp;
/**
* @type {clay.Texture2D}
*/
&nbsp;
/**
* @type {clay.Texture2D}
*/
&nbsp;
/**
* @type {clay.Texture2D}
*/
/**
* @type {clay.Texture2D}
*/
&nbsp;
/**
* @type {clay.TextureCube}
*/
&nbsp;
/**
* @type {clay.BoundingBox}
*/
&nbsp;
/**
* BRDF Lookup is generated by clay.util.cubemap.integrateBrdf
* @type {clay.Texture2D}
*/
&nbsp;
/**
* @type {clay.Texture2D}
*/
&nbsp;
/**
* @type {clay.Texture2D}
*/
&nbsp;
/**
* @type {Array.&lt;number&gt;}
* @default [1, 1]
*/
uvRepeat: [1, 1],
&nbsp;
/**
* @type {Array.&lt;number&gt;}
* @default [0, 0]
*/
uvOffset: [0, 0],
&nbsp;
/**
* @type {number}
* @default 1
*/
aoIntensity: 1,
&nbsp;
/**
* @type {boolean}
*/
environmentMapPrefiltered: false,
&nbsp;
/**
* @type {boolean}
*/
linear: false,
&nbsp;
/**
* @type {boolean}
*/
encodeRGBM: false,
&nbsp;
/**
* @type {boolean}
*/
decodeRGBM: false,
&nbsp;
/**
* @type {Number}
*/
roughnessChannel: 0,
/**
* @type {Number}
*/
metalnessChannel: 1
});
&nbsp;
this.define('fragment', 'USE_METALNESS');
this.define('fragment', 'USE_ROUGHNESS');
}, {
clone: function () {
var material = new StandardMaterial({
name: this.name
});
TEXTURE_PROPERTIES.forEach(function (propName) {
<span class="missing-if-branch" title="if path not taken" >I</span>if (this[propName]) {
<span class="cstat-no" title="statement not covered" > material[propName] = this[propName];</span>
}
}, this);
SIMPLE_PROPERTIES.concat(PROPERTIES_CHANGE_SHADER).forEach(function (propName) {
material[propName] = this[propName];
}, this);
return material;
}
});
&nbsp;
SIMPLE_PROPERTIES.forEach(function (propName) {
Object.defineProperty(StandardMaterial.prototype, propName, {
get: function () {
return this.get(propName);
},
set: function (value) {
this.setUniform(propName, value);
}
});
});
&nbsp;
TEXTURE_PROPERTIES.forEach(function (propName) {
Object.defineProperty(StandardMaterial.prototype, propName, {
get: function () {
return this.get(propName);
},
set: function (value) {
this.setUniform(propName, value);
}
});
});
&nbsp;
PROPERTIES_CHANGE_SHADER.forEach(function (propName) {
var privateKey = '_' + propName;
Object.defineProperty(StandardMaterial.prototype, propName, {
get: function () {
return this[privateKey];
},
set: function (value) {
this[privateKey] = value;
if (propName in NUM_DEFINE_MAP) {
var defineName = NUM_DEFINE_MAP[propName];
this.define('fragment', defineName, value);
}
else {
var defineName = BOOL_DEFINE_MAP[propName];
value ? this.define('fragment', defineName) : this.undefine('fragment', defineName);
}
}
});
});
&nbsp;
Object.defineProperty(StandardMaterial.prototype, 'environmentBox', {
get: function () <span class="fstat-no" title="function not covered" >{</span>
var envBox = <span class="cstat-no" title="statement not covered" >this._environmentBox;</span>
<span class="cstat-no" title="statement not covered" > if (envBox) {</span>
<span class="cstat-no" title="statement not covered" > envBox.min.setArray(this.get('environmentBoxMin'));</span>
<span class="cstat-no" title="statement not covered" > envBox.max.setArray(this.get('environmentBoxMax'));</span>
}
<span class="cstat-no" title="statement not covered" > return envBox;</span>
},
&nbsp;
set: function (value) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._environmentBox = value;</span>
&nbsp;
var uniforms = <span class="cstat-no" title="statement not covered" >this.uniforms = this.uniforms || {};</span>
<span class="cstat-no" title="statement not covered" > uniforms['environmentBoxMin'] = uniforms['environmentBoxMin'] || {</span>
value: null
};
<span class="cstat-no" title="statement not covered" > uniforms['environmentBoxMax'] = uniforms['environmentBoxMax'] || {</span>
value: null
};
&nbsp;
// TODO Can't detect operation like box.min = new Vector()
<span class="cstat-no" title="statement not covered" > if (value) {</span>
<span class="cstat-no" title="statement not covered" > this.setUniform('environmentBoxMin', value.min.array);</span>
<span class="cstat-no" title="statement not covered" > this.setUniform('environmentBoxMax', value.max.array);</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > if (value) {</span>
<span class="cstat-no" title="statement not covered" > this.define('fragment', 'PARALLAX_CORRECTED');</span>
}
else {
<span class="cstat-no" title="statement not covered" > this.undefine('fragment', 'PARALLAX_CORRECTED');</span>
}
}
});
&nbsp;
export default StandardMaterial;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

@ -0,0 +1,101 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/StaticGeometry.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../index.html">all files</a> / <a href="index.html">src/</a> StaticGeometry.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>1/1</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>1/1</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">/**
* StaticGeometry can not be changed once they've been setup
*/
import Geometry from './Geometry';
/**
* @constructor clay.StaticGeometry
* @extends clay.Geometry
*/
var StaticGeometry = Geometry.extend({
dynamic: false
});
export default StaticGeometry;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,755 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/Texture2D.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../index.html">all files</a> / <a href="index.html">src/</a> Texture2D.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">77.11% </span>
<span class="quiet">Statements</span>
<span class='fraction'>64/83</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">77.55% </span>
<span class="quiet">Branches</span>
<span class='fraction'>38/49</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">80% </span>
<span class="quiet">Functions</span>
<span class='fraction'>12/15</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">77.11% </span>
<span class="quiet">Lines</span>
<span class='fraction'>64/83</span>
</div>
</div>
</div>
<div class='status-line medium'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">11×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-yes">13×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12×</span>
<span class="cline-any cline-yes">12×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">57×</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">52×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">57×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">269×</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">264×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">25×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">25×</span>
<span class="cline-any cline-yes">24×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">25×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">219×</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">214×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">25×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">25×</span>
<span class="cline-any cline-yes">25×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">25×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Texture from './Texture';
import glenum from './core/glenum';
import mathUtil from './math/util';
var isPowerOfTwo = mathUtil.isPowerOfTwo;
&nbsp;
/**
* @constructor clay.Texture2D
* @extends clay.Texture
*
* @example
* ...
* var mat = new clay.Material({
* shader: clay.shader.library.get('clay.phong', 'diffuseMap')
* });
* var diffuseMap = new clay.Texture2D();
* diffuseMap.load('assets/textures/diffuse.jpg');
* mat.set('diffuseMap', diffuseMap);
* ...
* diffuseMap.success(function () {
* // Wait for the diffuse texture loaded
* animation.on('frame', function (frameTime) {
* renderer.render(scene, camera);
* });
* });
*/
var Texture2D = Texture.extend(function () {
return /** @lends clay.Texture2D# */ {
/**
* @type {?HTMLImageElement|HTMLCanvasElemnet}
*/
image: null,
/**
* Pixels data. Will be ignored if image is set.
* @type {?Uint8Array|Float32Array}
*/
pixels: null,
/**
* @type {Array.&lt;Object&gt;}
* @example
* [{
* image: mipmap0,
* pixels: null
* }, {
* image: mipmap1,
* pixels: null
* }, ....]
*/
mipmaps: []
};
}, {
&nbsp;
textureType: 'texture2D',
&nbsp;
update: function (renderer) {
&nbsp;
var _gl = renderer.gl;
_gl.bindTexture(_gl.TEXTURE_2D, this._cache.get('webgl_texture'));
&nbsp;
this.updateCommon(renderer);
&nbsp;
var glFormat = this.format;
var glType = this.type;
&nbsp;
_gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, this.getAvailableWrapS());
_gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, this.getAvailableWrapT());
&nbsp;
_gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, this.getAvailableMagFilter());
_gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, this.getAvailableMinFilter());
&nbsp;
var anisotropicExt = renderer.getGLExtension('EXT_texture_filter_anisotropic');
if (anisotropicExt &amp;&amp; this.anisotropic &gt; 1) {
_gl.texParameterf(_gl.TEXTURE_2D, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, this.anisotropic);
}
&nbsp;
// Fallback to float type if browser don't have half float extension
if (glType === 36193) {
var halfFloatExt = renderer.getGLExtension('OES_texture_half_float');
<span class="missing-if-branch" title="if path not taken" >I</span>if (!halfFloatExt) {
<span class="cstat-no" title="statement not covered" > glType = glenum.FLOAT;</span>
}
}
&nbsp;
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.mipmaps.length) {
var width = <span class="cstat-no" title="statement not covered" >this.width;</span>
var height = <span class="cstat-no" title="statement not covered" >this.height;</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.mipmaps.length; i++) {</span>
var mipmap = <span class="cstat-no" title="statement not covered" >this.mipmaps[i];</span>
<span class="cstat-no" title="statement not covered" > this._updateTextureData(_gl, mipmap, i, width, height, glFormat, glType);</span>
<span class="cstat-no" title="statement not covered" > width /= 2;</span>
<span class="cstat-no" title="statement not covered" > height /= 2;</span>
}
}
else {
this._updateTextureData(_gl, this, 0, this.width, this.height, glFormat, glType);
&nbsp;
if (this.useMipmap &amp;&amp; !this.NPOT) {
_gl.generateMipmap(_gl.TEXTURE_2D);
}
}
&nbsp;
_gl.bindTexture(_gl.TEXTURE_2D, null);
},
&nbsp;
_updateTextureData: function (_gl, data, level, width, height, glFormat, glType) {
if (data.image) {
_gl.texImage2D(_gl.TEXTURE_2D, level, glFormat, glFormat, glType, data.image);
}
else {
// Can be used as a blank texture when writing render to texture(RTT)
<span class="missing-if-branch" title="if path not taken" >I</span>if (
glFormat &lt;= Texture.COMPRESSED_RGBA_S3TC_DXT5_EXT
&amp;&amp; glFormat &gt;= Texture.COMPRESSED_RGB_S3TC_DXT1_EXT
) {
<span class="cstat-no" title="statement not covered" > _gl.compressedTexImage2D(_gl.TEXTURE_2D, level, glFormat, width, height, 0, data.pixels);</span>
}
else {
// Is a render target if pixels is null
_gl.texImage2D(_gl.TEXTURE_2D, level, glFormat, width, height, 0, glFormat, glType, data.pixels);
}
}
},
&nbsp;
/**
* @param {clay.Renderer} renderer
* @memberOf clay.Texture2D.prototype
*/
generateMipmap: function (renderer) <span class="fstat-no" title="function not covered" >{</span>
var _gl = <span class="cstat-no" title="statement not covered" >renderer.gl;</span>
<span class="cstat-no" title="statement not covered" > if (this.useMipmap &amp;&amp; !this.NPOT) {</span>
<span class="cstat-no" title="statement not covered" > _gl.bindTexture(_gl.TEXTURE_2D, this._cache.get('webgl_texture'));</span>
<span class="cstat-no" title="statement not covered" > _gl.generateMipmap(_gl.TEXTURE_2D);</span>
}
},
&nbsp;
isPowerOfTwo: function () {
var width;
var height;
if (this.image) {
width = this.image.width;
height = this.image.height;
}
else {
width = this.width;
height = this.height;
}
return isPowerOfTwo(width) &amp;&amp; isPowerOfTwo(height);
},
&nbsp;
isRenderable: function () {
if (this.image) {
return this.image.nodeName === 'CANVAS'
|| this.image.nodeName === 'VIDEO'
|| this.image.complete;
}
else {
return !!(this.width &amp;&amp; this.height);
}
},
&nbsp;
bind: function (renderer) {
renderer.gl.bindTexture(renderer.gl.TEXTURE_2D, this.getWebGLTexture(renderer));
},
&nbsp;
unbind: function (renderer) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > renderer.gl.bindTexture(renderer.gl.TEXTURE_2D, null);</span>
},
&nbsp;
load: function (src, crossOrigin) {
var image = new Image();
<span class="missing-if-branch" title="if path not taken" >I</span>if (crossOrigin) {
<span class="cstat-no" title="statement not covered" > image.crossOrigin = crossOrigin;</span>
}
var self = this;
image.onload = function () {
self.dirty();
self.trigger('success', self);
image.onload = null;
};
image.onerror = function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > self.trigger('error', self);</span>
<span class="cstat-no" title="statement not covered" > image.onerror = null;</span>
};
&nbsp;
image.src = src;
this.image = image;
&nbsp;
return this;
}
});
&nbsp;
Object.defineProperty(Texture2D.prototype, 'width', {
get: function () {
if (this.image) {
return this.image.width;
}
return this._width;
},
set: function (value) {
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.image) {
<span class="cstat-no" title="statement not covered" > console.warn('Texture from image can\'t set width');</span>
}
else {
if (this._width !== value) {
this.dirty();
}
this._width = value;
}
}
});
Object.defineProperty(Texture2D.prototype, 'height', {
get: function () {
if (this.image) {
return this.image.height;
}
return this._height;
},
set: function (value) {
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.image) {
<span class="cstat-no" title="statement not covered" > console.warn('Texture from image can\'t set height');</span>
}
else {
<span class="missing-if-branch" title="else path not taken" >E</span>if (this._height !== value) {
this.dirty();
}
this._height = value;
}
}
});
&nbsp;
export default Texture2D;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

@ -0,0 +1,884 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/TextureCube.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../index.html">all files</a> / <a href="index.html">src/</a> TextureCube.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">61.36% </span>
<span class="quiet">Statements</span>
<span class='fraction'>54/88</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">55.22% </span>
<span class="quiet">Branches</span>
<span class='fraction'>37/67</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">58.82% </span>
<span class="quiet">Functions</span>
<span class='fraction'>10/17</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">61.36% </span>
<span class="quiet">Lines</span>
<span class='fraction'>54/88</span>
</div>
</div>
</div>
<div class='status-line medium'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">7×</span>
<span class="cline-any cline-yes">7×</span>
<span class="cline-any cline-yes">7×</span>
<span class="cline-any cline-yes">7×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">10×</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">45×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">45×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">45×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">91×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">91×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">8×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">8×</span>
<span class="cline-any cline-yes">8×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">8×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">72×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">72×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">8×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">8×</span>
<span class="cline-any cline-yes">8×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">8×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Texture from './Texture';
import glenum from './core/glenum';
import util from './core/util';
import mathUtil from './math/util';
var isPowerOfTwo = mathUtil.isPowerOfTwo;
&nbsp;
var targetList = ['px', 'nx', 'py', 'ny', 'pz', 'nz'];
&nbsp;
/**
* @constructor clay.TextureCube
* @extends clay.Texture
*
* @example
* ...
* var mat = new clay.Material({
* shader: clay.shader.library.get('clay.phong', 'environmentMap')
* });
* var envMap = new clay.TextureCube();
* envMap.load({
* 'px': 'assets/textures/sky/px.jpg',
* 'nx': 'assets/textures/sky/nx.jpg'
* 'py': 'assets/textures/sky/py.jpg'
* 'ny': 'assets/textures/sky/ny.jpg'
* 'pz': 'assets/textures/sky/pz.jpg'
* 'nz': 'assets/textures/sky/nz.jpg'
* });
* mat.set('environmentMap', envMap);
* ...
* envMap.success(function () {
* // Wait for the sky texture loaded
* animation.on('frame', function (frameTime) {
* renderer.render(scene, camera);
* });
* });
*/
var TextureCube = Texture.extend(function () {
return /** @lends clay.TextureCube# */{
&nbsp;
/**
* @type {boolean}
* @default false
*/
// PENDING cubemap should not flipY in default.
// flipY: false,
&nbsp;
/**
* @type {Object}
* @property {?HTMLImageElement|HTMLCanvasElemnet} px
* @property {?HTMLImageElement|HTMLCanvasElemnet} nx
* @property {?HTMLImageElement|HTMLCanvasElemnet} py
* @property {?HTMLImageElement|HTMLCanvasElemnet} ny
* @property {?HTMLImageElement|HTMLCanvasElemnet} pz
* @property {?HTMLImageElement|HTMLCanvasElemnet} nz
*/
image: {
px: null,
nx: null,
py: null,
ny: null,
pz: null,
nz: null
},
/**
* Pixels data of each side. Will be ignored if images are set.
* @type {Object}
* @property {?Uint8Array} px
* @property {?Uint8Array} nx
* @property {?Uint8Array} py
* @property {?Uint8Array} ny
* @property {?Uint8Array} pz
* @property {?Uint8Array} nz
*/
pixels: {
px: null,
nx: null,
py: null,
ny: null,
pz: null,
nz: null
},
&nbsp;
/**
* @type {Array.&lt;Object&gt;}
*/
mipmaps: []
};
}, {
&nbsp;
textureType: 'textureCube',
&nbsp;
update: function (renderer) {
var _gl = renderer.gl;
_gl.bindTexture(_gl.TEXTURE_CUBE_MAP, this._cache.get('webgl_texture'));
&nbsp;
this.updateCommon(renderer);
&nbsp;
var glFormat = this.format;
var glType = this.type;
&nbsp;
_gl.texParameteri(_gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_WRAP_S, this.getAvailableWrapS());
_gl.texParameteri(_gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_WRAP_T, this.getAvailableWrapT());
&nbsp;
_gl.texParameteri(_gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_MAG_FILTER, this.getAvailableMagFilter());
_gl.texParameteri(_gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_MIN_FILTER, this.getAvailableMinFilter());
&nbsp;
var anisotropicExt = renderer.getGLExtension('EXT_texture_filter_anisotropic');
<span class="missing-if-branch" title="if path not taken" >I</span>if (anisotropicExt &amp;&amp; this.anisotropic &gt; 1) {
<span class="cstat-no" title="statement not covered" > _gl.texParameterf(_gl.TEXTURE_CUBE_MAP, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, this.anisotropic);</span>
}
&nbsp;
// Fallback to float type if browser don't have half float extension
if (glType === 36193) {
var halfFloatExt = renderer.getGLExtension('OES_texture_half_float');
<span class="missing-if-branch" title="if path not taken" >I</span>if (!halfFloatExt) {
<span class="cstat-no" title="statement not covered" > glType = glenum.FLOAT;</span>
}
}
&nbsp;
if (this.mipmaps.length) {
var width = this.width;
var height = this.height;
for (var i = 0; i &lt; this.mipmaps.length; i++) {
var mipmap = this.mipmaps[i];
this._updateTextureData(_gl, mipmap, i, width, height, glFormat, glType);
width /= 2;
height /= 2;
}
}
else {
this._updateTextureData(_gl, this, 0, this.width, this.height, glFormat, glType);
&nbsp;
if (!this.NPOT &amp;&amp; this.useMipmap) {
_gl.generateMipmap(_gl.TEXTURE_CUBE_MAP);
}
}
&nbsp;
_gl.bindTexture(_gl.TEXTURE_CUBE_MAP, null);
},
&nbsp;
_updateTextureData: function (_gl, data, level, width, height, glFormat, glType) {
for (var i = 0; i &lt; 6; i++) {
var target = targetList[i];
var img = data.image &amp;&amp; data.image[target];
<span class="missing-if-branch" title="if path not taken" >I</span>if (img) {
<span class="cstat-no" title="statement not covered" > _gl.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level, glFormat, glFormat, glType, img);</span>
}
else {
_gl.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level, glFormat, width, height, 0, glFormat, glType, data.pixels &amp;&amp; data.pixels[target]);
}
}
},
&nbsp;
/**
* @param {clay.Renderer} renderer
* @memberOf clay.TextureCube.prototype
*/
generateMipmap: function (renderer) <span class="fstat-no" title="function not covered" >{</span>
var _gl = <span class="cstat-no" title="statement not covered" >renderer.gl;</span>
<span class="cstat-no" title="statement not covered" > if (this.useMipmap &amp;&amp; !this.NPOT) {</span>
<span class="cstat-no" title="statement not covered" > _gl.bindTexture(_gl.TEXTURE_CUBE_MAP, this._cache.get('webgl_texture'));</span>
<span class="cstat-no" title="statement not covered" > _gl.generateMipmap(_gl.TEXTURE_CUBE_MAP);</span>
}
},
&nbsp;
bind: function (renderer) {
renderer.gl.bindTexture(renderer.gl.TEXTURE_CUBE_MAP, this.getWebGLTexture(renderer));
},
&nbsp;
unbind: function (renderer) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > renderer.gl.bindTexture(renderer.gl.TEXTURE_CUBE_MAP, null);</span>
},
&nbsp;
// Overwrite the isPowerOfTwo method
isPowerOfTwo: function () {
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.image.px) {
<span class="cstat-no" title="statement not covered" > return isPowerOfTwo(this.image.px.width)</span>
&amp;&amp; isPowerOfTwo(this.image.px.height);
}
else {
return isPowerOfTwo(this.width)
&amp;&amp; isPowerOfTwo(this.height);
}
},
&nbsp;
isRenderable: function () {
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.image.px) {
<span class="cstat-no" title="statement not covered" > return isImageRenderable(this.image.px)</span>
&amp;&amp; isImageRenderable(this.image.nx)
&amp;&amp; isImageRenderable(this.image.py)
&amp;&amp; isImageRenderable(this.image.ny)
&amp;&amp; isImageRenderable(this.image.pz)
&amp;&amp; isImageRenderable(this.image.nz);
}
else {
return !!(this.width &amp;&amp; this.height);
}
},
&nbsp;
load: function (imageList, crossOrigin) <span class="fstat-no" title="function not covered" >{</span>
var loading = <span class="cstat-no" title="statement not covered" >0;</span>
var self = <span class="cstat-no" title="statement not covered" >this;</span>
<span class="cstat-no" title="statement not covered" > util.each(imageList, function (src, target)<span class="fstat-no" title="function not covered" >{</span></span>
var image = <span class="cstat-no" title="statement not covered" >new Image();</span>
<span class="cstat-no" title="statement not covered" > if (crossOrigin) {</span>
<span class="cstat-no" title="statement not covered" > image.crossOrigin = crossOrigin;</span>
}
<span class="cstat-no" title="statement not covered" > image.onload = function () <span class="fstat-no" title="function not covered" >{</span></span>
<span class="cstat-no" title="statement not covered" > loading --;</span>
<span class="cstat-no" title="statement not covered" > if (loading === 0){</span>
<span class="cstat-no" title="statement not covered" > self.dirty();</span>
<span class="cstat-no" title="statement not covered" > self.trigger('success', self);</span>
}
<span class="cstat-no" title="statement not covered" > image.onload = null;</span>
};
<span class="cstat-no" title="statement not covered" > image.onerror = function () <span class="fstat-no" title="function not covered" >{</span></span>
<span class="cstat-no" title="statement not covered" > loading --;</span>
<span class="cstat-no" title="statement not covered" > image.onerror = null;</span>
};
&nbsp;
<span class="cstat-no" title="statement not covered" > loading++;</span>
<span class="cstat-no" title="statement not covered" > image.src = src;</span>
<span class="cstat-no" title="statement not covered" > self.image[target] = image;</span>
});
&nbsp;
<span class="cstat-no" title="statement not covered" > return this;</span>
}
});
&nbsp;
Object.defineProperty(TextureCube.prototype, 'width', {
get: function () {
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.image &amp;&amp; this.image.px) {
<span class="cstat-no" title="statement not covered" > return this.image.px.width;</span>
}
return this._width;
},
set: function (value) {
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.image &amp;&amp; this.image.px) {
<span class="cstat-no" title="statement not covered" > console.warn('Texture from image can\'t set width');</span>
}
else {
<span class="missing-if-branch" title="else path not taken" >E</span>if (this._width !== value) {
this.dirty();
}
this._width = value;
}
}
});
Object.defineProperty(TextureCube.prototype, 'height', {
get: function () {
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.image &amp;&amp; this.image.px) {
<span class="cstat-no" title="statement not covered" > return this.image.px.height;</span>
}
return this._height;
},
set: function (value) {
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.image &amp;&amp; this.image.px) {
<span class="cstat-no" title="statement not covered" > console.warn('Texture from image can\'t set height');</span>
}
else {
<span class="missing-if-branch" title="else path not taken" >E</span>if (this._height !== value) {
this.dirty();
}
this._height = value;
}
}
});
function isImageRenderable(image) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return image.nodeName === 'CANVAS' ||</span>
image.nodeName === 'VIDEO' ||
image.complete;
}
&nbsp;
export default TextureCube;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

@ -0,0 +1,740 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/Timeline.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../index.html">all files</a> / <a href="index.html">src/</a> Timeline.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">78.13% </span>
<span class="quiet">Statements</span>
<span class='fraction'>50/64</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">58.62% </span>
<span class="quiet">Branches</span>
<span class='fraction'>17/29</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">64.29% </span>
<span class="quiet">Functions</span>
<span class='fraction'>9/14</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">78.13% </span>
<span class="quiet">Lines</span>
<span class='fraction'>50/64</span>
</div>
</div>
</div>
<div class='status-line medium'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">38×</span>
<span class="cline-any cline-yes">38×</span>
<span class="cline-any cline-yes">38×</span>
<span class="cline-any cline-yes">38×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">38×</span>
<span class="cline-any cline-yes">38×</span>
<span class="cline-any cline-yes">38×</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">38×</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">57×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">38×</span>
<span class="cline-any cline-yes">38×</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">38×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">38×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">38×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">46×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">44×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">44×</span>
<span class="cline-any cline-yes">38×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Base from './core/Base';
import Animator from './animation/Animator';
&nbsp;
var g = typeof window === 'undefined' ? <span class="branch-0 cbranch-no" title="branch not covered" >global </span>: window;
&nbsp;
var requestAnimationFrame = g.requestAnimationFrame
|| <span class="branch-1 cbranch-no" title="branch not covered" >g.msRequestAnimationFrame</span>
|| <span class="branch-2 cbranch-no" title="branch not covered" >g.mozRequestAnimationFrame</span>
|| <span class="branch-3 cbranch-no" title="branch not covered" >g.webkitRequestAnimationFrame</span>
|| <span class="branch-4 cbranch-no" title="branch not covered" >function (func)<span class="fstat-no" title="function not covered" >{ <span class="cstat-no" title="statement not covered" >setTimeout(func, 16); </span>};</span></span>
&nbsp;
/**
* Animation is global timeline that schedule all clips. each frame animation will set the time of clips to current and update the states of clips
* @constructor clay.Timeline
* @extends clay.core.Base
*
* @example
* var animation = new clay.Timeline();
* var node = new clay.Node();
* animation.animate(node.position)
* .when(1000, {
* x: 500,
* y: 500
* })
* .when(2000, {
* x: 100,
* y: 100
* })
* .when(3000, {
* z: 10
* })
* .start('spline');
*/
var Timeline = Base.extend(function () {
return /** @lends clay.Timeline# */{
/**
* stage is an object with render method, each frame if there exists any animating clips, stage.render will be called
* @type {Object}
*/
stage: null,
&nbsp;
_clips: [],
&nbsp;
_running: false,
&nbsp;
_time: 0,
&nbsp;
_paused: false,
&nbsp;
_pausedTime: 0
};
},
/** @lends clay.Timeline.prototype */
{
&nbsp;
/**
* Add animator
* @param {clay.animate.Animator} animator
*/
addAnimator: function (animator) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > animator.animation = this;</span>
var clips = <span class="cstat-no" title="statement not covered" >animator.getClips();</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; clips.length; i++) {</span>
<span class="cstat-no" title="statement not covered" > this.addClip(clips[i]);</span>
}
},
&nbsp;
/**
* @param {clay.animation.Clip} clip
*/
addClip: function (clip) {
<span class="missing-if-branch" title="else path not taken" >E</span>if (this._clips.indexOf(clip) &lt; 0) {
this._clips.push(clip);
}
},
&nbsp;
/**
* @param {clay.animation.Clip} clip
*/
removeClip: function (clip) <span class="fstat-no" title="function not covered" >{</span>
var idx = <span class="cstat-no" title="statement not covered" >this._clips.indexOf(clip);</span>
<span class="cstat-no" title="statement not covered" > if (idx &gt;= 0) {</span>
<span class="cstat-no" title="statement not covered" > this._clips.splice(idx, 1);</span>
}
},
&nbsp;
/**
* Remove animator
* @param {clay.animate.Animator} animator
*/
removeAnimator: function (animator) <span class="fstat-no" title="function not covered" >{</span>
var clips = <span class="cstat-no" title="statement not covered" >animator.getClips();</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; clips.length; i++) {</span>
<span class="cstat-no" title="statement not covered" > this.removeClip(clips[i]);</span>
}
<span class="cstat-no" title="statement not covered" > animator.animation = null;</span>
},
&nbsp;
_update: function () {
&nbsp;
var time = Date.now() - this._pausedTime;
var delta = time - this._time;
var clips = this._clips;
var len = clips.length;
&nbsp;
var deferredEvents = [];
var deferredClips = [];
for (var i = 0; i &lt; len; i++) {
var clip = clips[i];
var e = clip.step(time, delta, false);
// Throw out the events need to be called after
// stage.render, like finish
if (e) {
deferredEvents.push(e);
deferredClips.push(clip);
}
}
&nbsp;
// Remove the finished clip
for (var i = 0; i &lt; len;) {
if (clips[i]._needsRemove) {
clips[i] = clips[len-1];
clips.pop();
len--;
} else {
i++;
}
}
&nbsp;
len = deferredEvents.length;
for (var i = 0; i &lt; len; i++) {
deferredClips[i].fire(deferredEvents[i]);
}
&nbsp;
this._time = time;
&nbsp;
this.trigger('frame', delta);
&nbsp;
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.stage &amp;&amp; <span class="branch-1 cbranch-no" title="branch not covered" >this.stage.render)</span> {
<span class="cstat-no" title="statement not covered" > this.stage.render();</span>
}
},
/**
* Start running animation
*/
start: function () {
var self = this;
&nbsp;
this._running = true;
this._time = Date.now();
&nbsp;
this._pausedTime = 0;
&nbsp;
function step() {
if (self._running) {
&nbsp;
requestAnimationFrame(step);
&nbsp;
if (!self._paused) {
self._update();
}
}
}
&nbsp;
requestAnimationFrame(step);
&nbsp;
},
/**
* Stop running animation
*/
stop: function () {
this._running = false;
},
&nbsp;
/**
* Pause
*/
pause: function () {
<span class="missing-if-branch" title="else path not taken" >E</span>if (!this._paused) {
this._pauseStart = Date.now();
this._paused = true;
}
},
&nbsp;
/**
* Resume
*/
resume: function () {
<span class="missing-if-branch" title="else path not taken" >E</span>if (this._paused) {
this._pausedTime += Date.now() - this._pauseStart;
this._paused = false;
}
},
&nbsp;
/**
* Remove all clips
*/
removeClipsAll: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._clips = [];</span>
},
/**
* Create an animator
* @param {Object} target
* @param {Object} [options]
* @param {boolean} [options.loop]
* @param {Function} [options.getter]
* @param {Function} [options.setter]
* @param {Function} [options.interpolater]
* @return {clay.animation.Animator}
*/
animate: function (target, options) {
options = options || {};
var animator = new Animator(
target,
options.loop,
options.getter,
options.setter,
options.interpolater
);
animator.animation = this;
return animator;
}
});
&nbsp;
export default Timeline;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,641 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/animation/Blend1DClip.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/animation/</a> Blend1DClip.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">10.98% </span>
<span class="quiet">Statements</span>
<span class='fraction'>9/82</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/46</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/7</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">10.98% </span>
<span class="quiet">Lines</span>
<span class='fraction'>9/82</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">// 1D Blend clip of blend tree
// http://docs.unity3d.com/Documentation/Manual/1DBlending.html
&nbsp;
import Clip from './Clip';
&nbsp;
var clipSortFunc = function (a, b) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return a.position &lt; b.position;</span>
};
&nbsp;
/**
* @typedef {Object} clay.animation.Blend1DClip.IClipInput
* @property {number} position
* @property {clay.animation.Clip} clip
* @property {number} offset
*/
&nbsp;
/**
* 1d blending node in animation blend tree.
* output clip must have blend1D and copy method
* @constructor
* @alias clay.animation.Blend1DClip
* @extends clay.animation.Clip
*
* @param {Object} [opts]
* @param {string} [opts.name]
* @param {Object} [opts.target]
* @param {number} [opts.life]
* @param {number} [opts.delay]
* @param {number} [opts.gap]
* @param {number} [opts.playbackRatio]
* @param {boolean|number} [opts.loop] If loop is a number, it indicate the loop count of animation
* @param {string|Function} [opts.easing]
* @param {Function} [opts.onframe]
* @param {Function} [opts.onfinish]
* @param {Function} [opts.onrestart]
* @param {object[]} [opts.inputs]
* @param {number} [opts.position]
* @param {clay.animation.Clip} [opts.output]
*/
var Blend1DClip = function (opts) <span class="fstat-no" title="function not covered" >{</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > opts = opts || {};</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > Clip.call(this, opts);</span>
/**
* Output clip must have blend1D and copy method
* @type {clay.animation.Clip}
*/
<span class="cstat-no" title="statement not covered" > this.output = opts.output || null;</span>
/**
* @type {clay.animation.Blend1DClip.IClipInput[]}
*/
<span class="cstat-no" title="statement not covered" > this.inputs = opts.inputs || [];</span>
/**
* @type {number}
*/
<span class="cstat-no" title="statement not covered" > this.position = 0;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this._cacheKey = 0;</span>
<span class="cstat-no" title="statement not covered" > this._cachePosition = -Infinity;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this.inputs.sort(clipSortFunc);</span>
};
&nbsp;
Blend1DClip.prototype = new Clip();
Blend1DClip.prototype.constructor = Blend1DClip;
&nbsp;
/**
* @param {number} position
* @param {clay.animation.Clip} inputClip
* @param {number} [offset]
* @return {clay.animation.Blend1DClip.IClipInput}
*/
Blend1DClip.prototype.addInput = function (position, inputClip, offset) <span class="fstat-no" title="function not covered" >{</span>
var obj = <span class="cstat-no" title="statement not covered" >{</span>
position: position,
clip: inputClip,
offset: offset || 0
};
<span class="cstat-no" title="statement not covered" > this.life = Math.max(inputClip.life, this.life);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > if (!this.inputs.length) {</span>
<span class="cstat-no" title="statement not covered" > this.inputs.push(obj);</span>
<span class="cstat-no" title="statement not covered" > return obj;</span>
}
var len = <span class="cstat-no" title="statement not covered" >this.inputs.length;</span>
<span class="cstat-no" title="statement not covered" > if (this.inputs[0].position &gt; position) {</span>
<span class="cstat-no" title="statement not covered" > this.inputs.unshift(obj);</span>
} else <span class="cstat-no" title="statement not covered" >if (this.inputs[len - 1].position &lt;= position) {</span>
<span class="cstat-no" title="statement not covered" > this.inputs.push(obj);</span>
} else {
var key = <span class="cstat-no" title="statement not covered" >this._findKey(position);</span>
<span class="cstat-no" title="statement not covered" > this.inputs.splice(key, obj);</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > return obj;</span>
};
&nbsp;
Blend1DClip.prototype.step = function (time, dTime, silent) <span class="fstat-no" title="function not covered" >{</span>
&nbsp;
var ret = <span class="cstat-no" title="statement not covered" >Clip.prototype.step.call(this, time);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > if (ret !== 'finish') {</span>
<span class="cstat-no" title="statement not covered" > this.setTime(this.getElapsedTime());</span>
}
&nbsp;
// PENDING Schedule
<span class="cstat-no" title="statement not covered" > if (!silent &amp;&amp; ret !== 'paused') {</span>
<span class="cstat-no" title="statement not covered" > this.fire('frame');</span>
}
<span class="cstat-no" title="statement not covered" > return ret;</span>
};
&nbsp;
Blend1DClip.prototype.setTime = function (time) <span class="fstat-no" title="function not covered" >{</span>
var position = <span class="cstat-no" title="statement not covered" >this.position;</span>
var inputs = <span class="cstat-no" title="statement not covered" >this.inputs;</span>
var len = <span class="cstat-no" title="statement not covered" >inputs.length;</span>
var min = <span class="cstat-no" title="statement not covered" >inputs[0].position;</span>
var max = <span class="cstat-no" title="statement not covered" >inputs[len-1].position;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > if (position &lt;= min || position &gt;= max) {</span>
var in0 = <span class="cstat-no" title="statement not covered" >position &lt;= min ? inputs[0] : inputs[len-1];</span>
var clip = <span class="cstat-no" title="statement not covered" >in0.clip;</span>
var offset = <span class="cstat-no" title="statement not covered" >in0.offset;</span>
<span class="cstat-no" title="statement not covered" > clip.setTime((time + offset) % clip.life);</span>
// Input clip is a blend clip
// PENDING
<span class="cstat-no" title="statement not covered" > if (clip.output instanceof Clip) {</span>
<span class="cstat-no" title="statement not covered" > this.output.copy(clip.output);</span>
} else {
<span class="cstat-no" title="statement not covered" > this.output.copy(clip);</span>
}
} else {
var key = <span class="cstat-no" title="statement not covered" >this._findKey(position);</span>
var in1 = <span class="cstat-no" title="statement not covered" >inputs[key];</span>
var in2 = <span class="cstat-no" title="statement not covered" >inputs[key + 1];</span>
var clip1 = <span class="cstat-no" title="statement not covered" >in1.clip;</span>
var clip2 = <span class="cstat-no" title="statement not covered" >in2.clip;</span>
// Set time on input clips
<span class="cstat-no" title="statement not covered" > clip1.setTime((time + in1.offset) % clip1.life);</span>
<span class="cstat-no" title="statement not covered" > clip2.setTime((time + in2.offset) % clip2.life);</span>
&nbsp;
var w = <span class="cstat-no" title="statement not covered" >(this.position - in1.position) / (in2.position - in1.position);</span>
&nbsp;
var c1 = <span class="cstat-no" title="statement not covered" >clip1.output instanceof Clip ? clip1.output : clip1;</span>
var c2 = <span class="cstat-no" title="statement not covered" >clip2.output instanceof Clip ? clip2.output : clip2;</span>
<span class="cstat-no" title="statement not covered" > this.output.blend1D(c1, c2, w);</span>
}
};
&nbsp;
/**
* Clone a new Blend1D clip
* @param {boolean} cloneInputs True if clone the input clips
* @return {clay.animation.Blend1DClip}
*/
Blend1DClip.prototype.clone = function (cloneInputs) <span class="fstat-no" title="function not covered" >{</span>
var clip = <span class="cstat-no" title="statement not covered" >Clip.prototype.clone.call(this);</span>
<span class="cstat-no" title="statement not covered" > clip.output = this.output.clone();</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.inputs.length; i++) {</span>
var inputClip = <span class="cstat-no" title="statement not covered" >cloneInputs ? this.inputs[i].clip.clone(true) : this.inputs[i].clip;</span>
<span class="cstat-no" title="statement not covered" > clip.addInput(this.inputs[i].position, inputClip, this.inputs[i].offset);</span>
}
<span class="cstat-no" title="statement not covered" > return clip;</span>
};
&nbsp;
// Find the key where position in range [inputs[key].position, inputs[key+1].position)
Blend1DClip.prototype._findKey = function (position) <span class="fstat-no" title="function not covered" >{</span>
var key = <span class="cstat-no" title="statement not covered" >-1;</span>
var inputs = <span class="cstat-no" title="statement not covered" >this.inputs;</span>
var len = <span class="cstat-no" title="statement not covered" >inputs.length;</span>
<span class="cstat-no" title="statement not covered" > if (this._cachePosition &lt; position) {</span>
<span class="cstat-no" title="statement not covered" > for (var i = this._cacheKey; i &lt; len-1; i++) {</span>
<span class="cstat-no" title="statement not covered" > if (position &gt;= inputs[i].position &amp;&amp; position &lt; inputs[i+1].position) {</span>
<span class="cstat-no" title="statement not covered" > key = i;</span>
}
}
} else {
var s = <span class="cstat-no" title="statement not covered" >Math.min(len-2, this._cacheKey);</span>
<span class="cstat-no" title="statement not covered" > for (var i = s; i &gt;= 0; i--) {</span>
<span class="cstat-no" title="statement not covered" > if (position &gt;= inputs[i].position &amp;&amp; position &lt; inputs[i+1].position) {</span>
<span class="cstat-no" title="statement not covered" > key = i;</span>
}
}
}
<span class="cstat-no" title="statement not covered" > if (key &gt;= 0) {</span>
<span class="cstat-no" title="statement not covered" > this._cacheKey = key;</span>
<span class="cstat-no" title="statement not covered" > this._cachePosition = position;</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > return key;</span>
};
&nbsp;
export default Blend1DClip;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,569 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/animation/Blend2DClip.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/animation/</a> Blend2DClip.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">13.64% </span>
<span class="quiet">Statements</span>
<span class='fraction'>9/66</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/30</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/8</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">13.64% </span>
<span class="quiet">Lines</span>
<span class='fraction'>9/66</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">// 2D Blend clip of blend tree
// http://docs.unity3d.com/Documentation/Manual/2DBlending.html
import Clip from './Clip';
import delaunay from '../util/delaunay';
import Vector2 from '../math/Vector2';
&nbsp;
/**
* @typedef {Object} clay.animation.Blend2DClip.IClipInput
* @property {clay.Vector2} position
* @property {clay.animation.Clip} clip
* @property {number} offset
*/
&nbsp;
/**
* 2d blending node in animation blend tree.
* output clip must have blend2D method
* @constructor
* @alias clay.animation.Blend2DClip
* @extends clay.animation.Clip
*
* @param {Object} [opts]
* @param {string} [opts.name]
* @param {Object} [opts.target]
* @param {number} [opts.life]
* @param {number} [opts.delay]
* @param {number} [opts.gap]
* @param {number} [opts.playbackRatio]
* @param {boolean|number} [opts.loop] If loop is a number, it indicate the loop count of animation
* @param {string|Function} [opts.easing]
* @param {Function} [opts.onframe]
* @param {Function} [opts.onfinish]
* @param {Function} [opts.onrestart]
* @param {object[]} [opts.inputs]
* @param {clay.Vector2} [opts.position]
* @param {clay.animation.Clip} [opts.output]
*/
var Blend2DClip = function (opts) <span class="fstat-no" title="function not covered" >{</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > opts = opts || {};</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > Clip.call(this, opts);</span>
/**
* Output clip must have blend2D method
* @type {clay.animation.Clip}
*/
<span class="cstat-no" title="statement not covered" > this.output = opts.output || null;</span>
/**
* @type {clay.animation.Blend2DClip.IClipInput[]}
*/
<span class="cstat-no" title="statement not covered" > this.inputs = opts.inputs || [];</span>
/**
* @type {clay.Vector2}
*/
<span class="cstat-no" title="statement not covered" > this.position = new Vector2();</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this._cacheTriangle = null;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this._triangles = [];</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this._updateTriangles();</span>
};
&nbsp;
Blend2DClip.prototype = new Clip();
Blend2DClip.prototype.constructor = Blend2DClip;
/**
* @param {clay.Vector2} position
* @param {clay.animation.Clip} inputClip
* @param {number} [offset]
* @return {clay.animation.Blend2DClip.IClipInput}
*/
Blend2DClip.prototype.addInput = function (position, inputClip, offset) <span class="fstat-no" title="function not covered" >{</span>
var obj = <span class="cstat-no" title="statement not covered" >{</span>
position : position,
clip : inputClip,
offset : offset || 0
};
<span class="cstat-no" title="statement not covered" > this.inputs.push(obj);</span>
<span class="cstat-no" title="statement not covered" > this.life = Math.max(inputClip.life, this.life);</span>
// TODO Change to incrementally adding
<span class="cstat-no" title="statement not covered" > this._updateTriangles();</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > return obj;</span>
};
&nbsp;
// Delaunay triangulate
Blend2DClip.prototype._updateTriangles = function () <span class="fstat-no" title="function not covered" >{</span>
var inputs = <span class="cstat-no" title="statement not covered" >this.inputs.map(function (a) <span class="fstat-no" title="function not covered" >{</span></span>
<span class="cstat-no" title="statement not covered" > return a.position;</span>
});
<span class="cstat-no" title="statement not covered" > this._triangles = delaunay.triangulate(inputs, 'array');</span>
};
&nbsp;
Blend2DClip.prototype.step = function (time, dTime, silent) <span class="fstat-no" title="function not covered" >{</span>
&nbsp;
var ret = <span class="cstat-no" title="statement not covered" >Clip.prototype.step.call(this, time);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > if (ret !== 'finish') {</span>
<span class="cstat-no" title="statement not covered" > this.setTime(this.getElapsedTime());</span>
}
&nbsp;
// PENDING Schedule
<span class="cstat-no" title="statement not covered" > if (!silent &amp;&amp; ret !== 'paused') {</span>
<span class="cstat-no" title="statement not covered" > this.fire('frame');</span>
}
<span class="cstat-no" title="statement not covered" > return ret;</span>
};
&nbsp;
Blend2DClip.prototype.setTime = function (time) <span class="fstat-no" title="function not covered" >{</span>
var res = <span class="cstat-no" title="statement not covered" >this._findTriangle(this.position);</span>
<span class="cstat-no" title="statement not covered" > if (!res) {</span>
<span class="cstat-no" title="statement not covered" > return;</span>
}
// In Barycentric
var a = <span class="cstat-no" title="statement not covered" >res[1];</span> // Percent of clip2
var b = <span class="cstat-no" title="statement not covered" >res[2];</span> // Percent of clip3
&nbsp;
var tri = <span class="cstat-no" title="statement not covered" >res[0];</span>
&nbsp;
var in1 = <span class="cstat-no" title="statement not covered" >this.inputs[tri.indices[0]];</span>
var in2 = <span class="cstat-no" title="statement not covered" >this.inputs[tri.indices[1]];</span>
var in3 = <span class="cstat-no" title="statement not covered" >this.inputs[tri.indices[2]];</span>
var clip1 = <span class="cstat-no" title="statement not covered" >in1.clip;</span>
var clip2 = <span class="cstat-no" title="statement not covered" >in2.clip;</span>
var clip3 = <span class="cstat-no" title="statement not covered" >in3.clip;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > clip1.setTime((time + in1.offset) % clip1.life);</span>
<span class="cstat-no" title="statement not covered" > clip2.setTime((time + in2.offset) % clip2.life);</span>
<span class="cstat-no" title="statement not covered" > clip3.setTime((time + in3.offset) % clip3.life);</span>
&nbsp;
var c1 = <span class="cstat-no" title="statement not covered" >clip1.output instanceof Clip ? clip1.output : clip1;</span>
var c2 = <span class="cstat-no" title="statement not covered" >clip2.output instanceof Clip ? clip2.output : clip2;</span>
var c3 = <span class="cstat-no" title="statement not covered" >clip3.output instanceof Clip ? clip3.output : clip3;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this.output.blend2D(c1, c2, c3, a, b);</span>
};
&nbsp;
/**
* Clone a new Blend2D clip
* @param {boolean} cloneInputs True if clone the input clips
* @return {clay.animation.Blend2DClip}
*/
Blend2DClip.prototype.clone = function (cloneInputs) <span class="fstat-no" title="function not covered" >{</span>
var clip = <span class="cstat-no" title="statement not covered" >Clip.prototype.clone.call(this);</span>
<span class="cstat-no" title="statement not covered" > clip.output = this.output.clone();</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.inputs.length; i++) {</span>
var inputClip = <span class="cstat-no" title="statement not covered" >cloneInputs ? this.inputs[i].clip.clone(true) : this.inputs[i].clip;</span>
<span class="cstat-no" title="statement not covered" > clip.addInput(this.inputs[i].position, inputClip, this.inputs[i].offset);</span>
}
<span class="cstat-no" title="statement not covered" > return clip;</span>
};
&nbsp;
Blend2DClip.prototype._findTriangle = function (position) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (this._cacheTriangle) {</span>
var res = <span class="cstat-no" title="statement not covered" >delaunay.contains(this._cacheTriangle.vertices, position.array);</span>
<span class="cstat-no" title="statement not covered" > if (res) {</span>
<span class="cstat-no" title="statement not covered" > return [this._cacheTriangle, res[0], res[1]];</span>
}
}
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this._triangles.length; i++) {</span>
var tri = <span class="cstat-no" title="statement not covered" >this._triangles[i];</span>
var res = <span class="cstat-no" title="statement not covered" >delaunay.contains(tri.vertices, this.position.array);</span>
<span class="cstat-no" title="statement not covered" > if (res) {</span>
<span class="cstat-no" title="statement not covered" > this._cacheTriangle = tri;</span>
<span class="cstat-no" title="statement not covered" > return [tri, res[0], res[1]];</span>
}
}
};
&nbsp;
export default Blend2DClip;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,827 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/animation/Clip.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/animation/</a> Clip.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">54.88% </span>
<span class="quiet">Statements</span>
<span class='fraction'>45/82</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">66.67% </span>
<span class="quiet">Branches</span>
<span class='fraction'>36/54</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">35.71% </span>
<span class="quiet">Functions</span>
<span class='fraction'>5/14</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">54.88% </span>
<span class="quiet">Lines</span>
<span class='fraction'>45/82</span>
</div>
</div>
</div>
<div class='status-line medium'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-yes">5×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-yes">57×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">57×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">63×</span>
<span class="cline-any cline-yes">63×</span>
<span class="cline-any cline-yes">63×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Easing from './easing';
&nbsp;
function noop () <span class="fstat-no" title="function not covered" >{}</span>
/**
* @constructor
* @alias clay.animation.Clip
* @param {Object} [opts]
* @param {Object} [opts.target]
* @param {number} [opts.life]
* @param {number} [opts.delay]
* @param {number} [opts.gap]
* @param {number} [opts.playbackRate]
* @param {boolean|number} [opts.loop] If loop is a number, it indicate the loop count of animation
* @param {string|Function} [opts.easing]
* @param {Function} [opts.onframe]
* @param {Function} [opts.onfinish]
* @param {Function} [opts.onrestart]
*/
var Clip = function (opts) {
&nbsp;
opts = opts || {};
&nbsp;
/**
* @type {string}
*/
this.name = opts.name || '';
&nbsp;
/**
* @type {Object}
*/
this.target = opts.target;
&nbsp;
/**
* @type {number}
*/
this.life = opts.life || 1000;
&nbsp;
/**
* @type {number}
*/
this.delay = opts.delay || 0;
&nbsp;
/**
* @type {number}
*/
this.gap = opts.gap || 0;
&nbsp;
/**
* @type {number}
*/
this.playbackRate = opts.playbackRate || 1;
&nbsp;
&nbsp;
this._initialized = false;
&nbsp;
this._elapsedTime = 0;
&nbsp;
this._loop = opts.loop == null ? false : opts.loop;
this.setLoop(this._loop);
&nbsp;
<span class="missing-if-branch" title="if path not taken" >I</span>if (opts.easing != null) {
<span class="cstat-no" title="statement not covered" > this.setEasing(opts.easing);</span>
}
&nbsp;
/**
* @type {Function}
*/
this.onframe = opts.onframe || noop;
&nbsp;
/**
* @type {Function}
*/
this.onfinish = opts.onfinish || noop;
&nbsp;
/**
* @type {Function}
*/
this.onrestart = opts.onrestart || noop;
&nbsp;
this._paused = false;
};
&nbsp;
Clip.prototype = {
&nbsp;
gap: 0,
&nbsp;
life: 0,
&nbsp;
delay: 0,
&nbsp;
/**
* @param {number|boolean} loop
*/
setLoop: function (loop) {
this._loop = loop;
<span class="missing-if-branch" title="if path not taken" >I</span>if (loop) {
<span class="cstat-no" title="statement not covered" > if (typeof(loop) == 'number') {</span>
<span class="cstat-no" title="statement not covered" > this._loopRemained = loop;</span>
}
else {
<span class="cstat-no" title="statement not covered" > this._loopRemained = 1e8;</span>
}
}
},
&nbsp;
/**
* @param {string|Function} easing
*/
setEasing: function (easing) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (typeof(easing) === 'string') {</span>
<span class="cstat-no" title="statement not covered" > easing = Easing[easing];</span>
}
<span class="cstat-no" title="statement not covered" > this.easing = easing;</span>
},
&nbsp;
/**
* @param {number} time
* @return {string}
*/
step: function (time, deltaTime, silent) {
if (!this._initialized) {
this._startTime = time + this.delay;
this._initialized = true;
}
if (this._currentTime != null) {
deltaTime = time - this._currentTime;
}
this._currentTime = time;
&nbsp;
<span class="missing-if-branch" title="if path not taken" >I</span>if (this._paused) {
<span class="cstat-no" title="statement not covered" > return 'paused';</span>
}
&nbsp;
<span class="missing-if-branch" title="if path not taken" >I</span>if (time &lt; this._startTime) {
<span class="cstat-no" title="statement not covered" > return;</span>
}
&nbsp;
// PENDIGN Sync ?
this._elapse(time, deltaTime);
&nbsp;
var percent = Math.min(this._elapsedTime / this.life, 1);
&nbsp;
<span class="missing-if-branch" title="if path not taken" >I</span>if (percent &lt; 0) {
<span class="cstat-no" title="statement not covered" > return;</span>
}
&nbsp;
var schedule;
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.easing) {
<span class="cstat-no" title="statement not covered" > schedule = this.easing(percent);</span>
}
else {
schedule = percent;
}
&nbsp;
<span class="missing-if-branch" title="else path not taken" >E</span>if (!silent) {
this.fire('frame', schedule);
}
&nbsp;
if (percent === 1) {
<span class="missing-if-branch" title="if path not taken" >I</span>if (this._loop &amp;&amp; <span class="branch-1 cbranch-no" title="branch not covered" >this._loopRemained &gt; 0)</span> {
<span class="cstat-no" title="statement not covered" > this._restartInLoop(time);</span>
<span class="cstat-no" title="statement not covered" > this._loopRemained--;</span>
<span class="cstat-no" title="statement not covered" > return 'restart';</span>
}
else {
// Mark this clip to be deleted
// In the animation.update
this._needsRemove = true;
&nbsp;
return 'finish';
}
}
else {
return null;
}
},
&nbsp;
/**
* @param {number} time
* @return {string}
*/
setTime: function (time) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return this.step(time + this._startTime);</span>
},
&nbsp;
restart: function (time) <span class="fstat-no" title="function not covered" >{</span>
// If user leave the page for a while, when he gets back
// All clips may be expired and all start from the beginning value(position)
// It is clearly wrong, so we use remainder to add a offset
&nbsp;
var remainder = <span class="cstat-no" title="statement not covered" >0;</span>
// Remainder ignored if restart is invoked manually
<span class="cstat-no" title="statement not covered" > if (time) {</span>
<span class="cstat-no" title="statement not covered" > this._elapse(time);</span>
<span class="cstat-no" title="statement not covered" > remainder = this._elapsedTime % this.life;</span>
}
<span class="cstat-no" title="statement not covered" > time = time || Date.now();</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this._startTime = time - remainder + this.delay;</span>
<span class="cstat-no" title="statement not covered" > this._elapsedTime = 0;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this._needsRemove = false;</span>
<span class="cstat-no" title="statement not covered" > this._paused = false;</span>
},
&nbsp;
getElapsedTime: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return this._elapsedTime;</span>
},
&nbsp;
_restartInLoop: function (time) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._startTime = time + this.gap;</span>
<span class="cstat-no" title="statement not covered" > this._elapsedTime = 0;</span>
},
&nbsp;
_elapse: function (time, deltaTime) {
this._elapsedTime += deltaTime * this.playbackRate;
},
&nbsp;
fire: function (eventType, arg) {
var eventName = 'on' + eventType;
<span class="missing-if-branch" title="else path not taken" >E</span>if (this[eventName]) {
this[eventName](this.target, arg);
}
},
&nbsp;
clone: function () <span class="fstat-no" title="function not covered" >{</span>
var clip = <span class="cstat-no" title="statement not covered" >new this.constructor();</span>
<span class="cstat-no" title="statement not covered" > clip.name = this.name;</span>
<span class="cstat-no" title="statement not covered" > clip._loop = this._loop;</span>
<span class="cstat-no" title="statement not covered" > clip._loopRemained = this._loopRemained;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > clip.life = this.life;</span>
<span class="cstat-no" title="statement not covered" > clip.gap = this.gap;</span>
<span class="cstat-no" title="statement not covered" > clip.delay = this.delay;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > return clip;</span>
},
/**
* Pause the clip.
*/
pause: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._paused = true;</span>
},
&nbsp;
/**
* Resume the clip.
*/
resume: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._paused = false;</span>
}
};
Clip.prototype.constructor = Clip;
&nbsp;
export default Clip;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,71 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/animation/Timeline.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/animation/</a> Timeline.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>0/0</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">// Alias
import Timeline from '../Timeline';
export default Timeline;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,743 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/animation/TrackClip.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/animation/</a> TrackClip.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">20.69% </span>
<span class="quiet">Statements</span>
<span class='fraction'>18/87</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/18</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/14</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">20.69% </span>
<span class="quiet">Lines</span>
<span class='fraction'>18/87</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Clip from './Clip';
&nbsp;
import glMatrix from '../dep/glmatrix';
var quat = glMatrix.quat;
var vec3 = glMatrix.vec3;
&nbsp;
/**
*
* Animation clip that manage a collection of {@link clay.animation.SamplerTrack}
* @constructor
* @alias clay.animation.TrackClip
*
* @extends clay.animation.Clip
* @param {Object} [opts]
* @param {string} [opts.name]
* @param {Object} [opts.target]
* @param {number} [opts.life]
* @param {number} [opts.delay]
* @param {number} [opts.gap]
* @param {number} [opts.playbackRatio]
* @param {boolean|number} [opts.loop] If loop is a number, it indicate the loop count of animation
* @param {string|Function} [opts.easing]
* @param {Function} [opts.onframe]
* @param {Function} [opts.onfinish]
* @param {Function} [opts.onrestart]
* @param {Array.&lt;clay.animation.SamplerTrack&gt;} [opts.tracks]
*/
var TrackClip = function (opts) <span class="fstat-no" title="function not covered" >{</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > opts = opts || {};</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > Clip.call(this, opts);</span>
&nbsp;
/**
*
* @type {clay.animation.SamplerTrack[]}
*/
<span class="cstat-no" title="statement not covered" > this.tracks = opts.tracks || [];</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this.calcLifeFromTracks();</span>
};
&nbsp;
TrackClip.prototype = Object.create(Clip.prototype);
&nbsp;
TrackClip.prototype.constructor = TrackClip;
&nbsp;
TrackClip.prototype.step = function (time, dTime, silent) <span class="fstat-no" title="function not covered" >{</span>
&nbsp;
var ret = <span class="cstat-no" title="statement not covered" >Clip.prototype.step.call(this, time, dTime, true);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > if (ret !== 'finish') {</span>
var time = <span class="cstat-no" title="statement not covered" >this.getElapsedTime();</span>
// TODO life may be changed.
<span class="cstat-no" title="statement not covered" > if (this._range) {</span>
<span class="cstat-no" title="statement not covered" > time = this._range[0] + time;</span>
}
<span class="cstat-no" title="statement not covered" > this.setTime(time);</span>
}
&nbsp;
// PENDING Schedule
<span class="cstat-no" title="statement not covered" > if (!silent &amp;&amp; ret !== 'paused') {</span>
<span class="cstat-no" title="statement not covered" > this.fire('frame');</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > return ret;</span>
};
&nbsp;
/**
* @param {Array.&lt;number&gt;} range
*/
TrackClip.prototype.setRange = function (range) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this.calcLifeFromTracks();</span>
<span class="cstat-no" title="statement not covered" > this._range = range;</span>
<span class="cstat-no" title="statement not covered" > if (range) {</span>
<span class="cstat-no" title="statement not covered" > range[1] = Math.min(range[1], this.life);</span>
<span class="cstat-no" title="statement not covered" > range[0] = Math.min(range[0], this.life);</span>
<span class="cstat-no" title="statement not covered" > this.life = (range[1] - range[0]);</span>
}
};
&nbsp;
TrackClip.prototype.setTime = function (time) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.tracks.length; i++) {</span>
<span class="cstat-no" title="statement not covered" > this.tracks[i].setTime(time);</span>
}
};
&nbsp;
TrackClip.prototype.calcLifeFromTracks = function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this.life = 0;</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.tracks.length; i++) {</span>
<span class="cstat-no" title="statement not covered" > this.life = Math.max(this.life, this.tracks[i].getMaxTime());</span>
}
};
&nbsp;
/**
* @param {clay.animation.SamplerTrack} track
*/
TrackClip.prototype.addTrack = function (track) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this.tracks.push(track);</span>
<span class="cstat-no" title="statement not covered" > this.calcLifeFromTracks();</span>
};
&nbsp;
/**
* @param {clay.animation.SamplerTrack} track
*/
TrackClip.prototype.removeTarck = function (track) <span class="fstat-no" title="function not covered" >{</span>
var idx = <span class="cstat-no" title="statement not covered" >this.tracks.indexOf(track);</span>
<span class="cstat-no" title="statement not covered" > if (idx &gt;= 0) {</span>
<span class="cstat-no" title="statement not covered" > this.tracks.splice(idx, 1);</span>
}
};
&nbsp;
/**
* @param {number} startTime
* @param {number} endTime
* @param {boolean} isLoop
* @return {clay.animation.TrackClip}
*/
TrackClip.prototype.getSubClip = function (startTime, endTime, isLoop) <span class="fstat-no" title="function not covered" >{</span>
var subClip = <span class="cstat-no" title="statement not covered" >new TrackClip({</span>
name: this.name
});
&nbsp;
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.tracks.length; i++) {</span>
var subTrack = <span class="cstat-no" title="statement not covered" >this.tracks[i].getSubTrack(startTime, endTime);</span>
<span class="cstat-no" title="statement not covered" > subClip.addTrack(subTrack);</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > if (isLoop !== undefined) {</span>
<span class="cstat-no" title="statement not covered" > subClip.setLoop(isLoop);</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > subClip.life = endTime - startTime;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > return subClip;</span>
};
&nbsp;
/**
* 1d blending from two skinning clips
* @param {clay.animation.TrackClip} clip1
* @param {clay.animation.TrackClip} clip2
* @param {number} w
*/
TrackClip.prototype.blend1D = function (clip1, clip2, w) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.tracks.length; i++) {</span>
var c1 = <span class="cstat-no" title="statement not covered" >clip1.tracks[i];</span>
var c2 = <span class="cstat-no" title="statement not covered" >clip2.tracks[i];</span>
var tClip = <span class="cstat-no" title="statement not covered" >this.tracks[i];</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > tClip.blend1D(c1, c2, w);</span>
}
};
&nbsp;
/**
* Additive blending from two skinning clips
* @param {clay.animation.TrackClip} clip1
* @param {clay.animation.TrackClip} clip2
*/
TrackClip.prototype.additiveBlend = function (clip1, clip2) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.tracks.length; i++) {</span>
var c1 = <span class="cstat-no" title="statement not covered" >clip1.tracks[i];</span>
var c2 = <span class="cstat-no" title="statement not covered" >clip2.tracks[i];</span>
var tClip = <span class="cstat-no" title="statement not covered" >this.tracks[i];</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > tClip.additiveBlend(c1, c2);</span>
}
};
&nbsp;
/**
* Subtractive blending from two skinning clips
* @param {clay.animation.TrackClip} clip1
* @param {clay.animation.TrackClip} clip2
*/
TrackClip.prototype.subtractiveBlend = function (clip1, clip2) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.tracks.length; i++) {</span>
var c1 = <span class="cstat-no" title="statement not covered" >clip1.tracks[i];</span>
var c2 = <span class="cstat-no" title="statement not covered" >clip2.tracks[i];</span>
var tClip = <span class="cstat-no" title="statement not covered" >this.tracks[i];</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > tClip.subtractiveBlend(c1, c2);</span>
}
};
&nbsp;
/**
* 2D blending from three skinning clips
* @param {clay.animation.TrackClip} clip1
* @param {clay.animation.TrackClip} clip2
* @param {clay.animation.TrackClip} clip3
* @param {number} f
* @param {number} g
*/
TrackClip.prototype.blend2D = function (clip1, clip2, clip3, f, g) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.tracks.length; i++) {</span>
var c1 = <span class="cstat-no" title="statement not covered" >clip1.tracks[i];</span>
var c2 = <span class="cstat-no" title="statement not covered" >clip2.tracks[i];</span>
var c3 = <span class="cstat-no" title="statement not covered" >clip3.tracks[i];</span>
var tClip = <span class="cstat-no" title="statement not covered" >this.tracks[i];</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > tClip.blend2D(c1, c2, c3, f, g);</span>
}
};
&nbsp;
/**
* Copy SRT of all joints clips from another TrackClip
* @param {clay.animation.TrackClip} clip
*/
TrackClip.prototype.copy = function (clip) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.tracks.length; i++) {</span>
var sTrack = <span class="cstat-no" title="statement not covered" >clip.tracks[i];</span>
var tTrack = <span class="cstat-no" title="statement not covered" >this.tracks[i];</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > vec3.copy(tTrack.position, sTrack.position);</span>
<span class="cstat-no" title="statement not covered" > vec3.copy(tTrack.scale, sTrack.scale);</span>
<span class="cstat-no" title="statement not covered" > quat.copy(tTrack.rotation, sTrack.rotation);</span>
}
};
&nbsp;
TrackClip.prototype.clone = function () <span class="fstat-no" title="function not covered" >{</span>
var clip = <span class="cstat-no" title="statement not covered" >Clip.prototype.clone.call(this);</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.tracks.length; i++) {</span>
<span class="cstat-no" title="statement not covered" > clip.addTrack(this.tracks[i].clone());</span>
}
<span class="cstat-no" title="statement not covered" > clip.life = this.life;</span>
<span class="cstat-no" title="statement not covered" > return clip;</span>
};
&nbsp;
export default TrackClip;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,677 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/animation/TransformTrack.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/animation/</a> TransformTrack.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">17.39% </span>
<span class="quiet">Statements</span>
<span class='fraction'>20/115</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/46</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">6.67% </span>
<span class="quiet">Functions</span>
<span class='fraction'>1/15</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">17.39% </span>
<span class="quiet">Lines</span>
<span class='fraction'>20/115</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Clip from './Clip';
&nbsp;
import glMatrix from '../dep/glmatrix';
var quat = glMatrix.quat;
var vec3 = glMatrix.vec3;
&nbsp;
function keyframeSort(a, b) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return a.time - b.time;</span>
}
&nbsp;
var TransformTrack = function (opts) <span class="fstat-no" title="function not covered" >{</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this.name = opts.name || '';</span>
//[{
// time: //ms
// position: // optional
// rotation: // optional
// scale: // optional
//}]
<span class="cstat-no" title="statement not covered" > this.keyFrames = [];</span>
<span class="cstat-no" title="statement not covered" > if (opts.keyFrames) {</span>
<span class="cstat-no" title="statement not covered" > this.addKeyFrames(opts.keyFrames);</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > this.position = vec3.create();</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this.rotation = quat.create();</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this.scale = vec3.fromValues(1, 1, 1);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this._cacheKey = 0;</span>
<span class="cstat-no" title="statement not covered" > this._cacheTime = 0;</span>
};
&nbsp;
TransformTrack.prototype = Object.create(Clip.prototype);
&nbsp;
TransformTrack.prototype.constructor = TransformTrack;
&nbsp;
TransformTrack.prototype.step = function (time, dTime, silent) <span class="fstat-no" title="function not covered" >{</span>
&nbsp;
var ret = <span class="cstat-no" title="statement not covered" >Clip.prototype.step.call(this, time, dTime, true);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > if (ret !== 'finish') {</span>
<span class="cstat-no" title="statement not covered" > this.setTime(this.getElapsedTime());</span>
}
&nbsp;
// PENDING Schedule
<span class="cstat-no" title="statement not covered" > if (!silent &amp;&amp; ret !== 'paused') {</span>
<span class="cstat-no" title="statement not covered" > this.fire('frame');</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > return ret;</span>
};
&nbsp;
TransformTrack.prototype.setTime = function (time) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._interpolateField(time, 'position');</span>
<span class="cstat-no" title="statement not covered" > this._interpolateField(time, 'rotation');</span>
<span class="cstat-no" title="statement not covered" > this._interpolateField(time, 'scale');</span>
};
&nbsp;
TransformTrack.prototype.getMaxTime = function () <span class="fstat-no" title="function not covered" >{</span>
var kf = <span class="cstat-no" title="statement not covered" >this.keyFrames[this.keyFrames.length - 1];</span>
<span class="cstat-no" title="statement not covered" > return kf ? kf.time : 0;</span>
};
&nbsp;
TransformTrack.prototype.addKeyFrame = function (kf) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.keyFrames.length - 1; i++) {</span>
var prevFrame = <span class="cstat-no" title="statement not covered" >this.keyFrames[i];</span>
var nextFrame = <span class="cstat-no" title="statement not covered" >this.keyFrames[i + 1];</span>
<span class="cstat-no" title="statement not covered" > if (prevFrame.time &lt;= kf.time &amp;&amp; nextFrame.time &gt;= kf.time) {</span>
<span class="cstat-no" title="statement not covered" > this.keyFrames.splice(i, 0, kf);</span>
<span class="cstat-no" title="statement not covered" > return i;</span>
}
}
&nbsp;
<span class="cstat-no" title="statement not covered" > this.life = kf.time;</span>
<span class="cstat-no" title="statement not covered" > this.keyFrames.push(kf);</span>
};
&nbsp;
TransformTrack.prototype.addKeyFrames = function (kfs) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; kfs.length; i++) {</span>
<span class="cstat-no" title="statement not covered" > this.keyFrames.push(kfs[i]);</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > this.keyFrames.sort(keyframeSort);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this.life = this.keyFrames[this.keyFrames.length - 1].time;</span>
};
&nbsp;
TransformTrack.prototype._interpolateField = function (time, fieldName) <span class="fstat-no" title="function not covered" >{</span>
var kfs = <span class="cstat-no" title="statement not covered" >this.keyFrames;</span>
var len = <span class="cstat-no" title="statement not covered" >kfs.length;</span>
var start;
var end;
&nbsp;
<span class="cstat-no" title="statement not covered" > if (!kfs.length) {</span>
<span class="cstat-no" title="statement not covered" > return;</span>
}
<span class="cstat-no" title="statement not covered" > if (time &lt; kfs[0].time || time &gt; kfs[kfs.length-1].time) {</span>
<span class="cstat-no" title="statement not covered" > return;</span>
}
<span class="cstat-no" title="statement not covered" > if (time &lt; this._cacheTime) {</span>
var s = <span class="cstat-no" title="statement not covered" >this._cacheKey &gt;= len-1 ? len-1 : this._cacheKey+1;</span>
<span class="cstat-no" title="statement not covered" > for (var i = s; i &gt;= 0; i--) {</span>
<span class="cstat-no" title="statement not covered" > if (kfs[i].time &lt;= time &amp;&amp; kfs[i][fieldName]) {</span>
<span class="cstat-no" title="statement not covered" > start = kfs[i];</span>
<span class="cstat-no" title="statement not covered" > this._cacheKey = i;</span>
<span class="cstat-no" title="statement not covered" > this._cacheTime = time;</span>
} else <span class="cstat-no" title="statement not covered" >if (kfs[i][fieldName]) {</span>
<span class="cstat-no" title="statement not covered" > end = kfs[i];</span>
<span class="cstat-no" title="statement not covered" > break;</span>
}
}
} else {
<span class="cstat-no" title="statement not covered" > for (var i = this._cacheKey; i &lt; len; i++) {</span>
<span class="cstat-no" title="statement not covered" > if (kfs[i].time &lt;= time &amp;&amp; kfs[i][fieldName]) {</span>
<span class="cstat-no" title="statement not covered" > start = kfs[i];</span>
<span class="cstat-no" title="statement not covered" > this._cacheKey = i;</span>
<span class="cstat-no" title="statement not covered" > this._cacheTime = time;</span>
} else <span class="cstat-no" title="statement not covered" >if (kfs[i][fieldName]) {</span>
<span class="cstat-no" title="statement not covered" > end = kfs[i];</span>
<span class="cstat-no" title="statement not covered" > break;</span>
}
}
}
&nbsp;
<span class="cstat-no" title="statement not covered" > if (start &amp;&amp; end) {</span>
var percent = <span class="cstat-no" title="statement not covered" >(time - start.time) / (end.time - start.time);</span>
<span class="cstat-no" title="statement not covered" > percent = Math.max(Math.min(percent, 1), 0);</span>
<span class="cstat-no" title="statement not covered" > if (fieldName === 'rotation') {</span>
<span class="cstat-no" title="statement not covered" > quat.slerp(this[fieldName], start[fieldName], end[fieldName], percent);</span>
} else {
<span class="cstat-no" title="statement not covered" > vec3.lerp(this[fieldName], start[fieldName], end[fieldName], percent);</span>
}
} else {
<span class="cstat-no" title="statement not covered" > this._cacheKey = 0;</span>
<span class="cstat-no" title="statement not covered" > this._cacheTime = 0;</span>
}
};
&nbsp;
TransformTrack.prototype.blend1D = function (t1, t2, w) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > vec3.lerp(this.position, t1.position, t2.position, w);</span>
<span class="cstat-no" title="statement not covered" > vec3.lerp(this.scale, t1.scale, t2.scale, w);</span>
<span class="cstat-no" title="statement not covered" > quat.slerp(this.rotation, t1.rotation, t2.rotation, w);</span>
};
&nbsp;
TransformTrack.prototype.blend2D = (function () {
var q1 = quat.create();
var q2 = quat.create();
return function (t1, t2, t3, f, g) <span class="fstat-no" title="function not covered" >{</span>
var a = <span class="cstat-no" title="statement not covered" >1 - f - g;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this.position[0] = t1.position[0] * a + t2.position[0] * f + t3.position[0] * g;</span>
<span class="cstat-no" title="statement not covered" > this.position[1] = t1.position[1] * a + t2.position[1] * f + t3.position[1] * g;</span>
<span class="cstat-no" title="statement not covered" > this.position[2] = t1.position[2] * a + t2.position[2] * f + t3.position[2] * g;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this.scale[0] = t1.scale[0] * a + t2.scale[0] * f + t3.scale[0] * g;</span>
<span class="cstat-no" title="statement not covered" > this.scale[1] = t1.scale[1] * a + t2.scale[1] * f + t3.scale[1] * g;</span>
<span class="cstat-no" title="statement not covered" > this.scale[2] = t1.scale[2] * a + t2.scale[2] * f + t3.scale[2] * g;</span>
&nbsp;
// http://msdn.microsoft.com/en-us/library/windows/desktop/bb205403(v=vs.85).aspx
// http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.quaternion.xmquaternionbarycentric(v=vs.85).aspx
var s = <span class="cstat-no" title="statement not covered" >f + g;</span>
<span class="cstat-no" title="statement not covered" > if (s === 0) {</span>
<span class="cstat-no" title="statement not covered" > quat.copy(this.rotation, t1.rotation);</span>
} else {
<span class="cstat-no" title="statement not covered" > quat.slerp(q1, t1.rotation, t2.rotation, s);</span>
<span class="cstat-no" title="statement not covered" > quat.slerp(q2, t1.rotation, c3.rotation, s);</span>
<span class="cstat-no" title="statement not covered" > quat.slerp(this.rotation, q1, q2, g / s);</span>
}
};
})();
&nbsp;
TransformTrack.prototype.additiveBlend = function (t1, t2) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > vec3.add(this.position, t1.position, t2.position);</span>
<span class="cstat-no" title="statement not covered" > vec3.add(this.scale, t1.scale, t2.scale);</span>
<span class="cstat-no" title="statement not covered" > quat.multiply(this.rotation, t2.rotation, t1.rotation);</span>
};
&nbsp;
TransformTrack.prototype.subtractiveBlend = function (t1, t2) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > vec3.sub(this.position, t1.position, t2.position);</span>
<span class="cstat-no" title="statement not covered" > vec3.sub(this.scale, t1.scale, t2.scale);</span>
<span class="cstat-no" title="statement not covered" > quat.invert(this.rotation, t2.rotation);</span>
<span class="cstat-no" title="statement not covered" > quat.multiply(this.rotation, this.rotation, t1.rotation);</span>
};
&nbsp;
TransformTrack.prototype.getSubClip = function (startTime, endTime) <span class="fstat-no" title="function not covered" >{</span>
// TODO
<span class="cstat-no" title="statement not covered" > console.warn('TODO');</span>
};
&nbsp;
TransformTrack.prototype.clone = function () <span class="fstat-no" title="function not covered" >{</span>
var track = <span class="cstat-no" title="statement not covered" >TransformTrack.prototype.clone.call(this);</span>
<span class="cstat-no" title="statement not covered" > track.keyFrames = this.keyFrames;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > vec3.copy(track.position, this.position);</span>
<span class="cstat-no" title="statement not covered" > quat.copy(track.rotation, this.rotation);</span>
<span class="cstat-no" title="statement not covered" > vec3.copy(track.scale, this.scale);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > return track;</span>
};
&nbsp;
&nbsp;
export default TransformTrack;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 07 2018 14:10:25 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,184 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/animation/</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> src/animation/
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">25.31% </span>
<span class="quiet">Statements</span>
<span class='fraction'>207/818</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">20.25% </span>
<span class="quiet">Branches</span>
<span class='fraction'>81/400</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">18.42% </span>
<span class="quiet">Functions</span>
<span class='fraction'>21/114</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">25.68% </span>
<span class="quiet">Lines</span>
<span class='fraction'>207/806</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file medium" data-value="Animator.js"><a href="Animator.js.html">Animator.js</a></td>
<td data-value="52.4" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 52%;"></div><div class="cover-empty" style="width:48%;"></div></div></td>
<td data-value="52.4" class="pct medium">52.4%</td>
<td data-value="208" class="abs medium">109/208</td>
<td data-value="39.47" class="pct low">39.47%</td>
<td data-value="114" class="abs low">45/114</td>
<td data-value="57.69" class="pct medium">57.69%</td>
<td data-value="26" class="abs medium">15/26</td>
<td data-value="52.4" class="pct medium">52.4%</td>
<td data-value="208" class="abs medium">109/208</td>
</tr>
<tr>
<td class="file low" data-value="Blend1DClip.js"><a href="Blend1DClip.js.html">Blend1DClip.js</a></td>
<td data-value="10.98" class="pic low"><div class="chart"><div class="cover-fill" style="width: 10%;"></div><div class="cover-empty" style="width:90%;"></div></div></td>
<td data-value="10.98" class="pct low">10.98%</td>
<td data-value="82" class="abs low">9/82</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="46" class="abs low">0/46</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="7" class="abs low">0/7</td>
<td data-value="10.98" class="pct low">10.98%</td>
<td data-value="82" class="abs low">9/82</td>
</tr>
<tr>
<td class="file low" data-value="Blend2DClip.js"><a href="Blend2DClip.js.html">Blend2DClip.js</a></td>
<td data-value="13.64" class="pic low"><div class="chart"><div class="cover-fill" style="width: 13%;"></div><div class="cover-empty" style="width:87%;"></div></div></td>
<td data-value="13.64" class="pct low">13.64%</td>
<td data-value="66" class="abs low">9/66</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="30" class="abs low">0/30</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="8" class="abs low">0/8</td>
<td data-value="13.64" class="pct low">13.64%</td>
<td data-value="66" class="abs low">9/66</td>
</tr>
<tr>
<td class="file medium" data-value="Clip.js"><a href="Clip.js.html">Clip.js</a></td>
<td data-value="54.88" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 54%;"></div><div class="cover-empty" style="width:46%;"></div></div></td>
<td data-value="54.88" class="pct medium">54.88%</td>
<td data-value="82" class="abs medium">45/82</td>
<td data-value="66.67" class="pct medium">66.67%</td>
<td data-value="54" class="abs medium">36/54</td>
<td data-value="35.71" class="pct low">35.71%</td>
<td data-value="14" class="abs low">5/14</td>
<td data-value="54.88" class="pct medium">54.88%</td>
<td data-value="82" class="abs medium">45/82</td>
</tr>
<tr>
<td class="file low" data-value="SamplerTrack.js"><a href="SamplerTrack.js.html">SamplerTrack.js</a></td>
<td data-value="8" class="pic low"><div class="chart"><div class="cover-fill" style="width: 8%;"></div><div class="cover-empty" style="width:92%;"></div></div></td>
<td data-value="8" class="pct low">8%</td>
<td data-value="200" class="abs low">16/200</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="82" class="abs low">0/82</td>
<td data-value="7.14" class="pct low">7.14%</td>
<td data-value="14" class="abs low">1/14</td>
<td data-value="8.25" class="pct low">8.25%</td>
<td data-value="194" class="abs low">16/194</td>
</tr>
<tr>
<td class="file high" data-value="Timeline.js"><a href="Timeline.js.html">Timeline.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
</tr>
<tr>
<td class="file low" data-value="TrackClip.js"><a href="TrackClip.js.html">TrackClip.js</a></td>
<td data-value="20.69" class="pic low"><div class="chart"><div class="cover-fill" style="width: 20%;"></div><div class="cover-empty" style="width:80%;"></div></div></td>
<td data-value="20.69" class="pct low">20.69%</td>
<td data-value="87" class="abs low">18/87</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="18" class="abs low">0/18</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="14" class="abs low">0/14</td>
<td data-value="20.69" class="pct low">20.69%</td>
<td data-value="87" class="abs low">18/87</td>
</tr>
<tr>
<td class="file low" data-value="easing.js"><a href="easing.js.html">easing.js</a></td>
<td data-value="1.08" class="pic low"><div class="chart"><div class="cover-fill" style="width: 1%;"></div><div class="cover-empty" style="width:99%;"></div></div></td>
<td data-value="1.08" class="pct low">1.08%</td>
<td data-value="93" class="abs low">1/93</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="56" class="abs low">0/56</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="31" class="abs low">0/31</td>
<td data-value="1.15" class="pct low">1.15%</td>
<td data-value="87" class="abs low">1/87</td>
</tr>
</tbody>
</table>
</div><div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,419 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/async/Task.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/async/</a> Task.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">23.26% </span>
<span class="quiet">Statements</span>
<span class='fraction'>10/43</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/12</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/12</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">23.26% </span>
<span class="quiet">Lines</span>
<span class='fraction'>10/43</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import notifier from '../core/mixin/notifier';
import request from '../core/request';
import util from '../core/util';
&nbsp;
/**
* @constructor
* @alias clay.async.Task
* @mixes clay.core.mixin.notifier
*/
var Task = function() <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._fullfilled = false;</span>
<span class="cstat-no" title="statement not covered" > this._rejected = false;</span>
};
/**
* Task successed
* @param {} data
*/
Task.prototype.resolve = function(data) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._fullfilled = true;</span>
<span class="cstat-no" title="statement not covered" > this._rejected = false;</span>
<span class="cstat-no" title="statement not covered" > this.trigger('success', data);</span>
};
/**
* Task failed
* @param {} err
*/
Task.prototype.reject = function(err) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._rejected = true;</span>
<span class="cstat-no" title="statement not covered" > this._fullfilled = false;</span>
<span class="cstat-no" title="statement not covered" > this.trigger('error', err);</span>
};
/**
* If task successed
* @return {boolean}
*/
Task.prototype.isFullfilled = function() <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return this._fullfilled;</span>
};
/**
* If task failed
* @return {boolean}
*/
Task.prototype.isRejected = function() <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return this._rejected;</span>
};
/**
* If task finished, either successed or failed
* @return {boolean}
*/
Task.prototype.isSettled = function() <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return this._fullfilled || this._rejected;</span>
};
&nbsp;
util.extend(Task.prototype, notifier);
&nbsp;
function makeRequestTask(url, responseType) <span class="fstat-no" title="function not covered" >{</span>
var task = <span class="cstat-no" title="statement not covered" >new Task();</span>
<span class="cstat-no" title="statement not covered" > request.get({</span>
url: url,
responseType: responseType,
onload: function(res) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > task.resolve(res);</span>
},
onerror: function(error) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > task.reject(error);</span>
}
});
<span class="cstat-no" title="statement not covered" > return task;</span>
}
/**
* Make a request task
* @param {string|object|object[]|string[]} url
* @param {string} [responseType]
* @example
* var task = Task.makeRequestTask('./a.json');
* var task = Task.makeRequestTask({
* url: 'b.bin',
* responseType: 'arraybuffer'
* });
* var tasks = Task.makeRequestTask(['./a.json', './b.json']);
* var tasks = Task.makeRequestTask([
* {url: 'a.json'},
* {url: 'b.bin', responseType: 'arraybuffer'}
* ]);
* @return {clay.async.Task|clay.async.Task[]}
*/
Task.makeRequestTask = function(url, responseType) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (typeof url === 'string') {</span>
<span class="cstat-no" title="statement not covered" > return makeRequestTask(url, responseType);</span>
} else <span class="cstat-no" title="statement not covered" >if (url.url) { // Configure object</span>
var obj = <span class="cstat-no" title="statement not covered" >url;</span>
<span class="cstat-no" title="statement not covered" > return makeRequestTask(obj.url, obj.responseType);</span>
} else <span class="cstat-no" title="statement not covered" >if (Array.isArray(url)) { // Url list</span>
var urlList = <span class="cstat-no" title="statement not covered" >url;</span>
var tasks = <span class="cstat-no" title="statement not covered" >[];</span>
<span class="cstat-no" title="statement not covered" > urlList.forEach(function(obj) <span class="fstat-no" title="function not covered" >{</span></span>
var url, responseType;
<span class="cstat-no" title="statement not covered" > if (typeof obj === 'string') {</span>
<span class="cstat-no" title="statement not covered" > url = obj;</span>
} else <span class="cstat-no" title="statement not covered" >if (Object(obj) === obj) {</span>
<span class="cstat-no" title="statement not covered" > url = obj.url;</span>
<span class="cstat-no" title="statement not covered" > responseType = obj.responseType;</span>
}
<span class="cstat-no" title="statement not covered" > tasks.push(makeRequestTask(url, responseType));</span>
});
<span class="cstat-no" title="statement not covered" > return tasks;</span>
}
};
/**
* @return {clay.async.Task}
*/
Task.makeTask = function() <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return new Task();</span>
};
&nbsp;
util.extend(Task.prototype, notifier);
&nbsp;
export default Task;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,755 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/async/TaskGroup.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/async/</a> TaskGroup.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">9.91% </span>
<span class="quiet">Statements</span>
<span class='fraction'>11/111</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/42</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">6.25% </span>
<span class="quiet">Functions</span>
<span class='fraction'>1/16</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">9.91% </span>
<span class="quiet">Lines</span>
<span class='fraction'>11/111</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import util from '../core/util';
import Task from './Task';
&nbsp;
/**
* @constructor
* @alias clay.async.TaskGroup
* @extends clay.async.Task
*/
var TaskGroup = function () <span class="fstat-no" title="function not covered" >{</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > Task.apply(this, arguments);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this._tasks = [];</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this._fulfilledNumber = 0;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this._rejectedNumber = 0;</span>
};
&nbsp;
var Ctor = function (){};
Ctor.prototype = Task.prototype;
TaskGroup.prototype = new Ctor();
&nbsp;
TaskGroup.prototype.constructor = TaskGroup;
&nbsp;
/**
* Wait for all given tasks successed, task can also be any notifier object which will trigger success and error events. Like {@link clay.Texture2D}, {@link clay.TextureCube}, {@link clay.loader.GLTF}.
* @param {Array.&lt;clay.async.Task&gt;} tasks
* @chainable
* @example
* // Load texture list
* var list = ['a.jpg', 'b.jpg', 'c.jpg']
* var textures = list.map(function (src) {
* var texture = new clay.Texture2D();
* texture.load(src);
* return texture;
* });
* var taskGroup = new clay.async.TaskGroup();
* taskGroup.all(textures).success(function () {
* // Do some thing after all textures loaded
* });
*/
TaskGroup.prototype.all = function (tasks) <span class="fstat-no" title="function not covered" >{</span>
var count = <span class="cstat-no" title="statement not covered" >0;</span>
var self = <span class="cstat-no" title="statement not covered" >this;</span>
var data = <span class="cstat-no" title="statement not covered" >[];</span>
<span class="cstat-no" title="statement not covered" > this._tasks = tasks;</span>
<span class="cstat-no" title="statement not covered" > this._fulfilledNumber = 0;</span>
<span class="cstat-no" title="statement not covered" > this._rejectedNumber = 0;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > util.each(tasks, function (task, idx) <span class="fstat-no" title="function not covered" >{</span></span>
<span class="cstat-no" title="statement not covered" > if (!task || !task.once) {</span>
<span class="cstat-no" title="statement not covered" > return;</span>
}
<span class="cstat-no" title="statement not covered" > count++;</span>
<span class="cstat-no" title="statement not covered" > task.once('success', function (res) <span class="fstat-no" title="function not covered" >{</span></span>
<span class="cstat-no" title="statement not covered" > count--;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > self._fulfilledNumber++;</span>
// TODO
// Some tasks like texture, loader are not inherited from task
// We need to set the states here
<span class="cstat-no" title="statement not covered" > task._fulfilled = true;</span>
<span class="cstat-no" title="statement not covered" > task._rejected = false;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > data[idx] = res;</span>
<span class="cstat-no" title="statement not covered" > if (count === 0) {</span>
<span class="cstat-no" title="statement not covered" > self.resolve(data);</span>
}
});
<span class="cstat-no" title="statement not covered" > task.once('error', function () <span class="fstat-no" title="function not covered" >{</span></span>
&nbsp;
<span class="cstat-no" title="statement not covered" > self._rejectedNumber ++;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > task._fulfilled = false;</span>
<span class="cstat-no" title="statement not covered" > task._rejected = true;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > self.reject(task);</span>
});
});
<span class="cstat-no" title="statement not covered" > if (count === 0) {</span>
<span class="cstat-no" title="statement not covered" > setTimeout(function () <span class="fstat-no" title="function not covered" >{</span></span>
<span class="cstat-no" title="statement not covered" > self.resolve(data);</span>
});
<span class="cstat-no" title="statement not covered" > return this;</span>
}
<span class="cstat-no" title="statement not covered" > return this;</span>
};
/**
* Wait for all given tasks finished, either successed or failed
* @param {Array.&lt;clay.async.Task&gt;} tasks
* @return {clay.async.TaskGroup}
*/
TaskGroup.prototype.allSettled = function (tasks) <span class="fstat-no" title="function not covered" >{</span>
var count = <span class="cstat-no" title="statement not covered" >0;</span>
var self = <span class="cstat-no" title="statement not covered" >this;</span>
var data = <span class="cstat-no" title="statement not covered" >[];</span>
<span class="cstat-no" title="statement not covered" > if (tasks.length === 0) {</span>
<span class="cstat-no" title="statement not covered" > setTimeout(function () <span class="fstat-no" title="function not covered" >{</span></span>
<span class="cstat-no" title="statement not covered" > self.trigger('success', data);</span>
});
<span class="cstat-no" title="statement not covered" > return this;</span>
}
<span class="cstat-no" title="statement not covered" > this._tasks = tasks;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > util.each(tasks, function (task, idx) <span class="fstat-no" title="function not covered" >{</span></span>
<span class="cstat-no" title="statement not covered" > if (!task || !task.once) {</span>
<span class="cstat-no" title="statement not covered" > return;</span>
}
<span class="cstat-no" title="statement not covered" > count++;</span>
<span class="cstat-no" title="statement not covered" > task.once('success', function (res) <span class="fstat-no" title="function not covered" >{</span></span>
<span class="cstat-no" title="statement not covered" > count--;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > self._fulfilledNumber++;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > task._fulfilled = true;</span>
<span class="cstat-no" title="statement not covered" > task._rejected = false;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > data[idx] = res;</span>
<span class="cstat-no" title="statement not covered" > if (count === 0) {</span>
<span class="cstat-no" title="statement not covered" > self.resolve(data);</span>
}
});
<span class="cstat-no" title="statement not covered" > task.once('error', function (err) <span class="fstat-no" title="function not covered" >{</span></span>
<span class="cstat-no" title="statement not covered" > count--;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > self._rejectedNumber++;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > task._fulfilled = false;</span>
<span class="cstat-no" title="statement not covered" > task._rejected = true;</span>
&nbsp;
// TODO
<span class="cstat-no" title="statement not covered" > data[idx] = null;</span>
<span class="cstat-no" title="statement not covered" > if (count === 0) {</span>
<span class="cstat-no" title="statement not covered" > self.resolve(data);</span>
}
});
});
<span class="cstat-no" title="statement not covered" > return this;</span>
};
/**
* Get successed sub tasks number, recursive can be true if sub task is also a TaskGroup.
* @param {boolean} [recursive]
* @return {number}
*/
TaskGroup.prototype.getFulfilledNumber = function (recursive) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (recursive) {</span>
var nFulfilled = <span class="cstat-no" title="statement not covered" >0;</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this._tasks.length; i++) {</span>
var task = <span class="cstat-no" title="statement not covered" >this._tasks[i];</span>
<span class="cstat-no" title="statement not covered" > if (task instanceof TaskGroup) {</span>
<span class="cstat-no" title="statement not covered" > nFulfilled += task.getFulfilledNumber(recursive);</span>
} else <span class="cstat-no" title="statement not covered" >if(task._fulfilled) {</span>
<span class="cstat-no" title="statement not covered" > nFulfilled += 1;</span>
}
}
<span class="cstat-no" title="statement not covered" > return nFulfilled;</span>
} else {
<span class="cstat-no" title="statement not covered" > return this._fulfilledNumber;</span>
}
};
&nbsp;
/**
* Get failed sub tasks number, recursive can be true if sub task is also a TaskGroup.
* @param {boolean} [recursive]
* @return {number}
*/
TaskGroup.prototype.getRejectedNumber = function (recursive) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (recursive) {</span>
var nRejected = <span class="cstat-no" title="statement not covered" >0;</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this._tasks.length; i++) {</span>
var task = <span class="cstat-no" title="statement not covered" >this._tasks[i];</span>
<span class="cstat-no" title="statement not covered" > if (task instanceof TaskGroup) {</span>
<span class="cstat-no" title="statement not covered" > nRejected += task.getRejectedNumber(recursive);</span>
} else <span class="cstat-no" title="statement not covered" >if(task._rejected) {</span>
<span class="cstat-no" title="statement not covered" > nRejected += 1;</span>
}
}
<span class="cstat-no" title="statement not covered" > return nRejected;</span>
} else {
<span class="cstat-no" title="statement not covered" > return this._rejectedNumber;</span>
}
};
&nbsp;
/**
* Get finished sub tasks number, recursive can be true if sub task is also a TaskGroup.
* @param {boolean} [recursive]
* @return {number}
*/
TaskGroup.prototype.getSettledNumber = function (recursive) <span class="fstat-no" title="function not covered" >{</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > if (recursive) {</span>
var nSettled = <span class="cstat-no" title="statement not covered" >0;</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this._tasks.length; i++) {</span>
var task = <span class="cstat-no" title="statement not covered" >this._tasks[i];</span>
<span class="cstat-no" title="statement not covered" > if (task instanceof TaskGroup) {</span>
<span class="cstat-no" title="statement not covered" > nSettled += task.getSettledNumber(recursive);</span>
} else <span class="cstat-no" title="statement not covered" >if(task._rejected || task._fulfilled) {</span>
<span class="cstat-no" title="statement not covered" > nSettled += 1;</span>
}
}
<span class="cstat-no" title="statement not covered" > return nSettled;</span>
} else {
<span class="cstat-no" title="statement not covered" > return this._fulfilledNumber + this._rejectedNumber;</span>
}
};
&nbsp;
/**
* Get all sub tasks number, recursive can be true if sub task is also a TaskGroup.
* @param {boolean} [recursive]
* @return {number}
*/
TaskGroup.prototype.getTaskNumber = function (recursive) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (recursive) {</span>
var nTask = <span class="cstat-no" title="statement not covered" >0;</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this._tasks.length; i++) {</span>
var task = <span class="cstat-no" title="statement not covered" >this._tasks[i];</span>
<span class="cstat-no" title="statement not covered" > if (task instanceof TaskGroup) {</span>
<span class="cstat-no" title="statement not covered" > nTask += task.getTaskNumber(recursive);</span>
} else {
<span class="cstat-no" title="statement not covered" > nTask += 1;</span>
}
}
<span class="cstat-no" title="statement not covered" > return nTask;</span>
} else {
<span class="cstat-no" title="statement not covered" > return this._tasks.length;</span>
}
};
&nbsp;
export default TaskGroup;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,106 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/async/</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> src/async/
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">13.64% </span>
<span class="quiet">Statements</span>
<span class='fraction'>21/154</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/54</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">3.57% </span>
<span class="quiet">Functions</span>
<span class='fraction'>1/28</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">13.64% </span>
<span class="quiet">Lines</span>
<span class='fraction'>21/154</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file low" data-value="Task.js"><a href="Task.js.html">Task.js</a></td>
<td data-value="23.26" class="pic low"><div class="chart"><div class="cover-fill" style="width: 23%;"></div><div class="cover-empty" style="width:77%;"></div></div></td>
<td data-value="23.26" class="pct low">23.26%</td>
<td data-value="43" class="abs low">10/43</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="12" class="abs low">0/12</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="12" class="abs low">0/12</td>
<td data-value="23.26" class="pct low">23.26%</td>
<td data-value="43" class="abs low">10/43</td>
</tr>
<tr>
<td class="file low" data-value="TaskGroup.js"><a href="TaskGroup.js.html">TaskGroup.js</a></td>
<td data-value="9.91" class="pic low"><div class="chart"><div class="cover-fill" style="width: 9%;"></div><div class="cover-empty" style="width:91%;"></div></div></td>
<td data-value="9.91" class="pct low">9.91%</td>
<td data-value="111" class="abs low">11/111</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="42" class="abs low">0/42</td>
<td data-value="6.25" class="pct low">6.25%</td>
<td data-value="16" class="abs low">1/16</td>
<td data-value="9.91" class="pct low">9.91%</td>
<td data-value="111" class="abs low">11/111</td>
</tr>
</tbody>
</table>
</div><div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,263 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/camera/Orthographic.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/camera/</a> Orthographic.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>17/17</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>3/3</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>17/17</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">10×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Camera from '../Camera';
/**
* @constructor clay.camera.Orthographic
* @extends clay.Camera
*/
var Orthographic = Camera.extend(
/** @lends clay.camera.Orthographic# */
{
/**
* @type {number}
*/
left: -1,
/**
* @type {number}
*/
right: 1,
/**
* @type {number}
*/
near: -1,
/**
* @type {number}
*/
far: 1,
/**
* @type {number}
*/
top: 1,
/**
* @type {number}
*/
bottom: -1
},
/** @lends clay.camera.Orthographic.prototype */
{
&nbsp;
updateProjectionMatrix: function() {
this.projectionMatrix.ortho(this.left, this.right, this.bottom, this.top, this.near, this.far);
},
&nbsp;
decomposeProjectionMatrix: function () {
var m = this.projectionMatrix.array;
this.left = (-1 - m[12]) / m[0];
this.right = (1 - m[12]) / m[0];
this.top = (1 - m[13]) / m[5];
this.bottom = (-1 - m[13]) / m[5];
this.near = -(-1 - m[14]) / m[10];
this.far = -(1 - m[14]) / m[10];
},
/**
* @return {clay.camera.Orthographic}
*/
clone: function() {
var camera = Camera.prototype.clone.call(this);
camera.left = this.left;
camera.right = this.right;
camera.near = this.near;
camera.far = this.far;
camera.top = this.top;
camera.bottom = this.bottom;
&nbsp;
return camera;
}
});
&nbsp;
export default Orthographic;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,245 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/camera/Perspective.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/camera/</a> Perspective.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>15/15</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>3/3</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>15/15</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">134×</span>
<span class="cline-any cline-yes">134×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Camera from '../Camera';
&nbsp;
/**
* @constructor clay.camera.Perspective
* @extends clay.Camera
*/
var Perspective = Camera.extend(
/** @lends clay.camera.Perspective# */
{
/**
* Vertical field of view in degrees
* @type {number}
*/
fov: 50,
/**
* Aspect ratio, typically viewport width / height
* @type {number}
*/
aspect: 1,
/**
* Near bound of the frustum
* @type {number}
*/
near: 0.1,
/**
* Far bound of the frustum
* @type {number}
*/
far: 2000
},
/** @lends clay.camera.Perspective.prototype */
{
&nbsp;
updateProjectionMatrix: function() {
var rad = this.fov / 180 * Math.PI;
this.projectionMatrix.perspective(rad, this.aspect, this.near, this.far);
},
decomposeProjectionMatrix: function () {
var m = this.projectionMatrix.array;
var rad = Math.atan(1 / m[5]) * 2;
this.fov = rad / Math.PI * 180;
this.aspect = m[5] / m[0];
this.near = m[14] / (m[10] - 1);
this.far = m[14] / (m[10] + 1);
},
/**
* @return {clay.camera.Perspective}
*/
clone: function() {
var camera = Camera.prototype.clone.call(this);
camera.fov = this.fov;
camera.aspect = this.aspect;
camera.near = this.near;
camera.far = this.far;
&nbsp;
return camera;
}
});
&nbsp;
export default Perspective;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,106 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/camera/</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> src/camera/
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>32/32</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>6/6</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>32/32</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file high" data-value="Orthographic.js"><a href="Orthographic.js.html">Orthographic.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="17" class="abs high">17/17</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="3" class="abs high">3/3</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="17" class="abs high">17/17</td>
</tr>
<tr>
<td class="file high" data-value="Perspective.js"><a href="Perspective.js.html">Perspective.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="15" class="abs high">15/15</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="3" class="abs high">3/3</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="15" class="abs high">15/15</td>
</tr>
</tbody>
</table>
</div><div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,107 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/canvas/Material.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/canvas/</a> Material.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>1/1</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>1/1</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Base from '../core/Base';
&nbsp;
var CanvasMaterial = Base.extend({
&nbsp;
color: [1, 1, 1, 1],
&nbsp;
opacity: 1,
&nbsp;
pointSize: 0,
&nbsp;
pointShape: 'rectangle'
});
&nbsp;
export default CanvasMaterial;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 07 2018 14:10:25 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,106 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/canvas/</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> src/canvas/
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">7.6% </span>
<span class="quiet">Statements</span>
<span class='fraction'>19/250</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">1.47% </span>
<span class="quiet">Branches</span>
<span class='fraction'>1/68</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">9.09% </span>
<span class="quiet">Functions</span>
<span class='fraction'>2/22</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">7.6% </span>
<span class="quiet">Lines</span>
<span class='fraction'>19/250</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file high" data-value="Material.js"><a href="Material.js.html">Material.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">1/1</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">1/1</td>
</tr>
<tr>
<td class="file low" data-value="Renderer.js"><a href="Renderer.js.html">Renderer.js</a></td>
<td data-value="7.23" class="pic low"><div class="chart"><div class="cover-fill" style="width: 7%;"></div><div class="cover-empty" style="width:93%;"></div></div></td>
<td data-value="7.23" class="pct low">7.23%</td>
<td data-value="249" class="abs low">18/249</td>
<td data-value="1.47" class="pct low">1.47%</td>
<td data-value="68" class="abs low">1/68</td>
<td data-value="9.09" class="pct low">9.09%</td>
<td data-value="22" class="abs low">2/22</td>
<td data-value="7.23" class="pct low">7.23%</td>
<td data-value="249" class="abs low">18/249</td>
</tr>
</tbody>
</table>
</div><div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 07 2018 14:10:25 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,323 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/compositor/Compositor.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/compositor/</a> Compositor.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">4.35% </span>
<span class="quiet">Statements</span>
<span class='fraction'>1/23</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/4</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/7</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">4.35% </span>
<span class="quiet">Lines</span>
<span class='fraction'>1/23</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Graph from './Graph';
import TexturePool from './TexturePool';
import FrameBuffer from '../FrameBuffer';
&nbsp;
/**
* Compositor provide graph based post processing
*
* @constructor clay.compositor.Compositor
* @extends clay.compositor.Graph
*
*/
var Compositor = Graph.extend(function() <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return {</span>
// Output node
_outputs: [],
&nbsp;
_texturePool: new TexturePool(),
&nbsp;
_frameBuffer: new FrameBuffer({
depthBuffer: false
})
};
},
/** @lends clay.compositor.Compositor.prototype */
{
addNode: function(node) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > Graph.prototype.addNode.call(this, node);</span>
<span class="cstat-no" title="statement not covered" > node._compositor = this;</span>
},
/**
* @param {clay.Renderer} renderer
*/
render: function(renderer, frameBuffer) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (this._dirty) {</span>
<span class="cstat-no" title="statement not covered" > this.update();</span>
<span class="cstat-no" title="statement not covered" > this._dirty = false;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this._outputs.length = 0;</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.nodes.length; i++) {</span>
<span class="cstat-no" title="statement not covered" > if (!this.nodes[i].outputs) {</span>
<span class="cstat-no" title="statement not covered" > this._outputs.push(this.nodes[i]);</span>
}
}
}
&nbsp;
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.nodes.length; i++) {</span>
// Update the reference number of each output texture
<span class="cstat-no" title="statement not covered" > this.nodes[i].beforeFrame();</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this._outputs.length; i++) {</span>
<span class="cstat-no" title="statement not covered" > this._outputs[i].updateReference();</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this._outputs.length; i++) {</span>
<span class="cstat-no" title="statement not covered" > this._outputs[i].render(renderer, frameBuffer);</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.nodes.length; i++) {</span>
// Clear up
<span class="cstat-no" title="statement not covered" > this.nodes[i].afterFrame();</span>
}
},
&nbsp;
allocateTexture: function (parameters) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return this._texturePool.get(parameters);</span>
},
&nbsp;
releaseTexture: function (parameters) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._texturePool.put(parameters);</span>
},
&nbsp;
getFrameBuffer: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return this._frameBuffer;</span>
},
&nbsp;
/**
* Dispose compositor
* @param {clay.Renderer} renderer
*/
dispose: function (renderer) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._texturePool.clear(renderer);</span>
}
});
&nbsp;
export default Compositor;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,803 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/compositor/CompositorNode.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/compositor/</a> CompositorNode.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">1.33% </span>
<span class="quiet">Statements</span>
<span class='fraction'>1/75</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/50</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/13</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">1.33% </span>
<span class="quiet">Lines</span>
<span class='fraction'>1/75</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Base from '../core/Base';
&nbsp;
// PENDING
// Use topological sort ?
&nbsp;
/**
* Node of graph based post processing.
*
* @constructor clay.compositor.CompositorNode
* @extends clay.core.Base
*
*/
var CompositorNode = Base.extend(function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return /** @lends clay.compositor.CompositorNode# */ {</span>
/**
* @type {string}
*/
name: '',
&nbsp;
/**
* Input links, will be updated by the graph
* @example:
* inputName: {
* node: someNode,
* pin: 'xxxx'
* }
* @type {Object}
*/
inputLinks: {},
&nbsp;
/**
* Output links, will be updated by the graph
* @example:
* outputName: {
* node: someNode,
* pin: 'xxxx'
* }
* @type {Object}
*/
outputLinks: {},
&nbsp;
// Save the output texture of previous frame
// Will be used when there exist a circular reference
_prevOutputTextures: {},
_outputTextures: {},
&nbsp;
// Example: { name: 2 }
_outputReferences: {},
&nbsp;
_rendering: false,
// If rendered in this frame
_rendered: false,
&nbsp;
_compositor: null
};
},
/** @lends clay.compositor.CompositorNode.prototype */
{
&nbsp;
// TODO Remove parameter function callback
updateParameter: function (outputName, renderer) <span class="fstat-no" title="function not covered" >{</span>
var outputInfo = <span class="cstat-no" title="statement not covered" >this.outputs[outputName];</span>
var parameters = <span class="cstat-no" title="statement not covered" >outputInfo.parameters;</span>
var parametersCopy = <span class="cstat-no" title="statement not covered" >outputInfo._parametersCopy;</span>
<span class="cstat-no" title="statement not covered" > if (!parametersCopy) {</span>
<span class="cstat-no" title="statement not covered" > parametersCopy = outputInfo._parametersCopy = {};</span>
}
<span class="cstat-no" title="statement not covered" > if (parameters) {</span>
<span class="cstat-no" title="statement not covered" > for (var key in parameters) {</span>
<span class="cstat-no" title="statement not covered" > if (key !== 'width' &amp;&amp; key !== 'height') {</span>
<span class="cstat-no" title="statement not covered" > parametersCopy[key] = parameters[key];</span>
}
}
}
var width, height;
<span class="cstat-no" title="statement not covered" > if (parameters.width instanceof Function) {</span>
<span class="cstat-no" title="statement not covered" > width = parameters.width.call(this, renderer);</span>
}
else {
<span class="cstat-no" title="statement not covered" > width = parameters.width;</span>
}
<span class="cstat-no" title="statement not covered" > if (parameters.height instanceof Function) {</span>
<span class="cstat-no" title="statement not covered" > height = parameters.height.call(this, renderer);</span>
}
else {
<span class="cstat-no" title="statement not covered" > height = parameters.height;</span>
}
<span class="cstat-no" title="statement not covered" > if (</span>
parametersCopy.width !== width
|| parametersCopy.height !== height
) {
<span class="cstat-no" title="statement not covered" > if (this._outputTextures[outputName]) {</span>
<span class="cstat-no" title="statement not covered" > this._outputTextures[outputName].dispose(renderer.gl);</span>
}
}
<span class="cstat-no" title="statement not covered" > parametersCopy.width = width;</span>
<span class="cstat-no" title="statement not covered" > parametersCopy.height = height;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > return parametersCopy;</span>
},
&nbsp;
/**
* Set parameter
* @param {string} name
* @param {} value
*/
setParameter: function (name, value) <span class="fstat-no" title="function not covered" >{},</span>
/**
* Get parameter value
* @param {string} name
* @return {}
*/
getParameter: function (name) <span class="fstat-no" title="function not covered" >{},</span>
/**
* Set parameters
* @param {Object} obj
*/
setParameters: function (obj) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > for (var name in obj) {</span>
<span class="cstat-no" title="statement not covered" > this.setParameter(name, obj[name]);</span>
}
},
&nbsp;
render: function () <span class="fstat-no" title="function not covered" >{},</span>
&nbsp;
getOutput: function (renderer /*optional*/, name) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (name == null) {</span>
// Return the output texture without rendering
<span class="cstat-no" title="statement not covered" > name = renderer;</span>
<span class="cstat-no" title="statement not covered" > return this._outputTextures[name];</span>
}
var outputInfo = <span class="cstat-no" title="statement not covered" >this.outputs[name];</span>
<span class="cstat-no" title="statement not covered" > if (!outputInfo) {</span>
<span class="cstat-no" title="statement not covered" > return ;</span>
}
&nbsp;
// Already been rendered in this frame
<span class="cstat-no" title="statement not covered" > if (this._rendered) {</span>
// Force return texture in last frame
<span class="cstat-no" title="statement not covered" > if (outputInfo.outputLastFrame) {</span>
<span class="cstat-no" title="statement not covered" > return this._prevOutputTextures[name];</span>
}
else {
<span class="cstat-no" title="statement not covered" > return this._outputTextures[name];</span>
}
}
else <span class="cstat-no" title="statement not covered" >if (</span>
// TODO
this._rendering // Solve Circular Reference
) {
<span class="cstat-no" title="statement not covered" > if (!this._prevOutputTextures[name]) {</span>
// Create a blank texture at first pass
<span class="cstat-no" title="statement not covered" > this._prevOutputTextures[name] = this._compositor.allocateTexture(outputInfo.parameters || {});</span>
}
<span class="cstat-no" title="statement not covered" > return this._prevOutputTextures[name];</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > this.render(renderer);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > return this._outputTextures[name];</span>
},
&nbsp;
removeReference: function (outputName) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._outputReferences[outputName]--;</span>
<span class="cstat-no" title="statement not covered" > if (this._outputReferences[outputName] === 0) {</span>
var outputInfo = <span class="cstat-no" title="statement not covered" >this.outputs[outputName];</span>
<span class="cstat-no" title="statement not covered" > if (outputInfo.keepLastFrame) {</span>
<span class="cstat-no" title="statement not covered" > if (this._prevOutputTextures[outputName]) {</span>
<span class="cstat-no" title="statement not covered" > this._compositor.releaseTexture(this._prevOutputTextures[outputName]);</span>
}
<span class="cstat-no" title="statement not covered" > this._prevOutputTextures[outputName] = this._outputTextures[outputName];</span>
}
else {
// Output of this node have alreay been used by all other nodes
// Put the texture back to the pool.
<span class="cstat-no" title="statement not covered" > this._compositor.releaseTexture(this._outputTextures[outputName]);</span>
}
}
},
&nbsp;
link: function (inputPinName, fromNode, fromPinName) <span class="fstat-no" title="function not covered" >{</span>
&nbsp;
// The relationship from output pin to input pin is one-on-multiple
<span class="cstat-no" title="statement not covered" > this.inputLinks[inputPinName] = {</span>
node: fromNode,
pin: fromPinName
};
<span class="cstat-no" title="statement not covered" > if (!fromNode.outputLinks[fromPinName]) {</span>
<span class="cstat-no" title="statement not covered" > fromNode.outputLinks[fromPinName] = [];</span>
}
<span class="cstat-no" title="statement not covered" > fromNode.outputLinks[fromPinName].push({</span>
node: this,
pin: inputPinName
});
&nbsp;
// Enabled the pin texture in shader
<span class="cstat-no" title="statement not covered" > this.pass.material.enableTexture(inputPinName);</span>
},
&nbsp;
clear: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this.inputLinks = {};</span>
<span class="cstat-no" title="statement not covered" > this.outputLinks = {};</span>
},
&nbsp;
updateReference: function (outputName) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (!this._rendering) {</span>
<span class="cstat-no" title="statement not covered" > this._rendering = true;</span>
<span class="cstat-no" title="statement not covered" > for (var inputName in this.inputLinks) {</span>
var link = <span class="cstat-no" title="statement not covered" >this.inputLinks[inputName];</span>
<span class="cstat-no" title="statement not covered" > link.node.updateReference(link.pin);</span>
}
<span class="cstat-no" title="statement not covered" > this._rendering = false;</span>
}
<span class="cstat-no" title="statement not covered" > if (outputName) {</span>
<span class="cstat-no" title="statement not covered" > this._outputReferences[outputName] ++;</span>
}
},
&nbsp;
beforeFrame: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._rendered = false;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > for (var name in this.outputLinks) {</span>
<span class="cstat-no" title="statement not covered" > this._outputReferences[name] = 0;</span>
}
},
&nbsp;
afterFrame: function () <span class="fstat-no" title="function not covered" >{</span>
// Put back all the textures to pool
<span class="cstat-no" title="statement not covered" > for (var name in this.outputLinks) {</span>
<span class="cstat-no" title="statement not covered" > if (this._outputReferences[name] &gt; 0) {</span>
var outputInfo = <span class="cstat-no" title="statement not covered" >this.outputs[name];</span>
<span class="cstat-no" title="statement not covered" > if (outputInfo.keepLastFrame) {</span>
<span class="cstat-no" title="statement not covered" > if (this._prevOutputTextures[name]) {</span>
<span class="cstat-no" title="statement not covered" > this._compositor.releaseTexture(this._prevOutputTextures[name]);</span>
}
<span class="cstat-no" title="statement not covered" > this._prevOutputTextures[name] = this._outputTextures[name];</span>
}
else {
<span class="cstat-no" title="statement not covered" > this._compositor.releaseTexture(this._outputTextures[name]);</span>
}
}
}
}
});
&nbsp;
export default CompositorNode;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,974 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/compositor/FilterNode.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/compositor/</a> FilterNode.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">1.32% </span>
<span class="quiet">Statements</span>
<span class='fraction'>1/76</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/32</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/11</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">1.32% </span>
<span class="quiet">Lines</span>
<span class='fraction'>1/76</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">// TODO Shader library
import Pass from './Pass';
import CompositorNode from './CompositorNode';
&nbsp;
// TODO curlnoise demo wrong
&nbsp;
// PENDING
// Use topological sort ?
&nbsp;
/**
* Filter node
*
* @constructor clay.compositor.FilterNode
* @extends clay.compositor.CompositorNode
*
* @example
var node = new clay.compositor.FilterNode({
name: 'fxaa',
shader: clay.Shader.source('clay.compositor.fxaa'),
inputs: {
texture: {
node: 'scene',
pin: 'color'
}
},
// Multiple outputs is preserved for MRT support in WebGL2.0
outputs: {
color: {
attachment: clay.FrameBuffer.COLOR_ATTACHMENT0
parameters: {
format: clay.Texture.RGBA,
width: 512,
height: 512
},
// Node will keep the RTT rendered in last frame
keepLastFrame: true,
// Force the node output the RTT rendered in last frame
outputLastFrame: true
}
}
});
*
*/
var FilterNode = CompositorNode.extend(function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return /** @lends clay.compositor.FilterNode# */ {</span>
/**
* @type {string}
*/
name: '',
&nbsp;
/**
* @type {Object}
*/
inputs: {},
&nbsp;
/**
* @type {Object}
*/
outputs: null,
&nbsp;
/**
* @type {string}
*/
shader: '',
&nbsp;
/**
* Input links, will be updated by the graph
* @example:
* inputName: {
* node: someNode,
* pin: 'xxxx'
* }
* @type {Object}
*/
inputLinks: {},
&nbsp;
/**
* Output links, will be updated by the graph
* @example:
* outputName: {
* node: someNode,
* pin: 'xxxx'
* }
* @type {Object}
*/
outputLinks: {},
&nbsp;
/**
* @type {clay.compositor.Pass}
*/
pass: null,
&nbsp;
// Save the output texture of previous frame
// Will be used when there exist a circular reference
_prevOutputTextures: {},
_outputTextures: {},
&nbsp;
// Example: { name: 2 }
_outputReferences: {},
&nbsp;
_rendering: false,
// If rendered in this frame
_rendered: false,
&nbsp;
_compositor: null
};
}, function () <span class="fstat-no" title="function not covered" >{</span>
&nbsp;
var pass = <span class="cstat-no" title="statement not covered" >new Pass({</span>
fragment: this.shader
});
<span class="cstat-no" title="statement not covered" > this.pass = pass;</span>
},
/** @lends clay.compositor.FilterNode.prototype */
{
/**
* @param {clay.Renderer} renderer
*/
render: function (renderer, frameBuffer) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this.trigger('beforerender', renderer);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this._rendering = true;</span>
&nbsp;
var _gl = <span class="cstat-no" title="statement not covered" >renderer.gl;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > for (var inputName in this.inputLinks) {</span>
var link = <span class="cstat-no" title="statement not covered" >this.inputLinks[inputName];</span>
var inputTexture = <span class="cstat-no" title="statement not covered" >link.node.getOutput(renderer, link.pin);</span>
<span class="cstat-no" title="statement not covered" > this.pass.setUniform(inputName, inputTexture);</span>
}
// Output
<span class="cstat-no" title="statement not covered" > if (!this.outputs) {</span>
<span class="cstat-no" title="statement not covered" > this.pass.outputs = null;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this._compositor.getFrameBuffer().unbind(renderer);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this.pass.render(renderer, frameBuffer);</span>
}
else {
<span class="cstat-no" title="statement not covered" > this.pass.outputs = {};</span>
&nbsp;
var attachedTextures = <span class="cstat-no" title="statement not covered" >{};</span>
<span class="cstat-no" title="statement not covered" > for (var name in this.outputs) {</span>
var parameters = <span class="cstat-no" title="statement not covered" >this.updateParameter(name, renderer);</span>
<span class="cstat-no" title="statement not covered" > if (isNaN(parameters.width)) {</span>
<span class="cstat-no" title="statement not covered" > this.updateParameter(name, renderer);</span>
}
var outputInfo = <span class="cstat-no" title="statement not covered" >this.outputs[name];</span>
var texture = <span class="cstat-no" title="statement not covered" >this._compositor.allocateTexture(parameters);</span>
<span class="cstat-no" title="statement not covered" > this._outputTextures[name] = texture;</span>
var attachment = <span class="cstat-no" title="statement not covered" >outputInfo.attachment || _gl.COLOR_ATTACHMENT0;</span>
<span class="cstat-no" title="statement not covered" > if (typeof(attachment) == 'string') {</span>
<span class="cstat-no" title="statement not covered" > attachment = _gl[attachment];</span>
}
<span class="cstat-no" title="statement not covered" > attachedTextures[attachment] = texture;</span>
}
<span class="cstat-no" title="statement not covered" > this._compositor.getFrameBuffer().bind(renderer);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > for (var attachment in attachedTextures) {</span>
// FIXME attachment changes in different nodes
<span class="cstat-no" title="statement not covered" > this._compositor.getFrameBuffer().attach(</span>
attachedTextures[attachment], attachment
);
}
&nbsp;
<span class="cstat-no" title="statement not covered" > this.pass.render(renderer);</span>
&nbsp;
// Because the data of texture is changed over time,
// Here update the mipmaps of texture each time after rendered;
<span class="cstat-no" title="statement not covered" > this._compositor.getFrameBuffer().updateMipmap(renderer.gl);</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > for (var inputName in this.inputLinks) {</span>
var link = <span class="cstat-no" title="statement not covered" >this.inputLinks[inputName];</span>
<span class="cstat-no" title="statement not covered" > link.node.removeReference(link.pin);</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > this._rendering = false;</span>
<span class="cstat-no" title="statement not covered" > this._rendered = true;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this.trigger('afterrender', renderer);</span>
},
&nbsp;
// TODO Remove parameter function callback
updateParameter: function (outputName, renderer) <span class="fstat-no" title="function not covered" >{</span>
var outputInfo = <span class="cstat-no" title="statement not covered" >this.outputs[outputName];</span>
var parameters = <span class="cstat-no" title="statement not covered" >outputInfo.parameters;</span>
var parametersCopy = <span class="cstat-no" title="statement not covered" >outputInfo._parametersCopy;</span>
<span class="cstat-no" title="statement not covered" > if (!parametersCopy) {</span>
<span class="cstat-no" title="statement not covered" > parametersCopy = outputInfo._parametersCopy = {};</span>
}
<span class="cstat-no" title="statement not covered" > if (parameters) {</span>
<span class="cstat-no" title="statement not covered" > for (var key in parameters) {</span>
<span class="cstat-no" title="statement not covered" > if (key !== 'width' &amp;&amp; key !== 'height') {</span>
<span class="cstat-no" title="statement not covered" > parametersCopy[key] = parameters[key];</span>
}
}
}
var width, height;
<span class="cstat-no" title="statement not covered" > if (parameters.width instanceof Function) {</span>
<span class="cstat-no" title="statement not covered" > width = parameters.width.call(this, renderer);</span>
}
else {
<span class="cstat-no" title="statement not covered" > width = parameters.width;</span>
}
<span class="cstat-no" title="statement not covered" > if (parameters.height instanceof Function) {</span>
<span class="cstat-no" title="statement not covered" > height = parameters.height.call(this, renderer);</span>
}
else {
<span class="cstat-no" title="statement not covered" > height = parameters.height;</span>
}
<span class="cstat-no" title="statement not covered" > if (</span>
parametersCopy.width !== width
|| parametersCopy.height !== height
) {
<span class="cstat-no" title="statement not covered" > if (this._outputTextures[outputName]) {</span>
<span class="cstat-no" title="statement not covered" > this._outputTextures[outputName].dispose(renderer);</span>
}
}
<span class="cstat-no" title="statement not covered" > parametersCopy.width = width;</span>
<span class="cstat-no" title="statement not covered" > parametersCopy.height = height;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > return parametersCopy;</span>
},
&nbsp;
/**
* Set parameter
* @param {string} name
* @param {} value
*/
setParameter: function (name, value) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this.pass.setUniform(name, value);</span>
},
/**
* Get parameter value
* @param {string} name
* @return {}
*/
getParameter: function (name) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return this.pass.getUniform(name);</span>
},
/**
* Set parameters
* @param {Object} obj
*/
setParameters: function (obj) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > for (var name in obj) {</span>
<span class="cstat-no" title="statement not covered" > this.setParameter(name, obj[name]);</span>
}
},
// /**
// * Set shader code
// * @param {string} shaderStr
// */
// setShader: function (shaderStr) {
// var material = this.pass.material;
// material.shader.setFragment(shaderStr);
// material.attachShader(material.shader, true);
// },
/**
* Proxy of pass.material.define('fragment', xxx);
* @param {string} symbol
* @param {number} [val]
*/
define: function (symbol, val) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this.pass.material.define('fragment', symbol, val);</span>
},
&nbsp;
/**
* Proxy of pass.material.undefine('fragment', xxx)
* @param {string} symbol
*/
undefine: function (symbol) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this.pass.material.undefine('fragment', symbol);</span>
},
&nbsp;
removeReference: function (outputName) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._outputReferences[outputName]--;</span>
<span class="cstat-no" title="statement not covered" > if (this._outputReferences[outputName] === 0) {</span>
var outputInfo = <span class="cstat-no" title="statement not covered" >this.outputs[outputName];</span>
<span class="cstat-no" title="statement not covered" > if (outputInfo.keepLastFrame) {</span>
<span class="cstat-no" title="statement not covered" > if (this._prevOutputTextures[outputName]) {</span>
<span class="cstat-no" title="statement not covered" > this._compositor.releaseTexture(this._prevOutputTextures[outputName]);</span>
}
<span class="cstat-no" title="statement not covered" > this._prevOutputTextures[outputName] = this._outputTextures[outputName];</span>
}
else {
// Output of this node have alreay been used by all other nodes
// Put the texture back to the pool.
<span class="cstat-no" title="statement not covered" > this._compositor.releaseTexture(this._outputTextures[outputName]);</span>
}
}
},
&nbsp;
clear: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > CompositorNode.prototype.clear.call(this);</span>
&nbsp;
// Default disable all texture
<span class="cstat-no" title="statement not covered" > this.pass.material.disableTexturesAll();</span>
}
});
&nbsp;
export default FilterNode;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,485 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/compositor/Graph.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/compositor/</a> Graph.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">2% </span>
<span class="quiet">Statements</span>
<span class='fraction'>1/50</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/36</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/7</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">2% </span>
<span class="quiet">Lines</span>
<span class='fraction'>1/50</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Base from '../core/Base';
import GraphNode from './CompositorNode';
&nbsp;
/**
* @constructor clay.compositor.Graph
* @extends clay.core.Base
*/
var Graph = Base.extend(function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return /** @lends clay.compositor.Graph# */ {</span>
/**
* @type {Array.&lt;clay.compositor.CompositorNode&gt;}
*/
nodes: []
};
},
/** @lends clay.compositor.Graph.prototype */
{
&nbsp;
/**
* Mark to update
*/
dirty: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._dirty = true;</span>
},
/**
* @param {clay.compositor.CompositorNode} node
*/
addNode: function (node) <span class="fstat-no" title="function not covered" >{</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > if (this.nodes.indexOf(node) &gt;= 0) {</span>
<span class="cstat-no" title="statement not covered" > return;</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > this.nodes.push(node);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this._dirty = true;</span>
},
/**
* @param {clay.compositor.CompositorNode|string} node
*/
removeNode: function (node) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (typeof node === 'string') {</span>
<span class="cstat-no" title="statement not covered" > node = this.getNodeByName(node);</span>
}
var idx = <span class="cstat-no" title="statement not covered" >this.nodes.indexOf(node);</span>
<span class="cstat-no" title="statement not covered" > if (idx &gt;= 0) {</span>
<span class="cstat-no" title="statement not covered" > this.nodes.splice(idx, 1);</span>
<span class="cstat-no" title="statement not covered" > this._dirty = true;</span>
}
},
/**
* @param {string} name
* @return {clay.compositor.CompositorNode}
*/
getNodeByName: function (name) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.nodes.length; i++) {</span>
<span class="cstat-no" title="statement not covered" > if (this.nodes[i].name === name) {</span>
<span class="cstat-no" title="statement not covered" > return this.nodes[i];</span>
}
}
},
/**
* Update links of graph
*/
update: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.nodes.length; i++) {</span>
<span class="cstat-no" title="statement not covered" > this.nodes[i].clear();</span>
}
// Traverse all the nodes and build the graph
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.nodes.length; i++) {</span>
var node = <span class="cstat-no" title="statement not covered" >this.nodes[i];</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > if (!node.inputs) {</span>
<span class="cstat-no" title="statement not covered" > continue;</span>
}
<span class="cstat-no" title="statement not covered" > for (var inputName in node.inputs) {</span>
<span class="cstat-no" title="statement not covered" > if (!node.inputs[inputName]) {</span>
<span class="cstat-no" title="statement not covered" > continue;</span>
}
<span class="cstat-no" title="statement not covered" > if (node.pass &amp;&amp; !node.pass.material.isUniformEnabled(inputName)) {</span>
<span class="cstat-no" title="statement not covered" > console.warn('Pin ' + node.name + '.' + inputName + ' not used.');</span>
<span class="cstat-no" title="statement not covered" > continue;</span>
}
var fromPinInfo = <span class="cstat-no" title="statement not covered" >node.inputs[inputName];</span>
&nbsp;
var fromPin = <span class="cstat-no" title="statement not covered" >this.findPin(fromPinInfo);</span>
<span class="cstat-no" title="statement not covered" > if (fromPin) {</span>
<span class="cstat-no" title="statement not covered" > node.link(inputName, fromPin.node, fromPin.pin);</span>
}
else {
<span class="cstat-no" title="statement not covered" > if (typeof fromPinInfo === 'string') {</span>
<span class="cstat-no" title="statement not covered" > console.warn('Node ' + fromPinInfo + ' not exist');</span>
}
else {
<span class="cstat-no" title="statement not covered" > console.warn('Pin of ' + fromPinInfo.node + '.' + fromPinInfo.pin + ' not exist');</span>
}
}
}
}
},
&nbsp;
findPin: function (input) <span class="fstat-no" title="function not covered" >{</span>
var node;
// Try to take input as a directly a node
<span class="cstat-no" title="statement not covered" > if (typeof input === 'string' || input instanceof GraphNode) {</span>
<span class="cstat-no" title="statement not covered" > input = {</span>
node: input
};
}
&nbsp;
<span class="cstat-no" title="statement not covered" > if (typeof input.node === 'string') {</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this.nodes.length; i++) {</span>
var tmp = <span class="cstat-no" title="statement not covered" >this.nodes[i];</span>
<span class="cstat-no" title="statement not covered" > if (tmp.name === input.node) {</span>
<span class="cstat-no" title="statement not covered" > node = tmp;</span>
}
}
}
else {
<span class="cstat-no" title="statement not covered" > node = input.node;</span>
}
<span class="cstat-no" title="statement not covered" > if (node) {</span>
var inputPin = <span class="cstat-no" title="statement not covered" >input.pin;</span>
<span class="cstat-no" title="statement not covered" > if (!inputPin) {</span>
// Use first pin defaultly
<span class="cstat-no" title="statement not covered" > if (node.outputs) {</span>
<span class="cstat-no" title="statement not covered" > inputPin = Object.keys(node.outputs)[0];</span>
}
}
<span class="cstat-no" title="statement not covered" > if (node.outputs[inputPin]) {</span>
<span class="cstat-no" title="statement not covered" > return {</span>
node: node,
pin: inputPin
};
}
}
}
});
&nbsp;
export default Graph;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,803 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/compositor/Node.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/compositor/</a> Node.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">1.33% </span>
<span class="quiet">Statements</span>
<span class='fraction'>1/75</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/50</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/13</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">1.33% </span>
<span class="quiet">Lines</span>
<span class='fraction'>1/75</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Base from '../core/Base';
&nbsp;
// PENDING
// Use topological sort ?
&nbsp;
/**
* Node of graph based post processing.
*
* @constructor clay.compositor.Node
* @extends clay.core.Base
*
*/
var Node = Base.extend(function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return /** @lends clay.compositor.Node# */ {</span>
/**
* @type {string}
*/
name: '',
&nbsp;
/**
* Input links, will be updated by the graph
* @example:
* inputName: {
* node: someNode,
* pin: 'xxxx'
* }
* @type {Object}
*/
inputLinks: {},
&nbsp;
/**
* Output links, will be updated by the graph
* @example:
* outputName: {
* node: someNode,
* pin: 'xxxx'
* }
* @type {Object}
*/
outputLinks: {},
&nbsp;
// Save the output texture of previous frame
// Will be used when there exist a circular reference
_prevOutputTextures: {},
_outputTextures: {},
&nbsp;
// Example: { name: 2 }
_outputReferences: {},
&nbsp;
_rendering: false,
// If rendered in this frame
_rendered: false,
&nbsp;
_compositor: null
};
},
/** @lends clay.compositor.Node.prototype */
{
&nbsp;
// TODO Remove parameter function callback
updateParameter: function (outputName, renderer) <span class="fstat-no" title="function not covered" >{</span>
var outputInfo = <span class="cstat-no" title="statement not covered" >this.outputs[outputName];</span>
var parameters = <span class="cstat-no" title="statement not covered" >outputInfo.parameters;</span>
var parametersCopy = <span class="cstat-no" title="statement not covered" >outputInfo._parametersCopy;</span>
<span class="cstat-no" title="statement not covered" > if (!parametersCopy) {</span>
<span class="cstat-no" title="statement not covered" > parametersCopy = outputInfo._parametersCopy = {};</span>
}
<span class="cstat-no" title="statement not covered" > if (parameters) {</span>
<span class="cstat-no" title="statement not covered" > for (var key in parameters) {</span>
<span class="cstat-no" title="statement not covered" > if (key !== 'width' &amp;&amp; key !== 'height') {</span>
<span class="cstat-no" title="statement not covered" > parametersCopy[key] = parameters[key];</span>
}
}
}
var width, height;
<span class="cstat-no" title="statement not covered" > if (parameters.width instanceof Function) {</span>
<span class="cstat-no" title="statement not covered" > width = parameters.width.call(this, renderer);</span>
}
else {
<span class="cstat-no" title="statement not covered" > width = parameters.width;</span>
}
<span class="cstat-no" title="statement not covered" > if (parameters.height instanceof Function) {</span>
<span class="cstat-no" title="statement not covered" > height = parameters.height.call(this, renderer);</span>
}
else {
<span class="cstat-no" title="statement not covered" > height = parameters.height;</span>
}
<span class="cstat-no" title="statement not covered" > if (</span>
parametersCopy.width !== width
|| parametersCopy.height !== height
) {
<span class="cstat-no" title="statement not covered" > if (this._outputTextures[outputName]) {</span>
<span class="cstat-no" title="statement not covered" > this._outputTextures[outputName].dispose(renderer.gl);</span>
}
}
<span class="cstat-no" title="statement not covered" > parametersCopy.width = width;</span>
<span class="cstat-no" title="statement not covered" > parametersCopy.height = height;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > return parametersCopy;</span>
},
&nbsp;
/**
* Set parameter
* @param {string} name
* @param {} value
*/
setParameter: function (name, value) <span class="fstat-no" title="function not covered" >{},</span>
/**
* Get parameter value
* @param {string} name
* @return {}
*/
getParameter: function (name) <span class="fstat-no" title="function not covered" >{},</span>
/**
* Set parameters
* @param {Object} obj
*/
setParameters: function (obj) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > for (var name in obj) {</span>
<span class="cstat-no" title="statement not covered" > this.setParameter(name, obj[name]);</span>
}
},
&nbsp;
render: function () <span class="fstat-no" title="function not covered" >{},</span>
&nbsp;
getOutput: function (renderer /*optional*/, name) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (name == null) {</span>
// Return the output texture without rendering
<span class="cstat-no" title="statement not covered" > name = renderer;</span>
<span class="cstat-no" title="statement not covered" > return this._outputTextures[name];</span>
}
var outputInfo = <span class="cstat-no" title="statement not covered" >this.outputs[name];</span>
<span class="cstat-no" title="statement not covered" > if (!outputInfo) {</span>
<span class="cstat-no" title="statement not covered" > return ;</span>
}
&nbsp;
// Already been rendered in this frame
<span class="cstat-no" title="statement not covered" > if (this._rendered) {</span>
// Force return texture in last frame
<span class="cstat-no" title="statement not covered" > if (outputInfo.outputLastFrame) {</span>
<span class="cstat-no" title="statement not covered" > return this._prevOutputTextures[name];</span>
}
else {
<span class="cstat-no" title="statement not covered" > return this._outputTextures[name];</span>
}
}
else <span class="cstat-no" title="statement not covered" >if (</span>
// TODO
this._rendering // Solve Circular Reference
) {
<span class="cstat-no" title="statement not covered" > if (!this._prevOutputTextures[name]) {</span>
// Create a blank texture at first pass
<span class="cstat-no" title="statement not covered" > this._prevOutputTextures[name] = this._compositor.allocateTexture(outputInfo.parameters || {});</span>
}
<span class="cstat-no" title="statement not covered" > return this._prevOutputTextures[name];</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > this.render(renderer);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > return this._outputTextures[name];</span>
},
&nbsp;
removeReference: function (outputName) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._outputReferences[outputName]--;</span>
<span class="cstat-no" title="statement not covered" > if (this._outputReferences[outputName] === 0) {</span>
var outputInfo = <span class="cstat-no" title="statement not covered" >this.outputs[outputName];</span>
<span class="cstat-no" title="statement not covered" > if (outputInfo.keepLastFrame) {</span>
<span class="cstat-no" title="statement not covered" > if (this._prevOutputTextures[outputName]) {</span>
<span class="cstat-no" title="statement not covered" > this._compositor.releaseTexture(this._prevOutputTextures[outputName]);</span>
}
<span class="cstat-no" title="statement not covered" > this._prevOutputTextures[outputName] = this._outputTextures[outputName];</span>
}
else {
// Output of this node have alreay been used by all other nodes
// Put the texture back to the pool.
<span class="cstat-no" title="statement not covered" > this._compositor.releaseTexture(this._outputTextures[outputName]);</span>
}
}
},
&nbsp;
link: function (inputPinName, fromNode, fromPinName) <span class="fstat-no" title="function not covered" >{</span>
&nbsp;
// The relationship from output pin to input pin is one-on-multiple
<span class="cstat-no" title="statement not covered" > this.inputLinks[inputPinName] = {</span>
node: fromNode,
pin: fromPinName
};
<span class="cstat-no" title="statement not covered" > if (!fromNode.outputLinks[fromPinName]) {</span>
<span class="cstat-no" title="statement not covered" > fromNode.outputLinks[fromPinName] = [];</span>
}
<span class="cstat-no" title="statement not covered" > fromNode.outputLinks[fromPinName].push({</span>
node: this,
pin: inputPinName
});
&nbsp;
// Enabled the pin texture in shader
<span class="cstat-no" title="statement not covered" > this.pass.material.enableTexture(inputPinName);</span>
},
&nbsp;
clear: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this.inputLinks = {};</span>
<span class="cstat-no" title="statement not covered" > this.outputLinks = {};</span>
},
&nbsp;
updateReference: function (outputName) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (!this._rendering) {</span>
<span class="cstat-no" title="statement not covered" > this._rendering = true;</span>
<span class="cstat-no" title="statement not covered" > for (var inputName in this.inputLinks) {</span>
var link = <span class="cstat-no" title="statement not covered" >this.inputLinks[inputName];</span>
<span class="cstat-no" title="statement not covered" > link.node.updateReference(link.pin);</span>
}
<span class="cstat-no" title="statement not covered" > this._rendering = false;</span>
}
<span class="cstat-no" title="statement not covered" > if (outputName) {</span>
<span class="cstat-no" title="statement not covered" > this._outputReferences[outputName] ++;</span>
}
},
&nbsp;
beforeFrame: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._rendered = false;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > for (var name in this.outputLinks) {</span>
<span class="cstat-no" title="statement not covered" > this._outputReferences[name] = 0;</span>
}
},
&nbsp;
afterFrame: function () <span class="fstat-no" title="function not covered" >{</span>
// Put back all the textures to pool
<span class="cstat-no" title="statement not covered" > for (var name in this.outputLinks) {</span>
<span class="cstat-no" title="statement not covered" > if (this._outputReferences[name] &gt; 0) {</span>
var outputInfo = <span class="cstat-no" title="statement not covered" >this.outputs[name];</span>
<span class="cstat-no" title="statement not covered" > if (outputInfo.keepLastFrame) {</span>
<span class="cstat-no" title="statement not covered" > if (this._prevOutputTextures[name]) {</span>
<span class="cstat-no" title="statement not covered" > this._compositor.releaseTexture(this._prevOutputTextures[name]);</span>
}
<span class="cstat-no" title="statement not covered" > this._prevOutputTextures[name] = this._outputTextures[name];</span>
}
else {
<span class="cstat-no" title="statement not covered" > this._compositor.releaseTexture(this._outputTextures[name]);</span>
}
}
}
}
});
&nbsp;
export default Node;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 07 2018 14:10:25 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,677 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/compositor/Pass.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/compositor/</a> Pass.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">68.85% </span>
<span class="quiet">Statements</span>
<span class='fraction'>42/61</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">38.24% </span>
<span class="quiet">Branches</span>
<span class='fraction'>13/34</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">72.73% </span>
<span class="quiet">Functions</span>
<span class='fraction'>8/11</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">68.85% </span>
<span class="quiet">Lines</span>
<span class='fraction'>42/61</span>
</div>
</div>
</div>
<div class='status-line medium'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">13×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13×</span>
<span class="cline-any cline-yes">13×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">18×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Base from '../core/Base';
import OrthoCamera from '../camera/Orthographic';
import Plane from '../geometry/Plane';
import Shader from '../Shader';
import Material from '../Material';
import Mesh from '../Mesh';
import glenum from '../core/glenum';
import vertexEssl from '../shader/source/compositor/vertex.glsl.js';
&nbsp;
Shader['import'](vertexEssl);
&nbsp;
var planeGeo = new Plane();
var mesh = new Mesh({
geometry: planeGeo,
frustumCulling: false
});
var camera = new OrthoCamera();
&nbsp;
/**
* @constructor clay.compositor.Pass
* @extends clay.core.Base
*/
var Pass = Base.extend(function () {
return /** @lends clay.compositor.Pass# */ {
/**
* Fragment shader string
* @type {string}
*/
// PENDING shader or fragment ?
fragment : '',
&nbsp;
/**
* @type {Object}
*/
outputs : null,
&nbsp;
/**
* @type {clay.Material}
*/
material : null,
&nbsp;
/**
* @type {Boolean}
*/
blendWithPrevious: false,
&nbsp;
/**
* @type {Boolean}
*/
clearColor: false,
&nbsp;
/**
* @type {Boolean}
*/
clearDepth: true
};
}, function() {
&nbsp;
var shader = new Shader(Shader.source('clay.compositor.vertex'), this.fragment);
var material = new Material({
shader: shader
});
material.enableTexturesAll();
&nbsp;
this.material = material;
&nbsp;
},
/** @lends clay.compositor.Pass.prototype */
{
/**
* @param {string} name
* @param {} value
*/
setUniform : function(name, value) {
this.material.setUniform(name, value);
},
/**
* @param {string} name
* @return {}
*/
getUniform : function(name) <span class="fstat-no" title="function not covered" >{</span>
var uniform = <span class="cstat-no" title="statement not covered" >this.material.uniforms[name];</span>
<span class="cstat-no" title="statement not covered" > if (uniform) {</span>
<span class="cstat-no" title="statement not covered" > return uniform.value;</span>
}
},
/**
* @param {clay.Texture} texture
* @param {number} attachment
*/
attachOutput : function(texture, attachment) {
<span class="missing-if-branch" title="else path not taken" >E</span>if (!this.outputs) {
this.outputs = {};
}
attachment = attachment || glenum.COLOR_ATTACHMENT0;
this.outputs[attachment] = texture;
},
/**
* @param {clay.Texture} texture
*/
detachOutput : function(texture) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > for (var attachment in this.outputs) {</span>
<span class="cstat-no" title="statement not covered" > if (this.outputs[attachment] === texture) {</span>
<span class="cstat-no" title="statement not covered" > this.outputs[attachment] = null;</span>
}
}
},
&nbsp;
bind : function(renderer, frameBuffer) {
&nbsp;
<span class="missing-if-branch" title="else path not taken" >E</span>if (this.outputs) {
for (var attachment in this.outputs) {
var texture = this.outputs[attachment];
<span class="missing-if-branch" title="else path not taken" >E</span>if (texture) {
frameBuffer.attach(texture, attachment);
}
}
}
&nbsp;
<span class="missing-if-branch" title="else path not taken" >E</span>if (frameBuffer) {
frameBuffer.bind(renderer);
}
},
&nbsp;
unbind : function(renderer, frameBuffer) {
frameBuffer.unbind(renderer);
},
/**
* @param {clay.Renderer} renderer
* @param {clay.FrameBuffer} [frameBuffer]
*/
render : function(renderer, frameBuffer) {
&nbsp;
var _gl = renderer.gl;
&nbsp;
<span class="missing-if-branch" title="else path not taken" >E</span>if (frameBuffer) {
this.bind(renderer, frameBuffer);
// MRT Support in chrome
// https://www.khronos.org/registry/webgl/sdk/tests/conformance/extensions/ext-draw-buffers.html
var ext = renderer.getGLExtension('EXT_draw_buffers');
<span class="missing-if-branch" title="if path not taken" >I</span>if (ext &amp;&amp; <span class="branch-1 cbranch-no" title="branch not covered" >this.outputs)</span> {
var bufs = <span class="cstat-no" title="statement not covered" >[];</span>
<span class="cstat-no" title="statement not covered" > for (var attachment in this.outputs) {</span>
<span class="cstat-no" title="statement not covered" > attachment = +attachment;</span>
<span class="cstat-no" title="statement not covered" > if (attachment &gt;= _gl.COLOR_ATTACHMENT0 &amp;&amp; attachment &lt;= _gl.COLOR_ATTACHMENT0 + 8) {</span>
<span class="cstat-no" title="statement not covered" > bufs.push(attachment);</span>
}
}
<span class="cstat-no" title="statement not covered" > ext.drawBuffersEXT(bufs);</span>
}
}
&nbsp;
this.trigger('beforerender', this, renderer);
&nbsp;
// FIXME Don't clear in each pass in default, let the color overwrite the buffer
// FIXME pixels may be discard
var clearBit = this.clearDepth ? _gl.DEPTH_BUFFER_BIT : <span class="branch-1 cbranch-no" title="branch not covered" >0;</span>
_gl.depthMask(true);
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.clearColor) {
<span class="cstat-no" title="statement not covered" > clearBit = clearBit | _gl.COLOR_BUFFER_BIT;</span>
<span class="cstat-no" title="statement not covered" > _gl.colorMask(true, true, true, true);</span>
var cc = <span class="cstat-no" title="statement not covered" >this.clearColor;</span>
<span class="cstat-no" title="statement not covered" > if (Array.isArray(cc)) {</span>
<span class="cstat-no" title="statement not covered" > _gl.clearColor(cc[0], cc[1], cc[2], cc[3]);</span>
}
}
_gl.clear(clearBit);
&nbsp;
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.blendWithPrevious) {
// Blend with previous rendered scene in the final output
// FIXME Configure blend.
// FIXME It will cause screen blink
<span class="cstat-no" title="statement not covered" > _gl.enable(_gl.BLEND);</span>
<span class="cstat-no" title="statement not covered" > this.material.transparent = true;</span>
}
else {
_gl.disable(_gl.BLEND);
this.material.transparent = false;
}
&nbsp;
this.renderQuad(renderer);
&nbsp;
this.trigger('afterrender', this, renderer);
&nbsp;
<span class="missing-if-branch" title="else path not taken" >E</span>if (frameBuffer) {
this.unbind(renderer, frameBuffer);
}
},
&nbsp;
/**
* Simply do quad rendering
*/
renderQuad: function (renderer) {
mesh.material = this.material;
renderer.renderPass([mesh], camera);
},
&nbsp;
/**
* @param {clay.Renderer} renderer
*/
dispose: function (renderer) <span class="fstat-no" title="function not covered" >{}</span>
});
&nbsp;
export default Pass;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,350 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/compositor/SceneNode.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/compositor/</a> SceneNode.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">2.94% </span>
<span class="quiet">Statements</span>
<span class='fraction'>1/34</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/12</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/2</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">2.94% </span>
<span class="quiet">Lines</span>
<span class='fraction'>1/34</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import CompositorNode from './CompositorNode';
import glenum from '../core/glenum';
import FrameBuffer from '../FrameBuffer';
&nbsp;
/**
* @constructor clay.compositor.SceneNode
* @extends clay.compositor.CompositorNode
*/
var SceneNode = CompositorNode.extend(
/** @lends clay.compositor.SceneNode# */
{
name: 'scene',
/**
* @type {clay.Scene}
*/
scene: null,
/**
* @type {clay.Camera}
*/
camera: null,
/**
* @type {boolean}
*/
autoUpdateScene: true,
/**
* @type {boolean}
*/
preZ: false
&nbsp;
}, function() <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this.frameBuffer = new FrameBuffer();</span>
}, {
render: function(renderer) <span class="fstat-no" title="function not covered" >{</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this._rendering = true;</span>
var _gl = <span class="cstat-no" title="statement not covered" >renderer.gl;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this.trigger('beforerender');</span>
&nbsp;
var renderInfo;
&nbsp;
<span class="cstat-no" title="statement not covered" > if (!this.outputs) {</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > renderInfo = renderer.render(this.scene, this.camera, !this.autoUpdateScene, this.preZ);</span>
&nbsp;
}
else {
&nbsp;
var frameBuffer = <span class="cstat-no" title="statement not covered" >this.frameBuffer;</span>
<span class="cstat-no" title="statement not covered" > for (var name in this.outputs) {</span>
var parameters = <span class="cstat-no" title="statement not covered" >this.updateParameter(name, renderer);</span>
var outputInfo = <span class="cstat-no" title="statement not covered" >this.outputs[name];</span>
var texture = <span class="cstat-no" title="statement not covered" >this._compositor.allocateTexture(parameters);</span>
<span class="cstat-no" title="statement not covered" > this._outputTextures[name] = texture;</span>
&nbsp;
var attachment = <span class="cstat-no" title="statement not covered" >outputInfo.attachment || _gl.COLOR_ATTACHMENT0;</span>
<span class="cstat-no" title="statement not covered" > if (typeof(attachment) == 'string') {</span>
<span class="cstat-no" title="statement not covered" > attachment = _gl[attachment];</span>
}
<span class="cstat-no" title="statement not covered" > frameBuffer.attach(texture, attachment);</span>
}
<span class="cstat-no" title="statement not covered" > frameBuffer.bind(renderer);</span>
&nbsp;
// MRT Support in chrome
// https://www.khronos.org/registry/webgl/sdk/tests/conformance/extensions/ext-draw-buffers.html
var ext = <span class="cstat-no" title="statement not covered" >renderer.getGLExtension('EXT_draw_buffers');</span>
<span class="cstat-no" title="statement not covered" > if (ext) {</span>
var bufs = <span class="cstat-no" title="statement not covered" >[];</span>
<span class="cstat-no" title="statement not covered" > for (var attachment in this.outputs) {</span>
<span class="cstat-no" title="statement not covered" > attachment = parseInt(attachment);</span>
<span class="cstat-no" title="statement not covered" > if (attachment &gt;= _gl.COLOR_ATTACHMENT0 &amp;&amp; attachment &lt;= _gl.COLOR_ATTACHMENT0 + 8) {</span>
<span class="cstat-no" title="statement not covered" > bufs.push(attachment);</span>
}
}
<span class="cstat-no" title="statement not covered" > ext.drawBuffersEXT(bufs);</span>
}
&nbsp;
// Always clear
// PENDING
<span class="cstat-no" title="statement not covered" > renderer.saveClear();</span>
<span class="cstat-no" title="statement not covered" > renderer.clearBit = glenum.DEPTH_BUFFER_BIT | glenum.COLOR_BUFFER_BIT;</span>
<span class="cstat-no" title="statement not covered" > renderInfo = renderer.render(this.scene, this.camera, !this.autoUpdateScene, this.preZ);</span>
<span class="cstat-no" title="statement not covered" > renderer.restoreClear();</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > frameBuffer.unbind(renderer);</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > this.trigger('afterrender', renderInfo);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this._rendering = false;</span>
<span class="cstat-no" title="statement not covered" > this._rendered = true;</span>
}
});
&nbsp;
export default SceneNode;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,158 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/compositor/TextureNode.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/compositor/</a> TextureNode.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">33.33% </span>
<span class="quiet">Statements</span>
<span class='fraction'>1/3</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/5</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">33.33% </span>
<span class="quiet">Lines</span>
<span class='fraction'>1/3</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import CompositorNode from './CompositorNode';
&nbsp;
/**
* @constructor clay.compositor.TextureNode
* @extends clay.compositor.CompositorNode
*/
var TextureNode = CompositorNode.extend(function() <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return /** @lends clay.compositor.TextureNode# */ {</span>
/**
* @type {clay.Texture2D}
*/
texture: null,
&nbsp;
// Texture node must have output without parameters
outputs: {
color: {}
}
};
}, function () <span class="fstat-no" title="function not covered" >{</span>
}, {
&nbsp;
getOutput: function (renderer, name) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return this.texture;</span>
},
&nbsp;
// Do nothing
beforeFrame: function () <span class="fstat-no" title="function not covered" >{},</span>
afterFrame: function () <span class="fstat-no" title="function not covered" >{}</span>
});
&nbsp;
export default TextureNode;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,392 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/compositor/TexturePool.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/compositor/</a> TexturePool.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">13.64% </span>
<span class="quiet">Statements</span>
<span class='fraction'>6/44</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/24</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">14.29% </span>
<span class="quiet">Functions</span>
<span class='fraction'>1/7</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">13.64% </span>
<span class="quiet">Lines</span>
<span class='fraction'>6/44</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Texture2D from '../Texture2D';
import glenum from '../core/glenum';
import util from '../core/util';
&nbsp;
var TexturePool = function () {
&nbsp;
this._pool = {};
&nbsp;
this._allocatedTextures = [];
};
&nbsp;
TexturePool.prototype = {
&nbsp;
constructor: TexturePool,
&nbsp;
get: function (parameters) <span class="fstat-no" title="function not covered" >{</span>
var key = <span class="cstat-no" title="statement not covered" >generateKey(parameters);</span>
<span class="cstat-no" title="statement not covered" > if (!this._pool.hasOwnProperty(key)) {</span>
<span class="cstat-no" title="statement not covered" > this._pool[key] = [];</span>
}
var list = <span class="cstat-no" title="statement not covered" >this._pool[key];</span>
<span class="cstat-no" title="statement not covered" > if (!list.length) {</span>
var texture = <span class="cstat-no" title="statement not covered" >new Texture2D(parameters);</span>
<span class="cstat-no" title="statement not covered" > this._allocatedTextures.push(texture);</span>
<span class="cstat-no" title="statement not covered" > return texture;</span>
}
<span class="cstat-no" title="statement not covered" > return list.pop();</span>
},
&nbsp;
put: function (texture) <span class="fstat-no" title="function not covered" >{</span>
var key = <span class="cstat-no" title="statement not covered" >generateKey(texture);</span>
<span class="cstat-no" title="statement not covered" > if (!this._pool.hasOwnProperty(key)) {</span>
<span class="cstat-no" title="statement not covered" > this._pool[key] = [];</span>
}
var list = <span class="cstat-no" title="statement not covered" >this._pool[key];</span>
<span class="cstat-no" title="statement not covered" > list.push(texture);</span>
},
&nbsp;
clear: function (renderer) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; this._allocatedTextures.length; i++) {</span>
<span class="cstat-no" title="statement not covered" > this._allocatedTextures[i].dispose(renderer);</span>
}
<span class="cstat-no" title="statement not covered" > this._pool = {};</span>
<span class="cstat-no" title="statement not covered" > this._allocatedTextures = [];</span>
}
};
&nbsp;
var defaultParams = {
width: 512,
height: 512,
type: glenum.UNSIGNED_BYTE,
format: glenum.RGBA,
wrapS: glenum.CLAMP_TO_EDGE,
wrapT: glenum.CLAMP_TO_EDGE,
minFilter: glenum.LINEAR_MIPMAP_LINEAR,
magFilter: glenum.LINEAR,
useMipmap: true,
anisotropic: 1,
flipY: true,
unpackAlignment: 4,
premultiplyAlpha: false
};
&nbsp;
var defaultParamPropList = Object.keys(defaultParams);
&nbsp;
function generateKey(parameters) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > util.defaultsWithPropList(parameters, defaultParams, defaultParamPropList);</span>
<span class="cstat-no" title="statement not covered" > fallBack(parameters);</span>
&nbsp;
var key = <span class="cstat-no" title="statement not covered" >'';</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; defaultParamPropList.length; i++) {</span>
var name = <span class="cstat-no" title="statement not covered" >defaultParamPropList[i];</span>
var chunk = <span class="cstat-no" title="statement not covered" >parameters[name].toString();</span>
<span class="cstat-no" title="statement not covered" > key += chunk;</span>
}
<span class="cstat-no" title="statement not covered" > return key;</span>
}
&nbsp;
function fallBack(target) <span class="fstat-no" title="function not covered" >{</span>
&nbsp;
var IPOT = <span class="cstat-no" title="statement not covered" >isPowerOfTwo(target.width, target.height);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > if (target.format === glenum.DEPTH_COMPONENT) {</span>
<span class="cstat-no" title="statement not covered" > target.useMipmap = false;</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > if (!IPOT || !target.useMipmap) {</span>
<span class="cstat-no" title="statement not covered" > if (target.minFilter == glenum.NEAREST_MIPMAP_NEAREST ||</span>
target.minFilter == glenum.NEAREST_MIPMAP_LINEAR) {
<span class="cstat-no" title="statement not covered" > target.minFilter = glenum.NEAREST;</span>
} else <span class="cstat-no" title="statement not covered" >if (</span>
target.minFilter == glenum.LINEAR_MIPMAP_LINEAR ||
target.minFilter == glenum.LINEAR_MIPMAP_NEAREST
) {
<span class="cstat-no" title="statement not covered" > target.minFilter = glenum.LINEAR;</span>
}
}
<span class="cstat-no" title="statement not covered" > if (!IPOT) {</span>
<span class="cstat-no" title="statement not covered" > target.wrapS = glenum.CLAMP_TO_EDGE;</span>
<span class="cstat-no" title="statement not covered" > target.wrapT = glenum.CLAMP_TO_EDGE;</span>
}
}
&nbsp;
function isPowerOfTwo(width, height) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return (width &amp; (width-1)) === 0 &amp;&amp;</span>
(height &amp; (height-1)) === 0;
}
&nbsp;
export default TexturePool;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,71 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/compositor/createCompositor.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/compositor/</a> createCompositor.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>0/0</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">// Alias
import createCompositor from '../createCompositor';
export default createCompositor;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,197 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/compositor/</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> src/compositor/
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">14.75% </span>
<span class="quiet">Statements</span>
<span class='fraction'>54/366</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">6.77% </span>
<span class="quiet">Branches</span>
<span class='fraction'>13/192</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">14.29% </span>
<span class="quiet">Functions</span>
<span class='fraction'>9/63</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">14.75% </span>
<span class="quiet">Lines</span>
<span class='fraction'>54/366</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file low" data-value="Compositor.js"><a href="Compositor.js.html">Compositor.js</a></td>
<td data-value="4.35" class="pic low"><div class="chart"><div class="cover-fill" style="width: 4%;"></div><div class="cover-empty" style="width:96%;"></div></div></td>
<td data-value="4.35" class="pct low">4.35%</td>
<td data-value="23" class="abs low">1/23</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="4" class="abs low">0/4</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="7" class="abs low">0/7</td>
<td data-value="4.35" class="pct low">4.35%</td>
<td data-value="23" class="abs low">1/23</td>
</tr>
<tr>
<td class="file low" data-value="CompositorNode.js"><a href="CompositorNode.js.html">CompositorNode.js</a></td>
<td data-value="1.33" class="pic low"><div class="chart"><div class="cover-fill" style="width: 1%;"></div><div class="cover-empty" style="width:99%;"></div></div></td>
<td data-value="1.33" class="pct low">1.33%</td>
<td data-value="75" class="abs low">1/75</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="50" class="abs low">0/50</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="13" class="abs low">0/13</td>
<td data-value="1.33" class="pct low">1.33%</td>
<td data-value="75" class="abs low">1/75</td>
</tr>
<tr>
<td class="file low" data-value="FilterNode.js"><a href="FilterNode.js.html">FilterNode.js</a></td>
<td data-value="1.32" class="pic low"><div class="chart"><div class="cover-fill" style="width: 1%;"></div><div class="cover-empty" style="width:99%;"></div></div></td>
<td data-value="1.32" class="pct low">1.32%</td>
<td data-value="76" class="abs low">1/76</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="32" class="abs low">0/32</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="11" class="abs low">0/11</td>
<td data-value="1.32" class="pct low">1.32%</td>
<td data-value="76" class="abs low">1/76</td>
</tr>
<tr>
<td class="file low" data-value="Graph.js"><a href="Graph.js.html">Graph.js</a></td>
<td data-value="2" class="pic low"><div class="chart"><div class="cover-fill" style="width: 2%;"></div><div class="cover-empty" style="width:98%;"></div></div></td>
<td data-value="2" class="pct low">2%</td>
<td data-value="50" class="abs low">1/50</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="36" class="abs low">0/36</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="7" class="abs low">0/7</td>
<td data-value="2" class="pct low">2%</td>
<td data-value="50" class="abs low">1/50</td>
</tr>
<tr>
<td class="file medium" data-value="Pass.js"><a href="Pass.js.html">Pass.js</a></td>
<td data-value="68.85" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 68%;"></div><div class="cover-empty" style="width:32%;"></div></div></td>
<td data-value="68.85" class="pct medium">68.85%</td>
<td data-value="61" class="abs medium">42/61</td>
<td data-value="38.24" class="pct low">38.24%</td>
<td data-value="34" class="abs low">13/34</td>
<td data-value="72.73" class="pct medium">72.73%</td>
<td data-value="11" class="abs medium">8/11</td>
<td data-value="68.85" class="pct medium">68.85%</td>
<td data-value="61" class="abs medium">42/61</td>
</tr>
<tr>
<td class="file low" data-value="SceneNode.js"><a href="SceneNode.js.html">SceneNode.js</a></td>
<td data-value="2.94" class="pic low"><div class="chart"><div class="cover-fill" style="width: 2%;"></div><div class="cover-empty" style="width:98%;"></div></div></td>
<td data-value="2.94" class="pct low">2.94%</td>
<td data-value="34" class="abs low">1/34</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="12" class="abs low">0/12</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="2" class="abs low">0/2</td>
<td data-value="2.94" class="pct low">2.94%</td>
<td data-value="34" class="abs low">1/34</td>
</tr>
<tr>
<td class="file low" data-value="TextureNode.js"><a href="TextureNode.js.html">TextureNode.js</a></td>
<td data-value="33.33" class="pic low"><div class="chart"><div class="cover-fill" style="width: 33%;"></div><div class="cover-empty" style="width:67%;"></div></div></td>
<td data-value="33.33" class="pct low">33.33%</td>
<td data-value="3" class="abs low">1/3</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="5" class="abs low">0/5</td>
<td data-value="33.33" class="pct low">33.33%</td>
<td data-value="3" class="abs low">1/3</td>
</tr>
<tr>
<td class="file low" data-value="TexturePool.js"><a href="TexturePool.js.html">TexturePool.js</a></td>
<td data-value="13.64" class="pic low"><div class="chart"><div class="cover-fill" style="width: 13%;"></div><div class="cover-empty" style="width:87%;"></div></div></td>
<td data-value="13.64" class="pct low">13.64%</td>
<td data-value="44" class="abs low">6/44</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="24" class="abs low">0/24</td>
<td data-value="14.29" class="pct low">14.29%</td>
<td data-value="7" class="abs low">1/7</td>
<td data-value="13.64" class="pct low">13.64%</td>
<td data-value="44" class="abs low">6/44</td>
</tr>
<tr>
<td class="file high" data-value="createCompositor.js"><a href="createCompositor.js.html">createCompositor.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
</tr>
</tbody>
</table>
</div><div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,146 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/core/Base.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/core/</a> Base.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>6/6</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>2/2</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>6/6</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">593×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">593×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import extendMixin from './mixin/extend';
import notifierMixin from './mixin/notifier';
import util from './util';
&nbsp;
/**
* Base class of all objects
* @constructor
* @alias clay.core.Base
* @mixes clay.core.mixin.notifier
*/
var Base = function () {
/**
* @type {number}
*/
this.__uid__ = util.genGUID();
};
&nbsp;
Base.__initializers__ = [
function (opts) {
util.extend(this, opts);
}
];
&nbsp;
util.extend(Base, extendMixin);
util.extend(Base.prototype, notifierMixin);
&nbsp;
export default Base;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,392 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/core/Cache.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/core/</a> Cache.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">72.34% </span>
<span class="quiet">Statements</span>
<span class='fraction'>34/47</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">63.64% </span>
<span class="quiet">Branches</span>
<span class='fraction'>14/22</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">62.5% </span>
<span class="quiet">Functions</span>
<span class='fraction'>10/16</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">72.34% </span>
<span class="quiet">Lines</span>
<span class='fraction'>34/47</span>
</div>
</div>
</div>
<div class='status-line medium'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">307×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">307×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">307×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">377×</span>
<span class="cline-any cline-yes">377×</span>
<span class="cline-any cline-yes">49×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">49×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">377×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">377×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">354×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">640×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">40×</span>
<span class="cline-any cline-yes">40×</span>
<span class="cline-any cline-yes">40×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">337×</span>
<span class="cline-any cline-yes">337×</span>
<span class="cline-any cline-yes">337×</span>
<span class="cline-any cline-yes">337×</span>
<span class="cline-any cline-yes">168×</span>
<span class="cline-any cline-yes">21×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">173×</span>
<span class="cline-any cline-yes">173×</span>
<span class="cline-any cline-yes">173×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">355×</span>
<span class="cline-any cline-yes">355×</span>
<span class="cline-any cline-yes">355×</span>
<span class="cline-any cline-yes">355×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">7×</span>
<span class="cline-any cline-yes">7×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">283×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">var DIRTY_PREFIX = '__dt__';
&nbsp;
var Cache = function () {
&nbsp;
this._contextId = 0;
&nbsp;
this._caches = [];
&nbsp;
this._context = {};
};
&nbsp;
Cache.prototype = {
&nbsp;
use: function (contextId, documentSchema) {
var caches = this._caches;
if (!caches[contextId]) {
caches[contextId] = {};
&nbsp;
<span class="missing-if-branch" title="if path not taken" >I</span>if (documentSchema) {
<span class="cstat-no" title="statement not covered" > caches[contextId] = documentSchema();</span>
}
}
this._contextId = contextId;
&nbsp;
this._context = caches[contextId];
},
&nbsp;
put: function (key, value) {
this._context[key] = value;
},
&nbsp;
get: function (key) {
return this._context[key];
},
&nbsp;
dirty: function (field) {
field = field || <span class="branch-1 cbranch-no" title="branch not covered" >'';</span>
var key = DIRTY_PREFIX + field;
this.put(key, true);
},
&nbsp;
dirtyAll: function (field) {
field = field || '';
var key = DIRTY_PREFIX + field;
var caches = this._caches;
for (var i = 0; i &lt; caches.length; i++) {
if (caches[i]) {
caches[i][key] = true;
}
}
},
&nbsp;
fresh: function (field) {
field = field || '';
var key = DIRTY_PREFIX + field;
this.put(key, false);
},
&nbsp;
freshAll: function (field) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > field = field || '';</span>
var key = <span class="cstat-no" title="statement not covered" >DIRTY_PREFIX + field;</span>
var caches = <span class="cstat-no" title="statement not covered" >this._caches;</span>
<span class="cstat-no" title="statement not covered" > for (var i = 0; i &lt; caches.length; i++) {</span>
<span class="cstat-no" title="statement not covered" > if (caches[i]) {</span>
<span class="cstat-no" title="statement not covered" > caches[i][key] = false;</span>
}
}
},
&nbsp;
isDirty: function (field) {
field = field || '';
var key = DIRTY_PREFIX + field;
var context = this._context;
return !context.hasOwnProperty(key)
|| context[key] === true;
},
&nbsp;
deleteContext: function (contextId) {
delete this._caches[contextId];
this._context = {};
},
&nbsp;
delete: function (key) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > delete this._context[key];</span>
},
&nbsp;
clearAll: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._caches = {};</span>
},
&nbsp;
getContext: function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return this._context;</span>
},
&nbsp;
eachContext : function (cb, context) <span class="fstat-no" title="function not covered" >{</span>
var keys = <span class="cstat-no" title="statement not covered" >Object.keys(this._caches);</span>
<span class="cstat-no" title="statement not covered" > keys.forEach(function (key) <span class="fstat-no" title="function not covered" >{</span></span>
<span class="cstat-no" title="statement not covered" > cb &amp;&amp; cb.call(context, key);</span>
});
},
&nbsp;
miss: function (key) {
return ! this._context.hasOwnProperty(key);
}
};
&nbsp;
Cache.prototype.constructor = Cache;
&nbsp;
export default Cache;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,248 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/core/GLInfo.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/core/</a> GLInfo.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">95.45% </span>
<span class="quiet">Statements</span>
<span class='fraction'>21/22</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>6/6</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">75% </span>
<span class="quiet">Functions</span>
<span class='fraction'>3/4</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">95.45% </span>
<span class="quiet">Lines</span>
<span class='fraction'>21/22</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">26×</span>
<span class="cline-any cline-yes">26×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">26×</span>
<span class="cline-any cline-yes">364×</span>
<span class="cline-any cline-yes">364×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">26×</span>
<span class="cline-any cline-yes">52×</span>
<span class="cline-any cline-yes">52×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">26×</span>
<span class="cline-any cline-yes">316×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">316×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">26×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">365×</span>
<span class="cline-any cline-yes">365×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">365×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">365×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">var EXTENSION_LIST = [
'OES_texture_float',
'OES_texture_half_float',
'OES_texture_float_linear',
'OES_texture_half_float_linear',
'OES_standard_derivatives',
'OES_vertex_array_object',
'OES_element_index_uint',
'WEBGL_compressed_texture_s3tc',
'WEBGL_depth_texture',
'EXT_texture_filter_anisotropic',
'EXT_shader_texture_lod',
'WEBGL_draw_buffers',
'EXT_frag_depth',
'EXT_sRGB'
];
&nbsp;
var PARAMETER_NAMES = [
'MAX_TEXTURE_SIZE',
'MAX_CUBE_MAP_TEXTURE_SIZE'
];
&nbsp;
function GLInfo(_gl) {
var extensions = {};
var parameters = {};
&nbsp;
// Get webgl extension
for (var i = 0; i &lt; EXTENSION_LIST.length; i++) {
var extName = EXTENSION_LIST[i];
createExtension(extName);
}
// Get parameters
for (var i = 0; i &lt; PARAMETER_NAMES.length; i++) {
var name = PARAMETER_NAMES[i];
parameters[name] = _gl.getParameter(_gl[name]);
}
&nbsp;
this.getExtension = function (name) {
if (!(name in extensions)) {
createExtension(name);
}
return extensions[name];
};
&nbsp;
this.getParameter = function (name) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return parameters[name];</span>
};
&nbsp;
function createExtension(name) {
var ext = _gl.getExtension(name);
if (!ext) {
ext = _gl.getExtension('MOZ_' + name);
}
if (!ext) {
ext = _gl.getExtension('WEBKIT_' + name);
}
extensions[name] = ext;
}
}
&nbsp;
export default GLInfo;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,308 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/core/LRU.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/core/</a> LRU.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">67.74% </span>
<span class="quiet">Statements</span>
<span class='fraction'>21/31</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">50% </span>
<span class="quiet">Branches</span>
<span class='fraction'>7/14</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">50% </span>
<span class="quiet">Functions</span>
<span class='fraction'>3/6</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">67.74% </span>
<span class="quiet">Lines</span>
<span class='fraction'>21/31</span>
</div>
</div>
</div>
<div class='status-line medium'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">30×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">30×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">30×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">28×</span>
<span class="cline-any cline-yes">28×</span>
<span class="cline-any cline-yes">28×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">28×</span>
<span class="cline-any cline-yes">28×</span>
<span class="cline-any cline-yes">28×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">64×</span>
<span class="cline-any cline-yes">64×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">36×</span>
<span class="cline-any cline-yes">36×</span>
<span class="cline-any cline-yes">36×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">36×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import LinkedList from './LinkedList';
&nbsp;
/**
* LRU Cache
* @constructor
* @alias clay.core.LRU
*/
var LRU = function(maxSize) {
&nbsp;
this._list = new LinkedList();
&nbsp;
this._map = {};
&nbsp;
this._maxSize = maxSize || <span class="branch-1 cbranch-no" title="branch not covered" >10;</span>
};
&nbsp;
/**
* Set cache max size
* @param {number} size
*/
LRU.prototype.setMaxSize = function(size) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._maxSize = size;</span>
};
&nbsp;
/**
* @param {string} key
* @param {} value
*/
LRU.prototype.put = function(key, value) {
<span class="missing-if-branch" title="else path not taken" >E</span>if (typeof(this._map[key]) == 'undefined') {
var len = this._list.length();
<span class="missing-if-branch" title="if path not taken" >I</span>if (len &gt;= this._maxSize &amp;&amp; <span class="branch-1 cbranch-no" title="branch not covered" >len &gt; 0)</span> {
// Remove the least recently used
var leastUsedEntry = <span class="cstat-no" title="statement not covered" >this._list.head;</span>
<span class="cstat-no" title="statement not covered" > this._list.remove(leastUsedEntry);</span>
<span class="cstat-no" title="statement not covered" > delete this._map[leastUsedEntry.key];</span>
}
&nbsp;
var entry = this._list.insert(value);
entry.key = key;
this._map[key] = entry;
}
};
&nbsp;
/**
* @param {string} key
* @return {}
*/
LRU.prototype.get = function(key) {
var entry = this._map[key];
if (typeof(entry) != 'undefined') {
// Put the latest used entry in the tail
<span class="missing-if-branch" title="else path not taken" >E</span>if (entry !== this._list.tail) {
this._list.remove(entry);
this._list.insertEntry(entry);
}
&nbsp;
return entry.value;
}
};
&nbsp;
/**
* @param {string} key
*/
LRU.prototype.remove = function(key) <span class="fstat-no" title="function not covered" >{</span>
var entry = <span class="cstat-no" title="statement not covered" >this._map[key];</span>
<span class="cstat-no" title="statement not covered" > if (typeof(entry) != 'undefined') {</span>
<span class="cstat-no" title="statement not covered" > delete this._map[key];</span>
<span class="cstat-no" title="statement not covered" > this._list.remove(entry);</span>
}
};
&nbsp;
/**
* Clear the cache
*/
LRU.prototype.clear = function() <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this._list.clear();</span>
<span class="cstat-no" title="statement not covered" > this._map = {};</span>
};
&nbsp;
export default LRU;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,839 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/core/LinkedList.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/core/</a> LinkedList.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">36.7% </span>
<span class="quiet">Statements</span>
<span class='fraction'>40/109</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">11.76% </span>
<span class="quiet">Branches</span>
<span class='fraction'>4/34</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">37.5% </span>
<span class="quiet">Functions</span>
<span class='fraction'>6/16</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">36.7% </span>
<span class="quiet">Lines</span>
<span class='fraction'>40/109</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">30×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">30×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">30×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">28×</span>
<span class="cline-any cline-yes">28×</span>
<span class="cline-any cline-yes">28×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">64×</span>
<span class="cline-any cline-yes">16×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">48×</span>
<span class="cline-any cline-yes">48×</span>
<span class="cline-any cline-yes">48×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">64×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">36×</span>
<span class="cline-any cline-yes">36×</span>
<span class="cline-any cline-yes">36×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">36×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">36×</span>
<span class="cline-any cline-yes">36×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">36×</span>
<span class="cline-any cline-yes">36×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">28×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">28×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">28×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">28×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">/**
* Simple double linked list. Compared with array, it has O(1) remove operation.
* @constructor
* @alias clay.core.LinkedList
*/
var LinkedList = function () {
&nbsp;
/**
* @type {clay.core.LinkedList.Entry}
*/
this.head = null;
&nbsp;
/**
* @type {clay.core.LinkedList.Entry}
*/
this.tail = null;
&nbsp;
this._length = 0;
};
&nbsp;
/**
* Insert a new value at the tail
* @param {} val
* @return {clay.core.LinkedList.Entry}
*/
LinkedList.prototype.insert = function (val) {
var entry = new LinkedList.Entry(val);
this.insertEntry(entry);
return entry;
};
&nbsp;
/**
* Insert a new value at idx
* @param {number} idx
* @param {} val
* @return {clay.core.LinkedList.Entry}
*/
LinkedList.prototype.insertAt = function (idx, val) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (idx &lt; 0) {</span>
<span class="cstat-no" title="statement not covered" > return;</span>
}
var next = <span class="cstat-no" title="statement not covered" >this.head;</span>
var cursor = <span class="cstat-no" title="statement not covered" >0;</span>
<span class="cstat-no" title="statement not covered" > while (next &amp;&amp; cursor != idx) {</span>
<span class="cstat-no" title="statement not covered" > next = next.next;</span>
<span class="cstat-no" title="statement not covered" > cursor++;</span>
}
<span class="cstat-no" title="statement not covered" > if (next) {</span>
var entry = <span class="cstat-no" title="statement not covered" >new LinkedList.Entry(val);</span>
var prev = <span class="cstat-no" title="statement not covered" >next.prev;</span>
<span class="cstat-no" title="statement not covered" > if (!prev) { //next is head</span>
<span class="cstat-no" title="statement not covered" > this.head = entry;</span>
}
else {
<span class="cstat-no" title="statement not covered" > prev.next = entry;</span>
<span class="cstat-no" title="statement not covered" > entry.prev = prev;</span>
}
<span class="cstat-no" title="statement not covered" > entry.next = next;</span>
<span class="cstat-no" title="statement not covered" > next.prev = entry;</span>
}
else {
<span class="cstat-no" title="statement not covered" > this.insert(val);</span>
}
};
&nbsp;
LinkedList.prototype.insertBeforeEntry = function (val, next) <span class="fstat-no" title="function not covered" >{</span>
var entry = <span class="cstat-no" title="statement not covered" >new LinkedList.Entry(val);</span>
var prev = <span class="cstat-no" title="statement not covered" >next.prev;</span>
<span class="cstat-no" title="statement not covered" > if (!prev) { //next is head</span>
<span class="cstat-no" title="statement not covered" > this.head = entry;</span>
}
else {
<span class="cstat-no" title="statement not covered" > prev.next = entry;</span>
<span class="cstat-no" title="statement not covered" > entry.prev = prev;</span>
}
<span class="cstat-no" title="statement not covered" > entry.next = next;</span>
<span class="cstat-no" title="statement not covered" > next.prev = entry;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > this._length++;</span>
};
&nbsp;
/**
* Insert an entry at the tail
* @param {clay.core.LinkedList.Entry} entry
*/
LinkedList.prototype.insertEntry = function (entry) {
if (!this.head) {
this.head = this.tail = entry;
}
else {
this.tail.next = entry;
entry.prev = this.tail;
this.tail = entry;
}
this._length++;
};
&nbsp;
/**
* Remove entry.
* @param {clay.core.LinkedList.Entry} entry
*/
LinkedList.prototype.remove = function (entry) {
var prev = entry.prev;
var next = entry.next;
<span class="missing-if-branch" title="if path not taken" >I</span>if (prev) {
<span class="cstat-no" title="statement not covered" > prev.next = next;</span>
}
else {
// Is head
this.head = next;
}
<span class="missing-if-branch" title="else path not taken" >E</span>if (next) {
next.prev = prev;
}
else {
// Is tail
<span class="cstat-no" title="statement not covered" > this.tail = prev;</span>
}
entry.next = entry.prev = null;
this._length--;
};
&nbsp;
/**
* Remove entry at index.
* @param {number} idx
* @return {}
*/
LinkedList.prototype.removeAt = function (idx) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (idx &lt; 0) {</span>
<span class="cstat-no" title="statement not covered" > return;</span>
}
var curr = <span class="cstat-no" title="statement not covered" >this.head;</span>
var cursor = <span class="cstat-no" title="statement not covered" >0;</span>
<span class="cstat-no" title="statement not covered" > while (curr &amp;&amp; cursor != idx) {</span>
<span class="cstat-no" title="statement not covered" > curr = curr.next;</span>
<span class="cstat-no" title="statement not covered" > cursor++;</span>
}
<span class="cstat-no" title="statement not covered" > if (curr) {</span>
<span class="cstat-no" title="statement not covered" > this.remove(curr);</span>
<span class="cstat-no" title="statement not covered" > return curr.value;</span>
}
};
/**
* Get head value
* @return {}
*/
LinkedList.prototype.getHead = function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (this.head) {</span>
<span class="cstat-no" title="statement not covered" > return this.head.value;</span>
}
};
/**
* Get tail value
* @return {}
*/
LinkedList.prototype.getTail = function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (this.tail) {</span>
<span class="cstat-no" title="statement not covered" > return this.tail.value;</span>
}
};
/**
* Get value at idx
* @param {number} idx
* @return {}
*/
LinkedList.prototype.getAt = function (idx) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > if (idx &lt; 0) {</span>
<span class="cstat-no" title="statement not covered" > return;</span>
}
var curr = <span class="cstat-no" title="statement not covered" >this.head;</span>
var cursor = <span class="cstat-no" title="statement not covered" >0;</span>
<span class="cstat-no" title="statement not covered" > while (curr &amp;&amp; cursor != idx) {</span>
<span class="cstat-no" title="statement not covered" > curr = curr.next;</span>
<span class="cstat-no" title="statement not covered" > cursor++;</span>
}
<span class="cstat-no" title="statement not covered" > return curr.value;</span>
};
&nbsp;
/**
* @param {} value
* @return {number}
*/
LinkedList.prototype.indexOf = function (value) <span class="fstat-no" title="function not covered" >{</span>
var curr = <span class="cstat-no" title="statement not covered" >this.head;</span>
var cursor = <span class="cstat-no" title="statement not covered" >0;</span>
<span class="cstat-no" title="statement not covered" > while (curr) {</span>
<span class="cstat-no" title="statement not covered" > if (curr.value === value) {</span>
<span class="cstat-no" title="statement not covered" > return cursor;</span>
}
<span class="cstat-no" title="statement not covered" > curr = curr.next;</span>
<span class="cstat-no" title="statement not covered" > cursor++;</span>
}
};
&nbsp;
/**
* @return {number}
*/
LinkedList.prototype.length = function () {
return this._length;
};
&nbsp;
/**
* If list is empty
*/
LinkedList.prototype.isEmpty = function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return this._length === 0;</span>
};
&nbsp;
/**
* @param {Function} cb
* @param {} context
*/
LinkedList.prototype.forEach = function (cb, context) <span class="fstat-no" title="function not covered" >{</span>
var curr = <span class="cstat-no" title="statement not covered" >this.head;</span>
var idx = <span class="cstat-no" title="statement not covered" >0;</span>
var haveContext = <span class="cstat-no" title="statement not covered" >typeof(context) != 'undefined';</span>
<span class="cstat-no" title="statement not covered" > while (curr) {</span>
<span class="cstat-no" title="statement not covered" > if (haveContext) {</span>
<span class="cstat-no" title="statement not covered" > cb.call(context, curr.value, idx);</span>
}
else {
<span class="cstat-no" title="statement not covered" > cb(curr.value, idx);</span>
}
<span class="cstat-no" title="statement not covered" > curr = curr.next;</span>
<span class="cstat-no" title="statement not covered" > idx++;</span>
}
};
&nbsp;
/**
* Clear the list
*/
LinkedList.prototype.clear = function () <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" > this.tail = this.head = null;</span>
<span class="cstat-no" title="statement not covered" > this._length = 0;</span>
};
&nbsp;
/**
* @constructor
* @param {} val
*/
LinkedList.Entry = function (val) {
/**
* @type {}
*/
this.value = val;
&nbsp;
/**
* @type {clay.core.LinkedList.Entry}
*/
this.next = null;
&nbsp;
/**
* @type {clay.core.LinkedList.Entry}
*/
this.prev = null;
};
&nbsp;
export default LinkedList;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,210 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/core/</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> src/core/
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">35.17% </span>
<span class="quiet">Statements</span>
<span class='fraction'>185/526</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">18.79% </span>
<span class="quiet">Branches</span>
<span class='fraction'>56/298</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">44.59% </span>
<span class="quiet">Functions</span>
<span class='fraction'>33/74</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">35.65% </span>
<span class="quiet">Lines</span>
<span class='fraction'>185/519</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file high" data-value="Base.js"><a href="Base.js.html">Base.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="6" class="abs high">6/6</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="2" class="abs high">2/2</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="6" class="abs high">6/6</td>
</tr>
<tr>
<td class="file medium" data-value="Cache.js"><a href="Cache.js.html">Cache.js</a></td>
<td data-value="72.34" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 72%;"></div><div class="cover-empty" style="width:28%;"></div></div></td>
<td data-value="72.34" class="pct medium">72.34%</td>
<td data-value="47" class="abs medium">34/47</td>
<td data-value="63.64" class="pct medium">63.64%</td>
<td data-value="22" class="abs medium">14/22</td>
<td data-value="62.5" class="pct medium">62.5%</td>
<td data-value="16" class="abs medium">10/16</td>
<td data-value="72.34" class="pct medium">72.34%</td>
<td data-value="47" class="abs medium">34/47</td>
</tr>
<tr>
<td class="file high" data-value="GLInfo.js"><a href="GLInfo.js.html">GLInfo.js</a></td>
<td data-value="95.45" class="pic high"><div class="chart"><div class="cover-fill" style="width: 95%;"></div><div class="cover-empty" style="width:5%;"></div></div></td>
<td data-value="95.45" class="pct high">95.45%</td>
<td data-value="22" class="abs high">21/22</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="6" class="abs high">6/6</td>
<td data-value="75" class="pct medium">75%</td>
<td data-value="4" class="abs medium">3/4</td>
<td data-value="95.45" class="pct high">95.45%</td>
<td data-value="22" class="abs high">21/22</td>
</tr>
<tr>
<td class="file medium" data-value="LRU.js"><a href="LRU.js.html">LRU.js</a></td>
<td data-value="67.74" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 67%;"></div><div class="cover-empty" style="width:33%;"></div></div></td>
<td data-value="67.74" class="pct medium">67.74%</td>
<td data-value="31" class="abs medium">21/31</td>
<td data-value="50" class="pct medium">50%</td>
<td data-value="14" class="abs medium">7/14</td>
<td data-value="50" class="pct medium">50%</td>
<td data-value="6" class="abs medium">3/6</td>
<td data-value="67.74" class="pct medium">67.74%</td>
<td data-value="31" class="abs medium">21/31</td>
</tr>
<tr>
<td class="file low" data-value="LinkedList.js"><a href="LinkedList.js.html">LinkedList.js</a></td>
<td data-value="36.7" class="pic low"><div class="chart"><div class="cover-fill" style="width: 36%;"></div><div class="cover-empty" style="width:64%;"></div></div></td>
<td data-value="36.7" class="pct low">36.7%</td>
<td data-value="109" class="abs low">40/109</td>
<td data-value="11.76" class="pct low">11.76%</td>
<td data-value="34" class="abs low">4/34</td>
<td data-value="37.5" class="pct low">37.5%</td>
<td data-value="16" class="abs low">6/16</td>
<td data-value="36.7" class="pct low">36.7%</td>
<td data-value="109" class="abs low">40/109</td>
</tr>
<tr>
<td class="file low" data-value="color.js"><a href="color.js.html">color.js</a></td>
<td data-value="7.01" class="pic low"><div class="chart"><div class="cover-fill" style="width: 7%;"></div><div class="cover-empty" style="width:93%;"></div></div></td>
<td data-value="7.01" class="pct low">7.01%</td>
<td data-value="214" class="abs low">15/214</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="148" class="abs low">0/148</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="15" class="abs low">0/15</td>
<td data-value="7.25" class="pct low">7.25%</td>
<td data-value="207" class="abs low">15/207</td>
</tr>
<tr>
<td class="file high" data-value="glenum.js"><a href="glenum.js.html">glenum.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">1/1</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">1/1</td>
</tr>
<tr>
<td class="file medium" data-value="request.js"><a href="request.js.html">request.js</a></td>
<td data-value="58.82" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 58%;"></div><div class="cover-empty" style="width:42%;"></div></div></td>
<td data-value="58.82" class="pct medium">58.82%</td>
<td data-value="17" class="abs medium">10/17</td>
<td data-value="42.86" class="pct low">42.86%</td>
<td data-value="14" class="abs low">6/14</td>
<td data-value="66.67" class="pct medium">66.67%</td>
<td data-value="3" class="abs medium">2/3</td>
<td data-value="58.82" class="pct medium">58.82%</td>
<td data-value="17" class="abs medium">10/17</td>
</tr>
<tr>
<td class="file low" data-value="util.js"><a href="util.js.html">util.js</a></td>
<td data-value="37.1" class="pic low"><div class="chart"><div class="cover-fill" style="width: 37%;"></div><div class="cover-empty" style="width:63%;"></div></div></td>
<td data-value="37.1" class="pct low">37.1%</td>
<td data-value="62" class="abs low">23/62</td>
<td data-value="23.81" class="pct low">23.81%</td>
<td data-value="42" class="abs low">10/42</td>
<td data-value="63.64" class="pct medium">63.64%</td>
<td data-value="11" class="abs medium">7/11</td>
<td data-value="37.1" class="pct low">37.1%</td>
<td data-value="62" class="abs low">23/62</td>
</tr>
<tr>
<td class="file high" data-value="vendor.js"><a href="vendor.js.html">vendor.js</a></td>
<td data-value="82.35" class="pic high"><div class="chart"><div class="cover-fill" style="width: 82%;"></div><div class="cover-empty" style="width:18%;"></div></div></td>
<td data-value="82.35" class="pct high">82.35%</td>
<td data-value="17" class="abs high">14/17</td>
<td data-value="50" class="pct medium">50%</td>
<td data-value="18" class="abs medium">9/18</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="1" class="abs low">0/1</td>
<td data-value="82.35" class="pct high">82.35%</td>
<td data-value="17" class="abs high">14/17</td>
</tr>
</tbody>
</table>
</div><div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,383 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/core/mixin/extend.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../../prettify.css" />
<link rel="stylesheet" href="../../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../../index.html">all files</a> / <a href="index.html">src/core/mixin/</a> extend.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">97.56% </span>
<span class="quiet">Statements</span>
<span class='fraction'>40/41</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">83.33% </span>
<span class="quiet">Branches</span>
<span class='fraction'>15/18</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>5/5</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">97.56% </span>
<span class="quiet">Lines</span>
<span class='fraction'>40/41</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">61×</span>
<span class="cline-any cline-yes">26×</span>
<span class="cline-any cline-yes">26×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">61×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">61×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">32×</span>
<span class="cline-any cline-yes">32×</span>
<span class="cline-any cline-yes">160×</span>
<span class="cline-any cline-yes">160×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">61×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1131×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1131×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">503×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">628×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1131×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">593×</span>
<span class="cline-any cline-yes">593×</span>
<span class="cline-any cline-yes">1586×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">61×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">61×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">61×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">61×</span>
<span class="cline-any cline-yes">33×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">61×</span>
<span class="cline-any cline-yes">61×</span>
<span class="cline-any cline-yes">61×</span>
<span class="cline-any cline-yes">61×</span>
<span class="cline-any cline-yes">61×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">61×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">61×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">61×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">564×</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">562×</span>
<span class="cline-any cline-yes">4066×</span>
<span class="cline-any cline-yes">4066×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">628×</span>
<span class="cline-any cline-yes">3860×</span>
<span class="cline-any cline-yes">3860×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">/**
* Extend a sub class from base class
* @param {object|Function} makeDefaultOpt default option of this sub class, method of the sub can use this.xxx to access this option
* @param {Function} [initialize] Initialize after the sub class is instantiated
* @param {Object} [proto] Prototype methods/properties of the sub class
* @memberOf clay.core.mixin.extend
* @return {Function}
*/
function derive(makeDefaultOpt, initialize/*optional*/, proto/*optional*/) {
&nbsp;
if (typeof initialize == 'object') {
proto = initialize;
initialize = null;
}
&nbsp;
var _super = this;
&nbsp;
var propList;
if (!(makeDefaultOpt instanceof Function)) {
// Optimize the property iterate if it have been fixed
propList = [];
for (var propName in makeDefaultOpt) {
<span class="missing-if-branch" title="else path not taken" >E</span>if (makeDefaultOpt.hasOwnProperty(propName)) {
propList.push(propName);
}
}
}
&nbsp;
var sub = function(options) {
&nbsp;
// call super constructor
_super.apply(this, arguments);
&nbsp;
if (makeDefaultOpt instanceof Function) {
// Invoke makeDefaultOpt each time if it is a function, So we can make sure each
// property in the object will not be shared by mutiple instances
extend(this, makeDefaultOpt.call(this, options));
}
else {
extendWithPropList(this, makeDefaultOpt, propList);
}
&nbsp;
if (this.constructor === sub) {
// Initialize function will be called in the order of inherit
var initializers = sub.__initializers__;
for (var i = 0; i &lt; initializers.length; i++) {
initializers[i].apply(this, arguments);
}
}
};
// save super constructor
sub.__super__ = _super;
// Initialize function will be called after all the super constructor is called
<span class="missing-if-branch" title="if path not taken" >I</span>if (!_super.__initializers__) {
<span class="cstat-no" title="statement not covered" > sub.__initializers__ = [];</span>
} else {
sub.__initializers__ = _super.__initializers__.slice();
}
if (initialize) {
sub.__initializers__.push(initialize);
}
&nbsp;
var Ctor = function() {};
Ctor.prototype = _super.prototype;
sub.prototype = new Ctor();
sub.prototype.constructor = sub;
extend(sub.prototype, proto);
&nbsp;
// extend the derive method as a static method;
sub.extend = _super.extend;
&nbsp;
// DEPCRATED
sub.derive = _super.extend;
&nbsp;
return sub;
}
&nbsp;
function extend(target, source) {
if (!source) {
return;
}
for (var name in source) {
<span class="missing-if-branch" title="else path not taken" >E</span>if (source.hasOwnProperty(name)) {
target[name] = source[name];
}
}
}
&nbsp;
function extendWithPropList(target, source, propList) {
for (var i = 0; i &lt; propList.length; i++) {
var propName = propList[i];
target[propName] = source[propName];
}
}
&nbsp;
/**
* @alias clay.core.mixin.extend
* @mixin
*/
export default {
&nbsp;
extend: derive,
&nbsp;
// DEPCRATED
derive: derive
};
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../../sorter.js"></script>
</body>
</html>

@ -0,0 +1,106 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/core/mixin/</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../../prettify.css" />
<link rel="stylesheet" href="../../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../../index.html">all files</a> src/core/mixin/
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">69.83% </span>
<span class="quiet">Statements</span>
<span class='fraction'>81/116</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">58.82% </span>
<span class="quiet">Branches</span>
<span class='fraction'>40/68</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">81.25% </span>
<span class="quiet">Functions</span>
<span class='fraction'>13/16</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">69.3% </span>
<span class="quiet">Lines</span>
<span class='fraction'>79/114</span>
</div>
</div>
</div>
<div class='status-line medium'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file high" data-value="extend.js"><a href="extend.js.html">extend.js</a></td>
<td data-value="97.56" class="pic high"><div class="chart"><div class="cover-fill" style="width: 97%;"></div><div class="cover-empty" style="width:3%;"></div></div></td>
<td data-value="97.56" class="pct high">97.56%</td>
<td data-value="41" class="abs high">40/41</td>
<td data-value="83.33" class="pct high">83.33%</td>
<td data-value="18" class="abs high">15/18</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="5" class="abs high">5/5</td>
<td data-value="97.56" class="pct high">97.56%</td>
<td data-value="41" class="abs high">40/41</td>
</tr>
<tr>
<td class="file medium" data-value="notifier.js"><a href="notifier.js.html">notifier.js</a></td>
<td data-value="54.67" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 54%;"></div><div class="cover-empty" style="width:46%;"></div></div></td>
<td data-value="54.67" class="pct medium">54.67%</td>
<td data-value="75" class="abs medium">41/75</td>
<td data-value="50" class="pct medium">50%</td>
<td data-value="50" class="abs medium">25/50</td>
<td data-value="72.73" class="pct medium">72.73%</td>
<td data-value="11" class="abs medium">8/11</td>
<td data-value="53.42" class="pct medium">53.42%</td>
<td data-value="73" class="abs medium">39/73</td>
</tr>
</tbody>
</table>
</div><div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 23 2018 01:09:23 GMT+0800 (CST)
</div>
</div>
<script src="../../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../../sorter.js"></script>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save