diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 308ce33324..4709bf234d 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -38,14 +38,11 @@ configure_file(InterfaceConfig.h.in ${PROJECT_BINARY_DIR}/includes/InterfaceConf # grab the implementation and header files from src dirs file(GLOB INTERFACE_SRCS src/*.cpp src/*.h) -foreach(SUBDIR avatar devices renderer ui) - file(GLOB SUBDIR_SRCS src/${SUBDIR}/*.cpp src/${SUBDIR}/*.h) +foreach(SUBDIR avatar devices renderer ui starfield) + file(GLOB_RECURSE SUBDIR_SRCS src/${SUBDIR}/*.cpp src/${SUBDIR}/*.h) set(INTERFACE_SRCS ${INTERFACE_SRCS} ${SUBDIR_SRCS}) endforeach(SUBDIR) -# project subdirectories -add_subdirectory(src/starfield) - find_package(Qt5Core REQUIRED) find_package(Qt5Gui REQUIRED) find_package(Qt5Multimedia REQUIRED) diff --git a/interface/src/Stars.cpp b/interface/src/Stars.cpp index 15beff5e9d..69340b2926 100755 --- a/interface/src/Stars.cpp +++ b/interface/src/Stars.cpp @@ -7,11 +7,9 @@ // #include "InterfaceConfig.h" -#include "Stars.h" +#include "Stars.h" -#define __interface__Starfield_impl__ #include "starfield/Controller.h" -#undef __interface__Starfield_impl__ Stars::Stars() : _controller(0l), _starsLoaded(false) { @@ -43,7 +41,7 @@ void Stars::render(float fovY, float aspect, float nearZ, float alpha) { // pull the modelview matrix off the GL stack glm::mat4 view; glGetFloatv(GL_MODELVIEW_MATRIX, glm::value_ptr(view)); - _controller->render(fovDiagonal, aspect, glm::affineInverse(view), alpha); + _controller->render(fovDiagonal, aspect, glm::affineInverse(view), alpha); } diff --git a/interface/src/Stars.h b/interface/src/Stars.h index 99d5149f37..f6fe7cfb80 100755 --- a/interface/src/Stars.h +++ b/interface/src/Stars.h @@ -13,53 +13,39 @@ namespace starfield { class Controller; } -// -// Starfield rendering component. -// +// Starfield rendering component. class Stars { - public: - Stars(); - ~Stars(); +public: + Stars(); + ~Stars(); - // - // Generate stars from random number seed - // - // The numStars parameter sets the number of stars to generate. - // - bool generate(unsigned numStars, unsigned seed); + // Generate stars from random number + // The numStars parameter sets the number of stars to generate. + bool generate(unsigned numStars, unsigned seed); - // - // Renders the starfield from a local viewer's perspective. - // The parameters specifiy the field of view. - // - void render(float fovY, float aspect, float nearZ, float alpha); + // Renders the starfield from a local viewer's perspective. + // The parameters specifiy the field of view. + void render(float fovY, float aspect, float nearZ, float alpha); - // - // Sets the resolution for FOV culling. - // - // The parameter determines the number of tiles in azimuthal - // and altitudinal directions. - // - // GPU resources are updated upon change in which case 'true' - // is returned. - // - bool setResolution(unsigned k); + // Sets the resolution for FOV culling. + // + // The parameter determines the number of tiles in azimuthal + // and altitudinal directions. + // + // GPU resources are updated upon change in which case 'true' + // is returned. + bool setResolution(unsigned k); + + // Returns true when stars have been loaded + bool isStarsLoaded() const { return _starsLoaded; }; +private: + // don't copy/assign + Stars(Stars const&); // = delete; + Stars& operator=(Stars const&); // delete; + + starfield::Controller* _controller; - - // - // Returns true when stars have been loaded - // - bool isStarsLoaded() const { return _starsLoaded; }; - private: - // don't copy/assign - Stars(Stars const&); // = delete; - Stars& operator=(Stars const&); // delete; - - // variables - - starfield::Controller* _controller; - - bool _starsLoaded; + bool _starsLoaded; }; diff --git a/interface/src/starfield/CMakeLists.txt b/interface/src/starfield/CMakeLists.txt deleted file mode 100755 index 0e25c37863..0000000000 --- a/interface/src/starfield/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ - -project(starfield) - -# Only headers (that are facaded by the Stars.cpp file) here - -# hence declared as custom target. - -file(GLOB_RECURSE STARFIELD_SRCS *.cpp *.h) -add_custom_target("starfield" SOURCES ${STARFIELD_SRCS}) - diff --git a/interface/src/starfield/Controller.h b/interface/src/starfield/Controller.h index 34cf9b46f3..c5ade48442 100755 --- a/interface/src/starfield/Controller.h +++ b/interface/src/starfield/Controller.h @@ -18,25 +18,16 @@ #include "starfield/renderer/VertexOrder.h" namespace starfield { - class Controller { public: - Controller() : _tileResolution(20), _renderer(0l) { } - - ~Controller() { - delete _renderer; - } + + ~Controller() { delete _renderer; } bool computeStars(unsigned numStars, unsigned seed); - bool setResolution(unsigned tileResolution); - - void render(float perspective, float angle, mat4 const& orientation, float alpha); - private: - void retile(unsigned numStars, unsigned tileResolution); void recreateRenderer(unsigned numStars, unsigned tileResolution); @@ -45,7 +36,6 @@ namespace starfield { unsigned _tileResolution; unsigned _numStars; Renderer* _renderer; - }; } #endif