Commit c7d1b170 authored by Justine Martin's avatar Justine Martin 💖
Browse files

chore : Ajoute glitter en dépendance

parent f255d029
Loading
Loading
Loading
Loading
+18 −2
Changes for CMakeLists.txt: 18 added lines, 2 removed lines.
Original line number Diff line number Diff line
cmake_minimum_required (VERSION 3.0)

project(GLEngine)

include_directories(include)
set (CMAKE_CXX_STANDARD 11)
add_definitions(-Wall -Wextra)

add_subdirectory("glitter")

include_directories("include")

include_directories("glitter/ext/tinyobjloader"
		"glitter/src/"
		"glitter/ext/glew/include glitter/ext/glew/src"
		"glitter/ext/stb"
		"glitter/ext/glfw/include"
		"glitter/ext/glm"
		${OPENGL_INCLUDE_DIR})

add_executable(GLE-test src/main.cpp)
add_executable(GLE-test src/main.cpp src/GlApplication.cpp)
target_link_libraries(GLE-test utils ${GLFW3_LIBRARIES} ${GLEW_LIBRARIES})
Compare f64684fa to 71336220
Changes for glitter: 1 added line, 1 removed line.
Original line number Diff line number Diff line
Subproject commit f64684fae4e0506e5d7d85ae4a6ec13a5a0b00f6
Subproject commit 7133622051149c9f690a90f388ce706bef8dd8f2
+108 −0
Changes for include/GlApplication.hpp: 108 added lines, 0 removed lines.
Original line number Diff line number Diff line
#ifndef __PA5_APPLICATION_H__
#define __PA5_APPLICATION_H__
#include <memory>
struct GLFWwindow;
#include "Application.hpp"
#include "glApi.hpp"

// forward declarations
struct SimpleMaterial;

class GlApplication : public Application {
public:
  GlApplication(int windowWidth, int windowHeight);
  void setCallbacks() override;
  static void usage(std::string & shortDescritpion, std::string & synopsis, std::string & description);

public:
  static bool displayNormals; ///< Toggles normal display

private:
  void renderFrame() override;
  void update() override;
  static void resize(GLFWwindow * window, int framebufferWidth, int framebufferHeight);
  static void keyCallback(GLFWwindow * window, int key, int scancode, int action, int mods);
  void continuousKey();
  void computeView(bool reset = false);

private:
  class RenderObjectPart {
  public:
    RenderObjectPart() = delete;
    RenderObjectPart(const RenderObjectPart &) = delete;
    RenderObjectPart(RenderObjectPart &&) = default;
    RenderObjectPart(std::shared_ptr<VAO> vao, std::shared_ptr<Program> program, std::shared_ptr<Texture> texture, std::shared_ptr<Texture> ntexture, std::shared_ptr<Texture> stexture);
    void draw(Sampler * colormap, Sampler * normalmap, Sampler * specularmap);
    void update(const glm::mat4 & proj, const glm::mat4 & view, const glm::mat4 & mw, bool displayNormals);

  private:
    std::shared_ptr<VAO> m_vao;
    std::shared_ptr<Program> m_program;
    std::shared_ptr<Texture> m_diffuseTexture;
    std::shared_ptr<Texture> m_normalTexture;
    std::shared_ptr<Texture> m_specularTexture;
  };

  /**
   * @brief The RenderObject class
   *
   * A RenderObject is split into parts, sharing the same geometry (VBOs), but referencing different primitive subsets (IBO) and materials (textures, ...).
   */
  class RenderObject {
  public:
    RenderObject() = delete;
    RenderObject(const RenderObject &) = delete;

    static std::unique_ptr<RenderObject> createCheckerBoardPlaneInstance(const glm::mat4 & modelWorld);
    /**
     * @brief creates an instance from a wavefront file and modelWorld matrix
     * @param objname the filename of the wavefront file
     * @param modelWorld the matrix transform between the object (a.k.a model) space and the world space
     * @return the created RenderObject as a smart pointer
     */
    static std::unique_ptr<RenderObject> createWavefrontInstance(const std::string & objname, const glm::mat4 & modelWorld);

    /**
     * @brief Sets all uniform variables related to material and lighting
     * @param program
     * @param material
     *
     * @note Besides the material, three directional lights (defined in world space) are passed to the GLSL program.
     */
    void setProgramMaterial(std::shared_ptr<Program> & program, const SimpleMaterial & material) const;

    /**
     * @brief Draw this RenderObject
     */
    void draw();

    /**
     * @brief update the program MVP uniform variable
     * @param proj the projection matrix
     * @param view the worldView matrix
     */
    void update(const glm::mat4 & proj, const glm::mat4 & view);

  private:
    RenderObject(const glm::mat4 & modelWorld);
    void loadWavefront(const std::string & objname);

  private:
    glm::mat4 m_mw; ///< modelWorld matrix
    std::vector<RenderObjectPart> m_parts;
    std::unique_ptr<Sampler> m_diffusemap;
    std::unique_ptr<Sampler> m_normalmap;
    std::unique_ptr<Sampler> m_specularmap;
  };

private:
  std::vector<std::unique_ptr<RenderObject>> m_objects; ///< render objects
  glm::mat4 m_proj;                                     ///< Projection matrix
  glm::mat4 m_view;                                     ///< worldView matrix
  float m_eyePhi;                                       ///< Camera position longitude angle
  float m_eyeTheta;                                     ///< Camera position latitude angle
  float m_currentTime;                                  ///< elapsed time since first frame
  float m_deltaTime;                                    ///< elapsed time since last frame
};

#endif // !defined(__PA5_APPLICATION_H__)
+14 −0
Changes for meshes/Pallet/Bswap_HPBake_Planks.mtl: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Blender MTL File: 'pallet_03.blend'
# Material Count: 1

newmtl pallet_03
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 1.000000 1.000000 1.000000
Ks 1.000000 1.000000 1.000000
Ni 1.000000
d 1.000000
illum 2
norm pallet_03_N.png
map_Kd pallet_03_D.png
map_Ks pallet_03_S.png
+993 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading