Compare commits

..

1 Commits

Author SHA1 Message Date
qiuguohua a855400c93 Move pal directory to private repository (#191) 2026-07-24 17:37:45 +08:00
38 changed files with 58 additions and 1161 deletions
+2 -8
View File
@@ -20,14 +20,8 @@ if ($env:GITHUB_BASE_REF) {
# Push
$gitHubEvent = Get-Content $env:GITHUB_EVENT_PATH | ConvertFrom-Json
Write-Host "GitHub event: $gitHubEvent"
$beforeSha = $gitHubEvent.before
# On tag creation or initial push, before is all zeros - skip diff in that case
if ($beforeSha -match '^0+$') {
Write-Host "No previous commit (tag creation or initial push). Skipping diff."
return
}
git fetch origin $beforeSha --depth=1
$diffFiles = git diff --name-only --diff-filter=$diffFilter $beforeSha $env:GITHUB_SHA
git fetch origin $gitHubEvent.before --depth=1
$diffFiles = git diff --name-only --diff-filter=$diffFilter $gitHubEvent.before $env:GITHUB_SHA
}
Write-Host "Diff files: $diffFiles"
+2 -2
View File
@@ -30,13 +30,13 @@ jobs:
cat $HOME/files.txt
mv $HOME/files.txt ${{github.workspace}}/files.txt
- uses: DoozyX/clang-format-lint-action@v0.18
- uses: fish9167/clang-format-lint-action@master
with:
source: ./native
exclude: ./native/cocos/bindings/auto
extensions: 'c,h,hpp,cpp,cxx'
style: file
inplace: true
inplace: True
clangFormatVersion: 12
- name: Create Pull Request
@@ -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 ON)" >> build-mac/proj/cfg.cmake
echo "set(USE_SE_JSVM OFF)" >> build-mac/proj/cfg.cmake
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_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,6 +493,7 @@ 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!"
@@ -533,7 +534,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 13.0)" >> build-ios/proj/cfg.cmake
echo "set(TARGET_IOS_VERSION 12.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
@@ -547,6 +548,7 @@ 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,7 +3980,3 @@ 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,15 +266,6 @@ 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) {
+1 -12
View File
@@ -398,23 +398,12 @@ 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);
if (!this._keepRenderData) {
this.destroyRenderData();
}
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) {
-52
View File
@@ -69,58 +69,6 @@ export function approx (a: number, b: number, maxDiff?: number): boolean {
return mathAbs(a - b) <= maxDiff;
}
/**
* @en Tests whether or not the first argument is approximately greater than or equal to the second
* @zh 测试第一个参数是否近似大于或等于第二个参数
* @param a The first number to test
* @param b The second number to test
* @param maxDiff Maximum difference (default: EPSILON)
* @return True if a is approximately greater than or equal to b, false otherwise
*/
export function approxGE (a: number, b: number, maxDiff?: number): boolean {
maxDiff = maxDiff || EPSILON;
return a >= b - maxDiff;
}
/**
* @en Tests whether or not the first argument is approximately less than or equal to the second
* @zh 测试第一个参数是否近似小于或等于第二个参数
* @param a The first number to test
* @param b The second number to test
* @param maxDiff Maximum difference (default: EPSILON)
* @return True if a is approximately less than or equal to b, false otherwise
*/
export function approxLE (a: number, b: number, maxDiff?: number): boolean {
maxDiff = maxDiff || EPSILON;
return a <= b + maxDiff;
}
/**
* @en Tests whether or not the first argument is approximately greater than the second
* @zh 测试第一个参数是否近似大于第二个参数
* @param a The first number to test
* @param b The second number to test
* @param maxDiff Maximum difference (default: EPSILON)
* @return True if a is approximately greater than b, false otherwise
*/
export function approxGT (a: number, b: number, maxDiff?: number): boolean {
maxDiff = maxDiff || EPSILON;
return a > b + maxDiff;
}
/**
* @en Tests whether or not the first argument is approximately less than the second
* @zh 测试第一个参数是否近似小于第二个参数
* @param a The first number to test
* @param b The second number to test
* @param maxDiff Maximum difference (default: EPSILON)
* @return True if a is approximately less than b, false otherwise
*/
export function approxLT (a: number, b: number, maxDiff?: number): boolean {
maxDiff = maxDiff || EPSILON;
return a < b - maxDiff;
}
/**
* @en Clamps a value between a minimum float and maximum float value.<br/>
* @zh 返回最小浮点数和最大浮点数之间的一个数值。可以使用 clamp 函数将不断变化的数值限制在范围内。
+2 -2
View File
@@ -23,7 +23,7 @@
*/
import { ccclass, type, serializable, editable, range } from 'cc.decorator';
import { approxGE, approxLT, repeat } from '../core/math';
import { repeat } from '../core/math';
import CurveRange from './animator/curve-range';
import type { ParticleSystem } from './particle-system';
@@ -108,7 +108,7 @@ export default class Burst {
let preFrameTime = repeat(psys.time - psys.startDelay.evaluate(0, 1), psys.duration) - dt;
preFrameTime = (preFrameTime > 0.0) ? preFrameTime : 0.0;
const curFrameTime = repeat(psys.time - psys.startDelay.evaluate(0, 1), psys.duration);
if (approxGE(this._curTime, preFrameTime) && approxLT(this._curTime, curFrameTime)) {
if (this._curTime >= preFrameTime && this._curTime < curFrameTime) {
psys.emit(this.count.evaluate(this._curTime / psys.duration, 1), dt - (curFrameTime - this._curTime));
this._curTime += this.repeatInterval;
--this._remainingCount;
+1 -23
View File
@@ -31,7 +31,7 @@ import { murmurhash2_32_gc, errorID, assertID, cclegacy, warnID } from '../../co
import {
BufferUsageBit, DynamicStateFlagBit, DynamicStateFlags, Feature, GetTypeSize, MemoryUsageBit, PrimitiveMode, Type, Color,
BlendState, BlendTarget, Buffer, BufferInfo, BufferViewInfo, DepthStencilState, DescriptorSet,
DescriptorSetInfo, DescriptorSetLayout, Device, RasterizerState, Sampler, SampleCount, Texture, Shader, PipelineLayout, deviceManager, UniformBlock,
DescriptorSetInfo, DescriptorSetLayout, Device, RasterizerState, Sampler, Texture, Shader, PipelineLayout, deviceManager, UniformBlock,
} from '../../gfx';
import { EffectAsset } from '../../asset/assets/effect-asset';
import { IProgramInfo, programLib } from './program-lib';
@@ -139,28 +139,6 @@ export class Pass {
if (bsInfo.isA2C !== undefined) { bs.isA2C = bsInfo.isA2C; }
if (bsInfo.isIndepend !== undefined) { bs.isIndepend = bsInfo.isIndepend; }
if (bsInfo.blendColor !== undefined) { bs.blendColor = bsInfo.blendColor as Color; }
// A2C (Alpha to Coverage) requires MSAA to be effective.
// Without multiple subsamples, A2C behaves like alpha-test at ~0.5 and should be disabled.
// Disable A2C when neither the pass nor the global framebuffer has MSAA enabled:
// - passWantsMultisample: pass explicitly requests isMultisample
// - globalMsaaEnabled: swapchain has MSAA (native: colorTexture.samples > X1;
// WebGL: antialias from gl.getContextAttributes(), since WebGL
// MSAA is controlled at context level, not texture level)
if (bs.isA2C) {
const gfxDevice = deviceManager.gfxDevice as any;
const gl: WebGL2RenderingContext | WebGLRenderingContext | null = gfxDevice.gl || null;
const ctxAttrs = gl && gl.getContextAttributes();
const antialias: boolean = !!(ctxAttrs && ctxAttrs.antialias);
const passWantsMultisample = (info.rasterizerState && info.rasterizerState.isMultisample === true);
const swapchain = deviceManager.swapchain;
const colorTex = swapchain && swapchain.colorTexture;
const msaaDisabled = (!colorTex || (colorTex && colorTex.samples <= SampleCount.X1))
|| !antialias || !passWantsMultisample;
if (msaaDisabled) {
bs.isA2C = false;
}
}
}
pass._rs.assign(info.rasterizerState as RasterizerState);
pass._dss.assign(info.depthStencilState as DepthStencilState);
-3
View File
@@ -91,9 +91,6 @@ export class PointLight extends Light {
* @en The luminance of the light source in LDR mode.
* @zh LDR 模式下光源的亮度。
*/
get luminanceLDR (): number {
return this._luminanceLDR;
}
set luminanceLDR (value: number) {
this._luminanceLDR = value;
}
-3
View File
@@ -102,9 +102,6 @@ export class SphereLight extends Light {
* @en The luminance of the light source in LDR mode
* @zh LDR 模式下光源的亮度
*/
get luminanceLDR (): number {
return this._luminanceLDR;
}
set luminanceLDR (value: number) {
this._luminanceLDR = value;
}
+5 -2
View File
@@ -29,6 +29,7 @@ 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';
@@ -82,16 +83,18 @@ export class PlanarShadowQueue {
const scene = camera.scene!;
const frustum = camera.frustum;
const shadowVisible = camera.visibility !== 0;
const shadowVisible = (camera.visibility & Layers.BitMask.DEFAULT) !== 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) {
if (model.enabled && model.node && model.castShadow
&& (model.node && ((visibility & model.node.layer) === model.node.layer))) {
this._castModels.push(model);
}
}
@@ -320,8 +320,7 @@ export class RenderAdditiveLightQueue {
const lightIdx = _lightIndices[l];
const light = validPunctualLights[lightIdx];
const visibility = light.visibility;
if (((visibility & model.node.layer) === model.node.layer)
|| (visibility & model.visFlags)) {
if (((visibility & model.node.layer) === model.node.layer)) {
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;
+5 -11
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, math } from '../core';
import { CCObjectFlags, Color, RecyclePool, js } from '../core';
import { SkeletonData } from './skeleton-data';
import type { Graphics } from '../2d/components/graphics';
import { UIRenderer } from '../2d/framework/ui-renderer';
@@ -1883,16 +1883,10 @@ export class Skeleton extends UIRenderer {
*/
public setTrackCompleteListener (entry: spine.TrackEntry, listener: TrackListener2): void {
const onComplete = (trackEntry: spine.TrackEntry): void => {
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);
}
const loopCount = Math.floor(trackEntry.trackTime / trackEntry.animationEnd);
listener(trackEntry, loopCount);
// this._instance.setListener(listenerID, spine.EventType.event);
// this._listener!.event = listener;
};
TrackEntryListeners.getListeners(entry, this._instance!).complete = onComplete;
}
@@ -81,10 +81,9 @@ 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) * binormal +
(normalFromTangentSpace.y * normalStrength) * normalize(binormal) +
normalFromTangentSpace.z * normalize(normal);
}
@@ -222,9 +222,7 @@ vec4 CCStandardShadingBase (StandardSurface s, vec4 shadowPos) {
vec3 R = normalize(reflect(-V, N));
#if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE
if(s.reflectionProbeId < 0.0){
#if CC_USE_IBL
env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == IBL_RGBE);
#endif
env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == IBL_RGBE);
}else{
vec3 centerPos, boxHalfSize;
float mipCount;
@@ -249,9 +247,7 @@ vec4 CCStandardShadingBase (StandardSurface s, vec4 shadowPos) {
env = unpackRGBE(probe);
#elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX
if (s.reflectionProbeId < 0.0) {
#if CC_USE_IBL
env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == IBL_RGBE);
#endif
env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == IBL_RGBE);
} else {
vec3 centerPos, boxHalfSize;
float mipCount;
@@ -260,10 +256,7 @@ vec4 CCStandardShadingBase (StandardSurface s, vec4 shadowPos) {
env = SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId));
if (s.reflectionProbeBlendId < 0.0) {
vec3 skyBoxEnv = vec3(0.0);
#if CC_USE_IBL
skyBoxEnv = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == IBL_RGBE) * lightIntensity;
#endif
vec3 skyBoxEnv = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == IBL_RGBE) * lightIntensity;
#if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX
//blend with skybox
env = mix(env, skyBoxEnv, s.reflectionProbeBlendFactor);
@@ -99,10 +99,7 @@ vec3 SampleEnvironmentSpecular(samplerCube tex, in LightingIntermediateData ligh
vec4 fixedR = CalculateBoxProjectedDirection(R, worldPos, cubeCenterPos, boxHalfSize);
R = fixedR.xyz;
vec3 envmap = vec3(0.0);
#if CC_USE_IBL
envmap = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w).xyz * cc_ambientSky.w;
#endif
vec3 envmap = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w).xyz * cc_ambientSky.w;
#if CC_SURFACES_LIGHTING_ANISOTROPIC && CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT
envSpec = EnvAnisotropicReflection(tex, fixedR.xyz, roughness, mipCount, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);
#if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE
@@ -162,9 +159,7 @@ vec3 CalculateEnvironmentSpecular(in LightingIntermediateData lightingData, floa
#if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE
if(FSInput_reflectionProbeId < 0.0){
#if CC_USE_IBL
envSpec = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w);
#endif
}else{
vec3 centerPos, boxHalfSize;
float mipCount;
@@ -186,9 +181,7 @@ vec3 CalculateEnvironmentSpecular(in LightingIntermediateData lightingData, floa
}
#elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX
if(FSInput_reflectionProbeId < 0.0){
#if CC_USE_IBL
envSpec = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w);
#endif
}else{
vec3 centerPos, boxHalfSize;
float mipCount;
@@ -204,10 +197,7 @@ vec3 CalculateEnvironmentSpecular(in LightingIntermediateData lightingData, floa
if(FSInput_reflectionProbeBlendId < 0.0)
{
vec3 skyBoxEnv = vec3(0.0);
#if CC_USE_IBL
skyBoxEnv = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w).rgb * lightIntensity;
#endif
vec3 skyBoxEnv = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w).rgb * lightIntensity;
#if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX
//blend with skybox
envSpec = mix(envSpec, skyBoxEnv, blendFactor);
+1 -1
View File
@@ -298,7 +298,7 @@ module.exports = link(mixin({
illuminance: 'Illuminance of the light',
luminous_power: 'Luminous power of the light',
luminance: 'Luminance of the light',
visibility: 'Visibility mask, declaring a set of node layers that will be visible in the current light source',
visibility: 'Visibility mask, declaring a set of node layers that will be visible to this valid punctual Light(Does not work with directional light)',
term: 'The photometric term currently being used',
size: 'Size of the light',
range: 'Range of the light',
+1 -1
View File
@@ -288,7 +288,7 @@ module.exports = link(mixin({
illuminance: '光源强度',
luminous_flux: '光通量',
luminance: '光亮度',
visibility: '可见性掩码,声明在当前光源中可见的节点层级集合',
visibility: '可见性掩码,声明在当前精确光源中可见的节点层级集合(对方向光不生效)',
term: '当前使用的光度学计量单位',
size: '光源大小',
range: '光源范围',
+4 -9
View File
@@ -3725,14 +3725,9 @@ 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 "${_CC_ENGINE_ARCHS}"
OSX_ARCHITECTURES "arm64;x86_64"
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/archives
)
if(MACOSX)
@@ -3744,9 +3739,9 @@ if(APPLE)
)
elseif(IOS)
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.")
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.")
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 -Wno-nontrivial-memcall")
set(WERROR_FLAGS " ${WERROR_FLAGS} -Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-unqualified-std-cast-call")
elseif(LINUX)
set(WERROR_FLAGS " ${WERROR_FLAGS} -Wno-nullability-completeness -Wno-deprecated-declarations")
elseif(ANDROID)
@@ -911,7 +911,7 @@ bool ScriptEngine::runByteCodeFile(const ccstd::string &pathBc, Value *ret /* =
internal::jsToSeValue(_isolate, result.ToLocalChecked(), ret);
}
SE_LOGD("ScriptEngine::runByteCodeFile success %s!\n", pathBc.c_str());
SE_LOGE("ScriptEngine::runByteCodeFile success %s!\n", pathBc.c_str());
return true;
}
-1
View File
@@ -623,7 +623,6 @@ 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,7 +1033,6 @@ 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
@@ -892,7 +892,7 @@ void CCVKCommandBuffer::pipelineBarrier(const GeneralBarrier *barrier, const Buf
signalEvent(ccBuffer, gpuBarrier->srcStageMask);
} else {
bool fullBarrier = ccBarrier->getInfo().type == BarrierType::FULL;
bool missed = _barrierEvents.find(ccBuffer) == _barrierEvents.end();
bool missed = _barrierEvents.find(ccBuffer) != _barrierEvents.end();
if (!fullBarrier && !missed) {
CC_ASSERT(_barrierEvents.find(ccBuffer) != _barrierEvents.end());
VkEvent event = _barrierEvents.at(ccBuffer);
@@ -966,8 +966,8 @@ void CCVKCommandBuffer::pipelineBarrier(const GeneralBarrier *barrier, const Buf
}
}
if (!fullBufferBarriers.empty() || !fullImageBarriers.empty() || pMemoryBarrier) {
vkCmdPipelineBarrier(_gpuCommandBuffer->vkCommandBuffer, fullSrcStageMask, fullDstStageMask, 0, pMemoryBarrier ? 1 : 0, pMemoryBarrier,
if (!fullBufferBarriers.empty() || !fullImageBarriers.empty()) {
vkCmdPipelineBarrier(_gpuCommandBuffer->vkCommandBuffer, fullSrcStageMask, fullDstStageMask, 0, 0, pMemoryBarrier,
fullBufferBarriers.size(), fullBufferBarriers.data(), fullImageBarriers.size(), fullImageBarriers.data());
}
}
@@ -59,7 +59,7 @@ void PlanarShadowQueue::gatherShadowPasses(scene::Camera *camera, gfx::CommandBu
}
const auto *scene = camera->getScene();
const bool shadowVisible = camera->getVisibility() != 0;
const bool shadowVisible = camera->getVisibility() & static_cast<uint32_t>(LayerList::DEFAULT);
if (!scene->getMainLight() || !shadowVisible) {
return;
}
@@ -208,8 +208,7 @@ 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()) ||
(visibility & static_cast<uint32_t>(model->getVisFlags()))) {
if ((visibility & model->getNode()->getLayer()) == model->getNode()->getLayer()) {
switch (batchingScheme) {
case scene::BatchingSchemes::INSTANCING: {
auto *buffer = pass->getInstancedBuffer(lightIdx);
-26
View File
@@ -119,32 +119,6 @@ void Pass::fillPipelineInfo(Pass *pass, const IPassInfoFull &info) {
if (info.blendState.has_value()) {
info.blendState.value().assignToGFXBlendState(pass->_blendState);
// A2C (Alpha to Coverage) requires MSAA to be effective.
// Without multiple subsamples, A2C behaves like alpha-test at ~0.5 and should be disabled.
// Disable A2C when neither the pass nor the global framebuffer has MSAA enabled:
// - passWantsMultisample: pass explicitly requests isMultisample
// - globalMsaaEnabled: swapchain colorTexture.samples > X1 (native backends only;
// WebGL MSAA is checked via gl.getContextAttributes() on the TS side)
if (pass->_blendState.isA2C) {
const bool passWantsMultisample =
(info.rasterizerState.has_value() && info.rasterizerState.value().isMultisample.has_value()
? info.rasterizerState.value().isMultisample.value() != 0
: pass->_rs.isMultisample != 0);
bool msaaDisabled = true;
const auto *device = gfx::Device::getInstance();
if (device) {
const auto &swapchains = device->getSwapchains();
if (!swapchains.empty() && swapchains[0] && swapchains[0]->getColorTexture()) {
msaaDisabled = (swapchains[0]->getColorTexture()->getInfo().samples <= gfx::SampleCount::X1) || !passWantsMultisample;
}
}
if (msaaDisabled) {
pass->_blendState.isA2C = 0;
}
}
}
if (info.rasterizerState.has_value()) {
+1 -1
View File
@@ -3,6 +3,6 @@
"type": "github",
"owner": "cocos",
"name": "cocos-engine-external",
"checkout": "v4.0.0-7"
"checkout": "v4.0.0-4"
}
}
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "cocos-creator",
"version": "4.0.0-alpha.30",
"version": "4.0.0-alpha.28",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "cocos-creator",
"version": "4.0.0-alpha.30",
"version": "4.0.0-alpha.28",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cocos-creator",
"version": "4.0.0-alpha.30",
"version": "4.0.0-alpha.28",
"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",
@@ -1,884 +0,0 @@
/****************************************************************************
Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
const cacheManager = require('./jsb-cache-manager');
// @ts-expect-error jsb polyfills
(function () {
if (globalThis.spine === undefined || globalThis.middleware === undefined) return;
if (cc.internal.SpineSkeletonData === undefined) return;
const spine = globalThis.spine;
const middleware = globalThis.middleware;
middleware.generateGetSet(spine);
// spine global time scale
Object.defineProperty(spine, 'timeScale', {
get () {
return this._timeScale;
},
set (value) {
this._timeScale = value;
spine.SkeletonAnimation.setGlobalTimeScale(value);
},
configurable: true,
});
const _slotColor = cc.color(0, 0, 255, 255);
const _boneColor = cc.color(255, 0, 0, 255);
const _meshColor = cc.color(255, 255, 0, 255);
const _originColor = cc.color(0, 255, 0, 255);
const skeletonDataProto = cc.internal.SpineSkeletonData.prototype;
let _gTextureIdx = 1;
const _textureKeyMap = {};
const _textureMap = new WeakMap();
const skeletonDataMgr = spine.SkeletonDataMgr.getInstance();
spine.skeletonDataMgr = skeletonDataMgr;
skeletonDataMgr.setDestroyCallback((textureIndex) => {
if (!textureIndex) return;
const texKey = _textureKeyMap[textureIndex];
if (texKey && _textureMap.has(texKey)) {
_textureMap.delete(texKey);
delete _textureKeyMap[textureIndex];
}
});
const skeletonCacheMgr = spine.SkeletonCacheMgr.getInstance();
spine.skeletonCacheMgr = skeletonCacheMgr;
skeletonDataProto.destroy = function () {
this.reset();
skeletonCacheMgr.removeSkeletonCache(this.mergedUUID());
cc.Asset.prototype.destroy.call(this);
};
skeletonDataProto.reset = function () {
if (this._skeletonCache) {
spine.disposeSkeletonData(this.mergedUUID());
this._jsbTextures = null;
this._skeletonCache = null;
}
this._atlasCache = null;
};
skeletonDataProto.getRuntimeData = function () {
if (!this._skeletonCache) {
this.init();
}
return this._skeletonCache;
};
skeletonDataProto.init = function () {
if (this._skeletonCache) return;
const uuid = this.mergedUUID();
if (!uuid) {
cc.errorID(7504);
return;
}
const atlasText = this.atlasText;
if (!atlasText) {
cc.errorID(7508, this.name);
return;
}
const textures = this.textures;
const textureNames = this.textureNames;
if (!(textures && textures.length > 0 && textureNames && textureNames.length > 0)) {
cc.errorID(7507, this.name);
return;
}
const jsbTextures = {};
for (let i = 0; i < textures.length; ++i) {
const texture = textures[i];
const textureIdx = this.recordTexture(texture);
const spTex = new middleware.Texture2D();
spTex.setRealTextureIndex(textureIdx);
spTex.setPixelsWide(texture.width);
spTex.setPixelsHigh(texture.height);
spTex.setRealTexture(texture);
jsbTextures[textureNames[i]] = spTex;
}
this._jsbTextures = jsbTextures;
let filePath = this.skeletonJsonStr;
if (!filePath) {
filePath = cacheManager.getCache(this.nativeUrl) || this.nativeUrl;
}
this._skeletonCache = spine.initSkeletonData(uuid, filePath, atlasText, jsbTextures, this.scale);
if (this._skeletonCache) {
this.width = this._skeletonCache.width;
this.height = this._skeletonCache.height;
}
};
skeletonDataProto.recordTexture = function (texture) {
const index = _gTextureIdx;
const texKey = _textureKeyMap[index] = { key: index };
_textureMap.set(texKey, texture);
_gTextureIdx++;
return index;
};
skeletonDataProto.getTextureByIndex = function (textureIdx) {
const texKey = _textureKeyMap[textureIdx];
if (!texKey) return null;
return _textureMap.get(texKey);
};
const animation = spine.SkeletonAnimation.prototype;
// The methods are added to be compatibility with old versions.
animation.setCompleteListener = function (listener) {
this._compeleteListener = listener;
this.setCompleteListenerNative(function (trackEntry) {
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);
}
});
};
// The methods are added to be compatibility with old versions.
animation.setTrackCompleteListener = function (trackEntry, listener) {
this._trackCompeleteListener = listener;
this.setTrackCompleteListenerNative(trackEntry, function (trackEntryNative) {
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);
}
});
};
// Temporary solution before upgrade the Spine API
animation.setAnimationListener = function (target, callback) {
this._target = target;
this._callback = callback;
const AnimationEventType = cc.internal.SpineAnimationEventType;
this.setStartListener(function (trackEntry) {
if (this._target && this._callback) {
this._callback.call(this._target, this, trackEntry, AnimationEventType.START, null, 0);
}
});
this.setInterruptListener(function (trackEntry) {
if (this._target && this._callback) {
this._callback.call(this._target, this, trackEntry, AnimationEventType.INTERRUPT, null, 0);
}
});
this.setEndListener(function (trackEntry) {
if (this._target && this._callback) {
this._callback.call(this._target, this, trackEntry, AnimationEventType.END, null, 0);
}
});
this.setDisposeListener(function (trackEntry) {
if (this._target && this._callback) {
this._callback.call(this._target, this, trackEntry, AnimationEventType.DISPOSE, null, 0);
}
});
this.setCompleteListener(function (trackEntry, loopCount) {
if (this._target && this._callback) {
this._callback.call(this._target, this, trackEntry, AnimationEventType.COMPLETE, null, loopCount);
}
});
this.setEventListener(function (trackEntry, event) {
if (this._target && this._callback) {
this._callback.call(this._target, this, trackEntry, AnimationEventType.EVENT, event, 0);
}
});
};
const skeleton = cc.internal.SpineSkeleton.prototype;
const AnimationCacheMode = cc.internal.SpineSkeleton.AnimationCacheMode;
Object.defineProperty(skeleton, 'paused', {
get () {
return this._paused || false;
},
set (value) {
this._paused = value;
if (this._nativeSkeleton) {
this._nativeSkeleton.paused(value);
}
},
});
Object.defineProperty(skeleton, 'premultipliedAlpha', {
get () {
if (this._premultipliedAlpha === undefined) {
return true;
}
return this._premultipliedAlpha;
},
set (value) {
this._premultipliedAlpha = value;
if (this._nativeSkeleton) {
this._nativeSkeleton.setOpacityModifyRGB(this._premultipliedAlpha);
}
},
});
Object.defineProperty(skeleton, 'timeScale', {
get () {
if (this._timeScale === undefined) return 1.0;
return this._timeScale;
},
set (value) {
this._timeScale = value;
if (this._nativeSkeleton) {
this._nativeSkeleton.setTimeScale(this._timeScale);
}
},
});
const _updateMaterial = skeleton.updateMaterial;
skeleton.updateMaterial = function () {
_updateMaterial.call(this);
if (this._nativeSkeleton) {
const mat = this.getMaterialTemplate();
this._nativeSkeleton.setMaterial(mat);
}
};
const _updateDebugDraw = skeleton._updateDebugDraw;
skeleton._updateDebugDraw = function () {
_updateDebugDraw.call(this);
if (this._nativeSkeleton && !this.isAnimationCached()) {
this._nativeSkeleton.setDebugMeshEnabled(this.debugMesh);
this._nativeSkeleton.setDebugSlotsEnabled(this.debugSlots);
this._nativeSkeleton.setDebugBonesEnabled(this.debugBones);
}
};
const _updateUseTint = skeleton._updateUseTint;
skeleton._updateUseTint = function () {
_updateUseTint.call(this);
if (this._nativeSkeleton) {
this._nativeSkeleton.setUseTint(this.useTint);
}
};
skeleton._updateBatch = function () {
if (this._nativeSkeleton) {
this._renderEntity.setUseLocal(!this.enableBatch);
this._nativeSkeleton.setBatchEnabled(this.enableBatch);
this.markForUpdateRenderData();
}
};
skeleton._updateUITransform = function () {
const skeletonData = this._skeletonData;
if (!skeletonData) return;
if (skeletonData.width != null && skeletonData.height != null) {
const uiTrans = this.node._uiProps.uiTransformComp;
uiTrans.setContentSize(skeletonData.width, skeletonData.height);
}
};
skeleton.setSkeletonData = function (skeletonData) {
const uuid = skeletonData.mergedUUID();
if (!uuid) {
cc.errorID(7504);
return;
}
const texValues = skeletonData.textures;
const texKeys = skeletonData.textureNames;
if (!(texValues && texValues.length > 0 && texKeys && texKeys.length > 0)) {
cc.errorID(7507, skeletonData.name);
return;
}
if (this._nativeSkeleton) {
this._nativeSkeleton.stopSchedule();
this._nativeSkeleton._comp = null;
this._nativeSkeleton = null;
}
let nativeSkeleton = null;
if (this.isAnimationCached()) {
nativeSkeleton = new spine.SkeletonCacheAnimation(uuid, this._cacheMode === AnimationCacheMode.SHARED_CACHE);
} else {
nativeSkeleton = new spine.SkeletonAnimation();
try {
spine.initSkeletonRenderer(nativeSkeleton, uuid);
} catch (e) {
cc._throw(e);
return;
}
nativeSkeleton.setDebugSlotsEnabled(this.debugSlots);
nativeSkeleton.setDebugMeshEnabled(this.debugMesh);
nativeSkeleton.setDebugBonesEnabled(this.debugBones);
}
this._nativeSkeleton = nativeSkeleton;
nativeSkeleton._comp = this;
if (this.shouldSchedule) nativeSkeleton.beginSchedule();
nativeSkeleton.setUseTint(this.useTint);
nativeSkeleton.setOpacityModifyRGB(this.premultipliedAlpha);
nativeSkeleton.setTimeScale(this.timeScale);
nativeSkeleton.setBatchEnabled(this.enableBatch);
const compColor = this.color;
nativeSkeleton.setColor(compColor.r, compColor.g, compColor.b, compColor.a);
const materialTemplate = this.getMaterialTemplate();
nativeSkeleton.setMaterial(materialTemplate);
this._renderEntity.setUseLocal(!this.enableBatch);
nativeSkeleton.setRenderEntity(this._renderEntity.nativeObj);
this._skeleton = nativeSkeleton.getSkeleton();
// init skeleton listener
this._startListener && this.setStartListener(this._startListener);
this._endListener && this.setEndListener(this._endListener);
this._completeListener && this.setCompleteListener(this._completeListener);
this._eventListener && this.setEventListener(this._eventListener);
this._interruptListener && this.setInterruptListener(this._interruptListener);
this._disposeListener && this.setDisposeListener(this._disposeListener);
this._sharedBufferOffset = nativeSkeleton.getSharedBufferOffset();
this._useAttach = false;
this.markForUpdateRenderData();
};
skeleton._updateColor = function () {
if (this._nativeSkeleton) {
const compColor = this._color;
this.setEntityColorDirty(true);
this.setEntityColor(compColor);
this._nativeSkeleton.setColor(compColor.r, compColor.g, compColor.b, compColor.a);
this.markForUpdateRenderData();
}
};
skeleton.setAnimationStateData = function (stateData) {
if (this._nativeSkeleton && !this.isAnimationCached()) {
this._stateData = stateData;
this._nativeSkeleton.setAnimationStateData(stateData);
}
};
const _onEnable = skeleton.onEnable;
skeleton.onEnable = function () {
if (_onEnable) {
_onEnable.call(this);
}
this.shouldSchedule = true;
if (this._nativeSkeleton) {
this._nativeSkeleton.onEnable();
}
middleware.retain();
};
const _onDisable = skeleton.onDisable;
skeleton.onDisable = function () {
if (_onDisable) {
_onDisable.call(this);
}
if (this._nativeSkeleton) {
this._nativeSkeleton.onDisable();
}
middleware.release();
};
skeleton.setVertexEffectDelegate = function (effectDelegate) {
if (cc.internal.SPINE_VERSION === '4.2') {
cc.warn('setVertexEffectDelegate is deprecated since spine 4.2');
return;
}
if (this._nativeSkeleton && !this.isAnimationCached()) {
this._nativeSkeleton.setVertexEffectDelegate(effectDelegate);
}
};
// eslint-disable-next-line no-unused-vars
skeleton.updateAnimation = function (dt) {
const nativeSkeleton = this._nativeSkeleton;
if (!nativeSkeleton) return;
const node = this.node;
if (!node) return;
if (this.__preColor__ === undefined || !this.color.equals(this.__preColor__)) {
const compColor = this.color;
nativeSkeleton.setColor(compColor.r, compColor.g, compColor.b, compColor.a);
this.__preColor__ = compColor;
}
const socketNodes = this.socketNodes;
if (!this._useAttach && socketNodes.size > 0) {
this._useAttach = true;
nativeSkeleton.setAttachEnabled(true);
}
};
skeleton.updateWorldTransform = function () {
if (this._nativeSkeleton && !this.isAnimationCached()) {
this._nativeSkeleton.updateWorldTransform();
}
};
skeleton.setToSetupPose = function () {
if (this._nativeSkeleton) {
this._nativeSkeleton.setToSetupPose();
}
};
skeleton.setBonesToSetupPose = function () {
if (this._nativeSkeleton) {
this._nativeSkeleton.setBonesToSetupPose();
}
};
skeleton.setSlotsToSetupPose = function () {
if (this._nativeSkeleton) {
this._nativeSkeleton.setSlotsToSetupPose();
}
};
skeleton.setSlotsRange = function (startSlotIndex, endSlotIndex) {
if (this._nativeSkeleton && !this.isAnimationCached()) {
this._nativeSkeleton.setSlotsRange(startSlotIndex, endSlotIndex);
}
};
skeleton.updateAnimationCache = function (animName) {
if (!this.isAnimationCached()) return;
if (this._nativeSkeleton) {
if (animName) {
this._nativeSkeleton.updateAnimationCache(animName);
} else {
this._nativeSkeleton.updateAllAnimationCache();
}
}
};
skeleton.invalidAnimationCache = function () {
if (!this.isAnimationCached()) return;
if (this._nativeSkeleton) {
this._nativeSkeleton.updateAllAnimationCache();
}
};
skeleton.findBone = function (boneName) {
if (this._nativeSkeleton) return this._nativeSkeleton.findBone(boneName);
return null;
};
skeleton.findSlot = function (slotName) {
if (this._nativeSkeleton) return this._nativeSkeleton.findSlot(slotName);
return null;
};
skeleton.setSkin = function (skinName) {
this._skinName = skinName;
if (this._nativeSkeleton) return this._nativeSkeleton.setSkin(skinName);
return null;
};
skeleton.getAttachment = function (slotName, attachmentName) {
if (this._nativeSkeleton) return this._nativeSkeleton.getAttachment(slotName, attachmentName);
return null;
};
skeleton.setAttachment = function (slotName, attachmentName) {
this._nativeSkeleton && this._nativeSkeleton.setAttachment(slotName, attachmentName);
};
// eslint-disable-next-line no-unused-vars
skeleton.getTextureAtlas = function (regionAttachment) {
cc.warn('Spine Skeleton getTextureAtlas not support in native');
return null;
};
skeleton.setMix = function (fromAnimation, toAnimation, duration) {
if (this._nativeSkeleton && !this.isAnimationCached()) {
this._nativeSkeleton.setMix(fromAnimation, toAnimation, duration);
}
};
skeleton.setAnimation = function (trackIndex, name, loop) {
const strName = name.toString();
this._playTimes = loop ? 0 : 1;
let res = null;
if (this._nativeSkeleton) {
if (!this._nativeSkeleton.findAnimation(strName)) return res;
this._animationName = strName;
if (this.isAnimationCached()) {
res = this._nativeSkeleton.setAnimation(strName, loop);
} else {
res = this._nativeSkeleton.setAnimation(trackIndex, strName, loop);
}
/**
* note: since native spine animation update called after Director.EVENT_BEFORE_UPDATE
* and before setAnimation. it's need to update native animation to first frame directly.
*/
this._nativeSkeleton.update(0);
}
return res;
};
skeleton.addAnimation = function (trackIndex, name, loop, delay) {
if (this._nativeSkeleton) {
delay = delay || 0;
if (this.isAnimationCached()) {
return this._nativeSkeleton.addAnimation(name, loop, delay);
} else {
return this._nativeSkeleton.addAnimation(trackIndex, name, loop, delay);
}
}
return null;
};
skeleton.findAnimation = function (name) {
if (this._nativeSkeleton) return this._nativeSkeleton.findAnimation(name);
return null;
};
skeleton.getCurrent = function (trackIndex) {
if (this._nativeSkeleton && !this.isAnimationCached()) {
return this._nativeSkeleton.getCurrent(trackIndex);
}
return null;
};
skeleton.clearTracks = function () {
if (this._nativeSkeleton && !this.isAnimationCached()) {
this._nativeSkeleton.clearTracks();
}
};
skeleton.clearTrack = function (trackIndex) {
if (this._nativeSkeleton && !this.isAnimationCached()) {
this._nativeSkeleton.clearTrack(trackIndex);
}
};
skeleton.setStartListener = function (listener) {
this._startListener = listener;
if (this._nativeSkeleton) {
if (this.isAnimationCached()) {
this._nativeSkeleton.setStartListener(function (animationName) {
const self = this._comp;
self._startEntry.animation.name = animationName;
self._startListener && self._startListener(self._startEntry);
});
} else {
this._nativeSkeleton.setStartListener(listener);
}
}
};
skeleton.setInterruptListener = function (listener) {
this._interruptListener = listener;
if (this._nativeSkeleton && !this.isAnimationCached()) {
this._nativeSkeleton.setInterruptListener(listener);
}
};
skeleton.setEndListener = function (listener) {
this._endListener = listener;
if (this._nativeSkeleton) {
if (this.isAnimationCached()) {
this._nativeSkeleton.setEndListener(function (animationName) {
const self = this._comp;
self._endEntry.animation.name = animationName;
self._endListener && self._endListener(self._endEntry);
});
} else {
this._nativeSkeleton.setEndListener(listener);
}
}
};
skeleton.setDisposeListener = function (listener) {
this._disposeListener = listener;
if (this._nativeSkeleton && !this.isAnimationCached()) {
this._nativeSkeleton.setDisposeListener(listener);
}
};
skeleton.setCompleteListener = function (listener) {
this._completeListener = listener;
if (this._nativeSkeleton) {
if (this.isAnimationCached()) {
this._nativeSkeleton.setCompleteListener(function (animationName) {
const self = this._comp;
self._endEntry.animation.name = animationName;
self._completeListener && self._completeListener(self._endEntry);
});
} else {
this._nativeSkeleton.setCompleteListener(listener);
}
}
};
skeleton.setEventListener = function (listener) {
this._eventListener = listener;
if (this._nativeSkeleton && !this.isAnimationCached()) {
this._nativeSkeleton.setEventListener(listener);
}
};
skeleton.setTrackStartListener = function (entry, listener) {
if (this._nativeSkeleton && !this.isAnimationCached()) {
this._nativeSkeleton.setTrackStartListener(entry, listener);
}
};
skeleton.setTrackInterruptListener = function (entry, listener) {
if (this._nativeSkeleton && !this.isAnimationCached()) {
this._nativeSkeleton.setTrackInterruptListener(entry, listener);
}
};
skeleton.setTrackEndListener = function (entry, listener) {
if (this._nativeSkeleton && !this.isAnimationCached()) {
this._nativeSkeleton.setTrackEndListener(entry, listener);
}
};
skeleton.setTrackDisposeListener = function (entry, listener) {
if (this._nativeSkeleton && !this.isAnimationCached()) {
this._nativeSkeleton.setTrackDisposeListener(entry, listener);
}
};
skeleton.setTrackCompleteListener = function (entry, listener) {
if (this._nativeSkeleton && !this.isAnimationCached()) {
this._nativeSkeleton.setTrackCompleteListener(entry, listener);
}
};
skeleton.setTrackEventListener = function (entry, listener) {
if (this._nativeSkeleton && !this.isAnimationCached()) {
this._nativeSkeleton.setTrackEventListener(entry, listener);
}
};
skeleton.getState = function () {
if (this._nativeSkeleton && !this.isAnimationCached()) {
return this._nativeSkeleton.getState();
}
return null;
};
skeleton._ensureListener = function () {
cc.warn('Spine Skeleton _ensureListener not need in native');
};
skeleton._updateSkeletonData = function () {
if (this.skeletonData) {
this.skeletonData.init();
this.setSkeletonData(this.skeletonData);
if (this.defaultSkin && this.defaultSkin !== '') {
this.setSkin(this.defaultSkin);
} else if (this._skinName && this._skinName !== '') {
this.setSkin(this._skinName);
}
if (this.defaultAnimation) {
this.animation = this.defaultAnimation;
} else if (this._animationName) {
this.animation = this._animationName;
} else {
this.animation = '';
}
} else if (this._nativeSkeleton) {
this._nativeSkeleton.stopSchedule();
this._nativeSkeleton._comp = null;
this._nativeSkeleton = null;
}
this._indexBoneSockets();
this._updateSocketBindings();
this.attachUtil.init(this);
this._preCacheMode = this._cacheMode;
};
const _onDestroy = skeleton.onDestroy;
skeleton.onDestroy = function () {
_onDestroy.call(this);
if (this._nativeSkeleton) {
this._nativeSkeleton.setRenderEntity(null);
this._nativeSkeleton.stopSchedule();
this._nativeSkeleton._comp = null;
this._nativeSkeleton = null;
}
this._stateData = null;
};
skeleton._render = function () {
const nativeSkeleton = this._nativeSkeleton;
if (!nativeSkeleton) return;
if (!this.isAnimationCached() && (this.debugBones || this.debugSlots || this.debugMesh) && this._debugRenderer) {
const graphics = this._debugRenderer;
graphics.clear();
graphics.lineWidth = 5;
const debugData = this._debugData || nativeSkeleton.getDebugData();
if (!debugData) return;
let debugIdx = 0; let debugType = 0; let debugLen = 0;
debugType = debugData[debugIdx++];
while (debugType !== 0) {
debugLen = debugData[debugIdx++];
switch (debugType) {
case 1: // slots
graphics.strokeColor = _slotColor;
for (let i = 0; i < debugLen; i += 8) {
graphics.moveTo(debugData[debugIdx++], debugData[debugIdx++]);
graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]);
graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]);
graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]);
graphics.close();
graphics.stroke();
}
break;
case 2: // mesh
graphics.strokeColor = _meshColor;
for (let i = 0; i < debugLen; i += 6) {
graphics.moveTo(debugData[debugIdx++], debugData[debugIdx++]);
graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]);
graphics.lineTo(debugData[debugIdx++], debugData[debugIdx++]);
graphics.close();
graphics.stroke();
}
break;
case 3: // bones
graphics.strokeColor = _boneColor;
graphics.fillColor = _slotColor; // Root bone color is same as slot color.
for (let i = 0; i < debugLen; i += 4) {
const bx = debugData[debugIdx++];
const by = debugData[debugIdx++];
const x = debugData[debugIdx++];
const y = debugData[debugIdx++];
// Bone lengths.
graphics.moveTo(bx, by);
graphics.lineTo(x, y);
graphics.stroke();
// Bone origins.
graphics.circle(bx, by, Math.PI * 1.5);
graphics.fill();
if (i === 0) {
graphics.fillColor = _originColor;
}
}
break;
default:
return;
}
debugType = debugData[debugIdx++];
}
}
};
const _tempAttachMat4 = cc.mat4();
skeleton.syncAttachedNode = function () {
const nativeSkeleton = this._nativeSkeleton;
if (!nativeSkeleton) return;
const socketNodes = this.socketNodes;
if (socketNodes.size > 0 && this._useAttach) {
const sharedBufferOffset = this._sharedBufferOffset;
if (!sharedBufferOffset) return;
const attachInfoMgr = middleware.attachInfoMgr;
const attachInfo = attachInfoMgr.attachInfo;
const attachInfoOffset = sharedBufferOffset[0];
// reset attach info offset
sharedBufferOffset[0] = 0;
for (const boneIdx of socketNodes.keys()) {
const boneNode = socketNodes.get(boneIdx);
// Node has been destroy
if (!boneNode || !boneNode.isValid) {
socketNodes.delete(boneIdx);
continue;
}
const tm = _tempAttachMat4;
const matOffset = attachInfoOffset + boneIdx * 16;
tm.m00 = attachInfo[matOffset];
tm.m01 = attachInfo[matOffset + 1];
tm.m04 = attachInfo[matOffset + 4];
tm.m05 = attachInfo[matOffset + 5];
tm.m12 = attachInfo[matOffset + 12];
tm.m13 = attachInfo[matOffset + 13];
boneNode.matrix = tm;
}
}
};
skeleton.setSlotTexture = function (slotName, tex2d, createNew) {
if (this.isAnimationCached()) {
console.error(`Cached mode can't change texture of slot`);
return;
}
if (!this._nativeSkeleton) return;
const slot = this.findSlot(slotName);
if (!slot) {
console.error(`No slot named:${slotName}`);
return;
}
const createNewAttachment = createNew || false;
this._nativeSkeleton.setSlotTexture(slotName, tex2d, createNewAttachment);
};
//////////////////////////////////////////
// assembler
const assembler = cc.internal.SpineAssembler;
// eslint-disable-next-line no-unused-vars
assembler.createData = function (comp) {
};
assembler.updateRenderData = function (comp) {
comp._render();
comp.syncAttachedNode();
};
// eslint-disable-next-line no-unused-vars
assembler.fillBuffers = function (comp, renderer) {
};
}());
+7 -15
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 "${CMAKE_OSX_ARCHITECTURES}"
OSX_ARCHITECTURES "arm64;x86_64"
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon"
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_LAUNCHSTORYBOARD_NAME "LaunchScreen"
@@ -95,20 +95,12 @@ 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.
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()
# # 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")
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 "13.0" CACHE STRING "Target iOS version" FORCE)
set(TARGET_IOS_VERSION "11.0" CACHE STRING "Target iOS version" FORCE)
set(CMAKE_CXX_STANDARD 17)
option(CC_DEBUG_FORCE "Force enable CC_DEBUG in release mode" OFF)
@@ -27,8 +27,7 @@ android.native.buildOutput=verbose
PROP_COMPILE_SDK_VERSION=36
# Android SDK version that will be used as the earliest version of android this application can run on
# play-services-oss-licenses, introduced on Feb 2, 2026, requires minSdkVersion 24. https://developers.google.com/android/guides/releases
PROP_MIN_SDK_VERSION=24
PROP_MIN_SDK_VERSION=21
# Android SDK version that will be used as the latest version of android this application has been tested on
PROP_TARGET_SDK_VERSION=36
-9
View File
@@ -5,15 +5,6 @@ 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
@@ -1,37 +0,0 @@
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();
});
});