diff --git a/cocos/gfx/device.ts b/cocos/gfx/device.ts index d0b8753f48..ddad601dd7 100644 --- a/cocos/gfx/device.ts +++ b/cocos/gfx/device.ts @@ -15,6 +15,12 @@ import { GFXTexture, IGFXTextureInfo } from './texture'; import { GFXTextureView, IGFXTextureViewInfo } from './texture-view'; import { GFXWindow, IGFXWindowInfo } from './window'; +export enum GFXAPI { + UNKNOWN, + WEBGL, + WEBGL2, +} + export enum GFXFeature { TEXTURE_FLOAT, TEXTURE_HALF_FLOAT, @@ -39,6 +45,10 @@ export abstract class GFXDevice { return this._canvas2D as HTMLCanvasElement; } + public get gfxAPI (): GFXAPI { + return this._gfxAPI; + } + public get queue (): GFXQueue { return this._queue as GFXQueue; } @@ -105,6 +115,7 @@ export abstract class GFXDevice { protected _canvas: HTMLCanvasElement | null = null; protected _canvas2D: HTMLCanvasElement | null = null; + protected _gfxAPI: GFXAPI = GFXAPI.UNKNOWN; protected _deviceName: string = ''; protected _renderer: string = ''; protected _vendor: string = ''; diff --git a/cocos/gfx/webgl/webgl-device.ts b/cocos/gfx/webgl/webgl-device.ts index a4613634cd..23c8928954 100644 --- a/cocos/gfx/webgl/webgl-device.ts +++ b/cocos/gfx/webgl/webgl-device.ts @@ -13,7 +13,7 @@ import { GFXTextureType, GFXTextureViewType, } from '../define'; -import { GFXDevice, GFXFeature, IGFXDeviceInfo } from '../device'; +import { GFXDevice, GFXFeature, IGFXDeviceInfo, GFXAPI } from '../device'; import { GFXFramebuffer, IGFXFramebufferInfo } from '../framebuffer'; import { GFXInputAssembler, IGFXInputAssemblerInfo } from '../input-assembler'; import { GFXPipelineLayout, IGFXPipelineLayoutInfo } from '../pipeline-layout'; @@ -215,6 +215,7 @@ export class WebGLGFXDevice extends GFXDevice { console.info('WebGL device initialized.'); + this._gfxAPI = GFXAPI.WEBGL; this._deviceName = 'WebGL'; const gl = this._webGLRC; diff --git a/cocos/gfx/webgl2/webgl2-device.ts b/cocos/gfx/webgl2/webgl2-device.ts index bb0b86a487..7b02efc3d4 100644 --- a/cocos/gfx/webgl2/webgl2-device.ts +++ b/cocos/gfx/webgl2/webgl2-device.ts @@ -3,7 +3,7 @@ import { GFXBuffer, IGFXBufferInfo } from '../buffer'; import { GFXCommandAllocator, IGFXCommandAllocatorInfo } from '../command-allocator'; import { GFXCommandBuffer, IGFXCommandBufferInfo } from '../command-buffer'; import { GFXBufferTextureCopy, GFXFormat, GFXFormatInfos, GFXFormatSize, GFXQueueType } from '../define'; -import { GFXDevice, GFXFeature, IGFXDeviceInfo } from '../device'; +import { GFXDevice, GFXFeature, IGFXDeviceInfo, GFXAPI } from '../device'; import { GFXFramebuffer, IGFXFramebufferInfo } from '../framebuffer'; import { GFXInputAssembler, IGFXInputAssemblerInfo } from '../input-assembler'; import { GFXPipelineLayout, IGFXPipelineLayoutInfo } from '../pipeline-layout'; @@ -124,7 +124,7 @@ export class WebGL2GFXDevice extends GFXDevice { // No errors are thrown using try catch // Tested through ios baidu browser 4.14.1 if (!this._webGL2RC) { - console.error('This device does not support WebGL.'); + console.error('This device does not support WebGL2.'); return false; } @@ -132,6 +132,7 @@ export class WebGL2GFXDevice extends GFXDevice { console.info('WebGL2 device initialized.'); + this._gfxAPI = GFXAPI.WEBGL2; this._deviceName = 'WebGL2'; const gl = this._webGL2RC; diff --git a/cocos/scene-graph/node.ts b/cocos/scene-graph/node.ts index 162586bb6c..ddc25f43ec 100644 --- a/cocos/scene-graph/node.ts +++ b/cocos/scene-graph/node.ts @@ -31,11 +31,15 @@ class Node extends BaseNode { public uiWidgetComp: WidgetComponent | null = null; // local transform - @property + @property({ + default: cc.v3(0, 0, 0), + }) protected _lpos = new Vec3(); @property protected _lrot = new Quat(); - @property + @property({ + default: cc.v3(1, 1, 1), + }) protected _lscale = new Vec3(1, 1, 1); @property protected _layer = Layers.Default; // the layer this node belongs to