Compare commits

..

8 Commits

Author SHA1 Message Date
yangchao 4992692780 update version, fix libwebp compile err. (#247) 2026-08-05 16:11:33 +08:00
hyde zhou c3a8a72f63 bump version to 4.0.0-alpha.29 (#237) 2026-08-02 21:25:47 +08:00
yangchao 2c0e75059f xcode > 14.3 apple silicon use arm64 arch for ios simulation。 (#214) 2026-08-02 17:52:06 +08:00
zxx43 19f4bd5b16 call ClearMaterialCaches when change tint state (#234) 2026-07-31 17:24:28 +08:00
徐兵 085d05928d fix(shader): fix lighting discontinuity at mirrored UV seams (#209) 2026-07-31 17:19:29 +08:00
Tianze-Chen fb4d586629 fix(2d): retain Graphics data while disabled (#230) 2026-07-31 17:03:55 +08:00
troublemaker52025 620d38cf42 Fix(legacy): only DEFAULT layer has lighting (#227) 2026-07-31 16:49:41 +08:00
zxx43 d2713fe00e fix loop duration time (#213) 2026-07-31 16:39:08 +08:00
23 changed files with 144 additions and 43 deletions
@@ -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!"
+4
View File
@@ -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.
+9
View File
@@ -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) {
+12 -1
View File
@@ -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) {
+2 -5
View File
@@ -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);
}
}
@@ -320,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);
+2 -2
View File
@@ -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
View File
@@ -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);
}
+9 -4
View File
@@ -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()
+1 -1
View File
@@ -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)
+1
View File
@@ -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;
}
@@ -208,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);
+1 -1
View File
@@ -3,6 +3,6 @@
"type": "github",
"owner": "cocos",
"name": "cocos-engine-external",
"checkout": "v4.0.0-4"
"checkout": "v4.0.0-7"
}
}
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "cocos-creator",
"version": "4.0.0-alpha.28",
"version": "4.0.0-alpha.29",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "cocos-creator",
"version": "4.0.0-alpha.28",
"version": "4.0.0-alpha.29",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cocos-creator",
"version": "4.0.0-alpha.28",
"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",
+16 -4
View File
@@ -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);
}
});
};
+15 -7
View File
@@ -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")
+1 -1
View File
@@ -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)
+9
View File
@@ -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)
+37
View File
@@ -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();
});
});