Published on

Engine Structure

Authors
  • avatar
    Name
    Yue Zhang
    Twitter

Source

source
├── editor/
│   ├── asset/
|	|	└── asset_ui.cpp/h
│   ├── base/
|	|	└── editor_ui.cpp/h
│   ├── log/
|	|	└── log_ui.cpp/h
│   ├── menu/
|	|	└── menu_ui.cpp/h
│   ├── property/
|	|	└── property_ui.cpp/h
│   ├── resource/
|	|	└── png
│   ├── simulation/
|	|	└── simulation_ui.cpp/h
│   ├── world/
|	|	└── world_ui.cpp/h
|	├── editor.cpp/h
|	└── main.cpp
└── runtime/
	├── core/
	│   ├── base/
	|	|	└── macro.h
	│   ├── log/
	|	|	└── log_system.cpp/h
	│   ├── math/
	|	|	├── bounding_box.cpp/h
	|	|	└── transform.cpp/h
	│   └── vulkan/
	|		├── vulkan_rhi.cpp/h
	|		└── vulkan_util.cpp/h
	├── function/
	│   ├── framework/
	|	│   ├── component/
	|	|	│   ├── component.h
	|	|	│   └── static_mesh_component.cpp/h
	|	│   ├── entity/
	|	|	│   └── entity.cpp/h
	|	│   └── world/
	|	|	│   └── world.cpp/h
	|	|	│   └── world_manager.cpp/h
	│   ├── global/
	|	|	└── runtim_context.cpp/h
	│   └── render/
	|		├── render_data.cpp/h
	|		├── render_system.cpp/h
	|		├── window_system.cpp/h
	|		└── pass/
	|			├── base_pass.cpp/h
	|			├── render_pass.cpp/h
	|			└── ui_pass.cpp/h
	├── paltform/
	│   ├── container/
	|	|	└── ts_queue.h
	│   ├── file/
	|	|	└── file_system.cpp/h
	│   ├── string/
	|	|	└── string_util.cpp/h
	│   └── timer/
	|		└── timer.cpp/h
	└── resource/
		├── asset/
		│   ├── animation.cpp/h
		│   ├── asset_manager.cpp/h
		│   ├── material.cpp/h
		│   ├── skeletal_mesh.cpp/h
		│   ├── skeleton.cpp/h
		│   ├── static_mesh.cpp/h
		│   ├── texture_2d.cpp/h
		│   ├── texture_cube.cpp/h
		│   └── base/
		|		├── asset.cpp/h
		|		├── bone.cpp/h
		|		├── mesh.cpp/h
		|		├── sub_mesh.cpp/h
		|		└── texture.cpp/h
		├── config/
		│   └── config_manager.cpp/h
		└── shader/
			└── shader_manager.cpp/h

Editor

Asset

  • asset_ui.cpp/h

Base

  • editor_ui.cpp/h

Log

  • log_ui.cpp/h
  • menu_ui.cpp/h

Property

  • property_ui.cpp/h

Resource

  • png

Simulation

  • simulation_ui.cpp/h

World

  • world_ui.cpp/h

editor.cpp/h and main.cpp


Runtime

engine.cpp/h


Core

  • Base

    • macro.h
  • Log

    • log_system.cpp/h
  • Math

    • bounding_box.cpp/h
    • transform.cpp/h
  • Vulkan

    • vulkan_rhi.cpp/h:包含(除了renderpass,frambuffer)常见的vulkan概念。虽然包含了vulkan_util.h 但只是使用了vulkan与vma头文件

    • vulkan_util.cpp/h

      1. 定义了VmaBuffer,VmaImage, VmaImageView, VmaImageViewSampler, 包含 handle 和 allocation
      2. 定义了与 instant command,buffer, image, image viewer, sampler相关的函数,创建verter/index buffer,拷贝

Function

  • Framework

    • Component
      • component.h
      • static_mesh_component.cpp/h
    • Entity
      • entity.cpp/h
    • World
      • world.cpp/h
      • world_manager.cpp/h
  • Global

  • Render

    • render_data.cpp/h

    • render_system.cpp/h

      • setConstructUIFunc(construct_ui_func)

      • init()

        • 初始化了 BasePassUIPass 放入 m_render_passes
        • 设置 VulkanRHI的 VulkanRHICallbacks
      • tick(delta_time) : 调用VulkanRHI::render

      • onCreateSwapchainObjects

      • onDestroySwapchainObjects:这里是第一项的内容。

      • onRecordFrame(commandBuffer, flight_index):遍历 m_render_passes中所有的renderpass 调用他们的 record 函数 。

      • setConstructUIFunc(function)

      • collectRenderDatas()

    • window_system.cpp/h

    • Pass

      • render_pass.cpp/h

      包含了 descriptor Pool, descriptor Set layout, pipeline and pipeline layout, renderpass Handle, vector of RenderData

      • base_pass.cpp/h

        • 初始化: 建立renderpass(subpass 和 attachments),建立pipeline layout和pipeline
        • 创建framebuffer: 创建了depth和color的image与imageview, 并用这两个创建了一个framebuffer
        • 封装了Record: renderpass begin , renderpass end
      • ui_pass.cpp/h

        • m_construct_func
        • setConstructFunc(construct_ui_func):
        • 封装了Record: renderpass begin , renderpass end
        • 初始化: 建立renderpass(subpass 和 attachments),建立pipeline layout和pipeline
        • 创建 framebuffers: 获得swap chain的 imageviews, 并创建对应数量的framebuffers

Platform

  • Container

    • ts_queue.h
  • File

    • file_system.cpp/h
  • String

    • string_util.cpp/h
  • Timer

    • timer.cpp/h

      • TimerManager:

        • init: Initializes the timer manager's state.

        • tick: Advances time by a delta_time and processes timers, executing their callback functions if their interval has elapsed.

        • addTimer: Adds a timer with a specific interval and callback function. Supports looping and immediate call for looping timers.

        • removeTimer: Removes a timer by its handle.

        • getTime: Returns the current tracked time of the manager.

      • StopWatch:

        • start: Records the current time as the start time.
        • stop : Records the current time as the end time and calculates elapsed time in milliseconds
        • elapsedTimeMs: Returns the elapsed time in seconds or milliseconds.

resource

  • asset

    • animation.cpp/h
    • asset_manager.cpp/h
    • material.cpp/h
    • skeletal_mesh.cpp/h
    • skeleton.cpp/h
    • static_mesh.cpp/h
    • texture_2d.cpp/h
    • texture_cube.cpp/h
    • Base
      • asset.cpp/h
      • bone.cpp/h
      • mesh.cpp/h
      • sub_mesh.cpp/h
      • texture.cpp/h
  • Config

    • config_manager.cpp/h
  • Shader

    • shader_manager.cpp/h