repo_name string | dataset string | owner string | lang string | func_name string | code string | docstring string | url string | sha string |
|---|---|---|---|---|---|---|---|---|
effects-runtime | github_2023 | galacean | typescript | broadcastPlayerEvent | function broadcastPlayerEvent (player: Player, isCreate: boolean) {
Object.keys(pluginLoaderMap).forEach(key => {
const ctrl = pluginLoaderMap[key];
const func = isCreate ? ctrl.onPlayerCreated : ctrl.onPlayerDestroy;
func?.(player);
});
} | /**
* 播放器在实例化、销毁(`dispose`)时分别触发插件的 `onPlayerCreated`、`onPlayerDestroy` 回调
* @param player - 播放器
* @param isCreate - 是否处于实例化时
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/packages/effects/src/player.ts#L997-L1004 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | assertNoConcurrentPlayers | function assertNoConcurrentPlayers () {
const runningPlayers = [];
for (const player of playerMap.values()) {
if (!player.paused) {
runningPlayers.push(player);
}
}
if (runningPlayers.length > 1) {
logger.error(`Current running player count: ${runningPlayers.length}, see ${HELP_LINK['Current... | /**
* 同时允许的播放器数量超过 1 时打印错误
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/packages/effects/src/player.ts#L1009-L1021 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | assertContainer | function assertContainer (container?: HTMLElement | null): asserts container is HTMLElement {
if (container === undefined || container === null) {
throw new Error(`Container is not an HTMLElement, see ${HELP_LINK['Container is not an HTMLElement']}.`);
}
} | /**
* 创建播放器传入的容器不是 `HTMLElement` 时抛出错误
* @param container
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/packages/effects/src/player.ts#L1027-L1031 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | DeviceProxy.setSystemInfo | setSystemInfo (systemInfo: SystemInfo) {
const {
performance, platform,
model = 'UNKNOWN_DEVICE',
system = 'Unknown',
} = systemInfo;
this.isIOS = platform === 'iOS';
this.model = model;
this.system = system;
this.setLevel(performance);
} | /**
* 设置 JSAPI 返回的系统信息
* @param systemInfo - JSAPI 返回的系统信息
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/alipay-downgrade/src/device-proxy.ts#L40-L51 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | DeviceProxy.getDowngradeDecision | getDowngradeDecision (result: any): DowngradeDecision {
let resultType = undefined;
let resultReason = undefined;
if (result.error) {
// 无权调用的情况下不降级
return {
downgrade: result.error !== 4,
level: this.getRenderLevel(),
reason: 'api error: ' + result.error,
};
}... | /**
* 根据传入的 JSAPI 降级结果,返回设备的降级决定
*
* @param result - JSAPI 返回的降级结果
* @returns 设备降级决定
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/alipay-downgrade/src/device-proxy.ts#L59-L125 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | DeviceProxy.getRenderLevel | getRenderLevel (): SceneRenderLevel {
if (this.level === DeviceLevel.High) {
return spec.RenderLevel.S;
} else if (this.level === DeviceLevel.Medium) {
return spec.RenderLevel.A;
} else if (this.level === DeviceLevel.Low) {
return spec.RenderLevel.B;
} else {
return this.isIOS ? ... | /**
* 获取设备渲染等级
* @returns 设备渲染等级
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/alipay-downgrade/src/device-proxy.ts#L131-L141 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | DowngradeJudge.getDowngradeResult | getDowngradeResult (): DowngradeResult {
const { downgradeCallback } = this.options;
if (downgradeCallback) {
const result = downgradeCallback(this.device);
if (result) {
if (!result.reason) {
result.reason = 'downgradeCallback';
}
return result;
}
}
... | /**
* 根据输入的设备信息和降级选项,以及内置的硬件机型和系统版本降级列表
* 返回当前设备降级相关的结果
*
* @returns 降级结果
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/downgrade/src/downgrade-judge.ts#L25-L84 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | GizmoComponent.getDefaultRenderMode | getDefaultRenderMode (): GeometryDrawMode {
let result: GeometryDrawMode;
const gizmoSubType = this.subType;
switch (gizmoSubType) {
case GizmoSubType.particleEmitter:
case GizmoSubType.modelWireframe:
case GizmoSubType.frustum:
case GizmoSubType.directionLight:
case GizmoSubT... | /**
* 获取默认绘制模式
* @returns 绘制模式常量
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/gizmo-component.ts#L292-L314 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | GizmoComponent.getDefaultSize | getDefaultSize () {
let result = {};
const gizmoSubType = this.subType;
switch (gizmoSubType) {
case GizmoSubType.box:
result = { width: 1, height: 1, depth: 1 };
break;
case GizmoSubType.sphere:
result = { radius: 1 };
break;
case GizmoSubType.cylinder:
... | /**
* 获取默认尺寸
* @returns 几何体尺寸
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/gizmo-component.ts#L320-L348 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | GizmoComponent.createBoundingBoxContent | createBoundingBoxContent (item: VFXItem, meshesToAdd: Mesh[]) {
const gizmoItem = this.item;
const shape = {
shape: 'Box',
width: this.size.width,
height: this.size.height,
depth: this.size.depth,
center: this.size.center,
};
const engine = gizmoItem.composition?.renderer.e... | /**
* 创建 BoundingBox 几何体模型
* @param item - VFXItem
* @param meshesToAdd - 插件缓存的 Mesh 数组
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/gizmo-component.ts#L395-L414 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | GizmoComponent.createBasicContent | createBasicContent (item: VFXItem, meshesToAdd: Mesh[], subType: GizmoSubType, iconTextures?: Map<string, Texture>) {
const gizmoItem = this.item;
const options = {
size: this.size,
color: this.color,
renderMode: this.renderMode,
depthTest: this.depthTest,
};
const engine = gizmo... | /**
* 创建基础几何体模型
* @param item - VFXItem
* @param meshesToAdd - 插件缓存的 Mesh 数组
* @param subType - GizmoSubType 类型
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/gizmo-component.ts#L422-L438 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | GizmoComponent.createCombinationContent | createCombinationContent (item: VFXItem, meshesToAdd: Mesh[], subType: GizmoSubType, iconTextures?: Map<string, Texture>) {
const gizmoItem = this.item;
const options = {
size: this.size,
renderMode: this.renderMode,
};
const engine = gizmoItem.composition?.renderer.engine;
assertExist... | /**
* 创建组合几何体模型
* @param item - VFXItem
* @param meshesToAdd - 插件缓存的 Mesh 数组
* @param subType - GizmoSubType 类型
* @param iconTextures - XYZ 图标纹理(viewHelper 专用)
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/gizmo-component.ts#L447-L463 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | GizmoComponent.getHitTestParams | private getHitTestParams = (): void | HitTestCustomParams => {
const item = this.item;
const boundingMap = this.boundingMap;
if (boundingMap.size > 0) {
const boundingKeys = boundingMap.keys();
let worldMat4: Matrix4;
worldMat4 = this.transform.getWorldMatrix();
const targetItem = ... | /**
* 射线检测算法
* @returns 包含射线检测算法回调方法的参数
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/gizmo-component.ts | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | EditorGizmoPlugin.onCompositionItemRemoved | override onCompositionItemRemoved (composition: Composition, item: VFXItem) {
if (item.type === GizmoVFXItemType) {
this.removeGizmoItem(composition, item);
} else {
const gizmoVFXItemList: VFXItem[] = composition.loaderData.gizmoTarget[item.id];
if (gizmoVFXItemList && gizmoVFXItemList.lengt... | // } | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/gizmo-loader.ts#L124-L136 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | createRotationMesh | function createRotationMesh (
engine: Engine,
options: MeshOption,
boundingMap: Map<string, GizmoItemBounding>,
): Map<Mesh, Transform> {
const result: Map<Mesh, Transform> = new Map();
const scale = options.size.scale || 1;
const size = {
radius: 0.8 * scale,
tube: 0.02 * scale,
radiusSegments:... | /**
* 创建旋转组件 Mesh 数组
* @internal
* @param options
* @param boundingMap - 包围盒 Map
* @returns Mesh 数组和对应的 Transform 组成的 Map
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/mesh.ts#L81-L163 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | getTriangle | function getTriangle (geometry: Geometry, transform: Transform): TriangleLike[] {
const result: TriangleLike[] = [];
const indices = geometry.getIndexData();
const points = geometry.getAttributeData('a_Position');
const mat4 = transform.getWorldMatrix();
if (points && indices && indices.length > 0) {
for... | /**
* 获取几何体的三角面数组
* @internal
* @param geometry - 几何体
* @param transform - 变换式
* @returns 三角面数组
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/mesh.ts#L172-L197 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | createTranslationMesh | function createTranslationMesh (engine: Engine, options: MeshOption, boundingMap: Map<string, GizmoItemBounding>): Map<Mesh, Transform> {
const result: Map<Mesh, Transform> = new Map();
const scale = options.size.scale || 1;
const axisSize = {
width: 0.8 * scale,
height: 0.02 * scale,
depth: 0.02 * sc... | /**
* 创建位移组件 Mesh 数组
* @internal
* @param options
* @param boundingMap - 包围盒 Map
* @returns Mesh 数组和对应的 Transform 组成的 Map
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/mesh.ts#L206-L320 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | createScaleMesh | function createScaleMesh (engine: Engine, options: MeshOption, boundingMap: Map<string, GizmoItemBounding>): Map<Mesh, Transform> {
const result: Map<Mesh, Transform> = new Map();
const scale = options.size.scale || 1;
const axisSize = {
width: 0.8 * scale,
height: 0.02 * scale,
depth: 0.02 * scale,
... | /**
* 创建缩放组件 Mesh 数组
* @internal
* @param options
* @param boundingMap - 包围盒 Map
* @returns Mesh 数组和对应的 Transform 组成的 Map
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/mesh.ts#L329-L398 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | createViewHelperMesh | function createViewHelperMesh (engine: Engine, options: MeshOption, boundingMap: Map<string, GizmoItemBounding>, texture: Map<string, Texture>): Map<Mesh, Transform> {
const result: Map<Mesh, Transform> = new Map();
const scale = options.size.scale || 1;
const axisSize = {
width: 0.8 * scale,
height: 0.02... | /**
* 创建视图辅助组件 Mesh 数组
* @internal
* @param options
* @param boundingMap - 包围盒 Map
* @returns Mesh 数组和对应的 Transform 组成的 Map
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/mesh.ts#L407-L500 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | createAxisMesh | function createAxisMesh (engine: Engine, axisSize: { width: number, height: number, depth: number }, isCentered = false, name?: string): Map<Mesh, Transform> {
const result: Map<Mesh, Transform> = new Map();
const xAxis = createBasicMesh(engine, GizmoSubType.box, {
size: axisSize, color: color.xAxisColor as vec... | /**
* 创建坐标轴 Mesh 数组
* @internal
* @param axisSize - 坐标轴尺寸
* @param isCentered - 是否居中,默认 false
* @returns Mesh 数组和对应的 Transform 组成的 Map
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/mesh.ts#L509-L543 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | createBasicMesh | function createBasicMesh (engine: Engine, subType: GizmoSubType, options: MeshOption, materialType = 'default'): Mesh {
const {
size, color, alpha, renderMode, depthTest, name,
} = options;
let geometryType: GeometryType;
switch (subType) {
case GizmoSubType.sphere:
geometryType = GeometryType.Sp... | /**
* 创建基础几何体 Mesh
* @internal
* @param subType - gizmoSubType 类型
* @param options - 几何体参数
* @returns 几何体 Mesh
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/mesh.ts#L552-L634 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | createSpriteMesh | function createSpriteMesh (engine: Engine, options: MeshOption, texture?: Texture, boundingMap?: Map<string, GizmoItemBounding>): Mesh {
const geometry = createGeometry(engine, GeometryType.Sprite, options.size, renderMode);
let spriteColor;
if (texture) {
spriteColor = texture;
} else {
spriteColor = ... | /**
* @internal
* @param options
* @param texture
* @param boundingMap
* @returns
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/mesh.ts#L643-L670 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | createMaterial | function createMaterial (engine: Engine, color?: vec3, depthTest?: boolean): Material {
const myColor = color ? Vector3.fromArray(color) : new Vector3(255, 255, 255);
const myDepthTest = depthTest ? depthTest : false;
const material = Material.create(
engine,
{
uniformValues: {
u_color: new... | /**
* 创建材质
* @internal
* @param color - 颜色
* @param depthTest
* @returns 纯色材质,无光照,无透明
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/mesh.ts#L679-L731 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | createHideBackMaterial | function createHideBackMaterial (engine: Engine, color?: vec3, depthTest?: boolean): Material {
const myColor = color ? Vector3.fromArray(color) : new Vector3(255, 255, 255);
const myDepthTest = depthTest ? depthTest : false;
const material = Material.create(
engine,
{
uniformValues: {
u_co... | /**
*
* @internal
* @param color
* @param depthTest
* @returns
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/mesh.ts#L740-L810 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | createBlendMaterial | function createBlendMaterial (engine: Engine, color?: vec3, depthTest?: boolean, alpha?: number): Material {
const myColor = color ? Vector3.fromArray(color) : new Vector3(255, 255, 255);
const myDepthTest = depthTest ? depthTest : false;
const myAlpha = alpha ? alpha : 1;
const material = Material.create(
... | /**
*
* @internal
* @param color
* @param depthTest
* @param alpha
* @returns
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/mesh.ts#L820-L877 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | createAxisBounding | function createAxisBounding (size: { width: number, length: number }, boundingMap: Map<string, GizmoItemBounding>) {
boundingMap.set('xAxis', {
type: BoundingType.line,
points: [new Vector3(0, 0, 0), new Vector3(size.length, 0, 0)],
width: size.width,
});
boundingMap.set('yAxis', {
type: BoundingT... | /**
* 创建坐标轴包围盒
* @internal
* @param size 包围盒尺寸
* @param boundingMap 包围盒 Map
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/mesh.ts#L973-L989 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | BoxGeometryData.constructor | constructor (width = 1, height = 1, depth = 1) {
super();
let numberOfVertices = 0;
buildPlane(2, 1, 0, - 1, - 1, depth, height, width, this.points, this.uvs, this.normals, this.indices); // px
buildPlane(2, 1, 0, 1, - 1, depth, height, - width, this.points, this.uvs, this.normals, this.indices); // n... | /**
*
* @param width
* @param height
* @param depth
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/geometry/box.ts#L12-L73 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | buildPlane | function buildPlane (u: number, v: number, w: number, uDir: number,
vDir: number, width: number, height: number, depth: number,
points: number[], uvs: number[], normals: number[], indices: number[]) {
const widthHalf = width / 2;
const heightHalf = height / 2;
const depthHalf = depth / 2;... | // nz | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/geometry/box.ts#L24-L72 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ConeGeometryData.constructor | constructor (
radius = 1,
height = 1,
radialSegments = 8,
heightSegments = 1,
openEnded = false,
thetaStart = 0,
thetaLength = Math.PI * 2,
) {
super(0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength);
} | /**
*
* @param radius
* @param height
* @param radialSegments
* @param heightSegments
* @param openEnded
* @param thetaStart
* @param thetaLength
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/geometry/cone.ts#L17-L27 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | CylinderGeometryData.constructor | constructor (
radiusTop = 1,
radiusBottom = 1,
height = 1,
radialSegments = 8,
heightSegments = 1,
openEnded = false,
thetaStart = 0,
thetaLength = Math.PI * 2,
) {
super();
radialSegments = Math.floor(radialSegments);
heightSegments = Math.floor(heightSegments);
let i... | /**
*
* @param radiusTop
* @param radiusBottom
* @param height
* @param radialSegments
* @param heightSegments
* @param openEnded
* @param thetaStart
* @param thetaLength
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/geometry/cylinder.ts#L21-L143 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | DirectionLightData.constructor | constructor (
radius = 1,
length = 2,
segments = 64,
linesNumber = 8,
thetaStart = 0,
thetaLength = Math.PI * 2,
) {
super();
this.createXYPlaneCircle(radius, 0, segments, thetaStart, thetaLength, 0, this.points, this.indices);
const start = segments % linesNumber / 2;
const s... | /**
* 构造函数
* @param radius - 圆半径
* @param length - 光线长度
* @param segments - 圆精度
* @param linesNumber - 光线数量
* @param thetaStart - 起始弧度
* @param thetaLength - 终止弧度
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/geometry/direction-light.ts#L17-L40 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | FloorLineEdgeGeometryData.constructor | constructor (sideLength = 12, parts = 6) {
super();
let index = 0;
const z = 0;
const end = sideLength / 2;
const start = -sideLength / 2;
for (let i = 0; i <= parts; i++) {
const v = start + i * sideLength / parts;
this.points.push(v, start, z, v, end, z, start, v, z, end, v, z)... | /**
*
* @param sideLength
* @param parts
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/geometry/floor-line-edge.ts#L13-L29 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | FloorLineGeometryData.constructor | constructor (sideLength = 12, parts = 6, subparts = 5) {
super();
const start = -sideLength / 2;
const end = sideLength / 2;
let index = 0;
const z = 0;
for (let i = 0; i <= parts; i++) {
for (let j = 1; j < subparts; j++) {
const partLength = sideLength / parts;
const v ... | /**
*
* @param sideLength
* @param parts
* @param subparts
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/geometry/floor-line.ts#L14-L32 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | FrustumGeometryData.constructor | constructor (
position: spec.vec3,
rotation: spec.vec3,
fov: number,
aspect: number,
near: number,
far: number,
) {
super();
const fovY = fov / 180 * Math.PI;
const ratio = aspect;
const halfY = far * Math.tan(fovY / 2);
const halfX = halfY * ratio;
const point1 = new ... | /**
*
* @param position
* @param rotation
* @param fov
* @param aspect
* @param near
* @param far
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/geometry/frustum.ts#L20-L50 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | PlaneGeometryData.constructor | constructor (
width = 1,
height = 1,
widthSegments = 1,
heightSegments = 1,
) {
super();
const widthHalf = width / 2;
const heightHalf = height / 2;
const gridX = Math.floor(widthSegments);
const gridY = Math.floor(heightSegments);
const gridX1 = gridX + 1;
const gridY1 ... | /**
*
* @param width
* @param height
* @param widthSegments
* @param heightSegments
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/geometry/plane.ts#L14-L57 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | PointLightData.constructor | constructor (
range = 10,
segments = 64,
thetaStart = 0,
thetaLength = Math.PI * 2,
) {
super();
this.createXYPlaneCircle(range, 0, segments, thetaStart, thetaLength, 0, this.points, this.indices);
this.createXZPlaneCircle(range, 0, segments, thetaStart, thetaLength, segments, this.points,... | /**
* 构造函数
* @param range - 光照范围
* @param segments - 圆精度
* @param thetaStart - 起始弧度
* @param thetaLength - 终止弧度
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/geometry/point-light.ts#L15-L25 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | SphereGeometryData.constructor | constructor (
radius = 1,
widthSegments = 8,
heightSegments = 6,
phiStart = 0,
phiLength = Math.PI * 2,
thetaStart = 0,
thetaLength = Math.PI,
) {
super();
// 限制至少需要分为六块以保持形状
widthSegments = Math.max(3, Math.floor(widthSegments));
heightSegments = Math.max(2, Math.floor(he... | /**
*
* @param radius
* @param widthSegments
* @param heightSegments
* @param phiStart
* @param phiLength
* @param thetaStart
* @param thetaLength
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/geometry/sphere.ts#L20-L87 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | SpotLightData.constructor | constructor (
range = 10,
spotAngle = 30,
segments = 64,
thetaStart = 0,
thetaLength = Math.PI * 2,
) {
super();
const angle = spotAngle / 2 / 180 * Math.PI;
const radius = range * Math.tan(angle);
this.createXYPlaneCircle(radius, -range, segments, thetaStart, thetaLength, 0, thi... | /**
* 构造函数
* @param range - 光线范围
* @param spotAngle - 光线范围[角度]
* @param segments - 圆精度
* @param thetaStart - 起始弧度
* @param thetaLength - 终止弧度
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/geometry/spot-light.ts#L16-L36 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | TorusGeometryData.constructor | constructor (
radius = 1,
tube = 0.4,
radialSegments = 64,
tubularSegments = 64,
arc = Math.PI * 2,
) {
super();
radialSegments = Math.floor(radialSegments);
tubularSegments = Math.floor(tubularSegments);
for (let j = 0; j <= radialSegments; j++) {
for (let i = 0; i <= tubu... | /**
*
* @param radius
* @param tube
* @param radialSegments
* @param tubularSegments
* @param arc
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/editor-gizmo/src/geometry/torus.ts#L18-L66 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | InputController.registerMouseEvent | private registerMouseEvent (owner: InputController) {
// 设备类型过滤,只在windows和mac上注册
const platform = navigator.platform.toLowerCase();
if (platform.search('win') < 0 && platform.search('mac') < 0) {
return;
}
if (this.canvas === undefined || this.gesture === undefined) {
return;
}
... | /**
* 注册鼠标回调事件,只有在PC上才会注册,手机上不会注册
*
* @param owner 输入控制器对象
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/gesture/controller.ts#L98-L247 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | InputController.registerTouchEvent | private registerTouchEvent (owner: InputController) {
// 设备类型过滤,只在安卓和iPhone上注册
const platform = navigator.platform.toLowerCase();
if (platform.search('arm') < 0 && platform.search('iphone') < 0) {
return;
}
if (this.canvas === undefined) {
return;
}
this.hammer = new Hammer(th... | /**
* 注册触控回调事件,只在手机上才会注册,PC上不会注册
*
* @param owner 输入控制器对象
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/gesture/controller.ts#L298-L384 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | InputController.launchBeginEventCallback | private launchBeginEventCallback (eventName: string) {
if (this.beginEventCallback !== undefined) {
this.beginEventCallback(eventName);
}
} | /**
* 相机开始事件的回调
*
* @param eventName 事件名称
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/gesture/controller.ts#L391-L395 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | InputController.launchMoveEventCallback | private launchMoveEventCallback (eventName: string) {
if (this.moveEventCallback !== undefined) {
this.moveEventCallback(eventName);
}
} | /**
* 相机持续事件的回调
*
* @param eventName 事件名称
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/gesture/controller.ts#L402-L406 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | InputController.launchEndEventCallback | private launchEndEventCallback (eventName: string) {
if (this.endEventCallback !== undefined) {
this.endEventCallback(eventName);
}
} | /**
* 相机结束事件的回调
*
* @param eventName 事件名称
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/gesture/controller.ts#L413-L417 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | LoaderImpl.processLight | processLight (lights: GLTFLight[], fromGLTF: boolean): void {
lights.forEach(l => {
if (l.color === undefined) {
if (fromGLTF) { l.color = [255, 255, 255, 255]; } else { l.color = [1, 1, 1, 1]; }
} else {
l.color[0] = this.scaleColorVal(l.color[0], fromGLTF);
l.color[1] = this.sc... | /**
* for old scene compatibility
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/gltf/loader-impl.ts#L946-L957 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelMeshComponent.constructor | constructor (engine: Engine, data?: ModelMeshComponentData) {
super(engine);
if (data) {
this.fromData(data);
}
} | /**
* 构造函数,只保存传入参数,不在这里创建内部对象
* @param engine - 引擎
* @param data - Mesh 参数
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L51-L56 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelMeshComponent.onStart | override onStart (): void {
this.sceneManager = getSceneManager(this);
this.createContent();
this.item.type = VFX_ITEM_TYPE_3D;
this.priority = this.item.renderOrder;
this.sceneManager?.addItem(this.content);
if (this.item.parentId && this.item.parent) {
this.content.updateParentInfo(this.... | /**
* 组件开始,需要创建内部对象,更新父元素信息和添加到场景管理器中
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L61-L72 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelMeshComponent.onUpdate | override onUpdate (dt: number): void {
if (this.sceneManager) {
this.content.build(this.sceneManager);
}
this.content.update();
} | /**
* 组件更新,更新内部对象状态
* @param dt - 更新间隔
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L78-L84 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelMeshComponent.onLateUpdate | override onLateUpdate (dt: number): void {
this.content.lateUpdate();
} | /**
* 组件晚更新,晚更新内部对象状态
* @param dt - 更新间隔
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L90-L92 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelSkyboxComponent.render | override render (renderer: Renderer) {
if (!this.getVisible() || !this.sceneManager) {
return;
}
this.content.render(this.sceneManager, renderer);
} | /**
* 组件渲染,需要检查可见性
* @param renderer - 渲染器
* @returns
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L99-L105 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelSkyboxComponent.onDestroy | override onDestroy (): void {
this.sceneManager?.removeItem(this.content);
this.sceneManager = undefined;
this.content.dispose();
} | /**
* 组件销毁,需要重场景管理器中删除
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L110-L114 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelMeshComponent.fromData | override fromData (data: ModelMeshComponentData): void {
super.fromData(data);
this.data = data;
} | /**
* 反序列化,记录传入参数
* @param data - 组件参数
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L120-L123 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelMeshComponent.createContent | createContent () {
if (this.data) {
const bounding = this.data.interaction;
this.bounding = bounding && JSON.parse(JSON.stringify(bounding));
this.content = new PMesh(this.engine, this.item.name, this.data, this, this.item.parentId);
}
} | /**
* 创建内部对象
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L128-L136 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelSkyboxComponent.setVisible | setVisible (visible: boolean) {
this.content?.onVisibleChanged(visible);
} | /**
* 设置当前 Mesh 的可见性。
* @param visible - true:可见,false:不可见
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L142-L144 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelSkyboxComponent.getVisible | getVisible (): boolean {
return this.content?.visible ?? false;
} | /**
* 获取当前 Mesh 的可见性。
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L149-L151 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelMeshComponent.getHitTestParams | getHitTestParams = (force?: boolean): HitTestBoxParams | HitTestSphereParams | HitTestCustomParams | undefined => {
this.computeBoundingBox();
const bounding = this.bounding;
if (bounding && (force || Number.isInteger(bounding.behavior))) {
const type = bounding.type;
if (type === spec.ModelBo... | /**
* 获取点击测试参数,根据元素包围盒进行相交测试,Mesh 对象会进行更加精确的点击测试
* @param force - 是否强制进行点击测试
* @returns 点击测试参数
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelMeshComponent.computeBoundingBox | computeBoundingBox (): ModelItemBounding | undefined {
if (this.content && this.content instanceof PMesh) {
const worldMatrix = this.transform.getWorldMatrix();
const bbox = this.content.computeBoundingBox(worldMatrix);
const center = bbox.getCenter(new Vector3());
const size = bbox.getSize(... | /**
* 计算元素包围盒,只针对 Mesh 对象
* @returns 包围盒
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L219-L237 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelSkyboxComponent.constructor | constructor (engine: Engine, data?: ModelSkyboxComponentData) {
super(engine);
if (data) {
this.fromData(data);
}
} | /**
* 构造函数,只保存传入参数,不在这里创建内部对象
* @param engine - 引擎
* @param data - Mesh 参数
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L264-L269 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelSkyboxComponent.onStart | override onStart (): void {
this.createContent();
this.item.type = VFX_ITEM_TYPE_3D;
this.priority = this.item.renderOrder;
this.sceneManager = getSceneManager(this);
this.sceneManager?.addItem(this.content);
this.setVisible(true);
} | /**
* 组件开始,需要创建内部对象和添加到场景管理器中
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L274-L281 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelSkyboxComponent.fromData | override fromData (data: ModelSkyboxComponentData): void {
super.fromData(data);
this.data = data;
} | /**
* 反序列化,记录传入参数
* @param data - 组件参数
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L309-L312 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelSkyboxComponent.createContent | createContent () {
if (this.data) {
const skyboxData = this.data;
this.content = new PSkybox(this.item.name, skyboxData, this);
}
} | /**
* 创建内部对象
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L317-L323 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelLightComponent.constructor | constructor (engine: Engine, data?: ModelLightComponentData) {
super(engine);
if (data) {
this.fromData(data);
}
} | /**
* 构造函数,只保存传入参数,不在这里创建内部对象
* @param engine - 引擎
* @param data - Mesh 参数
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L361-L366 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelLightComponent.onStart | override onStart (): void {
this.createContent();
this.item.type = VFX_ITEM_TYPE_3D;
const scene = getSceneManager(this);
scene?.addItem(this.content);
this.setVisible(true);
} | /**
* 组件开始,需要创建内部对象和添加到场景管理器中
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L371-L378 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelLightComponent.onUpdate | override onUpdate (dt: number): void {
this.content.update();
} | /**
* 组件更新,更新内部对象状态
* @param dt - 更新间隔
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L384-L386 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelLightComponent.onDestroy | override onDestroy (): void {
this.content.dispose();
} | /**
* 组件销毁
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L391-L393 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelLightComponent.fromData | override fromData (data: ModelLightComponentData): void {
super.fromData(data);
this.data = data;
} | /**
* 反序列化,记录传入参数
* @param data - 组件参数
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L399-L403 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelLightComponent.createContent | createContent () {
if (this.data) {
const lightData = this.data;
this.content = new PLight(this.item.name, lightData, this);
}
} | /**
* 创建内部对象
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L408-L414 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelCameraComponent.constructor | constructor (engine: Engine, data?: ModelCameraComponentData) {
super(engine);
if (data) {
this.fromData(data);
}
} | /**
* 构造函数,只保存传入参数,不在这里创建内部对象
* @param engine - 引擎
* @param data - Mesh 参数
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L451-L456 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelCameraComponent.onStart | override onStart (): void {
this.createContent();
this.item.type = VFX_ITEM_TYPE_3D;
const scene = getSceneManager(this);
scene?.addItem(this.content);
this.updateMainCamera();
} | /**
* 组件开始,需要创建内部对象和添加到场景管理器中
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L461-L468 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelCameraComponent.onUpdate | override onUpdate (dt: number): void {
this.content.update();
this.updateMainCamera();
} | /**
* 组件更新,更新内部对象状态
* @param dt - 更新间隔
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L474-L477 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelCameraComponent.onDestroy | override onDestroy (): void {
this.content?.dispose();
} | /**
* 组件销毁
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L482-L484 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelCameraComponent.fromData | override fromData (data: ModelCameraComponentData): void {
super.fromData(data);
this.data = data;
} | /**
* 反序列化,记录传入参数
* @param data - 组件参数
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L490-L494 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelCameraComponent.createContent | createContent () {
if (this.data) {
const cameraData = this.data;
const width = this.engine.renderer.getWidth();
const height = this.engine.renderer.getHeight();
this.content = new PCamera(this.item.name, width, height, cameraData, this);
}
} | /**
* 创建内部对象
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L499-L508 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelCameraComponent.updateMainCamera | updateMainCamera () {
this.content.matrix = this.transform.getWorldMatrix();
const composition = this.item.composition;
if (composition) {
composition.camera.position = this.transform.position.clone();
composition.camera.setQuat(this.transform.quat);
composition.camera.near = this.content... | /**
* 更新合成主相机,更加当前相机元素状态
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L513-L524 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelCameraComponent.setTransform | setTransform (position?: Vector3, rotation?: Euler): void {
if (position) {
this.transform.setPosition(position.x, position.y, position.z);
}
if (rotation) {
this.transform.setRotation(rotation.x, rotation.y, rotation.z);
}
this.updateMainCamera();
} | /**
* 设置变换
* @param position - 位置
* @param rotation - 旋转
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L531-L539 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | AnimationComponent.constructor | constructor (engine: Engine) {
super(engine);
} | /**
* 构造函数,只保存传入参数,不在这里创建内部对象
* @param engine - 引擎
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L560-L562 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | AnimationComponent.onStart | override onStart (): void {
this.elapsedTime = 0;
this.item.type = VFX_ITEM_TYPE_3D;
} | /**
* 组件开始,需要创建内部对象和添加到场景管理器中
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L567-L570 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | AnimationComponent.onUpdate | override onUpdate (dt: number): void {
this.elapsedTime += dt * 0.001;
if (this.animation >= 0 && this.animation < this.clips.length) {
this.clips[this.animation].sampleAnimation(this.item, this.elapsedTime);
}
} | /**
* 组件更新,更新内部对象状态
* @param dt - 更新间隔
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L576-L581 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | AnimationComponent.onDestroy | override onDestroy (): void {
} | /**
* 组件销毁
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L586-L588 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | AnimationComponent.fromData | override fromData (data: AnimationComponentData): void {
super.fromData(data);
this.data = data;
//
this.name = data.name ?? '<empty>';
this.animation = data.animation ?? -1;
this.clips = [];
data.animationClips.forEach(clipData => {
const clipObj = new ModelAnimationClip(this.engine);... | /**
* 反序列化,记录传入参数
* @param data - 组件参数
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-item.ts#L594-L607 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelPlugin.prepareResource | static override async prepareResource (scene: Scene, options: SceneLoadOptions): Promise<void> {
if (options.pluginData !== undefined) {
const keyList = [
'compatibleMode',
'renderSkybox',
'visBoundingBox',
'autoAdjustScene',
'enableDynamicSort',
'renderMode3D',... | /**
* 整个 load 阶段都不会创建 GL 相关的对象,只创建 JS 对象
* @param scene - 场景
* @param options - 加载选项
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-plugin.ts#L38-L62 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelPlugin.onCompositionConstructed | override onCompositionConstructed (composition: Composition, scene: Scene): void {
this.sceneParams = scene.storage;
const engine = composition.renderer.engine;
this.cache = new CompositionCache(engine);
this.cache.setup(false);
// FIXME: 先注释元素参数的配置
//PluginHelper.setupItem3DOptions(scene, thi... | /**
* 创建 3D 场景管理器和缓存器
* @param composition - 合成
* @param scene - 场景
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-plugin.ts#L98-L107 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelPlugin.onCompositionReset | override onCompositionReset (composition: Composition, renderFrame: RenderFrame) {
const props = {
id: 'ModelPluginItem',
name: 'ModelPluginItem',
duration: 9999999,
endBehavior: spec.END_BEHAVIOR_FORWARD,
} as unknown as spec.Item;
const item = new VFXItem(composition.getEngine(), p... | /**
* 每次播放都会执行,包括重播,所以这里执行“小的销毁”和新的初始化
* @param composition - 合成
* @param renderFrame - 渲染帧
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-plugin.ts#L114-L129 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelPlugin.onCompositionDestroyed | override onCompositionDestroyed (composition: Composition) {
this.cache.dispose();
// @ts-expect-error
this.cache = null;
// @ts-expect-error
this.sceneParams = null;
} | /**
* 合成销毁,同时销毁 3D 场景对象和缓存
* @param composition - 合成
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-plugin.ts#L135-L141 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelPluginComponent.constructor | constructor (engine: Engine, options?: ModelPluginOptions) {
super(engine);
if (options) {
this.fromData(options);
}
} | /**
* 构造函数,创建场景管理器
* @param engine - 引擎
* @param options - Mesh 参数
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-plugin.ts#L189-L194 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelPluginComponent.onLateUpdate | override onLateUpdate (dt: number): void {
const composition = this.item.composition as Composition;
if (this.autoAdjustScene && this.scene.tickCount == 1) {
// 自动计算场景中的相机位置
// 更加相机的具体参数,计算出合适的相机观察位置
// 但只会在第一帧进行更新,主要是用于测试使用
const cameraObject = composition.camera;
const cameraTra... | /**
* 组件后更新,合成相机和场景管理器更新
* @param dt - 更新间隔
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-plugin.ts#L200-L247 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelPluginComponent.onDestroy | override onDestroy (): void {
this.scene.dispose();
// @ts-expect-error
this.scene = null;
// @ts-expect-error
this.cache = null;
} | /**
* 组件销毁,同时销毁场景管理器和缓存器
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-plugin.ts#L252-L258 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelPluginComponent.fromData | override fromData (data: ModelPluginOptions): void {
super.fromData(data);
//
const options = data;
this.cache = options.cache;
this.scene = new PSceneManager(this.engine);
} | /**
* 反序列化,创建场景管理器
* @param date - 组件参数
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-plugin.ts#L264-L271 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelPluginComponent.initial | initial (sceneParams: Record<string, any>) {
this.runtimeEnv = sceneParams['runtimeEnv'] ?? this.runtimeEnv;
this.compatibleMode = sceneParams['compatibleMode'] ?? this.compatibleMode;
this.renderSkybox = sceneParams['renderSkybox'] ?? this.renderSkybox;
this.visBoundingBox = sceneParams['visBoundingBox... | /**
* 组件初始化,初始化场景管理器并更新合成相机
* @param sceneParams - 场景参数
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-plugin.ts#L277-L304 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelPluginComponent.updateSceneCamera | private updateSceneCamera (composition: Composition) {
this.scene.updateDefaultCamera(composition.camera.getOptions(), composition.camera.getViewportMatrix());
} | /**
* 更新 SceneManager 中渲染用的相机,相机参数来自 composition.camera
*
* @param composition - 当前合成对象
* @param sceneManager - 当前合成对象绑定的 SceneManager
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-plugin.ts#L312-L314 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelTreeComponent.constructor | constructor (engine: Engine, options?: ModelTreeContent) {
super(engine);
if (options) {
this.fromData(options);
}
} | /**
* 构造函数,创建节点树元素
* @param engine
* @param options
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-tree-component.ts#L23-L28 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | ModelTreeComponent.fromData | override fromData (options: ModelTreeContent): void {
super.fromData(options);
this.options = options;
} | /**
* 反序列化,保存入参和创建节点树元素
* @param options
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/plugin/model-tree-component.ts#L34-L37 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | PSkin.create | create (props: SkinProps, engine: Engine, rootBoneItem: VFXItem, maxJointCount: number) {
this.name = props.rootBoneName ?? 'Unnamed skin';
this.type = PObjectType.skin;
//
this.rootBoneItem = rootBoneItem;
this.skeleton = -1;
this.jointItem = this.getJointItems(props, rootBoneItem);
this.ma... | /**
* 创建蒙皮对象
* @param props - 蒙皮相关数据
* @param engine - 引擎对象
* @param rootBoneItem - 场景树父元素
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/runtime/animation.ts#L58-L86 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | PSkin.updateSkinMatrices | updateSkinMatrices () {
this.animationMatrices = [];
for (let i = 0; i < this.jointItem.length; i++) {
const node = this.jointItem[i];
// let parent = node?.transform.parentTransform;
// while(parent !== undefined){
// const pos = parent.position;
// parent.setPosition(pos[0]... | /**
* 更新蒙皮矩阵
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/runtime/animation.ts#L91-L117 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | PSkin.computeMeshAnimMatrices | computeMeshAnimMatrices (worldMatrix: Matrix4, matrixList: Float32Array, normalMatList: Float32Array) {
const inverseWorldMatrix = worldMatrix.clone().invert();
const tempMatrix = new Matrix4();
this.animationMatrices.forEach((mat, i) => {
const localMatrix = tempMatrix.multiplyMatrices(inverseWorldM... | /**
* 计算 Mesh 的动画矩阵
* @param worldMatrix - 世界矩阵
* @param matrixList - 矩阵列表
* @param normalMatList - 法线矩阵列表
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/runtime/animation.ts#L125-L138 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | PSkin.updateParentItem | updateParentItem (parentItem: VFXItem) {
this.rootBoneItem = parentItem;
} | /**
* 更新父元素
* @param parentItem - 场景树父元素
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/runtime/animation.ts#L144-L146 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | PSkin.getJointCount | getJointCount (): number {
return this.jointItem.length;
} | /**
* 获取关节点数
* @returns
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/runtime/animation.ts#L152-L154 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | PSkin.isTextureDataMode | isTextureDataMode (): boolean {
return this.textureDataMode !== TextureDataMode.none;
} | /**
* 是否纹理数据模式
* @returns
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/runtime/animation.ts#L160-L162 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | PSkin.dispose | override dispose (): void {
this.rootBoneItem = undefined;
this.jointItem = [];
this.inverseBindMatrices = [];
this.animationMatrices = [];
} | /**
* 销毁
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/runtime/animation.ts#L167-L172 | 20512f4406e62c400b2b4255576cfa628db74a22 |
effects-runtime | github_2023 | galacean | typescript | PMorph.create | create (geometry: Geometry): boolean {
this.name = this.genName('Morph target');
this.type = PObjectType.morph;
// 统计各个属性的在Morph中的数目
const positionCount = this.getAttributeMorphCount(PMorph.positionNameList, geometry);
const normalCount = this.getAttributeMorphCount(PMorph.normalNameList, geometry)... | /**
* 通过 Geometry 数据创建 Morph 动画相关状态,并进行必要的正确性检查
* @param geometry - Mesh 的几何体,是否包含 Morph 动画都是可以的
* @returns 是否创建成功
*/ | https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/plugin-packages/model/src/runtime/animation.ts#L268-L329 | 20512f4406e62c400b2b4255576cfa628db74a22 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.