mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2026-01-09 20:46:53 +00:00
[engine] [cocos2d-x] [jsb-adapter] 适配引擎 v2.4.12 版本
This commit is contained in:
@@ -316,7 +316,6 @@ Audio.State = {
|
||||
}
|
||||
this._state = Audio.State.INITIALZING;
|
||||
}
|
||||
return clip;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
@@ -493,7 +492,7 @@ let WebAudioElement = function (buffer, audio) {
|
||||
if (this._currentSource)
|
||||
this._currentSource.loop = bool;
|
||||
|
||||
return this._loop = bool;
|
||||
this._loop = bool;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
@@ -549,7 +548,6 @@ let WebAudioElement = function (buffer, audio) {
|
||||
} else {
|
||||
this.playedLength = num;
|
||||
}
|
||||
return num;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
|
||||
@@ -43,6 +43,9 @@ let recycleAudio = function (audio) {
|
||||
audio.off('ended');
|
||||
audio.off('stop');
|
||||
audio.src = null;
|
||||
if (cc.sys.platform === cc.sys.ALIPAY_GAME) {
|
||||
audio.destroy();
|
||||
} else {
|
||||
// In case repeatly recycle audio
|
||||
if (!_audioPool.includes(audio)) {
|
||||
if (_audioPool.length < audioEngine._maxPoolSize) {
|
||||
@@ -50,6 +53,7 @@ let recycleAudio = function (audio) {
|
||||
}
|
||||
else {
|
||||
audio.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
audio._shouldRecycleOnEnded = false;
|
||||
|
||||
@@ -39,7 +39,7 @@ if (CC_JSB && CC_NATIVERENDERER) {
|
||||
import renderer from '../renderer/index';
|
||||
import Enum from '../platform/CCEnum';
|
||||
import CCComponent from '../components/CCComponent';
|
||||
import { ccclass, menu, inspector, property, executeInEditMode } from '../platform/CCClassDecorator';
|
||||
import { ccclass, menu, inspector, property, executeInEditMode, help } from '../platform/CCClassDecorator';
|
||||
|
||||
/**
|
||||
* !#en The light source type
|
||||
@@ -140,6 +140,7 @@ const LightShadowType = Enum({
|
||||
@menu('i18n:MAIN_MENU.component.renderers/Light')
|
||||
@executeInEditMode
|
||||
@inspector('packages://inspector/inspectors/comps/light.js')
|
||||
@help('i18n:COMPONENT.help_url.light')
|
||||
export default class Light extends CCComponent {
|
||||
@property
|
||||
_type = LightType.DIRECTIONAL;
|
||||
|
||||
@@ -42,7 +42,7 @@ import { particleEmitZAxis } from './particle-general-function';
|
||||
import TrailModule from './renderer/trail';
|
||||
import Mesh from '../../mesh/CCMesh';
|
||||
|
||||
const { ccclass, menu, property, executeInEditMode, executionOrder} = require('../../platform/CCClassDecorator')
|
||||
const { ccclass, menu, property, executeInEditMode, executionOrder, help } = require('../../platform/CCClassDecorator')
|
||||
const RenderComponent = require('../../components/CCRenderComponent');
|
||||
|
||||
const _world_mat = new Mat4();
|
||||
@@ -66,6 +66,7 @@ const _module_props = CC_EDITOR && [
|
||||
*/
|
||||
@ccclass('cc.ParticleSystem3D')
|
||||
@menu('i18n:MAIN_MENU.component.renderers/ParticleSystem3D')
|
||||
@help('i18n:COMPONENT.help_url.particle-system-3d')
|
||||
@executionOrder(99)
|
||||
@executeInEditMode
|
||||
export default class ParticleSystem3D extends RenderComponent {
|
||||
|
||||
@@ -33,6 +33,7 @@ const {
|
||||
executionOrder,
|
||||
menu,
|
||||
property,
|
||||
help,
|
||||
} = cc._decorator;
|
||||
|
||||
const Vec3 = cc.Vec3;
|
||||
@@ -49,6 +50,7 @@ const Vec3 = cc.Vec3;
|
||||
@executionOrder(98)
|
||||
@menu('i18n:MAIN_MENU.component.physics/Collider/Box 3D')
|
||||
@executeInEditMode
|
||||
@help('i18n:COMPONENT.help_url.physics-collider')
|
||||
export class BoxCollider3D extends Collider3D {
|
||||
|
||||
/// PUBLIC PROPERTY GETTER\SETTER ///
|
||||
|
||||
@@ -33,6 +33,7 @@ const {
|
||||
executionOrder,
|
||||
menu,
|
||||
property,
|
||||
help,
|
||||
} = cc._decorator;
|
||||
|
||||
/**
|
||||
@@ -46,6 +47,7 @@ const {
|
||||
@ccclass('cc.SphereCollider3D')
|
||||
@executionOrder(98)
|
||||
@menu('i18n:MAIN_MENU.component.physics/Collider/Sphere 3D')
|
||||
@help('i18n:COMPONENT.help_url.physics-collider')
|
||||
@executeInEditMode
|
||||
export class SphereCollider3D extends Collider3D {
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ const {
|
||||
property,
|
||||
requireComponent,
|
||||
disallowMultiple,
|
||||
help,
|
||||
} = cc._decorator;
|
||||
const Vec3 = cc.Vec3;
|
||||
|
||||
@@ -48,6 +49,7 @@ const Vec3 = cc.Vec3;
|
||||
@executionOrder(98)
|
||||
@requireComponent(RigidBody3D)
|
||||
@menu('i18n:MAIN_MENU.component.physics/Constant Force 3D')
|
||||
@help('i18n:COMPONENT.help_url.constantforce')
|
||||
@disallowMultiple
|
||||
@executeInEditMode
|
||||
export class ConstantForce extends cc.Component {
|
||||
|
||||
@@ -33,6 +33,7 @@ const {
|
||||
executionOrder,
|
||||
menu,
|
||||
property,
|
||||
help,
|
||||
} = cc._decorator;
|
||||
const Vec3 = cc.Vec3;
|
||||
|
||||
@@ -47,6 +48,7 @@ const Vec3 = cc.Vec3;
|
||||
@ccclass('cc.RigidBody3D')
|
||||
@executionOrder(99)
|
||||
@menu('i18n:MAIN_MENU.component.physics/Rigid Body 3D')
|
||||
@help('i18n:COMPONENT.help_url.physics-rigidbody')
|
||||
@executeInEditMode
|
||||
@disallowMultiple
|
||||
export class RigidBody3D extends cc.Component {
|
||||
|
||||
@@ -43,6 +43,7 @@ let SkeletonAnimation = cc.Class({
|
||||
editor: CC_EDITOR && {
|
||||
inspector: 'packages://inspector/inspectors/comps/skeleton-animation.js',
|
||||
menu: 'i18n:MAIN_MENU.component.others/Skeleton Animation',
|
||||
help: 'i18n:COMPONENT.help_url.skeleton-animation',
|
||||
},
|
||||
|
||||
properties: {
|
||||
|
||||
@@ -46,6 +46,7 @@ let SkinnedMeshRenderer = cc.Class({
|
||||
|
||||
editor: CC_EDITOR && {
|
||||
menu: 'i18n:MAIN_MENU.component.mesh/Skinned Mesh Renderer',
|
||||
help: 'i18n:COMPONENT.help_url.skinned-mesh-renderer',
|
||||
},
|
||||
|
||||
ctor () {
|
||||
|
||||
@@ -543,6 +543,7 @@ var downloaders = {
|
||||
'.image' : downloadImage,
|
||||
'.pvr': downloadArrayBuffer,
|
||||
'.pkm': downloadArrayBuffer,
|
||||
'.astc': downloadArrayBuffer,
|
||||
|
||||
// Audio
|
||||
'.mp3' : downloadAudio,
|
||||
|
||||
@@ -148,6 +148,7 @@ const producers = {
|
||||
'.image' : createTexture,
|
||||
'.pvr': createTexture,
|
||||
'.pkm': createTexture,
|
||||
'.astc': createTexture,
|
||||
|
||||
// Audio
|
||||
'.mp3' : createAudioClip,
|
||||
|
||||
@@ -263,6 +263,113 @@ var parser = {
|
||||
}
|
||||
})(),
|
||||
|
||||
parseASTCTex: (function () {
|
||||
//= ==============//
|
||||
// ASTC constants //
|
||||
//= ==============//
|
||||
|
||||
// struct astc_header
|
||||
// {
|
||||
// uint8_t magic[4];
|
||||
// uint8_t blockdim_x;
|
||||
// uint8_t blockdim_y;
|
||||
// uint8_t blockdim_z;
|
||||
// uint8_t xsize[3]; // x-size = xsize[0] + xsize[1] + xsize[2]
|
||||
// uint8_t ysize[3]; // x-size, y-size and z-size are given in texels;
|
||||
// uint8_t zsize[3]; // block count is inferred
|
||||
// };
|
||||
const ASTC_MAGIC = 0x5CA1AB13;
|
||||
|
||||
const ASTC_HEADER_LENGTH = 16; // The header length
|
||||
const ASTC_HEADER_MAGIC = 4;
|
||||
const ASTC_HEADER_BLOCKDIM = 3;
|
||||
|
||||
const ASTC_HEADER_SIZE_X_BEGIN = 7;
|
||||
const ASTC_HEADER_SIZE_Y_BEGIN = 10;
|
||||
const ASTC_HEADER_SIZE_Z_BEGIN = 13;
|
||||
|
||||
function getASTCFormat (xdim, ydim) {
|
||||
if (xdim === 4) {
|
||||
return cc.Texture2D.PixelFormat.RGBA_ASTC_4x4;
|
||||
} if (xdim === 5) {
|
||||
if (ydim === 4) {
|
||||
return cc.Texture2D.PixelFormat.RGBA_ASTC_5x4;
|
||||
}
|
||||
return cc.Texture2D.PixelFormat.RGBA_ASTC_5x5;
|
||||
} if (xdim === 6) {
|
||||
if (ydim === 5) {
|
||||
return cc.Texture2D.PixelFormat.RGBA_ASTC_6x5;
|
||||
}
|
||||
return cc.Texture2D.PixelFormat.RGBA_ASTC_6x6;
|
||||
} if (xdim === 8) {
|
||||
if (ydim === 5) {
|
||||
return cc.Texture2D.PixelFormat.RGBA_ASTC_8x5;
|
||||
} if (ydim === 6) {
|
||||
return cc.Texture2D.PixelFormat.RGBA_ASTC_8x6;
|
||||
}
|
||||
return cc.Texture2D.PixelFormat.RGBA_ASTC_8x8;
|
||||
} if (xdim === 10) {
|
||||
if (ydim === 5) {
|
||||
return cc.Texture2D.PixelFormat.RGBA_ASTC_10x5;
|
||||
} if (ydim === 6) {
|
||||
return cc.Texture2D.PixelFormat.RGBA_ASTC_10x6;
|
||||
} if (ydim === 8) {
|
||||
return cc.Texture2D.PixelFormat.RGBA_ASTC_10x8;
|
||||
}
|
||||
return cc.Texture2D.PixelFormat.RGBA_ASTC_10x10;
|
||||
}
|
||||
if (ydim === 10) {
|
||||
return cc.Texture2D.PixelFormat.RGBA_ASTC_12x10;
|
||||
}
|
||||
return cc.Texture2D.PixelFormat.RGBA_ASTC_12x12;
|
||||
}
|
||||
|
||||
return function (file, options, onComplete) {
|
||||
let err = null, out = null;
|
||||
try {
|
||||
const buffer = file instanceof ArrayBuffer ? file : file.buffer;
|
||||
const header = new Uint8Array(buffer);
|
||||
|
||||
const magicval = header[0] + (header[1] << 8) + (header[2] << 16) + (header[3] << 24);
|
||||
if (magicval !== ASTC_MAGIC) {
|
||||
return new Error('Invalid magic number in ASTC header');
|
||||
}
|
||||
|
||||
const xdim = header[ASTC_HEADER_MAGIC];
|
||||
const ydim = header[ASTC_HEADER_MAGIC + 1];
|
||||
const zdim = header[ASTC_HEADER_MAGIC + 2];
|
||||
if ((xdim < 3 || xdim > 6 || ydim < 3 || ydim > 6 || zdim < 3 || zdim > 6)
|
||||
&& (xdim < 4 || xdim === 7 || xdim === 9 || xdim === 11 || xdim > 12
|
||||
|| ydim < 4 || ydim === 7 || ydim === 9 || ydim === 11 || ydim > 12 || zdim !== 1)) {
|
||||
return new Error('Invalid block number in ASTC header');
|
||||
}
|
||||
|
||||
const format = getASTCFormat(xdim, ydim);
|
||||
|
||||
const xsize = header[ASTC_HEADER_SIZE_X_BEGIN] + (header[ASTC_HEADER_SIZE_X_BEGIN + 1] << 8)
|
||||
+ (header[ASTC_HEADER_SIZE_X_BEGIN + 2] << 16);
|
||||
const ysize = header[ASTC_HEADER_SIZE_Y_BEGIN] + (header[ASTC_HEADER_SIZE_Y_BEGIN + 1] << 8)
|
||||
+ (header[ASTC_HEADER_SIZE_Y_BEGIN + 2] << 16);
|
||||
const zsize = header[ASTC_HEADER_SIZE_Z_BEGIN] + (header[ASTC_HEADER_SIZE_Z_BEGIN + 1] << 8)
|
||||
+ (header[ASTC_HEADER_SIZE_Z_BEGIN + 2] << 16);
|
||||
|
||||
// buffer = buffer.slice(ASTC_HEADER_LENGTH, buffer.byteLength);
|
||||
const astcData = new Uint8Array(buffer, ASTC_HEADER_LENGTH);
|
||||
|
||||
out = {
|
||||
_data: astcData,
|
||||
_compressed: true,
|
||||
width: xsize,
|
||||
height: ysize,
|
||||
format,
|
||||
};
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
onComplete(err, out);
|
||||
}
|
||||
})(),
|
||||
|
||||
/*
|
||||
* !#en
|
||||
* Parse plist file
|
||||
@@ -426,6 +533,7 @@ var parsers = {
|
||||
'.image' : parser.parseImage,
|
||||
'.pvr' : parser.parsePVRTex,
|
||||
'.pkm' : parser.parsePKMTex,
|
||||
'.astc' : parser.parseASTCTex,
|
||||
// Audio
|
||||
'.mp3' : parser.parseAudio,
|
||||
'.ogg' : parser.parseAudio,
|
||||
|
||||
@@ -228,7 +228,7 @@ let SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
return this._texture && this._texture.loaded;
|
||||
},
|
||||
|
||||
onTextureLoaded (callback, target) {
|
||||
onTextureLoaded: function (callback, target) {
|
||||
if (this.textureLoaded()) {
|
||||
callback.call(target);
|
||||
}
|
||||
@@ -259,8 +259,9 @@ let SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
*/
|
||||
setRotated: function (bRotated) {
|
||||
this._rotated = bRotated;
|
||||
if (this._texture)
|
||||
if (this._texture) {
|
||||
this._calculateUV();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -327,8 +328,9 @@ let SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
*/
|
||||
setRect: function (rect) {
|
||||
this._rect = rect;
|
||||
if (this._texture)
|
||||
if (this._texture) {
|
||||
this._calculateUV();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -366,7 +368,7 @@ let SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
return this._texture;
|
||||
},
|
||||
|
||||
_textureLoadedCallback () {
|
||||
_textureLoadedCallback: function () {
|
||||
let self = this;
|
||||
let texture = this._texture;
|
||||
if (!texture) {
|
||||
@@ -546,7 +548,7 @@ let SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
}
|
||||
},
|
||||
|
||||
_flipXY (uvs) {
|
||||
_flipXY: function (uvs) {
|
||||
if (this._flipX) {
|
||||
let tempVal = uvs[0];
|
||||
uvs[0] = uvs[1];
|
||||
@@ -568,7 +570,7 @@ let SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
}
|
||||
},
|
||||
|
||||
_calculateSlicedUV () {
|
||||
_calculateSlicedUV: function () {
|
||||
let rect = this._rect;
|
||||
let atlasWidth = this._texture.width;
|
||||
let atlasHeight = this._texture.height;
|
||||
@@ -629,7 +631,7 @@ let SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
}
|
||||
},
|
||||
|
||||
_setDynamicAtlasFrame (frame) {
|
||||
_setDynamicAtlasFrame: function (frame) {
|
||||
if (!frame) return;
|
||||
|
||||
this._original = {
|
||||
@@ -644,7 +646,7 @@ let SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
this._calculateUV();
|
||||
},
|
||||
|
||||
_resetDynamicAtlasFrame () {
|
||||
_resetDynamicAtlasFrame: function () {
|
||||
if (!this._original) return;
|
||||
this._rect.x = this._original._x;
|
||||
this._rect.y = this._original._y;
|
||||
@@ -658,7 +660,7 @@ let SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
this.emit("_resetDynamicAtlasFrame");
|
||||
},
|
||||
|
||||
_calculateUV () {
|
||||
_calculateUV: function () {
|
||||
let rect = this._rect,
|
||||
texture = this._texture,
|
||||
uv = this.uv,
|
||||
|
||||
@@ -205,6 +205,77 @@ const PixelFormat = cc.Enum({
|
||||
* @type {Number}
|
||||
*/
|
||||
RGBA_ETC2: gfx.TEXTURE_FMT_RGBA_ETC2,
|
||||
|
||||
/**
|
||||
* @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 4x4 block size.
|
||||
* @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 4x4
|
||||
*/
|
||||
RGBA_ASTC_4x4: gfx.TEXTURE_FMT_RGBA_ASTC_4X4,
|
||||
/**
|
||||
* @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 5x4 block size.
|
||||
* @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 5x4
|
||||
*/
|
||||
RGBA_ASTC_5x4: gfx.TEXTURE_FMT_RGBA_ASTC_5X4,
|
||||
/**
|
||||
* @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 5x5 block size.
|
||||
* @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 5x5
|
||||
*/
|
||||
RGBA_ASTC_5x5: gfx.TEXTURE_FMT_RGBA_ASTC_5X5,
|
||||
/**
|
||||
* @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 6x5 block size.
|
||||
* @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 6x5
|
||||
*/
|
||||
RGBA_ASTC_6x5: gfx.TEXTURE_FMT_RGBA_ASTC_6X5,
|
||||
/**
|
||||
* @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 6x6 block size.
|
||||
* @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 6x6
|
||||
*/
|
||||
RGBA_ASTC_6x6: gfx.TEXTURE_FMT_RGBA_ASTC_6X6,
|
||||
/**
|
||||
* @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 8x5 block size.
|
||||
* @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 8x5
|
||||
*/
|
||||
RGBA_ASTC_8x5: gfx.TEXTURE_FMT_RGBA_ASTC_8X5,
|
||||
/**
|
||||
* @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 8x6 block size.
|
||||
* @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 8x6
|
||||
*/
|
||||
RGBA_ASTC_8x6: gfx.TEXTURE_FMT_RGBA_ASTC_8X6,
|
||||
/**
|
||||
* @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 8x8 block size.
|
||||
* @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 8x8
|
||||
*/
|
||||
RGBA_ASTC_8x8: gfx.TEXTURE_FMT_RGBA_ASTC_8X8,
|
||||
/**
|
||||
* @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 10x5 block size.
|
||||
* @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 10x5
|
||||
*/
|
||||
RGBA_ASTC_10x5: gfx.TEXTURE_FMT_RGBA_ASTC_10X5,
|
||||
/**
|
||||
* @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 10x6 block size.
|
||||
* @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 10x6
|
||||
*/
|
||||
RGBA_ASTC_10x6: gfx.TEXTURE_FMT_RGBA_ASTC_10X6,
|
||||
/**
|
||||
* @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 10x8 block size.
|
||||
* @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 10x8
|
||||
*/
|
||||
RGBA_ASTC_10x8: gfx.TEXTURE_FMT_RGBA_ASTC_10X8,
|
||||
/**
|
||||
* @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 10x10 block size.
|
||||
* @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 10x10
|
||||
*/
|
||||
RGBA_ASTC_10x10: gfx.TEXTURE_FMT_RGBA_ASTC_10X10,
|
||||
/**
|
||||
* @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 12x10 block size.
|
||||
* @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 12x10
|
||||
*/
|
||||
RGBA_ASTC_12x10: gfx.TEXTURE_FMT_RGBA_ASTC_12X10,
|
||||
/**
|
||||
* @en A pixel format containing red, green, blue, and alpha channels that is ASTC compressed with 12x12 block size.
|
||||
* @zh 包含 RGBA 通道的 ASTC 压缩纹理格式,压缩分块大小为 12x12
|
||||
*/
|
||||
RGBA_ASTC_12x12: gfx.TEXTURE_FMT_RGBA_ASTC_12X12,
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -384,7 +455,7 @@ var Texture2D = cc.Class({
|
||||
Filter: Filter,
|
||||
_FilterIndex: FilterIndex,
|
||||
// predefined most common extnames
|
||||
extnames: ['.png', '.jpg', '.jpeg', '.bmp', '.webp', '.pvr', '.pkm'],
|
||||
extnames: ['.png', '.jpg', '.jpeg', '.bmp', '.webp', '.pvr', '.pkm', '.astc'],
|
||||
|
||||
_parseExt (extIdStr, defaultFormat) {
|
||||
let device = cc.renderer.device;
|
||||
@@ -406,7 +477,10 @@ var Texture2D = cc.Class({
|
||||
let tmpFormat = extFormat[1] ? parseInt(extFormat[1]) : defaultFormat;
|
||||
|
||||
// check whether or not support compressed texture
|
||||
if ( tmpExt === '.pvr' && !device.ext('WEBGL_compressed_texture_pvrtc')) {
|
||||
if ( tmpExt === '.astc' && !device.ext('WEBGL_compressed_texture_astc')) {
|
||||
continue;
|
||||
}
|
||||
else if ( tmpExt === '.pvr' && !device.ext('WEBGL_compressed_texture_pvrtc')) {
|
||||
continue;
|
||||
}
|
||||
else if ((tmpFormat === PixelFormat.RGB_ETC1 || tmpFormat === PixelFormat.RGBA_ETC1) && !device.ext('WEBGL_compressed_texture_etc1')) {
|
||||
|
||||
@@ -142,6 +142,7 @@ let Camera = cc.Class({
|
||||
editor: CC_EDITOR && {
|
||||
menu: 'i18n:MAIN_MENU.component.others/Camera',
|
||||
inspector: 'packages://inspector/inspectors/comps/camera.js',
|
||||
help: 'i18n:COMPONENT.help_url.camera',
|
||||
executeInEditMode: true
|
||||
},
|
||||
|
||||
|
||||
@@ -104,6 +104,7 @@ var BoxCollider = cc.Class({
|
||||
|
||||
editor: CC_EDITOR && {
|
||||
menu: 'i18n:MAIN_MENU.component.collider/Box Collider',
|
||||
help: 'i18n:COMPONENT.help_url.collider',
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -99,7 +99,8 @@ var CircleCollider = cc.Class({
|
||||
mixins: [cc.Collider.Circle],
|
||||
|
||||
editor: CC_EDITOR && {
|
||||
menu: 'i18n:MAIN_MENU.component.collider/Circle Collider'
|
||||
menu: 'i18n:MAIN_MENU.component.collider/Circle Collider',
|
||||
help: 'i18n:COMPONENT.help_url.collider',
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ var PolygonCollider = cc.Class({
|
||||
editor: CC_EDITOR && {
|
||||
menu: 'i18n:MAIN_MENU.component.collider/Polygon Collider',
|
||||
inspector: 'packages://inspector/inspectors/comps/physics/points-base-collider.js',
|
||||
help: 'i18n:COMPONENT.help_url.collider',
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -443,6 +443,7 @@ var Sprite = cc.Class({
|
||||
|
||||
onEnable () {
|
||||
this._super();
|
||||
this._validateRender();
|
||||
this._spriteFrame && this._spriteFrame.isValid && this._spriteFrame.ensureLoadTexture();
|
||||
|
||||
this.node.on(cc.Node.EventType.SIZE_CHANGED, this.setVertsDirty, this);
|
||||
|
||||
@@ -55,7 +55,7 @@ var StudioComponent = cc.Class({
|
||||
extends: cc.Component,
|
||||
|
||||
editor: CC_EDITOR && {
|
||||
inspector: 'unpack://engine-dev/extensions/cocostudio/editor/studio-component.js'
|
||||
inspector: 'unpack://engine/extensions/cocostudio/editor/studio-component.js'
|
||||
},
|
||||
|
||||
properties: CC_EDITOR && {
|
||||
|
||||
@@ -41,6 +41,7 @@ let Graphics = cc.Class({
|
||||
|
||||
editor: CC_EDITOR && {
|
||||
menu: 'i18n:MAIN_MENU.component.renderers/Graphics',
|
||||
help: 'i18n:COMPONENT.help_url.graphics',
|
||||
},
|
||||
|
||||
ctor () {
|
||||
|
||||
@@ -97,6 +97,7 @@ let MeshRenderer = cc.Class({
|
||||
|
||||
editor: CC_EDITOR && {
|
||||
menu: 'i18n:MAIN_MENU.component.mesh/MeshRenderer',
|
||||
help: 'i18n:COMPONENT.help_url.mesh-renderer',
|
||||
},
|
||||
|
||||
properties: {
|
||||
|
||||
@@ -47,6 +47,7 @@ var RigidBody = cc.Class({
|
||||
|
||||
editor: CC_EDITOR && {
|
||||
menu: 'i18n:MAIN_MENU.component.physics/Rigid Body',
|
||||
help: 'i18n:COMPONENT.help_url.rigidbody',
|
||||
disallowMultiple: true
|
||||
},
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ var PhysicsBoxCollider = cc.Class({
|
||||
|
||||
editor: {
|
||||
menu: CC_EDITOR && 'i18n:MAIN_MENU.component.physics/Collider/Box',
|
||||
help: 'i18n:COMPONENT.help_url.edit-collider-component',
|
||||
requireComponent: cc.RigidBody
|
||||
},
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ var PhysicsChainCollider = cc.Class({
|
||||
editor: {
|
||||
menu: CC_EDITOR && 'i18n:MAIN_MENU.component.physics/Collider/Chain',
|
||||
inspector: CC_EDITOR && 'packages://inspector/inspectors/comps/physics/points-base-collider.js',
|
||||
help: 'i18n:COMPONENT.help_url.edit-collider-component',
|
||||
requireComponent: cc.RigidBody
|
||||
},
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ var PhysicsCircleCollider = cc.Class({
|
||||
|
||||
editor: {
|
||||
menu: CC_EDITOR && 'i18n:MAIN_MENU.component.physics/Collider/Circle',
|
||||
help: 'i18n:COMPONENT.help_url.edit-collider-component',
|
||||
requireComponent: cc.RigidBody
|
||||
},
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ var PhysicsPolygonCollider = cc.Class({
|
||||
editor: {
|
||||
menu: CC_EDITOR && 'i18n:MAIN_MENU.component.physics/Collider/Polygon',
|
||||
inspector: CC_EDITOR && 'packages://inspector/inspectors/comps/physics/points-base-collider.js',
|
||||
help: 'i18n:COMPONENT.help_url.edit-collider-component',
|
||||
requireComponent: cc.RigidBody
|
||||
},
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ var DistanceJoint = cc.Class({
|
||||
|
||||
editor: CC_EDITOR && {
|
||||
menu: 'i18n:MAIN_MENU.component.physics/Joint/Distance',
|
||||
help: 'i18n:COMPONENT.help_url.joint-component',
|
||||
inspector: 'packages://inspector/inspectors/comps/physics/joint.js',
|
||||
},
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ var MotorJoint = cc.Class({
|
||||
|
||||
editor: CC_EDITOR && {
|
||||
menu: 'i18n:MAIN_MENU.component.physics/Joint/Motor',
|
||||
help: 'i18n:COMPONENT.help_url.joint-component',
|
||||
inspector: 'packages://inspector/inspectors/comps/physics/joint.js',
|
||||
},
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ var MouseJoint = cc.Class({
|
||||
|
||||
editor: CC_EDITOR && {
|
||||
inspector: 'packages://inspector/inspectors/comps/physics/joint.js',
|
||||
help: 'i18n:COMPONENT.help_url.joint-component',
|
||||
menu: 'i18n:MAIN_MENU.component.physics/Joint/Mouse',
|
||||
},
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ var PrismaticJoint = cc.Class({
|
||||
|
||||
editor: CC_EDITOR && {
|
||||
inspector: 'packages://inspector/inspectors/comps/physics/joint.js',
|
||||
help: 'i18n:COMPONENT.help_url.joint-component',
|
||||
menu: 'i18n:MAIN_MENU.component.physics/Joint/PrismaticJoint',
|
||||
},
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ var RevoluteJoint = cc.Class({
|
||||
|
||||
editor: CC_EDITOR && {
|
||||
menu: 'i18n:MAIN_MENU.component.physics/Joint/Revolute',
|
||||
help: 'i18n:COMPONENT.help_url.joint-component',
|
||||
inspector: 'packages://inspector/inspectors/comps/physics/joint.js',
|
||||
},
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ var RopeJoint = cc.Class({
|
||||
|
||||
editor: CC_EDITOR && {
|
||||
inspector: 'packages://inspector/inspectors/comps/physics/joint.js',
|
||||
help: 'i18n:COMPONENT.help_url.joint-component',
|
||||
menu: 'i18n:MAIN_MENU.component.physics/Joint/Rope',
|
||||
},
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ var WeldJoint = cc.Class({
|
||||
|
||||
editor: CC_EDITOR && {
|
||||
inspector: 'packages://inspector/inspectors/comps/physics/joint.js',
|
||||
help: 'i18n:COMPONENT.help_url.joint-component',
|
||||
menu: 'i18n:MAIN_MENU.component.physics/Joint/Weld',
|
||||
},
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ var WheelJoint = cc.Class({
|
||||
|
||||
editor: CC_EDITOR && {
|
||||
inspector: 'packages://inspector/inspectors/comps/physics/joint.js',
|
||||
help: 'i18n:COMPONENT.help_url.joint-component',
|
||||
menu: 'i18n:MAIN_MENU.component.physics/Joint/Wheel',
|
||||
},
|
||||
|
||||
|
||||
@@ -398,15 +398,15 @@ Object.defineProperty(cc.macro, 'ROTATE_ACTION_CCW', {
|
||||
}
|
||||
});
|
||||
|
||||
let SUPPORT_TEXTURE_FORMATS = ['.pkm', '.pvr', '.webp', '.jpg', '.jpeg', '.bmp', '.png'];
|
||||
let SUPPORT_TEXTURE_FORMATS = ['.astc', '.pkm', '.pvr', '.webp', '.jpg', '.jpeg', '.bmp', '.png'];
|
||||
|
||||
/**
|
||||
* !#en
|
||||
* The image format supported by the engine defaults, and the supported formats may differ in different build platforms and device types.
|
||||
* Currently all platform and device support ['.webp', '.jpg', '.jpeg', '.bmp', '.png'], The iOS mobile platform also supports the PVR format。
|
||||
* Currently all platform and device support ['.astc', '.webp', '.jpg', '.jpeg', '.bmp', '.png'], The iOS mobile platform also supports the PVR format。
|
||||
* !#zh
|
||||
* 引擎默认支持的图片格式,支持的格式可能在不同的构建平台和设备类型上有所差别。
|
||||
* 目前所有平台和设备支持的格式有 ['.webp', '.jpg', '.jpeg', '.bmp', '.png']. 另外 Ios 手机平台还额外支持了 PVR 格式。
|
||||
* 目前所有平台和设备支持的格式有 ['.astc', '.webp', '.jpg', '.jpeg', '.bmp', '.png']. 另外 Ios 手机平台还额外支持了 PVR 格式。
|
||||
* @property {String[]} SUPPORT_TEXTURE_FORMATS
|
||||
*/
|
||||
cc.macro.SUPPORT_TEXTURE_FORMATS = SUPPORT_TEXTURE_FORMATS;
|
||||
|
||||
@@ -187,6 +187,11 @@ function initSys () {
|
||||
*/
|
||||
sys.LANGUAGE_UNKNOWN = "unknown";
|
||||
|
||||
/**
|
||||
* @property {String} OS_OPENHARMONY
|
||||
* @readOnly
|
||||
*/
|
||||
sys.OS_OPENHARMONY = "OpenHarmony";
|
||||
/**
|
||||
* @property {String} OS_IOS
|
||||
* @readOnly
|
||||
@@ -321,6 +326,12 @@ function initSys () {
|
||||
* @default 11
|
||||
*/
|
||||
sys.WP8 = 11;
|
||||
/**
|
||||
* @property {Number} OPENHARMONY
|
||||
* @readOnly
|
||||
* @default 12
|
||||
*/
|
||||
sys.OPENHARMONY = 12;
|
||||
/**
|
||||
* @property {Number} MOBILE_BROWSER
|
||||
* @readOnly
|
||||
@@ -450,6 +461,14 @@ function initSys () {
|
||||
* @default 120
|
||||
*/
|
||||
sys.TAOBAO = 120;
|
||||
|
||||
/**
|
||||
* @property {Number} TAOBAO_MINIGAME
|
||||
* @readOnly
|
||||
* @default 121
|
||||
*/
|
||||
sys.TAOBAO_MINIGAME = 121;
|
||||
|
||||
/**
|
||||
* BROWSER_TYPE_WECHAT
|
||||
* @property {String} BROWSER_TYPE_WECHAT
|
||||
@@ -720,6 +739,7 @@ function initSys () {
|
||||
platform === sys.TIZEN ||
|
||||
platform === sys.BLACKBERRY ||
|
||||
platform === sys.XIAOMI_GAME ||
|
||||
platform === sys.OPENHARMONY ||
|
||||
isVivoGame ||
|
||||
isOppoGame ||
|
||||
isHuaweiGame ||
|
||||
@@ -1008,7 +1028,9 @@ function initSys () {
|
||||
imageBitmap.close && imageBitmap.close();
|
||||
}).catch(err => {});
|
||||
}
|
||||
if (docEle['ontouchstart'] !== undefined || doc['ontouchstart'] !== undefined || nav.msPointerEnabled)
|
||||
// NOTE: '__wxjs_environment' is defined in wechat miniprogram webview environment
|
||||
// developpers would embed builded web project in a webview component on wechat miniprogram, so that we need to handle this situation.
|
||||
if (docEle['ontouchstart'] !== undefined || doc['ontouchstart'] !== undefined || nav.msPointerEnabled || (typeof __wxjs_environment === 'string' && __wxjs_environment === 'miniprogram'))
|
||||
capabilities["touches"] = true;
|
||||
if (docEle['onmouseup'] !== undefined)
|
||||
capabilities["mouse"] = true;
|
||||
|
||||
@@ -1059,7 +1059,11 @@ cc.ContainerStrategy = cc.Class({
|
||||
var devicePixelRatio = view._devicePixelRatio = 1;
|
||||
if(CC_JSB){
|
||||
// view.isRetinaEnabled only work on web.
|
||||
if(globalThis.oh) {
|
||||
devicePixelRatio = view._devicePixelRatio = globalThis.oh.devicePixelRatio;
|
||||
} else {
|
||||
devicePixelRatio = view._devicePixelRatio = window.devicePixelRatio;
|
||||
}
|
||||
}else if (view.isRetinaEnabled()) {
|
||||
devicePixelRatio = view._devicePixelRatio = Math.min(view._maxPixelRatio, window.devicePixelRatio || 1);
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ export default class NativeTTF {
|
||||
this._cfg = new DataView(this._layout._cfg);
|
||||
this._layoutInfo = new DataView(this._layout._layout);
|
||||
|
||||
this._cfgFields = jsb.LabelRenderer._cfgFields;
|
||||
this._layoutFields = jsb.LabelRenderer._layoutFields;
|
||||
this._cfgFields = "string" == typeof jsb.LabelRenderer._cfgFields ? JSON.parse(jsb.LabelRenderer._cfgFields) : jsb.LabelRenderer._cfgFields;
|
||||
this._layoutFields = "string" == typeof jsb.LabelRenderer._layoutFields ? JSON.parse(jsb.LabelRenderer._layoutFields) : jsb.LabelRenderer._layoutFields;
|
||||
this._layout.bindNodeProxy(comp.node._proxy);
|
||||
this._bindMaterial(comp);
|
||||
}
|
||||
|
||||
@@ -735,6 +735,7 @@ var ParticleSystem = cc.Class({
|
||||
editor: CC_EDITOR && {
|
||||
menu: 'i18n:MAIN_MENU.component.renderers/ParticleSystem',
|
||||
inspector: 'packages://inspector/inspectors/comps/particle-system.js',
|
||||
help: 'i18n:COMPONENT.help_url.particle-system',
|
||||
playOnFocus: true,
|
||||
executeInEditMode: true
|
||||
},
|
||||
|
||||
@@ -244,6 +244,38 @@ export enum GFXFormat {
|
||||
PVRTC_RGBA4,
|
||||
PVRTC2_2BPP,
|
||||
PVRTC2_4BPP,
|
||||
|
||||
// ASTC (Adaptive Scalable Texture Compression)
|
||||
ASTC_RGBA_4x4,
|
||||
ASTC_RGBA_5x4,
|
||||
ASTC_RGBA_5x5,
|
||||
ASTC_RGBA_6x5,
|
||||
ASTC_RGBA_6x6,
|
||||
ASTC_RGBA_8x5,
|
||||
ASTC_RGBA_8x6,
|
||||
ASTC_RGBA_8x8,
|
||||
ASTC_RGBA_10x5,
|
||||
ASTC_RGBA_10x6,
|
||||
ASTC_RGBA_10x8,
|
||||
ASTC_RGBA_10x10,
|
||||
ASTC_RGBA_12x10,
|
||||
ASTC_RGBA_12x12,
|
||||
|
||||
// ASTC (Adaptive Scalable Texture Compression) SRGB
|
||||
ASTC_SRGBA_4x4,
|
||||
ASTC_SRGBA_5x4,
|
||||
ASTC_SRGBA_5x5,
|
||||
ASTC_SRGBA_6x5,
|
||||
ASTC_SRGBA_6x6,
|
||||
ASTC_SRGBA_8x5,
|
||||
ASTC_SRGBA_8x6,
|
||||
ASTC_SRGBA_8x8,
|
||||
ASTC_SRGBA_10x5,
|
||||
ASTC_SRGBA_10x6,
|
||||
ASTC_SRGBA_10x8,
|
||||
ASTC_SRGBA_10x10,
|
||||
ASTC_SRGBA_12x10,
|
||||
ASTC_SRGBA_12x12,
|
||||
}
|
||||
|
||||
export enum GFXBufferUsageBit {
|
||||
@@ -692,6 +724,36 @@ export const GFXFormatInfos: IGFXFormatInfo[] = [
|
||||
{ name: 'PVRTC_RGBA4', size: 2, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'PVRTC2_2BPP', size: 2, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'PVRTC2_4BPP', size: 2, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
|
||||
{ name: 'ASTC_RGBA_4x4', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_RGBA_5x4', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_RGBA_5x5', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_RGBA_6x5', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_RGBA_6x6', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_RGBA_8x5', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_RGBA_8x6', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_RGBA_8x8', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_RGBA_10x5', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_RGBA_10x6', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_RGBA_10x8', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_RGBA_10x10', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_RGBA_12x10', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_RGBA_12x12', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
|
||||
{ name: 'ASTC_SRGBA_4x4', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_SRGBA_5x4', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_SRGBA_5x5', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_SRGBA_6x5', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_SRGBA_6x6', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_SRGBA_8x5', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_SRGBA_8x6', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_SRGBA_8x8', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_SRGBA_10x5', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_SRGBA_10x6', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_SRGBA_10x8', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_SRGBA_10x10', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_SRGBA_12x10', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
{ name: 'ASTC_SRGBA_12x12', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
|
||||
];
|
||||
// tslint:enable: max-line-length
|
||||
|
||||
@@ -742,6 +804,49 @@ export function GFXFormatSize (format: GFXFormat, width: number, height: number,
|
||||
case GFXFormat.PVRTC2_4BPP:
|
||||
return Math.ceil(Math.max(width, 16) * Math.max(height, 8) / 2) * depth;
|
||||
|
||||
case GFXFormat.ASTC_RGBA_4x4:
|
||||
case GFXFormat.ASTC_SRGBA_4x4:
|
||||
return Math.ceil(width / 4) * Math.ceil(height / 4) * 16 * depth;
|
||||
case GFXFormat.ASTC_RGBA_5x4:
|
||||
case GFXFormat.ASTC_SRGBA_5x4:
|
||||
return Math.ceil(width / 5) * Math.ceil(height / 4) * 16 * depth;
|
||||
case GFXFormat.ASTC_RGBA_5x5:
|
||||
case GFXFormat.ASTC_SRGBA_5x5:
|
||||
return Math.ceil(width / 5) * Math.ceil(height / 5) * 16 * depth;
|
||||
case GFXFormat.ASTC_RGBA_6x5:
|
||||
case GFXFormat.ASTC_SRGBA_6x5:
|
||||
return Math.ceil(width / 6) * Math.ceil(height / 5) * 16 * depth;
|
||||
case GFXFormat.ASTC_RGBA_6x6:
|
||||
case GFXFormat.ASTC_SRGBA_6x6:
|
||||
return Math.ceil(width / 6) * Math.ceil(height / 6) * 16 * depth;
|
||||
case GFXFormat.ASTC_RGBA_8x5:
|
||||
case GFXFormat.ASTC_SRGBA_8x5:
|
||||
return Math.ceil(width / 8) * Math.ceil(height / 5) * 16 * depth;
|
||||
case GFXFormat.ASTC_RGBA_8x6:
|
||||
case GFXFormat.ASTC_SRGBA_8x6:
|
||||
return Math.ceil(width / 8) * Math.ceil(height / 6) * 16 * depth;
|
||||
case GFXFormat.ASTC_RGBA_8x8:
|
||||
case GFXFormat.ASTC_SRGBA_8x8:
|
||||
return Math.ceil(width / 8) * Math.ceil(height / 8) * 16 * depth;
|
||||
case GFXFormat.ASTC_RGBA_10x5:
|
||||
case GFXFormat.ASTC_SRGBA_10x5:
|
||||
return Math.ceil(width / 10) * Math.ceil(height / 5) * 16 * depth;
|
||||
case GFXFormat.ASTC_RGBA_10x6:
|
||||
case GFXFormat.ASTC_SRGBA_10x6:
|
||||
return Math.ceil(width / 10) * Math.ceil(height / 6) * 16 * depth;
|
||||
case GFXFormat.ASTC_RGBA_10x8:
|
||||
case GFXFormat.ASTC_SRGBA_10x8:
|
||||
return Math.ceil(width / 10) * Math.ceil(height / 8) * 16 * depth;
|
||||
case GFXFormat.ASTC_RGBA_10x10:
|
||||
case GFXFormat.ASTC_SRGBA_10x10:
|
||||
return Math.ceil(width / 10) * Math.ceil(height / 10) * 16 * depth;
|
||||
case GFXFormat.ASTC_RGBA_12x10:
|
||||
case GFXFormat.ASTC_SRGBA_12x10:
|
||||
return Math.ceil(width / 12) * Math.ceil(height / 10) * 16 * depth;
|
||||
case GFXFormat.ASTC_RGBA_12x12:
|
||||
case GFXFormat.ASTC_SRGBA_12x12:
|
||||
return Math.ceil(width / 12) * Math.ceil(height / 12) * 16 * depth;
|
||||
|
||||
default: {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -91,6 +91,38 @@ const enums = {
|
||||
TEXTURE_FMT_RGB_ETC2: 28,
|
||||
TEXTURE_FMT_RGBA_ETC2: 29,
|
||||
|
||||
// astc format (Adaptive Scalable Texture Compression)
|
||||
TEXTURE_FMT_RGBA_ASTC_4X4: 30,
|
||||
TEXTURE_FMT_RGBA_ASTC_5X4: 31,
|
||||
TEXTURE_FMT_RGBA_ASTC_5X5: 32,
|
||||
TEXTURE_FMT_RGBA_ASTC_6X5: 33,
|
||||
TEXTURE_FMT_RGBA_ASTC_6X6: 34,
|
||||
TEXTURE_FMT_RGBA_ASTC_8X5: 35,
|
||||
TEXTURE_FMT_RGBA_ASTC_8X6: 36,
|
||||
TEXTURE_FMT_RGBA_ASTC_8X8: 37,
|
||||
TEXTURE_FMT_RGBA_ASTC_10X5: 38,
|
||||
TEXTURE_FMT_RGBA_ASTC_10X6: 39,
|
||||
TEXTURE_FMT_RGBA_ASTC_10X8: 40,
|
||||
TEXTURE_FMT_RGBA_ASTC_10X10: 41,
|
||||
TEXTURE_FMT_RGBA_ASTC_12X10: 42,
|
||||
TEXTURE_FMT_RGBA_ASTC_12X12: 43,
|
||||
|
||||
// astc format (Adaptive Scalable Texture Compression) SRGB
|
||||
TEXTURE_FMT_SRGBA_ASTC_4X4: 44,
|
||||
TEXTURE_FMT_SRGBA_ASTC_5X4: 45,
|
||||
TEXTURE_FMT_SRGBA_ASTC_5X5: 46,
|
||||
TEXTURE_FMT_SRGBA_ASTC_6X5: 47,
|
||||
TEXTURE_FMT_SRGBA_ASTC_6X6: 48,
|
||||
TEXTURE_FMT_SRGBA_ASTC_8X5: 49,
|
||||
TEXTURE_FMT_SRGBA_ASTC_8X6: 50,
|
||||
TEXTURE_FMT_SRGBA_ASTC_8X8: 51,
|
||||
TEXTURE_FMT_SRGBA_ASTC_10X5: 52,
|
||||
TEXTURE_FMT_SRGBA_ASTC_10X6: 53,
|
||||
TEXTURE_FMT_SRGBA_ASTC_10X8: 54,
|
||||
TEXTURE_FMT_SRGBA_ASTC_10X10: 55,
|
||||
TEXTURE_FMT_SRGBA_ASTC_12X10: 56,
|
||||
TEXTURE_FMT_SRGBA_ASTC_12X12: 57,
|
||||
|
||||
// depth and stencil function
|
||||
DS_FUNC_NEVER: 512, // gl.NEVER
|
||||
DS_FUNC_LESS: 513, // gl.LESS
|
||||
@@ -449,6 +481,38 @@ var GFXFormat;
|
||||
GFXFormat[GFXFormat["PVRTC_RGBA4"] = 89] = "PVRTC_RGBA4";
|
||||
GFXFormat[GFXFormat["PVRTC2_2BPP"] = 90] = "PVRTC2_2BPP";
|
||||
GFXFormat[GFXFormat["PVRTC2_4BPP"] = 91] = "PVRTC2_4BPP";
|
||||
|
||||
// ASTC (Adaptive Scalable Texture Compression)
|
||||
GFXFormat[GFXFormat["ASTC_RGBA_4x4"] = 92] = "ASTC_RGBA_4x4";
|
||||
GFXFormat[GFXFormat["ASTC_RGBA_5x4"] = 92] = "ASTC_RGBA_5x4";
|
||||
GFXFormat[GFXFormat["ASTC_RGBA_5x5"] = 92] = "ASTC_RGBA_5x5";
|
||||
GFXFormat[GFXFormat["ASTC_RGBA_6x5"] = 92] = "ASTC_RGBA_6x5";
|
||||
GFXFormat[GFXFormat["ASTC_RGBA_6x6"] = 92] = "ASTC_RGBA_6x6";
|
||||
GFXFormat[GFXFormat["ASTC_RGBA_8x5"] = 92] = "ASTC_RGBA_8x5";
|
||||
GFXFormat[GFXFormat["ASTC_RGBA_8x6"] = 92] = "ASTC_RGBA_8x6";
|
||||
GFXFormat[GFXFormat["ASTC_RGBA_8x8"] = 92] = "ASTC_RGBA_8x8";
|
||||
GFXFormat[GFXFormat["ASTC_RGBA_10x5"] = 92] = "ASTC_RGBA_10x5";
|
||||
GFXFormat[GFXFormat["ASTC_RGBA_10x6"] = 92] = "ASTC_RGBA_10x6";
|
||||
GFXFormat[GFXFormat["ASTC_RGBA_10x8"] = 92] = "ASTC_RGBA_10x8";
|
||||
GFXFormat[GFXFormat["ASTC_RGBA_10x10"] = 92] = "ASTC_RGBA_10x10";
|
||||
GFXFormat[GFXFormat["ASTC_RGBA_12x10"] = 92] = "ASTC_RGBA_12x10";
|
||||
GFXFormat[GFXFormat["ASTC_RGBA_12x12"] = 92] = "ASTC_RGBA_12x12";
|
||||
|
||||
// ASTC (Adaptive Scalable Texture Compression) SRGB
|
||||
GFXFormat[GFXFormat["ASTC_SRGBA_4x4"] = 92] = "ASTC_SRGBA_4x4";
|
||||
GFXFormat[GFXFormat["ASTC_SRGBA_5x4"] = 92] = "ASTC_SRGBA_5x4";
|
||||
GFXFormat[GFXFormat["ASTC_SRGBA_5x5"] = 92] = "ASTC_SRGBA_5x5";
|
||||
GFXFormat[GFXFormat["ASTC_SRGBA_6x5"] = 92] = "ASTC_SRGBA_6x5";
|
||||
GFXFormat[GFXFormat["ASTC_SRGBA_6x6"] = 92] = "ASTC_SRGBA_6x6";
|
||||
GFXFormat[GFXFormat["ASTC_SRGBA_8x5"] = 92] = "ASTC_SRGBA_8x5";
|
||||
GFXFormat[GFXFormat["ASTC_SRGBA_8x6"] = 92] = "ASTC_SRGBA_8x6";
|
||||
GFXFormat[GFXFormat["ASTC_SRGBA_8x8"] = 92] = "ASTC_SRGBA_8x8";
|
||||
GFXFormat[GFXFormat["ASTC_SRGBA_10x5"] = 92] = "ASTC_SRGBA_10x5";
|
||||
GFXFormat[GFXFormat["ASTC_SRGBA_10x6"] = 92] = "ASTC_SRGBA_10x6";
|
||||
GFXFormat[GFXFormat["ASTC_SRGBA_10x8"] = 92] = "ASTC_SRGBA_10x8";
|
||||
GFXFormat[GFXFormat["ASTC_SRGBA_10x10"] = 92] = "ASTC_SRGBA_10x10";
|
||||
GFXFormat[GFXFormat["ASTC_SRGBA_12x10"] = 92] = "ASTC_SRGBA_12x10";
|
||||
GFXFormat[GFXFormat["ASTC_SRGBA_12x12"] = 92] = "ASTC_SRGBA_12x12";
|
||||
})(GFXFormat || (GFXFormat = {}));
|
||||
var GFXBufferUsageBit;
|
||||
(function (GFXBufferUsageBit) {
|
||||
|
||||
@@ -637,7 +637,7 @@ export default class Device {
|
||||
'OES_texture_half_float',
|
||||
'OES_texture_half_float_linear',
|
||||
'OES_vertex_array_object',
|
||||
'WEBGL_compressed_texture_atc',
|
||||
'WEBGL_compressed_texture_astc',
|
||||
'WEBGL_compressed_texture_etc',
|
||||
'WEBGL_compressed_texture_etc1',
|
||||
'WEBGL_compressed_texture_pvrtc',
|
||||
|
||||
@@ -39,6 +39,36 @@ const GL_COMPRESSED_RGB_ETC1_WEBGL = 0x8D64; // ext.COMPRESSED_RGB_ETC1_WEBGL
|
||||
const GL_COMPRESSED_RGB8_ETC2 = 0x9274; // ext.COMPRESSED_RGB8_ETC2
|
||||
const GL_COMPRESSED_RGBA8_ETC2_EAC = 0x9278; // ext.COMPRESSED_RGBA8_ETC2_EAC
|
||||
|
||||
const GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0;
|
||||
const GL_COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1;
|
||||
const GL_COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2;
|
||||
const GL_COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3;
|
||||
const GL_COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4;
|
||||
const GL_COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5;
|
||||
const GL_COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6;
|
||||
const GL_COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7;
|
||||
const GL_COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8;
|
||||
const GL_COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9;
|
||||
const GL_COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA;
|
||||
const GL_COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB;
|
||||
const GL_COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC;
|
||||
const GL_COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD;
|
||||
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD;
|
||||
|
||||
const _filterGL = [
|
||||
[ GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR ],
|
||||
[ GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_LINEAR ],
|
||||
@@ -134,6 +164,91 @@ const _textureFmtGL = [
|
||||
|
||||
// TEXTURE_FMT_RGBA_ETC2: 29
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA8_ETC2_EAC, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_4X4: 30
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_4x4_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_5X4: 31
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_5x4_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_5X5: 32
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_5x5_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_6X5: 33
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_6x5_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_6X6: 34
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_6x6_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_8X5: 35
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_8x5_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_8X6: 36
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_8x6_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_8X8: 37
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_8x8_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_10X5: 38
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_10x5_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_10X6: 39
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_10x6_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_10X8: 40
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_10x8_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_10X10: 41
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_10x10_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_12X10: 42
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_12x10_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_12X12: 43
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_12x12_KHR, pixelType: null },
|
||||
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_4X4: 44
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_5X4: 45
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_5X5: 46
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_6X5: 47
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_6X6: 48
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_8X5: 49
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_8X6: 50
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_8X8: 51
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_10X5: 52
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_10X6: 53
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_10X8: 54
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_10X10: 55
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_12X10: 56
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_12X12: 57
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, pixelType: null },
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -238,6 +353,38 @@ export const enums = {
|
||||
TEXTURE_FMT_RGB_ETC2: 28,
|
||||
TEXTURE_FMT_RGBA_ETC2: 29,
|
||||
|
||||
// astc format (Adaptive Scalable Texture Compression)
|
||||
TEXTURE_FMT_RGBA_ASTC_4X4: 30,
|
||||
TEXTURE_FMT_RGBA_ASTC_5X4: 31,
|
||||
TEXTURE_FMT_RGBA_ASTC_5X5: 32,
|
||||
TEXTURE_FMT_RGBA_ASTC_6X5: 33,
|
||||
TEXTURE_FMT_RGBA_ASTC_6X6: 34,
|
||||
TEXTURE_FMT_RGBA_ASTC_8X5: 35,
|
||||
TEXTURE_FMT_RGBA_ASTC_8X6: 36,
|
||||
TEXTURE_FMT_RGBA_ASTC_8X8: 37,
|
||||
TEXTURE_FMT_RGBA_ASTC_10X5: 38,
|
||||
TEXTURE_FMT_RGBA_ASTC_10X6: 39,
|
||||
TEXTURE_FMT_RGBA_ASTC_10X8: 40,
|
||||
TEXTURE_FMT_RGBA_ASTC_10X10: 41,
|
||||
TEXTURE_FMT_RGBA_ASTC_12X10: 42,
|
||||
TEXTURE_FMT_RGBA_ASTC_12X12: 43,
|
||||
|
||||
// astc format (Adaptive Scalable Texture Compression) SRGB
|
||||
TEXTURE_FMT_SRGBA_ASTC_4X4: 44,
|
||||
TEXTURE_FMT_SRGBA_ASTC_5X4: 45,
|
||||
TEXTURE_FMT_SRGBA_ASTC_5X5: 46,
|
||||
TEXTURE_FMT_SRGBA_ASTC_6X5: 47,
|
||||
TEXTURE_FMT_SRGBA_ASTC_6X6: 48,
|
||||
TEXTURE_FMT_SRGBA_ASTC_8X5: 49,
|
||||
TEXTURE_FMT_SRGBA_ASTC_8X6: 50,
|
||||
TEXTURE_FMT_SRGBA_ASTC_8X8: 51,
|
||||
TEXTURE_FMT_SRGBA_ASTC_10X5: 52,
|
||||
TEXTURE_FMT_SRGBA_ASTC_10X6: 53,
|
||||
TEXTURE_FMT_SRGBA_ASTC_10X8: 54,
|
||||
TEXTURE_FMT_SRGBA_ASTC_10X10: 55,
|
||||
TEXTURE_FMT_SRGBA_ASTC_12X10: 56,
|
||||
TEXTURE_FMT_SRGBA_ASTC_12X12: 57,
|
||||
|
||||
// depth and stencil function
|
||||
DS_FUNC_NEVER: 512, // gl.NEVER
|
||||
DS_FUNC_LESS: 513, // gl.LESS
|
||||
|
||||
@@ -65,8 +65,8 @@ export default class Texture2D extends Texture {
|
||||
this._format = options.format;
|
||||
this._compressed =
|
||||
(this._format >= enums.TEXTURE_FMT_RGB_DXT1 && this._format <= enums.TEXTURE_FMT_RGBA_PVRTC_4BPPV1) ||
|
||||
(this._format >= enums.TEXTURE_FMT_RGB_ETC2 && this._format <= enums.TEXTURE_FMT_RGBA_ETC2)
|
||||
;
|
||||
(this._format >= enums.TEXTURE_FMT_RGB_ETC2 && this._format <= enums.TEXTURE_FMT_RGBA_ETC2) ||
|
||||
(this._format >= enums.TEXTURE_FMT_RGBA_ASTC_4X4 && this._format <= enums.TEXTURE_FMT_SRGBA_ASTC_12X12);
|
||||
}
|
||||
|
||||
// check if generate mipmap
|
||||
|
||||
@@ -85,7 +85,8 @@ export default class TextureCube extends Texture {
|
||||
this._format = options.format;
|
||||
this._compressed =
|
||||
(this._format >= enums.TEXTURE_FMT_RGB_DXT1 && this._format <= enums.TEXTURE_FMT_RGBA_PVRTC_4BPPV1) ||
|
||||
(this._format >= enums.TEXTURE_FMT_RGB_ETC2 && this._format <= enums.TEXTURE_FMT_RGBA_ETC2)
|
||||
(this._format >= enums.TEXTURE_FMT_RGB_ETC2 && this._format <= enums.TEXTURE_FMT_RGBA_ETC2) ||
|
||||
(this._format >= enums.TEXTURE_FMT_RGBA_ASTC_4X4 && this._format <= enums.TEXTURE_FMT_SRGBA_ASTC_12X12)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ let TiledLayer = cc.Class({
|
||||
* !#en enable or disable culling
|
||||
* !#zh 开启或关闭裁剪。
|
||||
* @method enableCulling
|
||||
* @param value
|
||||
* @param {boolean} value
|
||||
*/
|
||||
enableCulling (value) {
|
||||
if (this._enableCulling != value) {
|
||||
|
||||
@@ -296,6 +296,7 @@ let TiledMap = cc.Class({
|
||||
editor: CC_EDITOR && {
|
||||
executeInEditMode: true,
|
||||
menu: 'i18n:MAIN_MENU.component.renderers/TiledMap',
|
||||
help: 'i18n:COMPONENT.help_url.tiledmap'
|
||||
},
|
||||
|
||||
ctor () {
|
||||
@@ -432,7 +433,7 @@ let TiledMap = cc.Class({
|
||||
* !#en enable or disable culling
|
||||
* !#zh 开启或关闭裁剪。
|
||||
* @method enableCulling
|
||||
* @param value
|
||||
* @param {boolean} value
|
||||
*/
|
||||
enableCulling (value) {
|
||||
let layers = this._layers;
|
||||
|
||||
@@ -40,6 +40,7 @@ let TiledTile = cc.Class({
|
||||
editor: CC_EDITOR && {
|
||||
executeInEditMode: true,
|
||||
menu: 'i18n:MAIN_MENU.component.renderers/TiledTile',
|
||||
help: 'i18n:COMPONENT.help_url.tiledtile',
|
||||
},
|
||||
|
||||
ctor () {
|
||||
|
||||
@@ -116,9 +116,9 @@ let VideoPlayerImpl = cc.Class({
|
||||
video.addEventListener("click", cbs.click);
|
||||
|
||||
function onCanPlay () {
|
||||
if (self._loaded || self._playing)
|
||||
return;
|
||||
let video = self._video;
|
||||
if (self._loaded || !video) return;
|
||||
|
||||
if (video.readyState === READY_STATE.HAVE_ENOUGH_DATA ||
|
||||
video.readyState === READY_STATE.HAVE_METADATA) {
|
||||
video.currentTime = 0;
|
||||
|
||||
@@ -67,6 +67,7 @@ let WebView = cc.Class({
|
||||
|
||||
editor: CC_EDITOR && {
|
||||
menu: 'i18n:MAIN_MENU.component.ui/WebView',
|
||||
help: 'i18n:COMPONENT.help_url.webview',
|
||||
executeInEditMode: true
|
||||
},
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ module.exports = {
|
||||
"scrollbar": "https://docs.cocos.com/creator/2.4/manual/en/components/scrollbar.html",
|
||||
"layout": "https://docs.cocos.com/creator/2.4/manual/en/components/layout.html",
|
||||
"tiledmap": "https://docs.cocos.com/creator/2.4/manual/en/components/tiledmap.html",
|
||||
"tiledtile": "https://docs.cocos.com/creator/2.4/manual/en/components/tiledtile.html",
|
||||
"editbox": "https://docs.cocos.com/creator/2.4/manual/en/components/editbox.html",
|
||||
"videoplayer": "https://docs.cocos.com/creator/2.4/manual/en/components/videoplayer.html",
|
||||
"motionStreak": "https://docs.cocos.com/creator/2.4/manual/en/components/motion-streak.html",
|
||||
@@ -27,7 +28,24 @@ module.exports = {
|
||||
"slider": "https://docs.cocos.com/creator/2.4/manual/en/components/slider.html",
|
||||
"block_input_events": "https://docs.cocos.com/creator/2.4/manual/en/components/block-input-events.html",
|
||||
"subcontext_view": "https://docs.cocos.com/creator/2.4/manual/en/publish/publish-wechatgame-sub-domain.html",
|
||||
"safe_area": "https://docs.cocos.com/creator/2.4/manual/en/components/safearea.html"
|
||||
"safe_area": "https://docs.cocos.com/creator/2.4/manual/en/components/safearea.html",
|
||||
"dragonbones": "https://docs.cocos.com/creator/2.4/manual/en/components/dragonbones.html",
|
||||
"graphics": "https://docs.cocos.com/creator/2.4/manual/en/components/graphics.html",
|
||||
"light": "https://docs.cocos.com/creator/2.4/manual/en/3d/lighting.html",
|
||||
"particle-system": "https://docs.cocos.com/creator/2.4/manual/en/components/particle-system.html",
|
||||
"particle-system-3d": "https://docs.cocos.com/creator/2.4/manual/en/3d/particle-system-3d.html",
|
||||
"skeleton-animation": "https://docs.cocos.com/creator/2.4/manual/en/3d/skeleton-animation.html",
|
||||
"mesh-renderer": "https://docs.cocos.com/creator/2.4/manual/en/3d/mesh-renderer.html",
|
||||
"skinned-mesh-renderer": "https://docs.cocos.com/creator/2.4/manual/en/3d/skinned-mesh-renderer.html",
|
||||
"webview": "https://docs.cocos.com/creator/2.4/manual/en/components/webview.html",
|
||||
"collider": "https://docs.cocos.com/creator/2.4/manual/en/components/collider.html",
|
||||
"camera": "https://docs.cocos.com/creator/2.4/manual/en/render/camera.html",
|
||||
"edit-collider-component": "https://docs.cocos.com/creator/2.4/manual/en/physics/collision/edit-collider-component.html",
|
||||
"joint-component": "https://docs.cocos.com/creator/2.4/manual/en/physics/physics/joint-component.html",
|
||||
"rigidbody": "https://docs.cocos.com/creator/2.4/manual/en/physics/physics/rigid-body.html",
|
||||
"physics-rigidbody": "https://docs.cocos.com/creator/2.4/manual/en/physics-3d/physics-rigidbody.html",
|
||||
"constantforce": "https://docs.cocos.com/creator/2.4/manual/en/physics-3d/physics-constant-force.html",
|
||||
"physics-collider": "https://docs.cocos.com/creator/2.4/manual/en/physics-3d/physics-collider.html",
|
||||
},
|
||||
"animation": {
|
||||
"default_clip": "When checking, the deault animation clip is automatically played.",
|
||||
|
||||
@@ -15,6 +15,7 @@ module.exports = {
|
||||
"scrollbar": "https://docs.cocos.com/creator/2.4/manual/zh/components/scrollbar.html",
|
||||
"layout": "https://docs.cocos.com/creator/2.4/manual/zh/components/layout.html",
|
||||
"tiledmap": "https://docs.cocos.com/creator/2.4/manual/zh/components/tiledmap.html",
|
||||
"tiledtile": "https://docs.cocos.com/creator/2.4/manual/zh/components/tiledtile.html",
|
||||
"editbox": "https://docs.cocos.com/creator/2.4/manual/zh/components/editbox.html",
|
||||
"videoplayer": "https://docs.cocos.com/creator/2.4/manual/zh/components/videoplayer.html",
|
||||
"motionStreak": "https://docs.cocos.com/creator/2.4/manual/zh/components/motion-streak.html",
|
||||
@@ -28,6 +29,23 @@ module.exports = {
|
||||
"block_input_events": "https://docs.cocos.com/creator/2.4/manual/zh/components/block-input-events.html",
|
||||
"subcontext_view": "https://docs.cocos.com/creator/2.4/manual/zh/publish/publish-wechatgame-sub-domain.html",
|
||||
"safe_area": "https://docs.cocos.com/creator/2.4/manual/zh/components/safearea.html",
|
||||
"dragonbones": "https://docs.cocos.com/creator/2.4/manual/zh/components/dragonbones.html",
|
||||
"graphics": "https://docs.cocos.com/creator/2.4/manual/zh/components/graphics.html",
|
||||
"light": "https://docs.cocos.com/creator/2.4/manual/zh/3d/lighting.html",
|
||||
"particle-system": "https://docs.cocos.com/creator/2.4/manual/zh/components/particle-system.html",
|
||||
"particle-system-3d": "https://docs.cocos.com/creator/2.4/manual/zh/3d/particle-system-3d.html",
|
||||
"skeleton-animation": "https://docs.cocos.com/creator/2.4/manual/zh/3d/skeleton-animation.html",
|
||||
"mesh-renderer": "https://docs.cocos.com/creator/2.4/manual/zh/3d/mesh-renderer.html",
|
||||
"skinned-mesh-renderer": "https://docs.cocos.com/creator/2.4/manual/zh/3d/skinned-mesh-renderer.html",
|
||||
"webview": "https://docs.cocos.com/creator/2.4/manual/zh/components/webview.html",
|
||||
"collider": "https://docs.cocos.com/creator/2.4/manual/zh/components/collider.html",
|
||||
"camera": "https://docs.cocos.com/creator/2.4/manual/zh/render/camera.html",
|
||||
"edit-collider-component": "https://docs.cocos.com/creator/2.4/manual/zh/physics/collision/edit-collider-component.html",
|
||||
"joint-component": "https://docs.cocos.com/creator/2.4/manual/zh/physics/physics/joint-component.html",
|
||||
"rigidbody": "https://docs.cocos.com/creator/2.4/manual/zh/physics/physics/rigid-body.html",
|
||||
"physics-rigidbody": "https://docs.cocos.com/creator/2.4/manual/zh/physics-3d/physics-rigidbody.html",
|
||||
"constantforce": "https://docs.cocos.com/creator/2.4/manual/zh/physics-3d/physics-constant-force.html",
|
||||
"physics-collider": "https://docs.cocos.com/creator/2.4/manual/zh/physics-3d/physics-collider.html",
|
||||
},
|
||||
'animation': {
|
||||
'default_clip': '在勾选自动播放或调用 play() 时默认播放的动画 clip。',
|
||||
|
||||
80
engine/extensions/cocostudio/editor/studio-component.js
Normal file
80
engine/extensions/cocostudio/editor/studio-component.js
Normal file
@@ -0,0 +1,80 @@
|
||||
Vue.component('cc-studio-component', {
|
||||
template: `
|
||||
<ui-prop v-prop="target.type"></ui-prop>
|
||||
|
||||
<div v-show="_isCheckbox()">
|
||||
<ui-prop v-prop="target.checkNormalBackFrame"></ui-prop>
|
||||
<ui-prop v-prop="target.checkPressedBackFrame"></ui-prop>
|
||||
<ui-prop v-prop="target.checkDisableBackFrame"></ui-prop>
|
||||
<ui-prop v-prop="target.checkNormalFrame"></ui-prop>
|
||||
<ui-prop v-prop="target.checkDisableFrame"></ui-prop>
|
||||
<ui-prop v-prop="target.checkInteractable"></ui-prop>
|
||||
<ui-prop v-prop="target.isChecked"></ui-prop>
|
||||
</div>
|
||||
|
||||
<div v-show="_isTextAtlas()">
|
||||
<ui-prop v-prop="target.atlasFrame"></ui-prop>
|
||||
<ui-prop v-prop="target.firstChar"></ui-prop>
|
||||
<ui-prop v-prop="target.charWidth"></ui-prop>
|
||||
<ui-prop v-prop="target.charHeight"></ui-prop>
|
||||
<ui-prop v-prop="target.string"></ui-prop>
|
||||
</div>
|
||||
|
||||
<div v-show="_isSliderBar()">
|
||||
<ui-prop v-prop="target.sliderBackFrame"></ui-prop>
|
||||
<ui-prop v-prop="target.sliderBarFrame"></ui-prop>
|
||||
<ui-prop v-prop="target.sliderBtnNormalFrame"></ui-prop>
|
||||
<ui-prop v-prop="target.sliderBtnPressedFrame"></ui-prop>
|
||||
<ui-prop v-prop="target.sliderBtnDisabledFrame"></ui-prop>
|
||||
<ui-prop v-prop="target.sliderInteractable"></ui-prop>
|
||||
<ui-prop v-prop="target.sliderProgress"></ui-prop>
|
||||
</div>
|
||||
|
||||
<div v-show="_isListView()">
|
||||
<ui-prop v-prop="target.listInertia"></ui-prop>
|
||||
<ui-prop v-prop="target.listDirection"></ui-prop>
|
||||
<ui-prop v-prop="target.listVerticalAlign" v-show="_isHList()"></ui-prop>
|
||||
<ui-prop v-prop="target.listHorizontalAlign" v-show="_isVList()"></ui-prop>
|
||||
<ui-prop v-prop="target.listPadding"></ui-prop>
|
||||
</div>
|
||||
`,
|
||||
|
||||
props: {
|
||||
target: {
|
||||
twoWay: true,
|
||||
type: Object,
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
_isCheckbox() {
|
||||
let type = this.target.type.value;
|
||||
return type === cc.StudioComponent.ComponentType.CHECKBOX;
|
||||
},
|
||||
|
||||
_isTextAtlas() {
|
||||
let type = this.target.type.value;
|
||||
return type === cc.StudioComponent.ComponentType.TEXT_ATLAS;
|
||||
},
|
||||
|
||||
_isSliderBar() {
|
||||
let type = this.target.type.value;
|
||||
return type === cc.StudioComponent.ComponentType.SLIDER_BAR;
|
||||
},
|
||||
|
||||
_isListView() {
|
||||
let type = this.target.type.value;
|
||||
return type === cc.StudioComponent.ComponentType.LIST_VIEW;
|
||||
},
|
||||
|
||||
_isHList() {
|
||||
let dir = this.target.listDirection.value;
|
||||
return dir === cc.StudioComponent.ListDirection.HORIZONTAL;
|
||||
},
|
||||
|
||||
_isVList() {
|
||||
let dir = this.target.listDirection.value;
|
||||
return dir === cc.StudioComponent.ListDirection.VERTICAL;
|
||||
},
|
||||
}
|
||||
});
|
||||
@@ -96,6 +96,7 @@ let ArmatureDisplay = cc.Class({
|
||||
editor: CC_EDITOR && {
|
||||
menu: 'i18n:MAIN_MENU.component.renderers/DragonBones',
|
||||
inspector: 'packages://inspector/inspectors/comps/skeleton2d.js',
|
||||
help: 'i18n:COMPONENT.help_url.dragonbones',
|
||||
},
|
||||
|
||||
statics: {
|
||||
|
||||
@@ -42,6 +42,10 @@
|
||||
var _global = typeof window === 'undefined' ? global : window;
|
||||
if (!CC_NATIVERENDERER) {
|
||||
_global.dragonBones = require('./lib/dragonBones');
|
||||
// HACK: can't share the global dragonBones between all cc sub modules on Taobao platform.
|
||||
if (cc.sys.platform === cc.sys.TAOBAO || cc.sys.platform === cc.sys.TAOBAO_MINIGAME) {
|
||||
dragonBones = _global.dragonBones;
|
||||
}
|
||||
}
|
||||
|
||||
if (_global.dragonBones !== undefined) {
|
||||
|
||||
@@ -480,7 +480,7 @@ sp.Skeleton = cc.Class({
|
||||
|
||||
// override base class _updateMaterial to set define value and clear material cache
|
||||
_updateMaterial () {
|
||||
let useTint = this.useTint;
|
||||
let useTint = this.useTint || (this.isAnimationCached() && !CC_NATIVERENDERER);
|
||||
let baseMaterial = this.getMaterial(0);
|
||||
if (baseMaterial) {
|
||||
const isMultiSupport = baseMaterial.material.isMultiSupport();
|
||||
@@ -535,7 +535,7 @@ sp.Skeleton = cc.Class({
|
||||
_updateUseTint () {
|
||||
let baseMaterial = this.getMaterial(0);
|
||||
if (baseMaterial) {
|
||||
let useTint = this.useTint;
|
||||
let useTint = this.useTint || (this.isAnimationCached() && !CC_NATIVERENDERER);
|
||||
if (baseMaterial.material.isMultiSupport()) {
|
||||
this._defineMaterialTint(baseMaterial, useTint);
|
||||
} else {
|
||||
|
||||
@@ -925,7 +925,7 @@ export default class SpineAssembler extends Assembler {
|
||||
if (!baseMaterial) return;
|
||||
|
||||
_useMulti = baseMaterial.material.isMultiSupport();
|
||||
_useTint = comp.useTint;
|
||||
_useTint = comp.useTint || comp.isAnimationCached();
|
||||
_vertexFormat = _useTint ? (_useMulti ? VFTwoColorTexId : VFTwoColor) : (_useMulti ? VFOneColorTexId : (comp.isAnimationCached() ? VFTwoColor : VFOneColor));
|
||||
// x y u v color1 color2 or x y u v color
|
||||
_perVertexSize = _useTint ? (_useMulti ? 7 : 6) : (_useMulti ? 6 : (comp.isAnimationCached() ? 6 : 5));
|
||||
|
||||
@@ -36,7 +36,13 @@ exports.getMacros = function (platform, flags) {
|
||||
// debug macros
|
||||
res['CC_DEV'] = res['CC_EDITOR'] || res['CC_PREVIEW'] || res['CC_TEST'];
|
||||
res['CC_DEBUG'] = res['CC_DEBUG'] || res['CC_DEV'];
|
||||
// openHarmony does not support Funtion ,therefore this macro variable is temporarily set to false
|
||||
//res['CC_SUPPORT_JIT'] = false;
|
||||
if (typeof flags.force_setting_support_jit !== 'undefined') {
|
||||
res['CC_SUPPORT_JIT'] = flags.force_setting_support_jit;
|
||||
} else {
|
||||
res['CC_SUPPORT_JIT'] = !(res['CC_RUNTIME'] || res['CC_MINIGAME']);
|
||||
}
|
||||
res['CC_NATIVERENDERER'] = res['CC_JSB'] && true;
|
||||
return res;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cocos-creator-js",
|
||||
"version": "2.4.10",
|
||||
"version": "2.4.12",
|
||||
"description": "Cocos Creator is a complete package of game development tools and workflow, including a game engine, resource management, scene editing, game preview, debug and publish one project to multiple platforms.",
|
||||
"homepage": "https://www.cocos.com",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -211,5 +211,5 @@ if (CC_DEV) {
|
||||
* If you post a bug to forum, please attach this flag.
|
||||
* @property {String} ENGINE_VERSION
|
||||
*/
|
||||
const engineVersion = '2.4.10';
|
||||
const engineVersion = '2.4.12';
|
||||
_global['CocosEngine'] = cc.ENGINE_VERSION = engineVersion;
|
||||
|
||||
Reference in New Issue
Block a user