mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4992692780 | |||
| c3a8a72f63 | |||
| 2c0e75059f | |||
| 19f4bd5b16 | |||
| 085d05928d | |||
| fb4d586629 | |||
| 620d38cf42 | |||
| d2713fe00e | |||
| 3aeb193d42 | |||
| c4e4790ee6 | |||
| 143af30cf2 | |||
| d6ff23fed4 | |||
| 84e8d4ebf7 | |||
| f2b9936033 | |||
| 129eb437ad |
@@ -483,8 +483,8 @@ jobs:
|
||||
echo "set(CC_USE_GLES3 OFF)" >> build-mac/proj/cfg.cmake
|
||||
echo "set(CC_USE_METAL ON)" >> build-mac/proj/cfg.cmake
|
||||
# Test JSVM v8 backend on macOS.
|
||||
echo "set(USE_SE_V8 OFF)" >> build-mac/proj/cfg.cmake
|
||||
echo "set(USE_SE_JSVM ON)" >> build-mac/proj/cfg.cmake
|
||||
echo "set(USE_SE_V8 ON)" >> build-mac/proj/cfg.cmake
|
||||
echo "set(USE_SE_JSVM OFF)" >> build-mac/proj/cfg.cmake
|
||||
echo "set(USE_WEBSOCKET_SERVER OFF)" >> build-mac/proj/cfg.cmake
|
||||
echo "set(CMAKE_CXX_STANDARD_REQUIRED ON)" >> build-mac/proj/cfg.cmake
|
||||
echo "set(CC_EXECUTABLE_NAME \"\")" >> build-mac/proj/cfg.cmake
|
||||
@@ -493,7 +493,6 @@ jobs:
|
||||
RES_DIR=$GITHUB_WORKSPACE/templates/mac/build-mac
|
||||
cd build-mac
|
||||
cmake ../ -GXcode -DCMAKE_OSX_ARCHITECTURES=${{ matrix.config.arch }} -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$NATIVE_ROOT
|
||||
set +e
|
||||
cmake --build . --config Release -- -jobs $NUM_OF_CORES -arch ${{ matrix.config.arch }}
|
||||
echo "Compile MacOSX Release Done!"
|
||||
|
||||
@@ -534,7 +533,7 @@ jobs:
|
||||
echo "set(CC_USE_VULKAN OFF)" >> build-ios/proj/cfg.cmake
|
||||
echo "set(CC_USE_GLES2 OFF)" >> build-ios/proj/cfg.cmake
|
||||
echo "set(CC_USE_METAL ON)" >> build-ios/proj/cfg.cmake
|
||||
echo "set(TARGET_IOS_VERSION 12.0)" >> build-ios/proj/cfg.cmake
|
||||
echo "set(TARGET_IOS_VERSION 13.0)" >> build-ios/proj/cfg.cmake
|
||||
echo "set(USE_WEBSOCKET_SERVER OFF)" >> build-ios/proj/cfg.cmake
|
||||
echo "set(USE_DRAGONBONES OFF)" >> build-ios/proj/cfg.cmake
|
||||
echo "set(CMAKE_CXX_STANDARD_REQUIRED OFF)" >> build-ios/proj/cfg.cmake
|
||||
@@ -548,7 +547,6 @@ jobs:
|
||||
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.config.arch }} \
|
||||
-DRES_DIR=$RES_DIR \
|
||||
-DCOCOS_X_PATH=$NATIVE_ROOT
|
||||
set +e
|
||||
#cmake --build . --config Debug -- -quiet -jobs $NUM_OF_CORES -allowProvisioningUpdates CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
|
||||
cmake --build . --config Debug -- -jobs $NUM_OF_CORES CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
|
||||
echo "Compile iOS Done!"
|
||||
|
||||
@@ -3980,3 +3980,7 @@ Debug bones or slots is invalid in cached mode.
|
||||
### 16419
|
||||
|
||||
Spine version not supported.
|
||||
|
||||
### 16420
|
||||
|
||||
Start time must bigger than end time.
|
||||
|
||||
@@ -266,6 +266,15 @@ export class Graphics extends UIRenderer {
|
||||
this._updateMtlForGraphics();
|
||||
}
|
||||
|
||||
protected override get _keepRenderData (): boolean {
|
||||
// Graphics is a retained-mode renderer: its MeshRenderData is the result of the
|
||||
// user's previous fill()/stroke() calls. Destroying it here would leave Impl's
|
||||
// render-data list pointing at cleared geometry, so re-enabling the node on native
|
||||
// platforms would require the user to draw the paths again. Keep it attached to the
|
||||
// disabled RenderEntity; clear() and onDestroy() remain the owning release points.
|
||||
return true;
|
||||
}
|
||||
|
||||
public onDestroy (): void {
|
||||
this._sceneGetter = null;
|
||||
if (JSB) {
|
||||
|
||||
@@ -398,12 +398,23 @@ export class UIRenderer extends Renderer {
|
||||
this.node.off(NodeEventType.ANCHOR_CHANGED, this._nodeStateChange, this);
|
||||
this.node.off(NodeEventType.SIZE_CHANGED, this._nodeStateChange, this);
|
||||
this.node.off(NodeEventType.PARENT_CHANGED, this._colorDirty, this);
|
||||
this.destroyRenderData();
|
||||
if (!this._keepRenderData) {
|
||||
this.destroyRenderData();
|
||||
}
|
||||
uiRendererManager.removeRenderer(this);
|
||||
this._renderFlag = false;
|
||||
this._renderEntity.enabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to keep render data when the component leaves the active hierarchy.
|
||||
* Retained-mode renderers may override this policy and keep their render data until
|
||||
* the content is explicitly cleared or the component is destroyed.
|
||||
*/
|
||||
protected get _keepRenderData (): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public onDestroy (): void {
|
||||
this._renderEntity.setNode(null);
|
||||
if (this.node._uiProps.uiComp === this) {
|
||||
|
||||
@@ -29,7 +29,6 @@ import { PipelineStateManager } from './pipeline-state-manager';
|
||||
import { Model, Camera, SubModel } from '../render-scene/scene';
|
||||
import { RenderInstancedQueue } from './render-instanced-queue';
|
||||
import { ShadowType } from '../render-scene/scene/shadows';
|
||||
import { Layers } from '../scene-graph/layers';
|
||||
import { PipelineRuntime } from './custom/pipeline';
|
||||
import { BatchingSchemes, Pass } from '../render-scene/core/pass';
|
||||
import { getPhaseID } from './pass-phase';
|
||||
@@ -83,18 +82,16 @@ export class PlanarShadowQueue {
|
||||
|
||||
const scene = camera.scene!;
|
||||
const frustum = camera.frustum;
|
||||
const shadowVisible = (camera.visibility & Layers.BitMask.DEFAULT) !== 0;
|
||||
const shadowVisible = camera.visibility !== 0;
|
||||
if (!scene.mainLight || !shadowVisible) { return; }
|
||||
|
||||
const models = scene.models;
|
||||
const visibility = camera.visibility;
|
||||
for (let i = 0; i < models.length; i++) {
|
||||
const model = models[i];
|
||||
if (scene.isCulledByLod(camera, model)) {
|
||||
continue;
|
||||
}
|
||||
if (model.enabled && model.node && model.castShadow
|
||||
&& (model.node && ((visibility & model.node.layer) === model.node.layer))) {
|
||||
if (model.enabled && model.node && model.castShadow) {
|
||||
this._castModels.push(model);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ export class RenderAdditiveLightQueue {
|
||||
private declare _lightBuffer: Buffer;
|
||||
private declare _firstLightBufferView: Buffer;
|
||||
private declare _lightBufferData: Float32Array;
|
||||
private _instancedQueues: RenderInstancedQueue[] = [];
|
||||
private _instancedQueues: (RenderInstancedQueue | undefined)[] = [];
|
||||
private _lightMeterScale = 10000.0;
|
||||
|
||||
constructor (pipeline: PipelineRuntime) {
|
||||
@@ -151,7 +151,9 @@ export class RenderAdditiveLightQueue {
|
||||
|
||||
public clear (): void {
|
||||
this._instancedQueues.forEach((instancedQueue) => {
|
||||
instancedQueue.clear();
|
||||
if (instancedQueue) {
|
||||
instancedQueue.clear();
|
||||
}
|
||||
});
|
||||
this._instancedQueues.length = 0;
|
||||
|
||||
@@ -235,18 +237,21 @@ export class RenderAdditiveLightQueue {
|
||||
}
|
||||
|
||||
this._instancedQueues.forEach((instancedQueue) => {
|
||||
instancedQueue.uploadBuffers(cmdBuff);
|
||||
if (instancedQueue) {
|
||||
instancedQueue.uploadBuffers(cmdBuff);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public recordCommandBuffer (device: Device, renderPass: RenderPass, cmdBuff: CommandBuffer): void {
|
||||
const globalDSManager: GlobalDSManager = this._pipeline.globalDSManager;
|
||||
for (let j = 0; j < this._instancedQueues.length; ++j) {
|
||||
if (!this._instancedQueues[j]) { continue; }
|
||||
const queue = this._instancedQueues[j];
|
||||
if (!queue) { continue; }
|
||||
const light = this._instancedLightPassPool.lights[j];
|
||||
_dynamicOffsets[0] = this._instancedLightPassPool.dynamicOffsets[j];
|
||||
const descriptorSet = globalDSManager.getOrCreateDescriptorSet(light);
|
||||
this._instancedQueues[j].recordCommandBuffer(device, renderPass, cmdBuff, descriptorSet, _dynamicOffsets);
|
||||
queue.recordCommandBuffer(device, renderPass, cmdBuff, descriptorSet, _dynamicOffsets);
|
||||
}
|
||||
|
||||
for (let i = 0; i < this._lightPasses.length; i++) {
|
||||
@@ -315,7 +320,8 @@ export class RenderAdditiveLightQueue {
|
||||
const lightIdx = _lightIndices[l];
|
||||
const light = validPunctualLights[lightIdx];
|
||||
const visibility = light.visibility;
|
||||
if (((visibility & model.node.layer) === model.node.layer)) {
|
||||
if (((visibility & model.node.layer) === model.node.layer)
|
||||
|| (visibility & model.visFlags)) {
|
||||
switch (batchingScheme) {
|
||||
case BatchingSchemes.INSTANCING: {
|
||||
const buffer = pass.getInstancedBuffer(lightIdx);
|
||||
@@ -325,7 +331,7 @@ export class RenderAdditiveLightQueue {
|
||||
this._instancedQueues.length = lightIdx + 1;
|
||||
this._instancedQueues[lightIdx] = new RenderInstancedQueue();
|
||||
}
|
||||
this._instancedQueues[lightIdx].queue.add(buffer);
|
||||
this._instancedQueues[lightIdx]!.queue.add(buffer);
|
||||
} break;
|
||||
default:
|
||||
lp!.lights.push(light);
|
||||
|
||||
@@ -195,8 +195,8 @@ export function sceneCulling (sceneData: PipelineSceneData, pipelineUBO: Pipelin
|
||||
csmLayerObjects.push(getRenderObject(model, camera));
|
||||
}
|
||||
|
||||
if (model.node && ((visibility & model.node.layer) === model.node.layer)
|
||||
|| (visibility & model.visFlags)) {
|
||||
if ((model.node && ((visibility & model.node.layer) === model.node.layer))
|
||||
|| (visibility & model.visFlags)) {
|
||||
// frustum culling
|
||||
if (model.worldBounds && !geometry.intersect.aabbFrustum(model.worldBounds, camera.frustum)) {
|
||||
return;
|
||||
|
||||
+11
-5
@@ -27,7 +27,7 @@ import { Material, Texture2D } from '../asset/assets';
|
||||
import { error, errorID, logID, warnID } from '../core/platform/debug';
|
||||
import { Enum, EnumType, ccenum } from '../core/value-types/enum';
|
||||
import { Node, NodeEventType } from '../scene-graph';
|
||||
import { CCObjectFlags, Color, RecyclePool, js } from '../core';
|
||||
import { CCObjectFlags, Color, RecyclePool, js, math } from '../core';
|
||||
import { SkeletonData } from './skeleton-data';
|
||||
import type { Graphics } from '../2d/components/graphics';
|
||||
import { UIRenderer } from '../2d/framework/ui-renderer';
|
||||
@@ -1883,10 +1883,16 @@ export class Skeleton extends UIRenderer {
|
||||
*/
|
||||
public setTrackCompleteListener (entry: spine.TrackEntry, listener: TrackListener2): void {
|
||||
const onComplete = (trackEntry: spine.TrackEntry): void => {
|
||||
const loopCount = Math.floor(trackEntry.trackTime / trackEntry.animationEnd);
|
||||
listener(trackEntry, loopCount);
|
||||
// this._instance.setListener(listenerID, spine.EventType.event);
|
||||
// this._listener!.event = listener;
|
||||
const animEnd = math.equals(trackEntry.animationEnd, -1.0) ? trackEntry.animation.duration : trackEntry.animationEnd;
|
||||
const duration = animEnd - trackEntry.animationStart;
|
||||
if (duration > 0) {
|
||||
const loopCount = trackEntry.loop ? Math.floor(trackEntry.trackTime / duration) : 1;
|
||||
listener(trackEntry, loopCount);
|
||||
// this._instance.setListener(listenerID, spine.EventType.event);
|
||||
// this._listener!.event = listener;
|
||||
} else {
|
||||
warnID(16420);
|
||||
}
|
||||
};
|
||||
TrackEntryListeners.getListeners(entry, this._instance!).complete = onComplete;
|
||||
}
|
||||
|
||||
@@ -81,9 +81,10 @@ vec3 CalculateNormal(vec3 tangent, vec3 binormal)
|
||||
// return value is un-normalized
|
||||
vec3 CalculateNormalFromTangentSpace(vec3 normalFromTangentSpace, float normalStrength, vec3 normal, vec3 tangent, float mirrorNormal)
|
||||
{
|
||||
// according to the linearly interpolated mirrorNormal value, the binormal length should vary linearly to ensure geometric smoothness. therefore, explicit normalization is unnecessary.
|
||||
vec3 binormal = CalculateBinormal(normal, tangent, mirrorNormal);
|
||||
return (normalFromTangentSpace.x * normalStrength) * normalize(tangent) +
|
||||
(normalFromTangentSpace.y * normalStrength) * normalize(binormal) +
|
||||
(normalFromTangentSpace.y * normalStrength) * binormal +
|
||||
normalFromTangentSpace.z * normalize(normal);
|
||||
}
|
||||
|
||||
|
||||
@@ -3725,9 +3725,14 @@ if(APPLE)
|
||||
"$(inherited)"
|
||||
${CC_EXTERNAL_LIBS}
|
||||
)
|
||||
if(CMAKE_OSX_ARCHITECTURES)
|
||||
set(_CC_ENGINE_ARCHS "${CMAKE_OSX_ARCHITECTURES}")
|
||||
else()
|
||||
set(_CC_ENGINE_ARCHS "arm64;x86_64")
|
||||
endif()
|
||||
set_target_properties(${ENGINE_NAME} PROPERTIES
|
||||
XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH "YES"
|
||||
OSX_ARCHITECTURES "arm64;x86_64"
|
||||
OSX_ARCHITECTURES "${_CC_ENGINE_ARCHS}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/archives
|
||||
)
|
||||
if(MACOSX)
|
||||
@@ -3739,9 +3744,9 @@ if(APPLE)
|
||||
)
|
||||
elseif(IOS)
|
||||
|
||||
if("${XCODE_VERSION}" VERSION_GREATER_EQUAL "15.0")
|
||||
# For Xcode 15 and newer, add extra link flags to fix crash in __cxx_global_var_init.
|
||||
message(STATUS "Using Xcode 15 or newer, adding extra link flags: -Wl,-ld_classic.")
|
||||
if("${XCODE_VERSION}" VERSION_GREATER_EQUAL "15.0" AND "${XCODE_VERSION}" VERSION_LESS "15.1")
|
||||
# Xcode 15.0 new linker crashes on weak symbols (114813650), fixed in 15.1.
|
||||
message(STATUS "Xcode ${XCODE_VERSION}: adding -Wl,-ld_classic to work around weak symbol crash.")
|
||||
target_link_options(${ENGINE_NAME} PUBLIC -Wl,-ld_classic)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ if("$ENV{COCOS_ENGINE_DEV}" EQUAL "1")
|
||||
set(WERROR_FLAGS "-Werror -Werror=return-type") # -Wshorten-64-to-32 -Werror=return-type
|
||||
|
||||
if(APPLE)
|
||||
set(WERROR_FLAGS " ${WERROR_FLAGS} -Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-unqualified-std-cast-call")
|
||||
set(WERROR_FLAGS " ${WERROR_FLAGS} -Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-unqualified-std-cast-call -Wno-nontrivial-memcall")
|
||||
elseif(LINUX)
|
||||
set(WERROR_FLAGS " ${WERROR_FLAGS} -Wno-nullability-completeness -Wno-deprecated-declarations")
|
||||
elseif(ANDROID)
|
||||
|
||||
@@ -699,7 +699,7 @@ static bool js_Model_setInstancedAttribute(se::State &s) // NOLINT(readability-i
|
||||
value[i] = dataVal.toFloat();
|
||||
}
|
||||
|
||||
cobj->setInstancedAttribute(name, value);
|
||||
cobj->setInstancedAttribute(name, std::move(value));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2022-2025 Xiamen Yaji Software Co., Ltd.
|
||||
Copyright (c) 2022-2026 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
@@ -23,11 +23,11 @@ THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#define COCOS_MAJOR_VERSION 3
|
||||
#define COCOS_MINJOR_VERSION 8
|
||||
#define COCOS_PATCH_VERSION 8
|
||||
#define COCOS_VERSION_STRING "3.8.8"
|
||||
#define COCOS_MAJOR_VERSION 4
|
||||
#define COCOS_MINJOR_VERSION 0
|
||||
#define COCOS_PATCH_VERSION 0
|
||||
#define COCOS_VERSION_STRING "4.0.0"
|
||||
#define COCOS_VERSION_DEFINED 1
|
||||
#define COCOS_VERSION 30808
|
||||
#define COCOS_VERSION 40000
|
||||
|
||||
// #define COCOS_PRE_RELEASE "release"
|
||||
// #define COCOS_PRE_RELEASE "alpha"
|
||||
|
||||
@@ -623,6 +623,7 @@ ccstd::unordered_map<uint32_t, ccstd::string> debugInfos = {
|
||||
{ 16417, "'clearTrack' interface can not be invoked in cached mode." },
|
||||
{ 16418, "Debug bones or slots is invalid in cached mode." },
|
||||
{ 16419, "Spine version not supported." },
|
||||
{ 16420, "Start time must bigger than end time." },
|
||||
|
||||
};
|
||||
}//namespace cc
|
||||
|
||||
@@ -1033,6 +1033,7 @@ bool SkeletonRenderer::setAttachment(const std::string &slotName, const char *at
|
||||
|
||||
void SkeletonRenderer::setUseTint(bool enabled) {
|
||||
_useTint = enabled;
|
||||
_needClearMaterialCaches = true;
|
||||
}
|
||||
|
||||
#if CC_USE_SPINE_3_8
|
||||
|
||||
@@ -59,7 +59,7 @@ void PlanarShadowQueue::gatherShadowPasses(scene::Camera *camera, gfx::CommandBu
|
||||
}
|
||||
|
||||
const auto *scene = camera->getScene();
|
||||
const bool shadowVisible = camera->getVisibility() & static_cast<uint32_t>(LayerList::DEFAULT);
|
||||
const bool shadowVisible = camera->getVisibility() != 0;
|
||||
if (!scene->getMainLight() || !shadowVisible) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -154,13 +154,17 @@ void RenderAdditiveLightQueue::gatherLightPasses(const scene::Camera *camera, gf
|
||||
_instancedLightPass.dynamicOffsets.emplace_back(_lightBufferStride * l);
|
||||
}
|
||||
for (const auto &instancedQueue : _instancedQueues) {
|
||||
instancedQueue->uploadBuffers(cmdBuffer);
|
||||
if (instancedQueue) {
|
||||
instancedQueue->uploadBuffers(cmdBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RenderAdditiveLightQueue::clear() {
|
||||
for (const auto &instancedQueue : _instancedQueues) {
|
||||
instancedQueue->clear();
|
||||
if (instancedQueue) {
|
||||
instancedQueue->clear();
|
||||
}
|
||||
}
|
||||
_instancedQueues.clear();
|
||||
_lightPasses.clear();
|
||||
@@ -204,7 +208,8 @@ void RenderAdditiveLightQueue::addRenderQueue(scene::SubModel *subModel, const s
|
||||
const auto lightIdx = _lightIndices[i];
|
||||
const auto *light = _validPunctualLights[lightIdx];
|
||||
const auto visibility = light->getVisibility();
|
||||
if ((visibility & model->getNode()->getLayer()) == model->getNode()->getLayer()) {
|
||||
if (((visibility & model->getNode()->getLayer()) == model->getNode()->getLayer()) ||
|
||||
(visibility & static_cast<uint32_t>(model->getVisFlags()))) {
|
||||
switch (batchingScheme) {
|
||||
case scene::BatchingSchemes::INSTANCING: {
|
||||
auto *buffer = pass->getInstancedBuffer(lightIdx);
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
"type": "github",
|
||||
"owner": "cocos",
|
||||
"name": "cocos-engine-external",
|
||||
"checkout": "v4.0.0-4"
|
||||
"checkout": "v4.0.0-7"
|
||||
}
|
||||
}
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "cocos-creator",
|
||||
"version": "4.0.0-alpha.27",
|
||||
"version": "4.0.0-alpha.29",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "cocos-creator",
|
||||
"version": "4.0.0-alpha.27",
|
||||
"version": "4.0.0-alpha.29",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cocos-creator",
|
||||
"version": "4.0.0-alpha.27",
|
||||
"version": "4.0.0-alpha.29",
|
||||
"description": "Cocos Creator is a cross-platform 2D & 3D game engine written in C++ and TypeScript, licensed under MIT.",
|
||||
"homepage": "http://www.cocos.com",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -155,8 +155,14 @@ const cacheManager = require('./jsb-cache-manager');
|
||||
animation.setCompleteListener = function (listener) {
|
||||
this._compeleteListener = listener;
|
||||
this.setCompleteListenerNative(function (trackEntry) {
|
||||
const loopCount = Math.floor(trackEntry.trackTime / trackEntry.animationEnd);
|
||||
this._compeleteListener && this._compeleteListener(trackEntry, loopCount);
|
||||
const animEnd = Math.abs(trackEntry.animationEnd - (-1.0)) < Number.EPSILON ? trackEntry.animation.duration : trackEntry.animationEnd;
|
||||
const duration = animEnd - trackEntry.animationStart;
|
||||
if (duration > 0) {
|
||||
const loopCount = trackEntry.loop ? Math.floor(trackEntry.trackTime / duration) : 1;
|
||||
this._compeleteListener && this._compeleteListener(trackEntry, loopCount);
|
||||
} else {
|
||||
cc.errorID(16420);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -164,8 +170,14 @@ const cacheManager = require('./jsb-cache-manager');
|
||||
animation.setTrackCompleteListener = function (trackEntry, listener) {
|
||||
this._trackCompeleteListener = listener;
|
||||
this.setTrackCompleteListenerNative(trackEntry, function (trackEntryNative) {
|
||||
const loopCount = Math.floor(trackEntryNative.trackTime / trackEntryNative.animationEnd);
|
||||
this._trackCompeleteListener && this._trackCompeleteListener(trackEntryNative, loopCount);
|
||||
const animEnd = Math.abs(trackEntryNative.animationEnd - (-1.0)) < Number.EPSILON ? trackEntryNative.animation.duration : trackEntryNative.animationEnd;
|
||||
const duration = animEnd - trackEntryNative.animationStart;
|
||||
if (duration > 0) {
|
||||
const loopCount = trackEntryNative.loop ? Math.floor(trackEntryNative.trackTime / duration) : 1;
|
||||
this._trackCompeleteListener && this._trackCompeleteListener(trackEntryNative, loopCount);
|
||||
} else {
|
||||
cc.errorID(16420);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ macro(cc_ios_after_target _target_name)
|
||||
MACOSX_DEPLOYMENT_TARGET "${TARGET_IOS_VERSION}"
|
||||
XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "${TARGET_IOS_VERSION}"
|
||||
XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "${DEVELOPMENT_TEAM}"
|
||||
OSX_ARCHITECTURES "arm64;x86_64"
|
||||
OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}"
|
||||
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
|
||||
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon"
|
||||
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_LAUNCHSTORYBOARD_NAME "LaunchScreen"
|
||||
@@ -95,12 +95,20 @@ macro(cc_ios_after_target _target_name)
|
||||
|
||||
cc_apple_set_launch_type(${CC_EXECUTABLE_NAME})
|
||||
|
||||
# # exclude arm64 arch and specify x86_64 for iphonesimulator by default, this will apply to both target.
|
||||
set(CMAKE_XCODE_ATTRIBUTE_EXCLUDED_ARCHS[sdk=iphonesimulator*] "arm64")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] "arm64")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "x86_64")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] "arm64")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "x86_64")
|
||||
# exclude arm64 arch and specify x86_64 for iphonesimulator by default, this will apply to both target.
|
||||
if(CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_EXCLUDED_ARCHS[sdk=iphonesimulator*] "")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] "arm64")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "arm64")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] "arm64")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "arm64")
|
||||
else()
|
||||
set(CMAKE_XCODE_ATTRIBUTE_EXCLUDED_ARCHS[sdk=iphonesimulator*] "arm64")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] "arm64")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "x86_64")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] "arm64")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "x86_64")
|
||||
endif()
|
||||
|
||||
set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ set(RES_DIR "" CACHE STRING "Resource path")
|
||||
set(COCOS_X_PATH "" CACHE STRING "Path to engine/native/")
|
||||
|
||||
set(TARGET_OSX_VERSION "10.14" CACHE STRING "Target MacOSX version" FORCE)
|
||||
set(TARGET_IOS_VERSION "11.0" CACHE STRING "Target iOS version" FORCE)
|
||||
set(TARGET_IOS_VERSION "13.0" CACHE STRING "Target iOS version" FORCE)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
option(CC_DEBUG_FORCE "Force enable CC_DEBUG in release mode" OFF)
|
||||
|
||||
@@ -5,6 +5,15 @@ set(APP_NAME "CocosGame" CACHE STRING "Project Name")
|
||||
|
||||
project(${APP_NAME} CXX)
|
||||
|
||||
# Xcode 14.3+ no longer supports running under Rosetta on Apple Silicon,
|
||||
# so iOS Simulator must use arm64 instead of x86_64.
|
||||
# See: https://developer.apple.com/documentation/xcode-release-notes/xcode-14_3-release-notes
|
||||
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64" AND "${XCODE_VERSION}" VERSION_GREATER_EQUAL "14.3")
|
||||
set(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "" FORCE)
|
||||
else()
|
||||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
set(CC_PROJECT_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
set(CC_UI_RESOURCES)
|
||||
set(CC_PROJ_SOURCES)
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import { Sprite } from '../../cocos/2d/components';
|
||||
import { Graphics } from '../../cocos/2d/components/graphics';
|
||||
import { MeshRenderData, RenderData } from '../../cocos/2d/renderer/render-data';
|
||||
import { Node } from '../../cocos/scene-graph/node';
|
||||
|
||||
describe('Graphics render-data lifecycle', () => {
|
||||
test('retains generated geometry while disabled', () => {
|
||||
const node = new Node('Graphics');
|
||||
const graphics = node.addComponent(Graphics);
|
||||
const renderData = MeshRenderData.add();
|
||||
renderData.vertexStart = 4;
|
||||
// Graphics binds MeshRenderData to UIRenderer only on JSB. Reproduce that
|
||||
// ownership boundary explicitly in the platform-independent unit test.
|
||||
graphics.setRenderData(renderData as unknown as RenderData);
|
||||
|
||||
graphics.onDisable();
|
||||
|
||||
expect(graphics.renderData).toBe(renderData);
|
||||
expect(renderData.vertexStart).toBe(4);
|
||||
|
||||
graphics.setRenderData(null);
|
||||
MeshRenderData.remove(renderData);
|
||||
node._destroyImmediate();
|
||||
});
|
||||
|
||||
test('ordinary UI renderers still release render data while disabled', () => {
|
||||
const node = new Node('Sprite');
|
||||
const sprite = node.addComponent(Sprite);
|
||||
const destroyRenderData = jest.spyOn(sprite, 'destroyRenderData');
|
||||
|
||||
sprite.onDisable();
|
||||
|
||||
expect(destroyRenderData).toHaveBeenCalledTimes(1);
|
||||
destroyRenderData.mockRestore();
|
||||
node._destroyImmediate();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user