Class Info |
|---|
class BaseApplication 应用基类,主要提供初始化、更新、渲染等功能。 |
Qualifier and Type |
Method Name and Description |
|---|---|
virtual void |
Start(void* param) 启动BaseApplication,完成log系统初始化,若为Android平台,则param可转换为android_app类型,完成文件系统的android_app绑定设置和Android平台的事件回调系统启动流程。 |
virtual void |
Initialize(const void* winHandle, u32 width, u32 height) 应用初始化接口,完成资源系统,渲染系统,场景管理系统初始化处理。 |
virtual void |
应用退出释放资源接口,完成资源系统,渲染系统,场景管理系统,Log系统卸载。 |
virtual bool |
Resume(const void* winHandle, u32 width, u32 height) 应用程序从后台切到前台时,完成渲染系统、资源管理系统、场景管理系统等资源的重建。 |
virtual void |
Pause() 应用程序从前台切到后台时,完成渲染系统、资源管理系统、场景管理系统等资源的销毁。 |
virtual void |
初始化场景接口,完成场景系统初始化。 |
virtual void |
更新函数,完成场景系统,场景物体,物体组件的更新。 |
virtual void |
Render() 渲染函数,完成物体渲染列表收集,并进行最终的渲染任务。 |
virtual void |
更改窗口大小,并触发SceneManager的Resize流程。 |
virtual void |
Run() |
virtual void |
ProcessInputEvent(const InputEvent* inputEvent) 完成键盘、触摸事件的分发及处理。 |
void |
MainLoop() Android平台主循环,完成事件循环的处理,若当前处于焦点状态,完成Run函数调用。 |
void |
SetFocus(bool flag) 设置当前应用是否处于焦点状态。 |
bool |
IsFocused() const 判断当前是否处于焦点状态,如果不在焦点状态,Update函数将不会调用。 |
const u8* |
GetSnapshotData() const 获取屏幕截图的数据。 |
void |
SaveSnapshotToFile(const String& fileName) 将屏幕截图的数据保存成ppm格式的文件。 |
const GraphicsRenderer* |
GetGraphicsRenderer() const 获取GraphicsRenderer指针。 |
const SceneManager* |
GetSceneManager() const 获取SceneManager指针。 |
GetResourceManager() const 获取ResourceManager指针。 |
|
GetAspectRatio() const 获取屏幕宽高比。 |
|
GetScreenWidth() const 获取屏幕宽度。 |
|
GetScreenHeight() const 获取屏幕高度。 |
|
bool |
IsPlatformSupported() const 判断CG Kit是否支持当前平台。目前支持Android 8.0及其以上版本。 |
GetProgramDirectory()const 获取工程目录。 |
|
SetThreadCount(u32 count) 设置多线程数,需在多线程渲染开启前设置,开启后设置无效。该方法为非必须调用,系统默认设置线程数为手机核数的一半减一。 |
|
void |
SetSceneManagerType(SceneManagerType sceneManagerType) 设置场景管理器类型,不设置时默认使用四叉树场景管理器。 |
void |
SetRenderingSortType(RenderingSortType sortType) 设置渲染排序类型。 |
void |
SetMinSampleShading(f32 minSampleShading) 设置最小着色率。 |
bool |
EnableMultiThreadRendering(bool open) 多线程渲染能力开关接口。 |
void |
EnableFrustumCull(bool enable) 视锥体裁剪能力开关接口。 |
u32 |
GetBackBufferCount() const 获取后台缓冲的数量。 |
const c8* |
GetEngineName() const 获取引擎名称。 |
const c8* |
GetTitle() const 获取config配置文件中的应用名称。 |
void |
EnableFullScreen(bool enable) 全屏功能开关接口。 |
bool |
IsFullScreen() const 判断是否是全屏状态。 |
void |
SetWindowSize(u32 width, u32 height) 设置窗口尺寸。 |
GetCascadeSplitCount() const 获取级联拆分的数量。 |
Method |
|---|
virtual void Start(void* param) 启动BaseApplication,完成log系统初始化,若为Android平台,则param可转换为android_app类型,完成文件系统的android_app绑定设置和Android平台的事件回调系统启动流程。 |
Parameters
Name |
Description |
|---|---|
param |
在Android平台下,可转换为android_app类型,进行文件系统的android_app绑定设置。 |
Method |
|---|
virtual void Initialize(const void* winHandle, u32 width, u32 height) 应用初始化接口,完成资源系统,渲染系统,场景管理系统初始化处理。 |
Parameters
Name |
Description |
|---|---|
winHandle |
窗口句柄。 |
width |
窗口宽度。 |
height |
窗口高度。 |
Method |
|---|
virtual bool Resume(const void* winHandle, u32 width, u32 height) 应用程序从后台切到前台时,完成渲染系统、资源管理系统、场景管理系统等资源的重建。 |
Parameters
Name |
Description |
|---|---|
winHandle |
窗口句柄。 |
width |
窗口宽度。 |
height |
窗口高度。 |
Returns
Type |
Description |
|---|---|
bool |
|
Method |
|---|
virtual void Update(f32 deltaTime) 更新函数,完成场景系统,场景物体,物体组件的更新。 |
Parameters
Name |
Description |
|---|---|
deltaTime |
帧间隔时间,单位为秒。 |
Method |
|---|
virtual void Resize(u32 width, u32 height) 更改窗口大小,并触发SceneManager的Resize流程。 |
Parameters
Name |
Description |
|---|---|
width |
更新后窗口宽度。 |
height |
更新后窗口高度。 |
Method |
|---|
virtual void ProcessInputEvent(const InputEvent* inputEvent) 完成键盘、触摸事件的分发及处理。 |
Parameters
Name |
Description |
|---|---|
inputEvent |
事件消息,目前包括键盘,触摸事件类型。 |
Method |
|---|
void SetFocus(bool flag) 设置当前应用是否处于焦点状态。 |
Parameters
Name |
Description |
|---|---|
flag |
|
Method |
|---|
bool IsFocused() const 判断当前是否处于焦点状态,如果不在焦点状态,Update函数将不会调用。 |
Returns
Type |
Description |
|---|---|
bool |
|
Method |
|---|
void SaveSnapshotToFile(const String& fileName) 将屏幕截图的数据保存成ppm文件。 |
Parameters
Name |
Description |
|---|---|
fileName |
带有路径的文件名。 |
Method |
|---|
const GraphicsRenderer* GetGraphicsRenderer() const 获取GraphicsRenderer指针。 |
Returns
Type |
Description |
|---|---|
返回GraphicsRenderer指针。 |
Method |
|---|
const SceneManager* GetSceneManager() const 获取SceneManager指针。 |
Returns
Type |
Description |
|---|---|
返回SceneManager指针。 |
Method |
|---|
ResourceManager* GetResourceManager() const 获取ResourceManager指针。 |
Returns
Type |
Description |
|---|---|
返回ResourceManager指针。 |
Method |
|---|
u32 GetScreenWidth() const 获取屏幕宽度。 |
Returns
Type |
Description |
|---|---|
返回32位无符号整数类型屏幕宽度。 |
Method |
|---|
u32 GetScreenHeight() const 获取屏幕高度。 |
Returns
Type |
Description |
|---|---|
返回32位无符号整数类型屏幕高度。 |
Method |
|---|
bool IsPlatformSupported() const 判断CG Kit是否支持当前平台。目前支持Android 8.0及其以上版本。 |
Returns
Type |
Description |
|---|---|
bool |
|
Method |
|---|
String GetProgramDirectory() const 获取工程目录。 |
Returns
Type |
Description |
|---|---|
工程目录。 |
Parameters
Name |
Description |
|---|---|
count |
设置开启的线程数,可设置的区间为[2,手机的核数]。 |
Returns
Type |
Description |
|---|---|
返回成功设置的线程数。 |
Method |
|---|
void SetSceneManagerType(SceneManagerType sceneManagerType) 设置场景管理器类型,不设置时默认使用四叉树场景管理器。 |
Parameters
Name |
Description |
|---|---|
sceneManagerType |
场景管理器类型,具体请参见SceneManagerType。默认值为四叉树场景管理器。 |
Parameters
Name |
Description |
|---|---|
sortType |
排序类型,具体请参见RenderingSortType。默认值为RENDERING_SORT_TYPE_DISTANCE。 |
Parameters
Name |
Description |
|---|---|
minSampleShading |
最小着色率。默认值为0.0f。 取值范围为[0.0f, 1.0f],其值越接近1,图像越平滑。 |
Method |
|---|
bool EnableMultiThreadRendering(bool open) 多线程渲染能力开关接口。 |
Parameters
Name |
Description |
|---|---|
open |
|
Returns
Type |
Description |
|---|---|
bool |
|
Method |
|---|
void EnableFrustumCull(bool enable) 视锥体剔除功能开关接口。 |
Parameters
Name |
Description |
|---|---|
enable |
|
Method |
|---|
u32 GetBackBufferCount() const 获取后台缓冲的数量。 |
Returns
Type |
Description |
|---|---|
u32 |
后台缓冲的数量。 |
Method |
|---|
const c8* GetTitle() const 获取config配置文件中的应用名称。 |
Returns
Type |
Description |
|---|---|
c8 |
获取config配置文件中的应用名称。 |
Method |
|---|
void EnableFullScreen(bool enable) 全屏功能开关接口。 |
Parameters
Name |
Description |
|---|---|
enable |
|
Method |
|---|
bool IsFullScreen() const 判断是否是全屏状态。 |
Returns
Type |
Description |
|---|---|
bool |
|