diff --git a/cocos/core/assets/texture-cube.jsb.ts b/cocos/core/assets/texture-cube.jsb.ts index 765920f9d9..03f64fa601 100644 --- a/cocos/core/assets/texture-cube.jsb.ts +++ b/cocos/core/assets/texture-cube.jsb.ts @@ -27,6 +27,7 @@ import { legacyCC } from '../global-exports'; import { Filter, PixelFormat, WrapMode } from './asset-enum'; import { js } from '../utils/js'; import './simple-texture'; +import { EDITOR, TEST } from 'internal:constants'; const textureCubeProto: any = jsb.TextureCube.prototype; interface ITextureCubeSerializeData { @@ -67,6 +68,9 @@ enum MipmapMode { } textureCubeProto.createNode = null!; +declare const jsb: any; + +// @ts-expect-error jsb.TextureCube is exported from cpp export type TextureCube = jsb.TextureCube; export const TextureCube: any = jsb.TextureCube; diff --git a/native/cocos/bindings/manual/jsb_assets_manual.cpp b/native/cocos/bindings/manual/jsb_assets_manual.cpp index 5d9f85a859..ed94996817 100644 --- a/native/cocos/bindings/manual/jsb_assets_manual.cpp +++ b/native/cocos/bindings/manual/jsb_assets_manual.cpp @@ -24,6 +24,7 @@ ****************************************************************************/ #include "bindings/auto/jsb_assets_auto.h" +#include "core/data/JSBNativeDataHolder.h" #include "core/event/EventTypesToJS.h" #include "jsb_scene_manual.h" diff --git a/native/cocos/core/assets/TextureCube.cpp b/native/cocos/core/assets/TextureCube.cpp index dece94df95..f7ffe2ce82 100644 --- a/native/cocos/core/assets/TextureCube.cpp +++ b/native/cocos/core/assets/TextureCube.cpp @@ -168,10 +168,14 @@ void TextureCube::setMipmapAtlasForJS(const TextureCubeMipmapAtlasInfo &value) { _mipmapAtlas = value; } -void TextureCube::setImage(const ITextureCubeMipmap &value) { - _mipmaps.clear(); - _mipmaps.emplace_back(value); +void TextureCube::setImage(const ITextureCubeMipmap *value) { + if (value != nullptr) { + setMipmaps({*value}); + } else { + setMipmaps({}); + } } + void TextureCube::reset(const ITextureCubeCreateInfo &info) { _width = info.width; _height = info.height; diff --git a/native/cocos/core/assets/TextureCube.h b/native/cocos/core/assets/TextureCube.h index fef986b88a..e0525962da 100644 --- a/native/cocos/core/assets/TextureCube.h +++ b/native/cocos/core/assets/TextureCube.h @@ -203,7 +203,7 @@ public: return _mipmaps.empty() ? nullptr : &_mipmaps[0]; } - void setImage(const ITextureCubeMipmap &value); + void setImage(const ITextureCubeMipmap *value); /** * @en Reset the current texture with given size, pixel format and mipmap images. @@ -248,19 +248,19 @@ public: bool validate() const override; // + /*@serializable*/ + MipmapMode _mipmapMode{MipmapMode::NONE}; + /*@serializable*/ bool isRGBE{false}; +private: /*@serializable*/ ccstd::vector _mipmaps; - /*@serializable*/ - MipmapMode _mipmapMode{MipmapMode::NONE}; - /*@serializable*/ TextureCubeMipmapAtlasInfo _mipmapAtlas; -private: CC_DISALLOW_COPY_MOVE_ASSIGN(TextureCube); }; diff --git a/native/cocos/core/builtin/BuiltinResMgr.cpp b/native/cocos/core/builtin/BuiltinResMgr.cpp index 9ceb76479e..71e0d4a47c 100644 --- a/native/cocos/core/builtin/BuiltinResMgr.cpp +++ b/native/cocos/core/builtin/BuiltinResMgr.cpp @@ -239,7 +239,7 @@ void BuiltinResMgr::initTextureCubeWithUuid(const ccstd::string &uuid, const uin mipmap.bottom = ccnew ImageAsset(); mipmap.bottom->setNativeAsset(imageSource); - texture->setImage(mipmap); + texture->setImage(&mipmap); texture->initialize(); _resources.emplace(texture->getUuid(), texture); diff --git a/native/tools/tojs/render.ini b/native/tools/tojs/render.ini index c5c4719a78..b5239bad81 100644 --- a/native/tools/tojs/render.ini +++ b/native/tools/tojs/render.ini @@ -30,7 +30,7 @@ headers = %(cocosdir)s/cocos/renderer/pipeline/custom/RenderInterfaceTypes.h hpp_headers = -cpp_headers = cocos/bindings/auto/jsb_gfx_auto.h cocos/bindings/auto/jsb_scene_auto.h cocos/renderer/pipeline/custom/LayoutGraphJsb.h cocos/renderer/pipeline/custom/RenderCommonJsb.h cocos/renderer/pipeline/custom/RenderGraphJsb.h +cpp_headers = cocos/bindings/auto/jsb_gfx_auto.h cocos/bindings/auto/jsb_scene_auto.h cocos/renderer/pipeline/custom/LayoutGraphJsb.h cocos/renderer/pipeline/custom/RenderCommonJsb.h cocos/renderer/pipeline/custom/RenderGraphJsb.h cocos/renderer/pipeline/GeometryRenderer.h cocos/renderer/pipeline/GlobalDescriptorSetManager.h replace_headers =