Skip to content

Commit

Permalink
1.15.2
Browse files Browse the repository at this point in the history
  • Loading branch information
06wj committed Jun 30, 2020
1 parent 3e15fbe commit 45855d6
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 39 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [1.15.2](https://github.com/hiloteam/Hilo3d/compare/1.15.1...1.15.2) (2020-06-30)


### Bug Fixes

* ResourceManager.destroyUnsuedResource parameter become optional ([3e15fbe](https://github.com/hiloteam/Hilo3d/commit/3e15fbe9d6c141e580e85bfe97bd11cb253c4d0d))



## [1.15.1](https://github.com/hiloteam/Hilo3d/compare/1.15.0...1.15.1) (2020-06-24)


Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ English | [简体中文](./README_ZH.md)
* use script tag from a [cdn][cdn-url]

```
<script src='//g.alicdn.com/hilo/Hilo3d/1.15.1/Hilo3d.js'></script>
<script src='//g.alicdn.com/hilo/Hilo3d/1.15.2/Hilo3d.js'></script>
```

### Documentation
Expand Down Expand Up @@ -119,4 +119,4 @@ English | [简体中文](./README_ZH.md)
[size-image]:https://img.badgesize.io/hiloteam/hilo3d/master/build/Hilo3d.js.svg?compression=gzip&style=flat-square
[ci-url]:https://github.com/hiloteam/Hilo3d/actions?query=workflow%3A%22npm+test%22+branch%3Adev
[ci-image]:https://img.shields.io/github/workflow/status/hiloteam/Hilo3d/npm%20test?style=flat-square
[cdn-url]: https://g.alicdn.com/hilo/Hilo3d/1.15.1/Hilo3d.js
[cdn-url]: https://g.alicdn.com/hilo/Hilo3d/1.15.2/Hilo3d.js
4 changes: 2 additions & 2 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* 使用 script 标签加载 [cdn][cdn-url]
```
<script src='//g.alicdn.com/hilo/Hilo3d/1.15.1/Hilo3d.js'></script>
<script src='//g.alicdn.com/hilo/Hilo3d/1.15.2/Hilo3d.js'></script>
```
### 文档
Expand Down Expand Up @@ -120,4 +120,4 @@
[size-image]:https://img.badgesize.io/hiloteam/hilo3d/master/build/Hilo3d.js.svg?compression=gzip&style=flat-square
[ci-url]:https://github.com/hiloteam/Hilo3d/actions?query=workflow%3A%22npm+test%22+branch%3Adev
[ci-image]:https://img.shields.io/github/workflow/status/hiloteam/Hilo3d/npm%20test?style=flat-square
[cdn-url]: https://g.alicdn.com/hilo/Hilo3d/1.15.1/Hilo3d.js
[cdn-url]: https://g.alicdn.com/hilo/Hilo3d/1.15.2/Hilo3d.js
4 changes: 2 additions & 2 deletions build/Hilo3d.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build/Hilo3d.single.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build/math.single.js

Large diffs are not rendered by default.

77 changes: 68 additions & 9 deletions docs/WebGLResourceManager.html
Original file line number Diff line number Diff line change
Expand Up @@ -8173,7 +8173,7 @@ <h5>Returns:</h5>
<div class="nameContainer">
<h4 class="name" id="getUsedResources">

getUsedResources<span class="signature">(stage)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Array.&lt;Object>}</span>
getUsedResources<span class="signature">(<span class="optional">rootNode</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Array.&lt;Object>}</span>
</h4>


Expand All @@ -8187,7 +8187,7 @@ <h4 class="name" id="getUsedResources">


<div class="description">
<p>获取用到的资源</p>
<p>获取 rootNode 用到的资源</p>
</div>


Expand Down Expand Up @@ -8218,13 +8218,13 @@ <h4 class="name" id="getUsedResources">

<tr>

<td class="name"><code>stage</code></td>
<td class="name"><code>rootNode</code></td>


<td class="type">


<span class="param-type"><a href="Stage.html">Stage</a></span>
<span class="param-type"><a href="Node.html">Node</a></span>



Expand All @@ -8234,7 +8234,14 @@ <h4 class="name" id="getUsedResources">

<td class="description last">

</td>

<span class="optional">optional</span>





<p>根节点,不传返回空数组</p></td>
</tr>


Expand Down Expand Up @@ -8317,12 +8324,12 @@ <h5>Returns:</h5>
<div class="nameContainer">
<h4 class="name" id="destroyUnsuedResource">

destroyUnsuedResource<span class="signature">()</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="WebGLResourceManager.html">WebGLResourceManager</a>}</span>
destroyUnsuedResource<span class="signature">(<span class="optional">rootNode</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="WebGLResourceManager.html">WebGLResourceManager</a>}</span>
</h4>


<div class="tag-source">
<a href="renderer_WebGLResourceManager.js.html">renderer/WebGLResourceManager.js</a>, <a href="renderer_WebGLResourceManager.js.html#line100">line 100</a>
<a href="renderer_WebGLResourceManager.js.html">renderer/WebGLResourceManager.js</a>, <a href="renderer_WebGLResourceManager.js.html#line103">line 103</a>
</div>

</div>
Expand All @@ -8331,7 +8338,7 @@ <h4 class="name" id="destroyUnsuedResource">


<div class="description">
<p>销毁没被使用的资源</p>
<p>销毁没被 rootNode 使用的资源,通常传 stage。</p>
</div>


Expand All @@ -8340,6 +8347,58 @@ <h4 class="name" id="destroyUnsuedResource">





<table class="params">
<thead>
<tr>

<th>Name</th>


<th>Type</th>



<th class="last">Description</th>
</tr>
</thead>

<tbody>


<tr>

<td class="name"><code>rootNode</code></td>


<td class="type">


<span class="param-type"><a href="Node.html">Node</a></span>



</td>



<td class="description last">


<span class="optional">optional</span>





<p>根节点,不传代表所有资源都没被使用过。</p></td>
</tr>


</tbody>
</table>



<dl class="details">
Expand Down Expand Up @@ -8421,7 +8480,7 @@ <h4 class="name" id="reset">


<div class="tag-source">
<a href="renderer_WebGLResourceManager.js.html">renderer/WebGLResourceManager.js</a>, <a href="renderer_WebGLResourceManager.js.html#line125">line 125</a>
<a href="renderer_WebGLResourceManager.js.html">renderer/WebGLResourceManager.js</a>, <a href="renderer_WebGLResourceManager.js.html#line128">line 128</a>
</div>

</div>
Expand Down
6 changes: 3 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7733,7 +7733,7 @@ <h3> </h3>
<h3 align="center">A 3D WebGL Rendering Engine</h3>
<hr>
<p><a href="#Installation">Installation</a><a href="#Documentation">Documentation</a><a href="#Development">Development</a><a href="#Showcase">Showcase</a><a href="#Examples">Examples</a><a href="#Authors">Authors</a><a href="#License">License</a></p>
<p><a target="_blank" href="https://www.npmjs.com/package/hilo3d"><img src="https://img.shields.io/npm/v/hilo3d.svg?style=flat-square" alt="npm"></a> <a target="_blank" href="https://github.com/hiloteam/Hilo3d/actions?query=workflow%3A%22npm+test%22+branch%3Adev"><img src="https://img.shields.io/github/workflow/status/hiloteam/Hilo3d/npm%20test?style=flat-square" alt="ci"></a> <a target="_blank" href="https://g.alicdn.com/hilo/Hilo3d/1.15.1/Hilo3d.js"><img src="https://img.badgesize.io/hiloteam/hilo3d/master/build/Hilo3d.js.svg?compression=gzip&amp;style=flat-square" alt="size"></a> <a target="_blank" href="https://gitter.im/hiloteam/Hilo3d?utm_source=badge&amp;utm_medium=badge&amp;utm_campaign=pr-badge&amp;utm_content=badge"><img src="https://img.shields.io/badge/GITTER-join%20chat-green.svg?style=flat-square" alt="gitter.im"></a></p>
<p><a target="_blank" href="https://www.npmjs.com/package/hilo3d"><img src="https://img.shields.io/npm/v/hilo3d.svg?style=flat-square" alt="npm"></a> <a target="_blank" href="https://github.com/hiloteam/Hilo3d/actions?query=workflow%3A%22npm+test%22+branch%3Adev"><img src="https://img.shields.io/github/workflow/status/hiloteam/Hilo3d/npm%20test?style=flat-square" alt="ci"></a> <a target="_blank" href="https://g.alicdn.com/hilo/Hilo3d/1.15.2/Hilo3d.js"><img src="https://img.badgesize.io/hiloteam/hilo3d/master/build/Hilo3d.js.svg?compression=gzip&amp;style=flat-square" alt="size"></a> <a target="_blank" href="https://gitter.im/hiloteam/Hilo3d?utm_source=badge&amp;utm_medium=badge&amp;utm_campaign=pr-badge&amp;utm_content=badge"><img src="https://img.shields.io/badge/GITTER-join%20chat-green.svg?style=flat-square" alt="gitter.im"></a></p>
<h3>Features</h3>
<ul>
<li>Compatible for multiple mobile and desktop browsers.</li>
Expand All @@ -7749,8 +7749,8 @@ <h3 id="Installation">Installation</h3>
</code></pre>
</li>
<li>
<p>use script tag from a <a target="_blank" href="https://g.alicdn.com/hilo/Hilo3d/1.15.1/Hilo3d.js">cdn</a></p>
<pre class="prettyprint source"><code>&lt;script src='//g.alicdn.com/hilo/Hilo3d/1.15.1/Hilo3d.js'>&lt;/script>
<p>use script tag from a <a target="_blank" href="https://g.alicdn.com/hilo/Hilo3d/1.15.2/Hilo3d.js">cdn</a></p>
<pre class="prettyprint source"><code>&lt;script src='//g.alicdn.com/hilo/Hilo3d/1.15.2/Hilo3d.js'>&lt;/script>
</code></pre>
</li>
</ul>
Expand Down
25 changes: 14 additions & 11 deletions docs/renderer_WebGLResourceManager.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -7793,32 +7793,35 @@ <h1 class="page-title" data-filename="renderer_WebGLResourceManager.js.html">Sou
},

/**
* 获取用到的资源
* @param {Stage} stage
* 获取 rootNode 用到的资源
* @param {Node} [rootNode] 根节点,不传返回空数组
* @return {Object[]}
*/
getUsedResources(stage) {
getUsedResources(rootNode) {
const resources = [];
stage.traverse((node) => {
if (node.isMesh &amp;&amp; !node.isDestroyed) {
this.getMeshResources(node, resources);
}
});
if (rootNode) {
rootNode.traverse((node) => {
if (node.isMesh &amp;&amp; !node.isDestroyed) {
this.getMeshResources(node, resources);
}
});
}

return resources;
},

/**
* 销毁没被使用的资源
* 销毁没被 rootNode 使用的资源,通常传 stage。
* @param {Node} [rootNode] 根节点,不传代表所有资源都没被使用过。
* @return {WebGLResourceManager} this
*/
destroyUnsuedResource(stage) {
destroyUnsuedResource(rootNode) {
const needDestroyResources = this._needDestroyResources;
if (needDestroyResources.length === 0) {
return this;
}

const usedResources = this.getUsedResources(stage);
const usedResources = this.getUsedResources(rootNode);

needDestroyResources.forEach((resource) => {
if (usedResources.indexOf(resource) &lt; 0) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hilo3d",
"version": "1.15.1",
"version": "1.15.2",
"description": "Hilo3d, a WebGL 3d engine.",
"main": "build/Hilo3d.js",
"types": "types/index.d.ts",
Expand Down
11 changes: 6 additions & 5 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1477,15 +1477,16 @@ declare class WebGLResourceManager implements EventMixin {
*/
destroyIfNoRef(res: any): WebGLResourceManager;
/**
* 获取用到的资源
* @param stage
* 获取 rootNode 用到的资源
* @param [rootNode] - 根节点,不传返回空数组
*/
getUsedResources(stage: Stage): object[];
getUsedResources(rootNode?: Node): object[];
/**
* 销毁没被使用的资源
* 销毁没被 rootNode 使用的资源,通常传 stage。
* @param [rootNode] - 根节点,不传代表所有资源都没被使用过。
* @returns this
*/
destroyUnsuedResource(): WebGLResourceManager;
destroyUnsuedResource(rootNode?: Node): WebGLResourceManager;
/**
* 重置
* @returns this
Expand Down

0 comments on commit 45855d6

Please sign in to comment.