-
- optional
-
-
-
-
-
事件对象
@@ -9298,7 +9313,7 @@
-String
+string
@@ -9321,7 +9336,7 @@
-Object
+any
@@ -9344,7 +9359,7 @@
-Object
+any
@@ -9367,7 +9382,7 @@
-Date
+number
@@ -9381,6 +9396,121 @@
+
+
+
+ stageX |
+
+
+
+
+
+number
+
+
+
+ |
+
+
+
+
+
+ 鼠标相对 stage 的 x 偏移 ( 仅鼠标事件有效 ) |
+
+
+
+
+
+
+ stageY |
+
+
+
+
+
+number
+
+
+
+ |
+
+
+
+
+
+ 鼠标相对 stage 的 y 偏移 ( 仅鼠标事件有效 ) |
+
+
+
+
+
+
+ eventTarget |
+
+
+
+
+
+Node
+
+
+
+ |
+
+
+
+
+
+ 触发鼠标事件的对象 ( 仅鼠标事件有效 ) |
+
+
+
+
+
+
+ eventCurrentTarget |
+
+
+
+
+
+Node
+
+
+
+ |
+
+
+
+
+
+ 监听鼠标事件的对象 ( 仅鼠标事件有效 ) |
+
+
+
+
+
+
+ hitPoint |
+
+
+
+
+
+Vector3
+
+
+
+ |
+
+
+
+
+
+ 鼠标碰撞点 ( 仅鼠标事件有效 ) |
+
+
+
|
@@ -10030,7 +10160,7 @@
@@ -10174,7 +10304,7 @@
@@ -10612,6 +10742,144 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+ updateCustomInfoCallback(lightManager, camera)
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ lightManager |
+
+
+
+
+
+LightManager
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+
+
+
+
+ camera |
+
+
+
+
+
+Camera
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -12359,7 +12627,7 @@ Properties:
diff --git a/docs/helper_AxisHelper.js.html b/docs/helper_AxisHelper.js.html
index e69e9486..b60a3e53 100644
--- a/docs/helper_AxisHelper.js.html
+++ b/docs/helper_AxisHelper.js.html
@@ -4721,6 +4721,18 @@
- className
+ - ambientLights
+
+ - directionalLights
+
+ - pointLights
+
+ - spotLights
+
+ - areaLights
+
+ - updateCustomInfo
+
@@ -7132,6 +7152,8 @@
- isQuaternion
+ - elements
+
- x
- y
@@ -9056,7 +9078,7 @@ Source: light/
*/
isLightManager: true,
/**
- * @default DirectionalLight
+ * @default LightManager
* @type {string}
*/
className: 'LightManager',
@@ -9065,11 +9087,31 @@ Source: light/
* @param {Object} [params] 创建对象的属性参数。可包含此类的所有属性。
*/
constructor(params) {
+ /**
+ * @type {AmbientLight[]}
+ */
this.ambientLights = [];
+
+ /**
+ * @type {DirectionalLight[]}
+ */
this.directionalLights = [];
+
+ /**
+ * @type {PointLight[]}
+ */
this.pointLights = [];
+
+ /**
+ * @type {SpotLight[]}
+ */
this.spotLights = [];
+
+ /**
+ * @type {AreaLight[]}
+ */
this.areaLights = [];
+
this.lightInfo = {
AMBIENT_LIGHTS: 0,
POINT_LIGHTS: 0,
@@ -9387,7 +9429,16 @@ Source: light/
this.spotInfo = this.getSpotInfo(camera);
this.areaInfo = this.getAreaInfo(camera);
this.ambientInfo = this.getAmbientInfo();
+ if (this.updateCustomInfo) {
+ this.updateCustomInfo(this, camera);
+ }
},
+ /**
+ * 更新自定义灯光信息
+ * @type updateCustomInfoCallback
+ * @default null
+ */
+ updateCustomInfo: null,
/**
* 获取光源信息
* @return {Object}
@@ -9440,6 +9491,13 @@ Source: light/
});
export default LightManager;
+
+/**
+ * 更新自定义灯光回调
+ * @callback updateCustomInfoCallback
+ * @param { LightManager } lightManager
+ * @param { Camera } camera
+ */
@@ -9452,7 +9510,7 @@ Source: light/
diff --git a/docs/light_PointLight.js.html b/docs/light_PointLight.js.html
index e1f25baa..43b7a823 100644
--- a/docs/light_PointLight.js.html
+++ b/docs/light_PointLight.js.html
@@ -4721,6 +4721,18 @@
- className
+ - ambientLights
+
+ - directionalLights
+
+ - pointLights
+
+ - spotLights
+
+ - areaLights
+
+ - updateCustomInfo
+
@@ -7132,6 +7152,8 @@
- isQuaternion
+ - elements
+
- x
- y
@@ -9070,6 +9092,10 @@ Source: math/Euler.js<
* @param {Number} [z=0] 角度 Z, 弧度制
*/
constructor(x = 0, y = 0, z = 0) {
+ /**
+ * 数据
+ * @type {Float32Array}
+ */
this.elements = new Float32Array([x, y, z]);
this.updateDegrees();
},
@@ -9355,7 +9381,7 @@ Source: math/Euler.js<
diff --git a/docs/math_EulerNotifier.js.html b/docs/math_EulerNotifier.js.html
index 5225e56c..e5a27b1c 100644
--- a/docs/math_EulerNotifier.js.html
+++ b/docs/math_EulerNotifier.js.html
@@ -4721,6 +4721,18 @@
- className
+ - ambientLights
+
+ - directionalLights
+
+ - pointLights
+
+ - spotLights
+
+ - areaLights
+
+ - updateCustomInfo
+
@@ -7132,6 +7152,8 @@
- isQuaternion
+ - elements
+
- x
- y
@@ -9353,7 +9375,7 @@ Source: math/Matrix4
* of a transformation matrix. If a matrix is built with
* fromRotationTranslation, the returned quaternion will be the
* same as the quaternion originally supplied.
- * @param {Quaternion} out Quaternion to receive the rotation component
+ * @param {Quaternion} [out=new Quaternion] Quaternion to receive the rotation component
* @return {Quaternion} out
*/
getRotation(out = new Quaternion()) {
@@ -9687,7 +9709,7 @@ Source: math/Matrix4
diff --git a/docs/math_Matrix4Notifier.js.html b/docs/math_Matrix4Notifier.js.html
index fc14bbb6..8dc6c5fe 100644
--- a/docs/math_Matrix4Notifier.js.html
+++ b/docs/math_Matrix4Notifier.js.html
@@ -4721,6 +4721,18 @@
- className
+ - ambientLights
+
+ - directionalLights
+
+ - pointLights
+
+ - spotLights
+
+ - areaLights
+
+ - updateCustomInfo
+
@@ -7132,6 +7152,8 @@
- isQuaternion
+ - elements
+
- x
- y
@@ -9058,7 +9080,15 @@ Source: math/Plane.js<
* @param {Number} [distance=0] 距离
*/
constructor(normal = new Vector3(), distance = 0) {
+ /**
+ * 法线向量
+ * @type Vector3
+ */
this.normal = normal;
+ /**
+ * 距离
+ * @type number
+ */
this.distance = distance;
},
/**
@@ -9134,7 +9164,7 @@ Source: math/Plane.js<
diff --git a/docs/math_Quaternion.js.html b/docs/math_Quaternion.js.html
index e041d0fe..39de3510 100644
--- a/docs/math_Quaternion.js.html
+++ b/docs/math_Quaternion.js.html
@@ -4721,6 +4721,18 @@
- className
+ - ambientLights
+
+ - directionalLights
+
+ - pointLights
+
+ - spotLights
+
+ - areaLights
+
+ - updateCustomInfo
+
@@ -7132,6 +7152,8 @@
- isQuaternion
+ - elements
+
- x
- y
@@ -9069,6 +9091,10 @@ Source: math/Quat
* @param {Number} [w=1] W component
*/
constructor(x = 0, y = 0, z = 0, w = 1) {
+ /**
+ * 数据
+ * @type {Float32Array}
+ */
this.elements = quat.fromValues(x, y, z, w);
},
@@ -9628,7 +9654,7 @@ Source: math/Quat
diff --git a/docs/math_Ray.js.html b/docs/math_Ray.js.html
index 20b6607d..973a8832 100644
--- a/docs/math_Ray.js.html
+++ b/docs/math_Ray.js.html
@@ -4721,6 +4721,18 @@
- className
+ - ambientLights
+
+ - directionalLights
+
+ - pointLights
+
+ - spotLights
+
+ - areaLights
+
+ - updateCustomInfo
+
@@ -7132,6 +7152,8 @@
- isQuaternion
+ - elements
+
- x
- y
@@ -9561,10 +9583,10 @@ Source: re
*/
setupCullFace(material) {
const state = this.state;
+ state.frontFace(material.frontFace);
if (material.cullFace && material.cullFaceType !== FRONT_AND_BACK) {
state.enable(CULL_FACE);
state.cullFace(material.cullFaceType);
- state.frontFace(material.frontFace);
} else {
state.disable(CULL_FACE);
}
@@ -9966,7 +9988,7 @@ Source: re
diff --git a/docs/renderer_WebGLResourceManager.js.html b/docs/renderer_WebGLResourceManager.js.html
index d5dee397..50a3a4c4 100644
--- a/docs/renderer_WebGLResourceManager.js.html
+++ b/docs/renderer_WebGLResourceManager.js.html
@@ -4721,6 +4721,18 @@
- className
+ - ambientLights
+
+ - directionalLights
+
+ - pointLights
+
+ - spotLights
+
+ - areaLights
+
+ - updateCustomInfo
+
@@ -7132,6 +7152,8 @@
- isQuaternion
+ - elements
+
- x
- y
@@ -9203,38 +9225,43 @@ Source: utils/brows
*/
let cssVendor = (data.cssVendor = '-' + jsVendor + '-');
- // css transform/3d feature dectection
- const testElem = doc.createElement('div');
- let style = testElem.style;
- /**
- * 是否支持CSS Transform变换。
- * @memberOf browser
- * @readOnly
- * @type {boolean}
- */
- const supportTransform = style[jsVendor + 'Transform'] !== undefined;
+ try {
+ // css transform/3d feature dectection
+ const testElem = doc.createElement('div');
+ let style = testElem.style;
+ /**
+ * 是否支持CSS Transform变换。
+ * @memberOf browser
+ * @readOnly
+ * @type {boolean}
+ */
+ const supportTransform = style[jsVendor + 'Transform'] !== undefined;
- /**
- * 是否支持CSS Transform 3D变换。
- * @memberOf browser
- * @readOnly
- * @type {boolean}
- */
- let supportTransform3D = style[jsVendor + 'Perspective'] !== undefined;
- if (supportTransform3D) {
- testElem.id = 'test3d';
- style = doc.createElement('style');
- style.textContent = '@media (' + cssVendor + 'transform-3d){#test3d{height:3px}}';
- doc.head.appendChild(style);
+ /**
+ * 是否支持CSS Transform 3D变换。
+ * @memberOf browser
+ * @readOnly
+ * @type {boolean}
+ */
+ let supportTransform3D = style[jsVendor + 'Perspective'] !== undefined;
+ if (supportTransform3D) {
+ testElem.id = 'test3d';
+ style = doc.createElement('style');
+ style.textContent = '@media (' + cssVendor + 'transform-3d){#test3d{height:3px}}';
+ doc.head.appendChild(style);
- docElem.appendChild(testElem);
- supportTransform3D = testElem.offsetHeight === 3;
- doc.head.removeChild(style);
- docElem.removeChild(testElem);
- }
+ docElem.appendChild(testElem);
+ supportTransform3D = testElem.offsetHeight === 3;
+ doc.head.removeChild(style);
+ docElem.removeChild(testElem);
+ }
- data.supportTransform = supportTransform;
- data.supportTransform3D = supportTransform3D;
+ data.supportTransform = supportTransform;
+ data.supportTransform3D = supportTransform3D;
+ } catch (e) {
+ data.supportTransform = false;
+ data.supportTransform3D = false;
+ }
const supportTouch = data.supportTouch;
@@ -9282,7 +9309,7 @@ Source: utils/brows
diff --git a/docs/utils_log.js.html b/docs/utils_log.js.html
index 73f322c6..00ef8dcf 100644
--- a/docs/utils_log.js.html
+++ b/docs/utils_log.js.html
@@ -4721,6 +4721,18 @@
- className
+ - ambientLights
+
+ - directionalLights
+
+ - pointLights
+
+ - spotLights
+
+ - areaLights
+
+ - updateCustomInfo
+
@@ -7132,6 +7152,8 @@
- isQuaternion
+ - elements
+
- x
- y
@@ -9436,7 +9458,7 @@ Source: utils/util.js<
diff --git a/package.json b/package.json
index 2f9f1970..e5a3d4f9 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "hilo3d",
- "version": "1.16.2",
+ "version": "1.16.3",
"description": "Hilo3d, a WebGL 3d engine.",
"main": "build/Hilo3d.js",
"types": "types/index.d.ts",
diff --git a/types/index.d.ts b/types/index.d.ts
index c47a1fb8..f4573589 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -490,17 +490,27 @@ interface EventObject {
}
/**
- * @param [e] - 事件对象
+ * @param e - 事件对象
* @param e.type - 事件类型
* @param e.detail - 事件数据
* @param e.target - 事件触发对象
* @param e.timeStamp - 时间戳
+ * @param e.stageX - 鼠标相对 stage 的 x 偏移 ( 仅鼠标事件有效 )
+ * @param e.stageY - 鼠标相对 stage 的 y 偏移 ( 仅鼠标事件有效 )
+ * @param e.eventTarget - 触发鼠标事件的对象 ( 仅鼠标事件有效 )
+ * @param e.eventCurrentTarget - 监听鼠标事件的对象 ( 仅鼠标事件有效 )
+ * @param e.hitPoint - 鼠标碰撞点 ( 仅鼠标事件有效 )
*/
-type EventMixinCallback = (e?: {
+type EventMixinCallback = (e: {
type: string;
detail: any;
target: any;
- timeStamp: Date;
+ timeStamp: number;
+ stageX: number;
+ stageY: number;
+ eventTarget: Node;
+ eventCurrentTarget: Node;
+ hitPoint: Vector3;
}) => void;
/**
@@ -638,6 +648,13 @@ type GeometryDataTraverseCallback = (attribute: number | Vector2 | Vector3 | Vec
*/
type GeometryDataTraverseByComponentCallback = (component: number, index: number, offset: number) => void;
+/**
+ * 更新自定义灯光回调
+ * @param lightManager
+ * @param camera
+ */
+type updateCustomInfoCallback = (lightManager: LightManager, camera: Camera) => void;
+
/**
* GLTFExtension Handler 接口
*/
@@ -4078,6 +4095,10 @@ class Quaternion implements EventMixin {
*/
className: string;
isQuaternion: boolean;
+ /**
+ * 数据
+ */
+ elements: Float32Array;
/**
* Copy the values from one quat to this
* @param q
@@ -4360,6 +4381,14 @@ class Plane {
*/
className: string;
isPlane: boolean;
+ /**
+ * 法线向量
+ */
+ normal: Vector3;
+ /**
+ * 距离
+ */
+ distance: number;
/**
* Copy the values from one plane to this
* @param m - the source plane
@@ -4615,10 +4644,10 @@ class Matrix4 {
* of a transformation matrix. If a matrix is built with
* fromRotationTranslation, the returned quaternion will be the
* same as the quaternion originally supplied.
- * @param out - Quaternion to receive the rotation component
+ * @param [out = new Quaternion] - Quaternion to receive the rotation component
* @returns out
*/
- getRotation(out: Quaternion): Quaternion;
+ getRotation(out?: Quaternion): Quaternion;
/**
* Creates a matrix from a quaternion rotation, vector translation and vector scale
* @param q - Rotation quaternion
@@ -5042,6 +5071,10 @@ class Euler {
* 旋转顺序,默认为 ZYX
*/
order: string;
+ /**
+ * 数据
+ */
+ elements: Float32Array;
/**
* 克隆
*/
@@ -6339,6 +6372,11 @@ class LightManager {
constructor(params?: any);
isLightManager: boolean;
className: string;
+ ambientLights: AmbientLight[];
+ directionalLights: DirectionalLight[];
+ pointLights: PointLight[];
+ spotLights: SpotLight[];
+ areaLights: AreaLight[];
/**
* 增加光
* @param light - 光源
@@ -6374,6 +6412,10 @@ class LightManager {
* @param camera - 摄像机
*/
updateInfo(camera: Camera): void;
+ /**
+ * 更新自定义灯光信息
+ */
+ updateCustomInfo: updateCustomInfoCallback;
/**
* 获取光源信息
*/
@@ -7712,15 +7754,15 @@ class Node implements EventMixin {
/**
* traverse callback 返回值,执行后不暂停 traverse
*/
- static TRAVERSE_STOP_NONE: any;
+ static TRAVERSE_STOP_NONE: number;
/**
* traverse callback 返回值,执行后暂停子元素 traverse
*/
- static TRAVERSE_STOP_CHILDREN: any;
+ static TRAVERSE_STOP_CHILDREN: number;
/**
* traverse callback 返回值,执行后暂停所有 traverse
*/
- static TRAVERSE_STOP_ALL: any;
+ static TRAVERSE_STOP_ALL: number;
isNode: boolean;
className: string;
/**
| | | |