mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-04 02:02:41 +08:00
fix conflicts
This commit is contained in:
@@ -8,6 +8,8 @@ type Constructor<T = {}> = new(...args: any[]) => T;
|
||||
|
||||
export type IEventTargetCallback = (...args: any[]) => void;
|
||||
|
||||
class Empty {}
|
||||
|
||||
export function EventTarget<Base extends Constructor<{}>> (base: Base) {
|
||||
class EventTarget extends base {
|
||||
private _callbacksInvoker = new CallbacksInvoker();
|
||||
@@ -171,3 +173,5 @@ export function EventTarget<Base extends Constructor<{}>> (base: Base) {
|
||||
interface ITargetImpl extends Object {
|
||||
__eventTargets?: Object[];
|
||||
}
|
||||
|
||||
export const DefaultEventTarget = EventTarget(Empty);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { IBlockInfo, IPassInfo, ISamplerInfo } from '../../3d/assets/effect-asset';
|
||||
import { color4, mat2, mat3, mat4, vec2, vec3, vec4 } from '../../core/vmath';
|
||||
import { GFXBindingLayout } from '../../gfx/binding-layout';
|
||||
import { GFXBindingLayout, IGFXBinding } from '../../gfx/binding-layout';
|
||||
import { GFXBuffer } from '../../gfx/buffer';
|
||||
import { GFXBindingType, GFXBufferUsageBit, GFXMemoryUsageBit, GFXPrimitiveMode, GFXType } from '../../gfx/define';
|
||||
import { GFXDevice } from '../../gfx/device';
|
||||
@@ -98,6 +98,7 @@ export class Pass {
|
||||
protected _stage: RenderPassStage = RenderPassStage.DEFAULT;
|
||||
protected _handleMap: Record<string, number> = {};
|
||||
protected _blocks: IBlock[] = [];
|
||||
protected _bindings: IGFXBinding[] = [];
|
||||
// external references
|
||||
protected _device: GFXDevice;
|
||||
protected _shader: GFXShader | null = null;
|
||||
@@ -111,7 +112,7 @@ export class Pass {
|
||||
this._programName = info.program;
|
||||
// pipeline state
|
||||
const device = this._device;
|
||||
const bindings = info.blocks.map((u) =>
|
||||
const bindings = this._bindings = info.blocks.map((u) =>
|
||||
({ name: u.name, binding: u.binding, type: GFXBindingType.UNIFORM_BUFFER }),
|
||||
).concat(info.samplers.map((u) =>
|
||||
({ name: u.name, binding: u.binding, type: GFXBindingType.SAMPLER }),
|
||||
@@ -295,7 +296,8 @@ export class Pass {
|
||||
get shader (): GFXShader { return this._shader!; }
|
||||
get pipelineState () { return this._pipelineState as GFXPipelineState; }
|
||||
get bindingLayout () { return this._bindingLayout as GFXBindingLayout; }
|
||||
get primitive (): GFXPrimitiveMode { return this._primitive; }
|
||||
get primitive () { return this._primitive; }
|
||||
get bindings () { return this.bindings; }
|
||||
}
|
||||
|
||||
function serializeBlendState (bs: GFXBlendState) {
|
||||
|
||||
+20
-1
@@ -55,6 +55,7 @@ export interface IUIRenderItem {
|
||||
export interface IUIRenderData {
|
||||
meshBuffer: MeshBuffer;
|
||||
material: Material;
|
||||
camera: Camera;
|
||||
}
|
||||
|
||||
export class UI {
|
||||
@@ -163,6 +164,18 @@ export class UI {
|
||||
this._screens.push(comp);
|
||||
}
|
||||
|
||||
public getScreen (visibility: number) {
|
||||
for (const screen of this._screens) {
|
||||
if (screen.camera) {
|
||||
if (screen.camera.visibility === visibility) {
|
||||
return screen;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public removeScreen (comp) {
|
||||
const idx = this._screens.indexOf(comp);
|
||||
if (idx !== -1) {
|
||||
@@ -226,7 +239,13 @@ export class UI {
|
||||
attributes: vfmt,
|
||||
} as IMeshBufferInitData);
|
||||
comp.updateRenderData(buffer);
|
||||
this._commitBuffers.push({ meshBuffer: buffer, material: comp.material});
|
||||
const canvasComp: CanvasComponent | null = this.getScreen(comp.viewID);
|
||||
|
||||
this._commitBuffers.push({
|
||||
meshBuffer: buffer,
|
||||
material: comp.material,
|
||||
camera: canvasComp ? canvasComp.camera : null,
|
||||
} as IUIRenderData);
|
||||
}
|
||||
|
||||
private render () {
|
||||
|
||||
@@ -6,7 +6,7 @@ import { mat4, quat, vec3 } from '../core/vmath';
|
||||
import { UITransformComponent } from '../3d/ui/components/ui-transfrom-component';
|
||||
import { BaseNode } from './base-node';
|
||||
import { Layers } from './layers';
|
||||
import { EventTarget } from '../core/event/event-target-base';
|
||||
import { EventTarget, DefaultEventTarget } from '../core/event/event-target-base';
|
||||
|
||||
const v3_a = new Vec3();
|
||||
const q_a = new Quat();
|
||||
@@ -1058,7 +1058,7 @@ class Node extends EventTarget(BaseNode) {
|
||||
// break;
|
||||
// }
|
||||
if (!this._bubblingListeners) {
|
||||
this._bubblingListeners = new EventTarget();
|
||||
this._bubblingListeners = new DefaultEventTarget();
|
||||
}
|
||||
return this._bubblingListeners.on(type, callback, target);
|
||||
}
|
||||
@@ -1092,10 +1092,10 @@ class Node extends EventTarget(BaseNode) {
|
||||
|
||||
// let listeners = null;
|
||||
// if (forDispatch && useCapture) {
|
||||
// listeners = this._capturingListeners = this._capturingListeners || new EventTarget();
|
||||
// listeners = this._capturingListeners = this._capturingListeners || new DefaultEventTarget();
|
||||
// }
|
||||
// else {
|
||||
// listeners = this._bubblingListeners = this._bubblingListeners || new EventTarget();
|
||||
// listeners = this._bubblingListeners = this._bubblingListeners || new DefaultEventTarget();
|
||||
// }
|
||||
|
||||
// let hasOnceListener = listeners.hasEventListener(eventType_hasOnceListener, callback, target);
|
||||
@@ -1124,9 +1124,9 @@ class Node extends EventTarget(BaseNode) {
|
||||
|
||||
let listeners = null;
|
||||
if (useCapture) {
|
||||
listeners = this._capturingListeners = this._capturingListeners || new EventTarget();
|
||||
listeners = this._capturingListeners = this._capturingListeners || new DefaultEventTarget();
|
||||
} else {
|
||||
listeners = this._bubblingListeners = this._bubblingListeners || new EventTarget();
|
||||
listeners = this._bubblingListeners = this._bubblingListeners || new DefaultEventTarget();
|
||||
}
|
||||
|
||||
if (!listeners.hasEventListener(type, callback, target)) {
|
||||
|
||||
Reference in New Issue
Block a user