(function (exports, Laya) {
'use strict';
class MathUtils3D {
constructor() {
}
static isZero(v) {
return Math.abs(v) < MathUtils3D.zeroTolerance;
}
static nearEqual(n1, n2) {
if (MathUtils3D.isZero(n1 - n2))
return true;
return false;
}
static fastInvSqrt(value) {
if (MathUtils3D.isZero(value))
return value;
return 1.0 / Math.sqrt(value);
}
}
MathUtils3D.zeroTolerance = 1e-6;
MathUtils3D.MaxValue = 3.40282347e+38;
MathUtils3D.MinValue = -3.40282347e+38;
MathUtils3D.Deg2Rad = Math.PI / 180;
class Vector2 {
constructor(x = 0, y = 0) {
this.x = x;
this.y = y;
}
setValue(x, y) {
this.x = x;
this.y = y;
}
static scale(a, b, out) {
out.x = a.x * b;
out.y = a.y * b;
}
fromArray(array, offset = 0) {
this.x = array[offset + 0];
this.y = array[offset + 1];
}
toArray(array, offset = 0) {
array[offset + 0] = this.x;
array[offset + 1] = this.y;
}
cloneTo(destObject) {
var destVector2 = destObject;
destVector2.x = this.x;
destVector2.y = this.y;
}
static dot(a, b) {
return (a.x * b.x) + (a.y * b.y);
}
static normalize(s, out) {
var x = s.x, y = s.y;
var len = x * x + y * y;
if (len > 0) {
len = 1 / Math.sqrt(len);
out.x = x * len;
out.y = y * len;
}
}
static scalarLength(a) {
var x = a.x, y = a.y;
return Math.sqrt(x * x + y * y);
}
clone() {
var destVector2 = new Vector2();
this.cloneTo(destVector2);
return destVector2;
}
forNativeElement(nativeElements = null) {
if (nativeElements) {
this.elements = nativeElements;
this.elements[0] = this.x;
this.elements[1] = this.y;
}
else {
this.elements = new Float32Array([this.x, this.y]);
}
Vector2.rewriteNumProperty(this, "x", 0);
Vector2.rewriteNumProperty(this, "y", 1);
}
static rewriteNumProperty(proto, name, index) {
Object["defineProperty"](proto, name, {
"get": function () {
return this.elements[index];
},
"set": function (v) {
this.elements[index] = v;
}
});
}
}
Vector2.ZERO = new Vector2(0.0, 0.0);
Vector2.ONE = new Vector2(1.0, 1.0);
class Vector4 {
constructor(x = 0, y = 0, z = 0, w = 0) {
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}
setValue(x, y, z, w) {
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}
fromArray(array, offset = 0) {
this.x = array[offset + 0];
this.y = array[offset + 1];
this.z = array[offset + 2];
this.w = array[offset + 3];
}
toArray(array, offset = 0) {
array[offset + 0] = this.x;
array[offset + 1] = this.y;
array[offset + 2] = this.z;
array[offset + 3] = this.w;
}
cloneTo(destObject) {
var destVector4 = destObject;
destVector4.x = this.x;
destVector4.y = this.y;
destVector4.z = this.z;
destVector4.w = this.w;
}
clone() {
var destVector4 = new Vector4();
this.cloneTo(destVector4);
return destVector4;
}
static lerp(a, b, t, out) {
var ax = a.x, ay = a.y, az = a.z, aw = a.w;
out.x = ax + t * (b.x - ax);
out.y = ay + t * (b.y - ay);
out.z = az + t * (b.z - az);
out.w = aw + t * (b.w - aw);
}
static transformByM4x4(vector4, m4x4, out) {
var vx = vector4.x;
var vy = vector4.y;
var vz = vector4.z;
var vw = vector4.w;
var me = m4x4.elements;
out.x = vx * me[0] + vy * me[4] + vz * me[8] + vw * me[12];
out.y = vx * me[1] + vy * me[5] + vz * me[9] + vw * me[13];
out.z = vx * me[2] + vy * me[6] + vz * me[10] + vw * me[14];
out.w = vx * me[3] + vy * me[7] + vz * me[11] + vw * me[15];
}
static equals(a, b) {
return MathUtils3D.nearEqual(Math.abs(a.x), Math.abs(b.x)) && MathUtils3D.nearEqual(Math.abs(a.y), Math.abs(b.y)) && MathUtils3D.nearEqual(Math.abs(a.z), Math.abs(b.z)) && MathUtils3D.nearEqual(Math.abs(a.w), Math.abs(b.w));
}
length() {
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
}
lengthSquared() {
return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;
}
static normalize(s, out) {
var len = s.length();
if (len > 0) {
var inverse = 1.0 / len;
out.x = s.x * inverse;
out.y = s.y * inverse;
out.z = s.z * inverse;
out.w = s.w * inverse;
}
}
static add(a, b, out) {
out.x = a.x + b.x;
out.y = a.y + b.y;
out.z = a.z + b.z;
out.w = a.w + b.w;
}
static subtract(a, b, out) {
out.x = a.x - b.x;
out.y = a.y - b.y;
out.z = a.z - b.z;
out.w = a.w - b.w;
}
static multiply(a, b, out) {
out.x = a.x * b.x;
out.y = a.y * b.y;
out.z = a.z * b.z;
out.w = a.w * b.w;
}
static scale(a, b, out) {
out.x = a.x * b;
out.y = a.y * b;
out.z = a.z * b;
out.w = a.w * b;
}
static Clamp(value, min, max, out) {
var x = value.x;
var y = value.y;
var z = value.z;
var w = value.w;
var mineX = min.x;
var mineY = min.y;
var mineZ = min.z;
var mineW = min.w;
var maxeX = max.x;
var maxeY = max.y;
var maxeZ = max.z;
var maxeW = max.w;
x = (x > maxeX) ? maxeX : x;
x = (x < mineX) ? mineX : x;
y = (y > maxeY) ? maxeY : y;
y = (y < mineY) ? mineY : y;
z = (z > maxeZ) ? maxeZ : z;
z = (z < mineZ) ? mineZ : z;
w = (w > maxeW) ? maxeW : w;
w = (w < mineW) ? mineW : w;
out.x = x;
out.y = y;
out.z = z;
out.w = w;
}
static distanceSquared(value1, value2) {
var x = value1.x - value2.x;
var y = value1.y - value2.y;
var z = value1.z - value2.z;
var w = value1.w - value2.w;
return (x * x) + (y * y) + (z * z) + (w * w);
}
static distance(value1, value2) {
var x = value1.x - value2.x;
var y = value1.y - value2.y;
var z = value1.z - value2.z;
var w = value1.w - value2.w;
return Math.sqrt((x * x) + (y * y) + (z * z) + (w * w));
}
static dot(a, b) {
return (a.x * b.x) + (a.y * b.y) + (a.z * b.z) + (a.w * b.w);
}
static min(a, b, out) {
out.x = Math.min(a.x, b.x);
out.y = Math.min(a.y, b.y);
out.z = Math.min(a.z, b.z);
out.w = Math.min(a.w, b.w);
}
static max(a, b, out) {
out.x = Math.max(a.x, b.x);
out.y = Math.max(a.y, b.y);
out.z = Math.max(a.z, b.z);
out.w = Math.max(a.w, b.w);
}
forNativeElement(nativeElements = null) {
if (nativeElements) {
this.elements = nativeElements;
this.elements[0] = this.x;
this.elements[1] = this.y;
this.elements[2] = this.z;
this.elements[3] = this.w;
没有合适的资源?快使用搜索试试~ 我知道了~
LayaAir是核心库仅100K左右的新一代HTML5引擎,LayaAir支持动画、UI、粒子、骨骼、物理等系统
共1646个文件
ts:671个
as:652个
js:242个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 38 浏览量
2023-11-03
21:49:31
上传
评论
收藏 12.02MB ZIP 举报
温馨提示
LayaAir是核心库仅100K左右的新一代HTML5引擎,LayaAir支持动画、UI、粒子、骨骼、物理等系统;支持AS3、TypeScript、javascript三种语言;支持AS3TSJS语言开发,支持2D3D,非运行器模式下性能媲美APP,LayaAir支持动画、UI、粒子、骨骼、物理等系统;支持AS3、TypeScript、JavaScript三种语言;支持DragonBones骨骼编辑器、tileMapEditor地图编辑器等第三方工具
资源推荐
资源详情
资源评论
收起资源包目录
LayaAir是核心库仅100K左右的新一代HTML5引擎,LayaAir支持动画、UI、粒子、骨骼、物理等系统 (1646个子文件)
Sprite.as 35KB
Ease.as 21KB
Text.as 18KB
Byte.as 18KB
List.as 17KB
Graphics.as 17KB
Tree.as 16KB
Button.as 15KB
Context.as 14KB
Animation.as 14KB
Stage.as 13KB
Node.as 13KB
wx.as 12KB
ComboBox.as 12KB
Dialog.as 11KB
Label.as 11KB
Keyboard.as 11KB
ShurikenParticleSystem.as 11KB
CollisionUtils.as 11KB
Clip.as 11KB
TiledMap.as 11KB
XmlDom.as 10KB
Event.as 9KB
LoaderManager.as 9KB
UIComponent.as 9KB
Loader.as 9KB
ScrollBar.as 9KB
TextInput.as 9KB
ColorPicker.as 9KB
ConchVector3.as 8KB
ProgressBar.as 8KB
RigidBody.as 8KB
Matrix4x4.as 8KB
Video.as 8KB
Matrix.as 8KB
UIGroup.as 8KB
CommandBuffer.as 8KB
GradientAngularVelocity.as 8KB
Input.as 7KB
Scene.as 7KB
HTMLStyle.as 7KB
SoundManager.as 7KB
ConchQuaternion.as 7KB
Scene3D.as 7KB
Camera.as 7KB
Image.as 7KB
BlinnPhongMaterial.as 7KB
Vector3.as 7KB
ParticleSetting.as 7KB
TextArea.as 7KB
Utils.as 7KB
Slider.as 6KB
Rectangle.as 6KB
Transform3D.as 6KB
Skeleton.as 6KB
Socket.as 6KB
Quaternion.as 6KB
Browser.as 6KB
GradientSize.as 6KB
ConchVector4.as 6KB
Tween.as 6KB
ShaderData.as 6KB
Utils3D.as 6KB
Texture.as 6KB
Mesh.as 6KB
PhysicsSimulation.as 6KB
Panel.as 6KB
AnimationPlayer.as 5KB
RenderState.as 5KB
Vector4.as 5KB
glTFUtils.as 5KB
TextRender.as 5KB
AnimationBase.as 5KB
Templet.as 5KB
Shader3D.as 5KB
TimeLine.as 5KB
Script.as 5KB
CheckBox.as 5KB
Shader.as 5KB
BaseCamera.as 5KB
HSlider.as 5KB
Timer.as 4KB
VSlider.as 4KB
GradientVelocity.as 4KB
TrailMaterial.as 4KB
Animator.as 4KB
Rigidbody3D.as 4KB
UnlitMaterial.as 4KB
BaseTexture.as 4KB
View.as 4KB
HScrollBar.as 4KB
ConfigurableConstraint.as 4KB
VScrollBar.as 4KB
RadioGroup.as 4KB
ColorFilter.as 4KB
AnimationTemplet.as 4KB
Material.as 4KB
Script3D.as 4KB
BoneSlot.as 4KB
BoundsOctreeNode.as 4KB
共 1646 条
- 1
- 2
- 3
- 4
- 5
- 6
- 17
资源评论
DNCS高级工程师
- 粉丝: 761
- 资源: 551
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 使用lvgl v9自带LVGLImage.py把png图片批量生成bin或c文件的bat脚本
- 基于Pytorch的多种卷积神经网络模型搭建功能实现
- 280256087383610OldRoll-v4.9.0.apk
- VisualSVN Repository Configurator(VisualSVN库配置器)远程管理版本仓库
- 农作物害虫识别分类数据集4183张7类别.7z
- jenkins管道的方式从gitlib拉去若依并构建成docker镜像,生成容器.docx
- linux安装详细教程
- stm32f103HAL五线四相步进电机
- OpenCV(基于python)
- 进程的同步与互斥,生产者与消费者同步机制问题
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功