mirror of https://github.com/auygun/kaliber.git
Compare commits
No commits in common. "e376b1bc1780141a65669d08ab0943344b83d495" and "7b637a95d90da3046b76e37eb54bae9045e3cb94" have entirely different histories.
e376b1bc17
...
7b637a95d9
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
|
@ -11,7 +11,6 @@
|
|||
#include "engine/font.h"
|
||||
#include "engine/image.h"
|
||||
#include "engine/input_event.h"
|
||||
#include "engine/renderer/renderer.h"
|
||||
#include "engine/sound.h"
|
||||
|
||||
#include "demo/demo.h"
|
||||
|
@ -34,10 +33,9 @@ const Vector4f kColorNormal = {1, 1, 1, 1};
|
|||
const Vector4f kColorHighlight = {20, 20, 20, 1};
|
||||
constexpr float kBlendingSpeed = 0.12f;
|
||||
|
||||
const std::array<Vector4f, 2> kColorSwitch = {Vector4f{0.003f, 0.91f, 0.99f, 1},
|
||||
Vector4f{0.33f, 0.47, 0.51f, 1}};
|
||||
const Vector4f kColorSwitch[2] = {{0.003f, 0.91f, 0.99f, 1},
|
||||
{0.33f, 0.47, 0.51f, 1}};
|
||||
|
||||
const Vector4f kColorFadeIn = {1, 1, 1, 1};
|
||||
const Vector4f kColorFadeOut = {1, 1, 1, 0};
|
||||
constexpr float kFadeSpeed = 0.2f;
|
||||
|
||||
|
@ -152,8 +150,7 @@ bool Menu::Initialize() {
|
|||
}
|
||||
game->saved_data().root()["audio"] = toggle_audio_.enabled();
|
||||
},
|
||||
true, game->saved_data().root().get("audio", Json::Value(true)).asBool(),
|
||||
kColorFadeOut, kColorSwitch);
|
||||
true, game->saved_data().root().get("audio", Json::Value(true)).asBool());
|
||||
toggle_audio_.image().SetPosition(Engine::Get().GetScreenSize() *
|
||||
Vector2f(0, -0.25f));
|
||||
toggle_audio_.image().Scale(0.7f);
|
||||
|
@ -165,8 +162,7 @@ bool Menu::Initialize() {
|
|||
game->SetEnableMusic(toggle_music_.enabled());
|
||||
game->saved_data().root()["music"] = toggle_music_.enabled();
|
||||
},
|
||||
true, game->saved_data().root().get("music", Json::Value(true)).asBool(),
|
||||
kColorFadeOut, kColorSwitch);
|
||||
true, game->saved_data().root().get("music", Json::Value(true)).asBool());
|
||||
toggle_music_.image().SetPosition(Engine::Get().GetScreenSize() *
|
||||
Vector2f(0, -0.25f));
|
||||
toggle_music_.image().Scale(0.7f);
|
||||
|
@ -181,8 +177,7 @@ bool Menu::Initialize() {
|
|||
game->saved_data().root()["vibration"] = toggle_vibration_.enabled();
|
||||
},
|
||||
true,
|
||||
game->saved_data().root().get("vibration", Json::Value(true)).asBool(),
|
||||
kColorFadeOut, kColorSwitch);
|
||||
game->saved_data().root().get("vibration", Json::Value(true)).asBool());
|
||||
toggle_vibration_.image().SetPosition(Engine::Get().GetScreenSize() *
|
||||
Vector2f(0, -0.25f));
|
||||
toggle_vibration_.image().Scale(0.7f);
|
||||
|
@ -193,21 +188,6 @@ bool Menu::Initialize() {
|
|||
toggle_vibration_.image().Translate(
|
||||
{toggle_music_.image().GetSize().x / 2, 0});
|
||||
|
||||
renderer_type_.Create(
|
||||
"renderer_logo", {2, 1}, 0, 1,
|
||||
[&] {
|
||||
Engine::Get().CreateRenderer(renderer_type_.enabled()
|
||||
? RendererType::kVulkan
|
||||
: RendererType::kOpenGL);
|
||||
renderer_type_.SetEnabled(
|
||||
(Engine::Get().GetRendererType() == RendererType::kVulkan));
|
||||
},
|
||||
true, Engine::Get().GetRendererType() == RendererType::kVulkan,
|
||||
kColorFadeOut, {Vector4f{1, 1, 1, 1}, Vector4f{1, 1, 1, 1}});
|
||||
renderer_type_.image().PlaceToBottomOf(toggle_music_.image());
|
||||
renderer_type_.image().Translate(toggle_music_.image().GetPosition() *
|
||||
Vector2f(0, 1.1f));
|
||||
|
||||
high_score_value_ = game->GetHighScore();
|
||||
|
||||
high_score_.Create("high_score_tex");
|
||||
|
@ -246,7 +226,7 @@ bool Menu::Initialize() {
|
|||
starting_wave_.image().SetFrame(start_from_wave_ / 3);
|
||||
click_.Play(false);
|
||||
},
|
||||
false, true, kColorFadeOut, kColorSwitch);
|
||||
false, true);
|
||||
wave_up_.image().Scale(1.5f);
|
||||
|
||||
return true;
|
||||
|
@ -256,7 +236,6 @@ void Menu::OnInputEvent(std::unique_ptr<InputEvent> event) {
|
|||
if (toggle_audio_.OnInputEvent(event.get()) ||
|
||||
toggle_music_.OnInputEvent(event.get()) ||
|
||||
toggle_vibration_.OnInputEvent(event.get()) ||
|
||||
renderer_type_.OnInputEvent(event.get()) ||
|
||||
(wave_up_.image().IsVisible() && wave_up_.OnInputEvent(event.get())))
|
||||
return;
|
||||
|
||||
|
@ -371,7 +350,6 @@ void Menu::Show() {
|
|||
toggle_audio_.Show();
|
||||
toggle_music_.Show();
|
||||
toggle_vibration_.Show();
|
||||
renderer_type_.Show();
|
||||
|
||||
Demo* game = static_cast<Demo*>(Engine::Get().GetGame());
|
||||
|
||||
|
@ -432,7 +410,6 @@ void Menu::Hide(Closure cb) {
|
|||
toggle_audio_.Hide();
|
||||
toggle_music_.Hide();
|
||||
toggle_vibration_.Hide();
|
||||
renderer_type_.Hide();
|
||||
|
||||
if (starting_wave_.image().IsVisible()) {
|
||||
starting_wave_.Hide();
|
||||
|
@ -448,7 +425,6 @@ bool Menu::CreateRenderResources() {
|
|||
Engine::Get().SetImageSource("buttons_tex", "menu_icons.png");
|
||||
Engine::Get().SetImageSource("high_score_tex",
|
||||
std::bind(&Menu::CreateHighScoreImage, this));
|
||||
Engine::Get().SetImageSource("renderer_logo", "renderer_logo.png");
|
||||
|
||||
Engine::Get().SetImageSource("wave_up_tex", []() -> std::unique_ptr<Image> {
|
||||
const Font& font = static_cast<Demo*>(Engine::Get().GetGame())->GetFont();
|
||||
|
@ -544,20 +520,16 @@ void Menu::Button::Create(const std::string& asset_name,
|
|||
int frame2,
|
||||
Closure pressed_cb,
|
||||
bool switch_control,
|
||||
bool enabled,
|
||||
const Vector4f& fade_out_color,
|
||||
const std::array<Vector4f, 2>& switch_color) {
|
||||
bool enabled) {
|
||||
frame1_ = frame1;
|
||||
frame2_ = frame2;
|
||||
pressed_cb_ = std::move(pressed_cb);
|
||||
switch_control_ = switch_control;
|
||||
enabled_ = enabled;
|
||||
fade_out_color_ = fade_out_color;
|
||||
switch_color_ = switch_color;
|
||||
|
||||
image_.Create(asset_name, num_frames);
|
||||
image_.SetFrame(enabled ? frame1 : frame2);
|
||||
image_.SetColor(fade_out_color_);
|
||||
image_.SetColor(kColorFadeOut);
|
||||
image_.SetZOrder(41);
|
||||
image_.SetVisible(false);
|
||||
|
||||
|
@ -590,14 +562,14 @@ bool Menu::Button::OnInputEvent(eng::InputEvent* event) {
|
|||
|
||||
void Menu::Button::Show() {
|
||||
animator_.SetVisible(true);
|
||||
animator_.SetBlending(enabled_ ? switch_color_[0] : switch_color_[1],
|
||||
animator_.SetBlending(enabled_ ? kColorSwitch[0] : kColorSwitch[1],
|
||||
kBlendingSpeed);
|
||||
animator_.Play(Animator::kBlending, false);
|
||||
animator_.SetEndCallback(Animator::kBlending, nullptr);
|
||||
}
|
||||
|
||||
void Menu::Button::Hide() {
|
||||
animator_.SetBlending(fade_out_color_, kBlendingSpeed);
|
||||
animator_.SetBlending(kColorFadeOut, kBlendingSpeed);
|
||||
animator_.Play(Animator::kBlending, false);
|
||||
animator_.SetEndCallback(Animator::kBlending,
|
||||
[&]() -> void { animator_.SetVisible(false); });
|
||||
|
@ -607,7 +579,7 @@ void Menu::Button::SetEnabled(bool enable) {
|
|||
if (switch_control_) {
|
||||
enabled_ = enable;
|
||||
image_.SetFrame(enabled_ ? frame1_ : frame2_);
|
||||
image_.SetColor(enabled_ ? switch_color_[0] : switch_color_[1]);
|
||||
image_.SetColor(enabled_ ? kColorSwitch[0] : kColorSwitch[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,17 +55,13 @@ class Menu {
|
|||
int frame2,
|
||||
base::Closure pressed_cb,
|
||||
bool switch_control,
|
||||
bool enabled,
|
||||
const base::Vector4f& fade_out_color,
|
||||
const std::array<base::Vector4f, 2>& switch_color);
|
||||
bool enabled);
|
||||
|
||||
bool OnInputEvent(eng::InputEvent* event);
|
||||
|
||||
void Show();
|
||||
void Hide();
|
||||
|
||||
void SetEnabled(bool enable);
|
||||
|
||||
eng::ImageQuad& image() { return image_; };
|
||||
|
||||
bool enabled() const { return enabled_; }
|
||||
|
@ -81,8 +77,7 @@ class Menu {
|
|||
bool enabled_ = false;
|
||||
base::Vector2f tap_pos_[2] = {{0, 0}, {0, 0}};
|
||||
|
||||
base::Vector4f fade_out_color_;
|
||||
std::array<base::Vector4f, 2> switch_color_;
|
||||
void SetEnabled(bool enable);
|
||||
};
|
||||
|
||||
class Radio {
|
||||
|
@ -131,7 +126,6 @@ class Menu {
|
|||
Button toggle_audio_;
|
||||
Button toggle_music_;
|
||||
Button toggle_vibration_;
|
||||
Button renderer_type_;
|
||||
|
||||
size_t high_score_value_ = 0;
|
||||
|
||||
|
|
|
@ -11,28 +11,28 @@ namespace eng {
|
|||
namespace {
|
||||
|
||||
template <typename T>
|
||||
std::array<std::unique_ptr<T[]>, 2> Deinterleave(
|
||||
size_t num_channels,
|
||||
size_t num_samples,
|
||||
std::unique_ptr<float[]> source_buffer) {
|
||||
std::array<std::unique_ptr<T[]>, 2> Deinterleave(size_t num_channels,
|
||||
size_t num_samples,
|
||||
float* input_buffer) {
|
||||
std::array<std::unique_ptr<T[]>, 2> channels;
|
||||
|
||||
if (num_channels == 1) {
|
||||
// Single channel.
|
||||
if constexpr (std::is_same<float, T>::value) {
|
||||
// Passthrough
|
||||
channels[0] = std::move(source_buffer);
|
||||
channels[0] = std::make_unique<T[]>(num_samples);
|
||||
memcpy(channels[0].get(), input_buffer, num_samples * sizeof(float));
|
||||
} else {
|
||||
channels[0] = std::make_unique<T[]>(num_samples);
|
||||
for (int i = 0; i < num_samples; ++i)
|
||||
channels[0].get()[i] = static_cast<T>(source_buffer.get()[i]);
|
||||
channels[0].get()[i] = static_cast<T>(input_buffer[i]);
|
||||
}
|
||||
} else {
|
||||
// Deinterleave into separate channels.
|
||||
channels[0] = std::make_unique<T[]>(num_samples);
|
||||
channels[1] = std::make_unique<T[]>(num_samples);
|
||||
for (size_t i = 0, j = 0; i < num_samples * 2; i += 2) {
|
||||
channels[0].get()[j] = static_cast<T>(source_buffer.get()[i]);
|
||||
channels[1].get()[j++] = static_cast<T>(source_buffer.get()[i + 1]);
|
||||
channels[0].get()[j] = static_cast<T>(input_buffer[i]);
|
||||
channels[1].get()[j++] = static_cast<T>(input_buffer[i + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,15 +59,15 @@ void AudioBus::SetAudioConfig(size_t num_channels, size_t sample_rate) {
|
|||
sample_rate_ = sample_rate;
|
||||
}
|
||||
|
||||
void AudioBus::FromInterleaved(std::unique_ptr<float[]> source_buffer,
|
||||
void AudioBus::FromInterleaved(std::unique_ptr<float[]> input_buffer,
|
||||
size_t samples_per_channel) {
|
||||
auto channels = Deinterleave<float>(num_channels_, samples_per_channel,
|
||||
std::move(source_buffer));
|
||||
input_buffer.get());
|
||||
|
||||
size_t hw_sample_rate = Engine::Get().GetAudioHardwareSampleRate();
|
||||
|
||||
if (hw_sample_rate == sample_rate_) {
|
||||
// Passthrough
|
||||
// No need for resmapling.
|
||||
channel_data_[0] = std::move(channels[0]);
|
||||
if (num_channels_ == 2)
|
||||
channel_data_[1] = std::move(channels[1]);
|
||||
|
|
|
@ -7,10 +7,6 @@ namespace eng {
|
|||
|
||||
class SincResampler;
|
||||
|
||||
// Represents a sequence of audio samples for each channels. The data layout is
|
||||
// planar as opposed to interleaved. The memory for the data is allocated and
|
||||
// owned by the AudioBus. Max two channels are supported. An AudioBus with one
|
||||
// channel is mono, with two channels is stereo.
|
||||
class AudioBus {
|
||||
public:
|
||||
AudioBus();
|
||||
|
@ -32,11 +28,7 @@ class AudioBus {
|
|||
protected:
|
||||
void SetAudioConfig(size_t num_channels, size_t sample_rate);
|
||||
|
||||
// Overwrites the sample values stored in this AudioBus instance with values
|
||||
// from a given interleaved source_buffer. The expected layout of the
|
||||
// source_buffer is [ch0, ch1, ch0, ch1, ...]. A sample-rate conversion to the
|
||||
// system sample-rate will be made if it doesn't match.
|
||||
void FromInterleaved(std::unique_ptr<float[]> source_buffer,
|
||||
void FromInterleaved(std::unique_ptr<float[]> input_buffer,
|
||||
size_t samples_per_channel);
|
||||
|
||||
private:
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <unordered_map>
|
||||
|
||||
#include "base/closure.h"
|
||||
#include "engine/audio/audio_sink.h"
|
||||
#include "engine/audio/audio_sink_delegate.h"
|
||||
|
||||
namespace base {
|
||||
class TaskRunner;
|
||||
|
@ -22,7 +22,7 @@ class AudioBus;
|
|||
// Mix and render audio with low overhead. A platform specific AudioSink
|
||||
// implementation is expected to periodically call RenderAudio() in a background
|
||||
// thread.
|
||||
class AudioMixer : public AudioSink::Delegate {
|
||||
class AudioMixer : public AudioSinkDelegate {
|
||||
public:
|
||||
AudioMixer();
|
||||
~AudioMixer();
|
||||
|
@ -91,7 +91,7 @@ class AudioMixer : public AudioSink::Delegate {
|
|||
|
||||
bool audio_enabled_ = true;
|
||||
|
||||
// AudioSink::Delegate implementation
|
||||
// AudioSinkDelegate implementation
|
||||
int GetChannelCount() final { return kChannelCount; }
|
||||
void RenderAudio(float* output_buffer, size_t num_frames) final;
|
||||
|
||||
|
|
|
@ -4,19 +4,9 @@
|
|||
namespace eng {
|
||||
|
||||
// Models an audio sink sending mixed audio to the audio driver. Audio data from
|
||||
// the mixer source is delivered on a pull model using Delegate.
|
||||
// the mixer source is delivered on a pull model using AudioSinkDelegate.
|
||||
class AudioSink {
|
||||
public:
|
||||
class Delegate {
|
||||
public:
|
||||
Delegate() = default;
|
||||
virtual ~Delegate() = default;
|
||||
|
||||
virtual int GetChannelCount() = 0;
|
||||
|
||||
virtual void RenderAudio(float* output_buffer, size_t num_frames) = 0;
|
||||
};
|
||||
|
||||
AudioSink() = default;
|
||||
virtual ~AudioSink() = default;
|
||||
|
||||
|
|
|
@ -5,12 +5,13 @@
|
|||
#include <alsa/asoundlib.h>
|
||||
|
||||
#include "base/log.h"
|
||||
#include "engine/audio/audio_sink_delegate.h"
|
||||
|
||||
using namespace base;
|
||||
|
||||
namespace eng {
|
||||
|
||||
AudioSinkAlsa::AudioSinkAlsa(AudioSink::Delegate* delegate)
|
||||
AudioSinkAlsa::AudioSinkAlsa(AudioSinkDelegate* delegate)
|
||||
: delegate_(delegate) {}
|
||||
|
||||
AudioSinkAlsa::~AudioSinkAlsa() {
|
||||
|
|
|
@ -10,9 +10,11 @@ typedef struct _snd_pcm snd_pcm_t;
|
|||
|
||||
namespace eng {
|
||||
|
||||
class AudioSinkDelegate;
|
||||
|
||||
class AudioSinkAlsa final : public AudioSink {
|
||||
public:
|
||||
AudioSinkAlsa(AudioSink::Delegate* delegate);
|
||||
AudioSinkAlsa(AudioSinkDelegate* delegate);
|
||||
~AudioSinkAlsa() final;
|
||||
|
||||
bool Initialize() final;
|
||||
|
@ -34,7 +36,7 @@ class AudioSinkAlsa final : public AudioSink {
|
|||
size_t sample_rate_ = 0;
|
||||
size_t period_size_ = 0;
|
||||
|
||||
AudioSink::Delegate* delegate_ = nullptr;
|
||||
AudioSinkDelegate* delegate_ = nullptr;
|
||||
|
||||
void StartAudioThread();
|
||||
void TerminateAudioThread();
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef ENGINE_AUDIO_AUDIO_SINK_DELEGATE_H
|
||||
#define ENGINE_AUDIO_AUDIO_SINK_DELEGATE_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
namespace eng {
|
||||
|
||||
class AudioSinkDelegate {
|
||||
public:
|
||||
AudioSinkDelegate() = default;
|
||||
virtual ~AudioSinkDelegate() = default;
|
||||
|
||||
virtual int GetChannelCount() = 0;
|
||||
|
||||
virtual void RenderAudio(float* output_buffer, size_t num_frames) = 0;
|
||||
};
|
||||
|
||||
} // namespace eng
|
||||
|
||||
#endif // ENGINE_AUDIO_AUDIO_SINK_DELEGATE_H
|
|
@ -1,13 +1,14 @@
|
|||
#include "engine/audio/audio_sink_oboe.h"
|
||||
|
||||
#include "base/log.h"
|
||||
#include "engine/audio/audio_sink_delegate.h"
|
||||
#include "third_party/oboe/include/oboe/Oboe.h"
|
||||
|
||||
using namespace base;
|
||||
|
||||
namespace eng {
|
||||
|
||||
AudioSinkOboe::AudioSinkOboe(AudioSink::Delegate* delegate)
|
||||
AudioSinkOboe::AudioSinkOboe(AudioSinkDelegate* delegate)
|
||||
: callback_(std::make_unique<StreamCallback>(this)), delegate_(delegate) {}
|
||||
|
||||
AudioSinkOboe::~AudioSinkOboe() {
|
||||
|
|
|
@ -10,9 +10,11 @@
|
|||
|
||||
namespace eng {
|
||||
|
||||
class AudioSinkDelegate;
|
||||
|
||||
class AudioSinkOboe final : public AudioSink {
|
||||
public:
|
||||
AudioSinkOboe(AudioSink::Delegate* delegate);
|
||||
AudioSinkOboe(AudioSinkDelegate* delegate);
|
||||
~AudioSinkOboe() final;
|
||||
|
||||
bool Initialize() final;
|
||||
|
@ -42,7 +44,7 @@ class AudioSinkOboe final : public AudioSink {
|
|||
oboe::ManagedStream stream_;
|
||||
std::unique_ptr<StreamCallback> callback_;
|
||||
|
||||
AudioSink::Delegate* delegate_ = nullptr;
|
||||
AudioSinkDelegate* delegate_ = nullptr;
|
||||
|
||||
bool RestartStream();
|
||||
};
|
||||
|
|
|
@ -106,7 +106,7 @@ void Engine::Initialize() {
|
|||
|
||||
thread_pool_.Initialize();
|
||||
|
||||
CreateRenderer(RendererType::kVulkan);
|
||||
CreateRenderer(true);
|
||||
|
||||
// Normalize viewport.
|
||||
if (GetScreenWidth() > GetScreenHeight()) {
|
||||
|
@ -201,27 +201,23 @@ void Engine::RemoveAnimator(Animator* animator) {
|
|||
}
|
||||
}
|
||||
|
||||
void Engine::CreateRenderer(RendererType type) {
|
||||
if ((dynamic_cast<RendererVulkan*>(renderer_.get()) &&
|
||||
type == RendererType::kVulkan) ||
|
||||
(dynamic_cast<RendererOpenGL*>(renderer_.get()) &&
|
||||
type == RendererType::kOpenGL))
|
||||
void Engine::CreateRenderer(bool vulkan) {
|
||||
if ((dynamic_cast<RendererVulkan*>(renderer_.get()) && vulkan) ||
|
||||
(dynamic_cast<RendererOpenGL*>(renderer_.get()) && !vulkan))
|
||||
return;
|
||||
|
||||
if (type == RendererType::kVulkan)
|
||||
if (vulkan)
|
||||
renderer_ =
|
||||
std::make_unique<RendererVulkan>(std::bind(&Engine::ContextLost, this));
|
||||
else if (type == RendererType::kOpenGL)
|
||||
else
|
||||
renderer_ =
|
||||
std::make_unique<RendererOpenGL>(std::bind(&Engine::ContextLost, this));
|
||||
else
|
||||
NOTREACHED;
|
||||
|
||||
bool result = renderer_->Initialize(platform_);
|
||||
if (!result && type == RendererType::kVulkan) {
|
||||
if (!result && vulkan) {
|
||||
LOG << "Failed to initialize " << renderer_->GetDebugName() << " renderer.";
|
||||
LOG << "Fallback to OpenGL renderer.";
|
||||
CreateRenderer(RendererType::kOpenGL);
|
||||
CreateRenderer(false);
|
||||
return;
|
||||
}
|
||||
CHECK(result) << "Failed to initialize " << renderer_->GetDebugName()
|
||||
|
@ -231,12 +227,6 @@ void Engine::CreateRenderer(RendererType type) {
|
|||
ContextLost();
|
||||
}
|
||||
|
||||
RendererType Engine::GetRendererType() {
|
||||
if (renderer_)
|
||||
return renderer_->GetRendererType();
|
||||
return RendererType::kUnknown;
|
||||
}
|
||||
|
||||
void Engine::Exit() {
|
||||
platform_->Exit();
|
||||
}
|
||||
|
|
|
@ -20,18 +20,17 @@ namespace eng {
|
|||
|
||||
class Animator;
|
||||
class AudioMixer;
|
||||
class Drawable;
|
||||
class Font;
|
||||
class Game;
|
||||
class Geometry;
|
||||
class Drawable;
|
||||
class InputEvent;
|
||||
class Image;
|
||||
class ImageQuad;
|
||||
class InputEvent;
|
||||
class Platform;
|
||||
class Renderer;
|
||||
class Geometry;
|
||||
class Shader;
|
||||
class Texture;
|
||||
enum class RendererType;
|
||||
class Platform;
|
||||
|
||||
class Engine : public PlatformObserver {
|
||||
public:
|
||||
|
@ -50,8 +49,7 @@ class Engine : public PlatformObserver {
|
|||
void AddAnimator(Animator* animator);
|
||||
void RemoveAnimator(Animator* animator);
|
||||
|
||||
void CreateRenderer(RendererType type);
|
||||
RendererType GetRendererType();
|
||||
void CreateRenderer(bool vulkan);
|
||||
|
||||
void Exit();
|
||||
|
||||
|
|
|
@ -86,8 +86,6 @@ class RendererOpenGL final : public Renderer {
|
|||
|
||||
const char* GetDebugName() final { return "OpenGL"; }
|
||||
|
||||
RendererType GetRendererType() final { return RendererType::kOpenGL; }
|
||||
|
||||
private:
|
||||
struct GeometryOpenGL {
|
||||
struct Element {
|
||||
|
|
|
@ -15,8 +15,6 @@ class ShaderSource;
|
|||
class Mesh;
|
||||
class Platform;
|
||||
|
||||
enum class RendererType { kUnknown, kVulkan, kOpenGL };
|
||||
|
||||
class Renderer {
|
||||
public:
|
||||
const unsigned kInvalidId = 0;
|
||||
|
@ -84,8 +82,6 @@ class Renderer {
|
|||
|
||||
virtual const char* GetDebugName() = 0;
|
||||
|
||||
virtual RendererType GetRendererType() { return RendererType::kUnknown; }
|
||||
|
||||
protected:
|
||||
struct TextureCompression {
|
||||
unsigned etc1 : 1;
|
||||
|
|
|
@ -69,8 +69,6 @@ class RendererVulkan final : public Renderer {
|
|||
|
||||
const char* GetDebugName() final { return "Vulkan"; }
|
||||
|
||||
RendererType GetRendererType() final { return RendererType::kVulkan; }
|
||||
|
||||
private:
|
||||
// VkBuffer or VkImage with allocator.
|
||||
template <typename T>
|
||||
|
|
Loading…
Reference in New Issue