Skip to content

Commit 9992b91

Browse files
committed
adding RenderScene
1 parent 1a3fafd commit 9992b91

6 files changed

Lines changed: 270 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
Copyright (c) 2021-2024 Xiamen Yaji Software Co., Ltd.
3+
4+
https://www.cocos.com
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights to
9+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10+
of the Software, and to permit persons to whom the Software is furnished to do so,
11+
subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.
23+
*/
24+
25+
/**
26+
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
27+
* The following section is auto-generated.
28+
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
29+
*/
30+
/* eslint-disable max-len */
31+
export interface RenderScene {
32+
empty (): boolean;
33+
readonly numNodes: number;
34+
}

native/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,6 +1599,9 @@ cocos_source_files(
15991599
cocos/renderer/pipeline/custom/details/SerializationUtils.h
16001600
cocos/renderer/pipeline/custom/details/Set.h
16011601
cocos/renderer/pipeline/custom/details/Utility.h
1602+
cocos/renderer/scene/RenderSceneInterfaceFwd.h
1603+
cocos/renderer/scene/RenderSceneInterfaceTypes.cpp
1604+
cocos/renderer/scene/RenderSceneInterfaceTypes.h
16021605
)
16031606

16041607
if (USE_GEOMETRY_RENDERER)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
Copyright (c) 2021-2024 Xiamen Yaji Software Co., Ltd.
3+
4+
https://www.cocos.com
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights to
9+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10+
of the Software, and to permit persons to whom the Software is furnished to do so,
11+
subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.
23+
*/
24+
25+
/**
26+
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
27+
* The following section is auto-generated.
28+
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
29+
*/
30+
#pragma once
31+
// clang-format off
32+
33+
namespace cc {
34+
35+
namespace render {
36+
37+
class RenderScene;
38+
39+
} // namespace render
40+
41+
} // namespace cc
42+
43+
// clang-format on
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
Copyright (c) 2021-2024 Xiamen Yaji Software Co., Ltd.
3+
4+
https://www.cocos.com
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights to
9+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10+
of the Software, and to permit persons to whom the Software is furnished to do so,
11+
subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.
23+
*/
24+
25+
/**
26+
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
27+
* The following section is auto-generated.
28+
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
29+
*/
30+
// clang-format off
31+
// NOLINTBEGIN(misc-include-cleaner, bugprone-easily-swappable-parameters)
32+
#include "RenderSceneInterfaceTypes.h"
33+
34+
namespace cc {
35+
36+
namespace render {
37+
38+
} // namespace render
39+
40+
} // namespace cc
41+
42+
// NOLINTEND(misc-include-cleaner, bugprone-easily-swappable-parameters)
43+
// clang-format on
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
Copyright (c) 2021-2024 Xiamen Yaji Software Co., Ltd.
3+
4+
https://www.cocos.com
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights to
9+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10+
of the Software, and to permit persons to whom the Software is furnished to do so,
11+
subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.
23+
*/
24+
25+
/**
26+
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
27+
* The following section is auto-generated.
28+
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
29+
*/
30+
// clang-format off
31+
// NOLINTBEGIN(misc-include-cleaner, bugprone-easily-swappable-parameters)
32+
#pragma once
33+
#include "cocos/base/RefCounted.h"
34+
#include "cocos/renderer/scene/RenderSceneInterfaceFwd.h"
35+
36+
namespace cc {
37+
38+
namespace render {
39+
40+
class RenderScene : public RefCounted {
41+
public:
42+
RenderScene() = default;
43+
RenderScene(RenderScene&& rhs) = delete;
44+
RenderScene(RenderScene const& rhs) = delete;
45+
RenderScene& operator=(RenderScene&& rhs) = delete;
46+
RenderScene& operator=(RenderScene const& rhs) = delete;
47+
~RenderScene() noexcept override = default;
48+
49+
virtual bool empty() const = 0;
50+
virtual uint32_t getNumNodes() const = 0;
51+
};
52+
53+
} // namespace render
54+
55+
} // namespace cc
56+
57+
// NOLINTEND(misc-include-cleaner, bugprone-easily-swappable-parameters)
58+
// clang-format on
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// Define module
2+
// target_namespace means the name exported to JS, could be same as which in other modules
3+
// native2d at the last means the suffix of binding function name, different modules should use unique name
4+
// Note: doesn't support number prefix
5+
%module(target_namespace="render") scene
6+
7+
// Disable some swig warnings, find warning number reference here ( https://www.swig.org/Doc4.1/Warnings.html )
8+
#pragma SWIG nowarn=503,302,401,317,402
9+
10+
// Insert code at the beginning of generated header file (.h)
11+
%insert(header_file) %{
12+
#pragma once
13+
#include <type_traits>
14+
#include "bindings/jswrapper/SeApi.h"
15+
#include "bindings/manual/jsb_conversions.h"
16+
#include "renderer/scene/RenderSceneInterfaceTypes.h"
17+
%}
18+
19+
// Insert code at the beginning of generated source file (.cpp)
20+
%{
21+
#include "bindings/auto/jsb_render_scene_auto.h"
22+
23+
using namespace cc;
24+
using namespace cc::render;
25+
%}
26+
27+
// ----- Ignore Section ------
28+
// Brief: Classes, methods or attributes need to be ignored
29+
//
30+
// Usage:
31+
//
32+
// %ignore your_namespace::your_class_name;
33+
// %ignore your_namespace::your_class_name::your_method_name;
34+
// %ignore your_namespace::your_class_name::your_attribute_name;
35+
//
36+
// Note:
37+
// 1. 'Ignore Section' should be placed before attribute definition and %import/%include
38+
// 2. namespace is needed
39+
//
40+
41+
// ----- Rename Section ------
42+
// Brief: Classes, methods or attributes needs to be renamed
43+
//
44+
// Usage:
45+
//
46+
// %rename(rename_to_name) your_namespace::original_class_name;
47+
// %rename(rename_to_name) your_namespace::original_class_name::method_name;
48+
// %rename(rename_to_name) your_namespace::original_class_name::attribute_name;
49+
//
50+
// Note:
51+
// 1. 'Rename Section' should be placed before attribute definition and %import/%include
52+
// 2. namespace is needed
53+
54+
// ----- Module Macro Section ------
55+
// Brief: Generated code should be wrapped inside a macro
56+
// Usage:
57+
// 1. Configure for class
58+
// %module_macro(CC_USE_GEOMETRY_RENDERER) cc::pipeline::GeometryRenderer;
59+
// 2. Configure for member function or attribute
60+
// %module_macro(CC_USE_GEOMETRY_RENDERER) cc::pipeline::RenderPipeline::geometryRenderer;
61+
// Note: Should be placed before 'Attribute Section'
62+
63+
// ----- Attribute Section ------
64+
// Brief: Define attributes ( JS properties with getter and setter )
65+
// Usage:
66+
// 1. Define an attribute without setter
67+
// %attribute(your_namespace::your_class_name, cpp_member_variable_type, js_property_name, cpp_getter_name)
68+
// 2. Define an attribute with getter and setter
69+
// %attribute(your_namespace::your_class_name, cpp_member_variable_type, js_property_name, cpp_getter_name, cpp_setter_name)
70+
// 3. Define an attribute without getter
71+
// %attribute_writeonly(your_namespace::your_class_name, cpp_member_variable_type, js_property_name, cpp_setter_name)
72+
//
73+
// Note:
74+
// 1. Don't need to add 'const' prefix for cpp_member_variable_type
75+
// 2. The return type of getter should keep the same as the type of setter's parameter
76+
// 3. If using reference, add '&' suffix for cpp_member_variable_type to avoid generated code using value assignment
77+
// 4. 'Attribute Section' should be placed before 'Import Section' and 'Include Section'
78+
//
79+
%attribute(cc::render::RenderScene, uint32_t, numNodes, getNumNodes);
80+
81+
// ----- Import Section ------
82+
// Brief: Import header files which are depended by 'Include Section'
83+
// Note:
84+
// %import "your_header_file.h" will not generate code for that header file
85+
//
86+
87+
// ----- Include Section ------
88+
// Brief: Include header files in which classes and methods will be bound
89+
%include "renderer/scene/RenderSceneInterfaceTypes.h"

0 commit comments

Comments
 (0)