-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Devyatovskaya task3 #35
base: master
Are you sure you want to change the base?
Conversation
Оно работает:) |
|
||
include_directories( ${OPENGL_INCLUDE_DIRS}) | ||
|
||
qt5_wrap_ui(UI_HEADERS PhongLighting.ui RenderDialog.ui MorphingDialog.ui) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужно поправить cmake аналогично тому, как это сделано в Task2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
поправила
d1e0a73
to
1b955bb
Compare
std::string vertex; | ||
std::string fragment; | ||
std::shared_ptr<GLMeshRendererGenerator> renderer_generator; | ||
std::shared_ptr<QOpenGLShaderProgram> shader_program{nullptr}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::shared_ptr<QOpenGLShaderProgram> shader_program{nullptr}; | |
std::shared_ptr<QOpenGLShaderProgram> shader_program; |
float shininess; | ||
}; | ||
|
||
uniform Material material; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Шейдеры лучше не копировать (чревато ошибками), можно просто вынести общий код в отдельный шейдер и перед компиляцией склеить все шейдеры вместе (как C++ строки)
Можно не исправлять.
|
||
class ShaderCollection final { | ||
public: | ||
inline static std::map<std::string, ShaderData> shaders = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это не java :) Зачем вам класс с одной статической переменной :)
void init(); | ||
|
||
private: | ||
GLScene default_morphing(ShaderData &data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если эти методы не модифицируют ShaderData, то лучше сделать метод константным и данные передавать по const ссылке
GLScene default_morphing(ShaderData &data); | |
[[nodiscard]] GLScene default_morphing(const ShaderData &data); |
Q_OBJECT | ||
|
||
public: | ||
PhongLighting(QWidget *parent = Q_NULLPTR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PhongLighting(QWidget *parent = Q_NULLPTR); | |
PhongLighting(QWidget *parent = nullptr); |
|
||
class MeshGeneratorCollection final { | ||
public: | ||
inline static std::map<std::string, std::shared_ptr<GLMeshGenerator>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Опять класс с одной статической переменной
#include <string> | ||
|
||
struct GLTexture { | ||
std::string type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше использовать enum class
src/devyatovskaya/Task3/GLTexture.h
Outdated
|
||
struct GLTexture { | ||
std::string type; | ||
std::string path; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::filesystem::path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
И поле вообще не используется
shader_program_ = std::move(shader_program); | ||
} | ||
|
||
void GLMeshRenderer::render_wireframe(QOpenGLFunctions_3_0 &functions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Просите интерфейс для 3.0 версии, а в шейдерах 450 ставите. Все еще проблема с несколькими точками входа.
float shininess; | ||
bool is_light_source; | ||
|
||
GLMaterial(QColor _ambient = {}, QColor _diffuse = {}, QColor _specular = {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нуууу, это какая-то "жесть", задавайте значения полям. А объект создавайте через фигурные скобки.
1b955bb
to
7f50dae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почитайте замечания, исправить вы их очевидно не успеете.
src/devyatovskaya/Task3/GLTexture.h
Outdated
|
||
struct GLTexture { | ||
std::string type; | ||
std::string path; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
И поле вообще не используется
|
||
Q_OBJECT | ||
signals: | ||
void emit_fps(const QString &); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сигнал не реализован
public: | ||
void calculate_fps(); | ||
|
||
float delta_time() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
float delta_time() const; | |
[[nodiscard]] float delta_time() const; |
float delta_time() const; | ||
|
||
private: | ||
QString fps_to_str() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QString fps_to_str() const; | |
[[nodiscard]] QString fps_to_str() const; |
elapsed_frame_time_ += frame_time; | ||
|
||
// update fps every half second | ||
if (elapsed_frame_time_ >= 0.5f) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.5f
лучше вынести в отдельную compile-time константу с понятным названием.
void set_morph_factor(int morph_factor); | ||
|
||
signals: | ||
void send_fps(const QString &); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
нереализован сигнал
PreparedScenes prep_scenes_; | ||
|
||
std::size_t scene_count_{0}; | ||
bool is_morphing_{false}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Никогда не читается
void update_framerate(); | ||
|
||
public: | ||
PreparedScenes prep_scenes_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Снова публичные поля
GLScene default_scene_sphere(ShaderData &); | ||
GLScene default_scene_cube(ShaderData &); | ||
|
||
GLScene mesh_earth(ShaderData &); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Методы ниже не реализованы
|
||
QSurfaceFormat format; | ||
format.setSamples(16); | ||
format.setVersion(2, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут 2.1
версию OpenGL просите, в коде создаете контекст и интерфейс для 3.0
, в шейдерах просите 4.1+
. Странное, что оно вообще не падает
7f50dae
to
a1549d0
Compare
No description provided.