Skip to content

Commit

Permalink
Merge pull request #38 from star-e/v3.6.0-pipeline
Browse files Browse the repository at this point in the history
V3.6.0 pipeline
  • Loading branch information
zxx43 committed Jun 20, 2022
2 parents 7958c50 + f8ec38e commit fdbcb89
Show file tree
Hide file tree
Showing 480 changed files with 3,113 additions and 3,860 deletions.
2 changes: 2 additions & 0 deletions @types/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ declare interface IWritableArrayLike<T> {

declare type Constructor<T = unknown> = new (...args: any[]) => T;

declare type AbstractedConstructor<T = unknown> = abstract new (...args: any[]) => T;

/**
* Alias of `Function` but suppress eslint warning.
* Please avoid using it and explicitly specify function signatures as possible.
Expand Down
95 changes: 27 additions & 68 deletions @types/jsb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,48 +427,6 @@ declare namespace jsb {
* Get default resource root path.
*/
export function getDefaultResourceRootPath ():string;
/**
* Loads the filenameLookup dictionary from the contents of a filename.
*
* @note The plist file name should follow the format below:
*
* @code
* <?xml version="1.0" encoding="UTF-8"?>
* <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
* <plist version="1.0">
* <dict>
* <key>filenames</key>
* <dict>
* <key>sounds/click.wav</key>
* <string>sounds/click.caf</string>
* <key>sounds/endgame.wav</key>
* <string>sounds/endgame.caf</string>
* <key>sounds/gem-0.wav</key>
* <string>sounds/gem-0.caf</string>
* </dict>
* <key>metadata</key>
* <dict>
* <key>version</key>
* <integer>1</integer>
* </dict>
* </dict>
* </plist>
* @endcode
* @param filename The plist file name.
*
@since v2.1
* @js loadFilenameLookup
* @lua loadFilenameLookup
*/
export function loadFilenameLookup (filepath:string):void;
/** Checks whether to pop up a message box when failed to load an image.
* @return True if pop up a message box when failed to load an image, false if not.
*/
export function isPopupNotify ():boolean;
/**
* Sets whether to pop-up a message box when failed to load an image.
*/
export function setPopupNotify (notify:boolean):void;

// Converts the contents of a file to a ValueVector.
// This method is used internally.
Expand Down Expand Up @@ -564,23 +522,7 @@ declare namespace jsb {
* @return bool True if write success
*/
export function writeStringToFile (dataStr:string, fullPath:string):boolean;
/**
* Sets the array that contains the search order of the resources.
*
* @param searchResolutionsOrder The source array that contains the search order of the resources.
* @see getSearchResolutionsOrder(), fullPathForFilename(const char*).
* @since v2.1
* In js:var setSearchResolutionsOrder(var jsval)
* @lua NA
*/
export function setSearchResolutionsOrder (searchResolutionsOrder:Array<string>):void;
/**
* Append search order of the resources.
*
* @see setSearchResolutionsOrder(), fullPathForFilename().
* @since v2.1
*/
export function addSearchResolutionsOrder (order:string, front:boolean):void;

/**
* Add search path.
*
Expand Down Expand Up @@ -649,14 +591,6 @@ declare namespace jsb {
*/
export function setDefaultResourceRootPath (filepath:string):void;

/**
* Gets the array that contains the search order of the resources.
*
* @see setSearchResolutionsOrder(const std::vector<std::string>&), fullPathForFilename(const char*).
* @since v2.1
* @lua NA
*/
export function getSearchResolutionsOrder ():Array<string>;
/**
* Creates a directory.
*
Expand All @@ -675,7 +609,32 @@ declare namespace jsb {
* Gets the writable path.
* @return The path that can be write/read a file in
*/
export function getWritablePath ():string;
export function getWritablePath():string;

/**
* Renames a file under the given directory.
*
* @param oldFullpath The current fullpath of the file. Includes path and name.
* @param newFullPath The new fullpath of the file. Includes path and name.
* @return True if the file have been renamed successfully, false if not.
*/
export function renameFile(oldFullpath: string, newFullPath: string):boolean;

/**
* Creates binary data from a file.
* @param fullpath The current fullpath of the file. Includes path and name.
* @return A data object.
*/
export function getDataFromFile(fullpath: string):ArrayBuffer;

/**
* write Data into a file
*
*@param data the data want to save
*@param fullpath The full path to the file you want to save a string
*@return bool
*/
export function writeDataToFile(buffer: ArrayBuffer, fullpath: string):boolean;
}

/**
Expand Down
20 changes: 19 additions & 1 deletion cocos/3d/assets/mesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { warnID } from '../../core/platform/debug';
import { RenderingSubMesh } from '../../core/assets';
import {
Attribute, Device, Buffer, BufferInfo, AttributeName, BufferUsageBit, Feature, Format,
FormatInfos, FormatType, MemoryUsageBit, PrimitiveMode, getTypedArrayConstructor, DrawInfo,
FormatInfos, FormatType, MemoryUsageBit, PrimitiveMode, getTypedArrayConstructor, DrawInfo, FormatInfo,
} from '../../core/gfx';
import { Mat4, Quat, Vec3 } from '../../core/math';
import { Morph } from './morph';
Expand Down Expand Up @@ -1224,6 +1224,24 @@ export class Mesh extends Asset {
return true;
}

/**
* @en Read the format by attributeName of submesh
* @zh 根据属性名读取子网格的属性信息。
* @param primitiveIndex @en Sub mesh index @zh 子网格索引
* @param attributeName @en Attribute name @zh 属性名称
* @returns @en Return null if failed to read format, return the format otherwise. @zh 读取失败返回 null, 否则返回 format
*/
public readAttributeFormat(primitiveIndex: number, attributeName: AttributeName): FormatInfo | null {
let result: FormatInfo | null = null;

this._accessAttribute(primitiveIndex, attributeName, (vertexBundle, iAttribute) => {
const format = vertexBundle.attributes[iAttribute].format;
result = FormatInfos[format];
});

return result;
}

private _accessAttribute (
primitiveIndex: number,
attributeName: AttributeName,
Expand Down
2 changes: 1 addition & 1 deletion cocos/3d/lights/light-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export class Light extends Component {

protected _destroyLight () {
if (this._light) {
legacyCC.director.root.destroyLight(this._light);
legacyCC.director.root.recycleLight(this._light);
this._light = null;
}
}
Expand Down
10 changes: 10 additions & 0 deletions cocos/3d/skeletal-animation/skeletal-animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,16 @@ export class SkeletalAnimation extends Animation {
this._removeAllUsers();
}

public onEnable () {
super.onEnable();
this._currentBakedState?.resume();
}

public onDisable () {
super.onDisable();
this._currentBakedState?.pause();
}

public start () {
this.sockets = this._sockets;
this.useBakedAnimation = this._useBakedAnimation;
Expand Down
10 changes: 8 additions & 2 deletions cocos/core/animation/marionette/graph-eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,13 @@ export interface MotionStateStatus {
/**
* @en
* The normalized time of the state.
* It would be the fraction part of `elapsed-time / duration` if elapsed time is non-negative,
* and would be 1 plus the fraction part of `(elapsed-time / duration)` otherwise.
* This is **NOT** the clip's progress if the state is not a clip motion or its wrap mode isn't loop.
* @zh
* 状态的规范化进度。
* 状态的规范化时间。
* 如果流逝的时间是非负的,它就是 `流逝时间 / 周期` 的小数部分;否则,它是 `(流逝时间 / 周期)` 的小数部分加 1。
* 它并不一定代表剪辑的进度,因为该状态可能并不是一个剪辑动作,或者它的循环模式并非循环。
*/
progress: number;
}
Expand Down Expand Up @@ -1335,7 +1340,8 @@ function calcProgressUpdate (currentProgress: number, duration: number, deltaTim
}

function normalizeProgress (progress: number) {
return progress - Math.trunc(progress);
const signedFrac = progress - Math.trunc(progress);
return signedFrac >= 0.0 ? signedFrac : (1.0 + signedFrac);
}

interface MotionEvalPort {
Expand Down
4 changes: 2 additions & 2 deletions cocos/core/assets/image-asset.jsb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export type ImageSource = HTMLCanvasElement | HTMLImageElement | IMemoryImageSou
const extnames = ['.png', '.jpg', '.jpeg', '.bmp', '.webp', '.pvr', '.pkm', '.astc'];

function isImageBitmap (imageSource: any): boolean {
return !!(legacyCC.sys.capabilities.imageBitmap && imageSource instanceof ImageBitmap);
return !!(legacyCC.sys.hasFeature(legacyCC.sys.Feature.IMAGE_BITMAP) && imageSource instanceof ImageBitmap);
}

function isNativeImage (imageSource: ImageSource): imageSource is (HTMLImageElement | HTMLCanvasElement | ImageBitmap) {
Expand Down Expand Up @@ -237,7 +237,7 @@ imageAssetProto._deserialize = function (data: any) {
} else if ((fmt === PixelFormat.RGB_ETC2 || fmt === PixelFormat.RGBA_ETC2)
&& (!device || !(device.getFormatFeatures(Format.ETC2_RGB8) & FormatFeatureBit.SAMPLED_TEXTURE))) {
continue;
} else if (tmpExt === '.webp' && !legacyCC.sys.capabilities.webp) {
} else if (tmpExt === '.webp' && !legacyCC.sys.hasFeature(legacyCC.sys.Feature.WEBP)) {
continue;
}
preferedExtensionIndex = index;
Expand Down
Loading

0 comments on commit fdbcb89

Please sign in to comment.