forked from cocos/cocos-engine
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cocos#44 from dumganhar/v3.3.0-native
Update jsb hacking code, editor compilation for native works
- Loading branch information
Showing
21 changed files
with
666 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. | ||
https://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. | ||
*/ | ||
|
||
import { Material } from "../../assets"; | ||
import { RenderableComponent } from "../../components"; | ||
|
||
export interface IMaterialInstanceInfo { | ||
parent: Material; | ||
owner?: RenderableComponent; | ||
subModelIdx?: number; | ||
} | ||
export const MaterialInstance = jsb.MaterialInstance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,6 @@ | |
THE SOFTWARE. | ||
*/ | ||
|
||
|
||
declare const jsb: any; | ||
|
||
export const NativeBufferPool = jsb.NativeBufferPool; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. | ||
https://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. | ||
*/ | ||
|
||
import { IPassInfo, IPassStates } from "../../assets/effect-asset"; | ||
import { MacroRecord } from "./pass-utils"; | ||
|
||
export interface IPassInfoFull extends IPassInfo { | ||
// generated part | ||
passIndex: number; | ||
defines: MacroRecord; | ||
stateOverrides?: PassOverrides; | ||
} | ||
export type PassOverrides = RecursivePartial<IPassStates>; | ||
|
||
export interface IMacroPatch { | ||
name: string; | ||
value: boolean | number | string; | ||
} | ||
|
||
export enum BatchingSchemes { | ||
NONE = 0, | ||
INSTANCING = 1, | ||
VB_MERGING = 2, | ||
} | ||
|
||
export const Pass = jsb.Pass; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. | ||
https://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. | ||
*/ | ||
|
||
import { RenderPassInfo } from "../../gfx"; | ||
|
||
export interface IRenderWindowInfo { | ||
title?: string; | ||
width: number; | ||
height: number; | ||
renderPassInfo: RenderPassInfo; | ||
swapchainBufferIndices?: number; | ||
shouldSyncSizeWithSwapchain?: boolean; | ||
} | ||
|
||
export const RenderWindow = jsb.RenderWindow; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. | ||
https://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. | ||
*/ | ||
|
||
import { legacyCC } from "../../global-exports"; | ||
|
||
export const Pass = jsb.Pass; | ||
|
||
const SamplerLib = nr.SamplerLib; | ||
export const samplerLib = new SamplerLib(); | ||
legacyCC.samplerLib = samplerLib; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. | ||
https://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. | ||
*/ | ||
|
||
import config from './config'; | ||
|
||
import * as scene from './scene'; | ||
|
||
import './scene/deprecated'; | ||
import { legacyCC } from "../global-exports"; | ||
import { RenderableComponent } from "../components"; | ||
|
||
export { createIA } from './utils'; | ||
|
||
const addStage = config.addStage; | ||
export { addStage }; | ||
|
||
export * from './core/constants'; | ||
export * from './core/pass-utils'; | ||
export const Pass = jsb.Pass; | ||
const ProgramLib = jsb.ProgramLib; | ||
export const programLib = new ProgramLib(); | ||
legacyCC.programLib = programLib; | ||
export * from "./core/sampler-lib"; | ||
export * from './core/texture-buffer-pool'; | ||
|
||
export interface IMaterialInstanceInfo { | ||
parent: any; | ||
owner?: RenderableComponent; | ||
subModelIdx?: number; | ||
} | ||
export const MaterialInstance = jsb.MaterialInstance; | ||
export const PassInstance = jsb.PassInstance; | ||
|
||
export * from './core/memory-pools'; | ||
export { scene }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* | ||
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. | ||
https://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. | ||
*/ | ||
|
||
import { RenderWindow } from "../core/render-window"; | ||
import { ClearFlagBit } from "../../gfx"; | ||
|
||
export enum CameraFOVAxis { | ||
VERTICAL, | ||
HORIZONTAL, | ||
} | ||
|
||
export enum CameraProjection { | ||
ORTHO, | ||
PERSPECTIVE, | ||
} | ||
|
||
export enum CameraAperture { | ||
F1_8, | ||
F2_0, | ||
F2_2, | ||
F2_5, | ||
F2_8, | ||
F3_2, | ||
F3_5, | ||
F4_0, | ||
F4_5, | ||
F5_0, | ||
F5_6, | ||
F6_3, | ||
F7_1, | ||
F8_0, | ||
F9_0, | ||
F10_0, | ||
F11_0, | ||
F13_0, | ||
F14_0, | ||
F16_0, | ||
F18_0, | ||
F20_0, | ||
F22_0, | ||
} | ||
|
||
export enum CameraISO { | ||
ISO100, | ||
ISO200, | ||
ISO400, | ||
ISO800, | ||
} | ||
|
||
export enum CameraShutter { | ||
D1, | ||
D2, | ||
D4, | ||
D8, | ||
D15, | ||
D30, | ||
D60, | ||
D125, | ||
D250, | ||
D500, | ||
D1000, | ||
D2000, | ||
D4000, | ||
} | ||
|
||
const FSTOPS: number[] = [1.8, 2.0, 2.2, 2.5, 2.8, 3.2, 3.5, 4.0, 4.5, 5.0, 5.6, 6.3, 7.1, 8.0, 9.0, 10.0, 11.0, 13.0, 14.0, 16.0, 18.0, 20.0, 22.0]; | ||
const SHUTTERS: number[] = [1.0, 1.0 / 2.0, 1.0 / 4.0, 1.0 / 8.0, 1.0 / 15.0, 1.0 / 30.0, 1.0 / 60.0, 1.0 / 125.0, | ||
1.0 / 250.0, 1.0 / 500.0, 1.0 / 1000.0, 1.0 / 2000.0, 1.0 / 4000.0]; | ||
const ISOS: number[] = [100.0, 200.0, 400.0, 800.0]; | ||
|
||
export interface ICameraInfo { | ||
name: string; | ||
node: Node; | ||
projection: number; | ||
targetDisplay?: number; | ||
window?: RenderWindow | null; | ||
priority: number; | ||
pipeline?: string; | ||
} | ||
|
||
export const SKYBOX_FLAG = ClearFlagBit.STENCIL << 1; | ||
|
||
export const Camera = jsb.Camera; |
Oops, something went wrong.