fix missing link to starfield implementation files

This commit is contained in:
Stephen Birarda 2013-10-18 09:01:44 -07:00
parent 53ffff2718
commit 1ddc52252a
5 changed files with 34 additions and 72 deletions

View file

@ -38,14 +38,11 @@ configure_file(InterfaceConfig.h.in ${PROJECT_BINARY_DIR}/includes/InterfaceConf
# grab the implementation and header files from src dirs # grab the implementation and header files from src dirs
file(GLOB INTERFACE_SRCS src/*.cpp src/*.h) file(GLOB INTERFACE_SRCS src/*.cpp src/*.h)
foreach(SUBDIR avatar devices renderer ui) foreach(SUBDIR avatar devices renderer ui starfield)
file(GLOB SUBDIR_SRCS src/${SUBDIR}/*.cpp src/${SUBDIR}/*.h) file(GLOB_RECURSE SUBDIR_SRCS src/${SUBDIR}/*.cpp src/${SUBDIR}/*.h)
set(INTERFACE_SRCS ${INTERFACE_SRCS} ${SUBDIR_SRCS}) set(INTERFACE_SRCS ${INTERFACE_SRCS} ${SUBDIR_SRCS})
endforeach(SUBDIR) endforeach(SUBDIR)
# project subdirectories
add_subdirectory(src/starfield)
find_package(Qt5Core REQUIRED) find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED) find_package(Qt5Gui REQUIRED)
find_package(Qt5Multimedia REQUIRED) find_package(Qt5Multimedia REQUIRED)

View file

@ -7,11 +7,9 @@
// //
#include "InterfaceConfig.h" #include "InterfaceConfig.h"
#include "Stars.h" #include "Stars.h"
#define __interface__Starfield_impl__
#include "starfield/Controller.h" #include "starfield/Controller.h"
#undef __interface__Starfield_impl__
Stars::Stars() : Stars::Stars() :
_controller(0l), _starsLoaded(false) { _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 // pull the modelview matrix off the GL stack
glm::mat4 view; glGetFloatv(GL_MODELVIEW_MATRIX, glm::value_ptr(view)); 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);
} }

View file

@ -13,53 +13,39 @@
namespace starfield { class Controller; } namespace starfield { class Controller; }
// // Starfield rendering component.
// Starfield rendering component.
//
class Stars { class Stars {
public: public:
Stars(); Stars();
~Stars(); ~Stars();
// // Generate stars from random number
// Generate stars from random number seed // The numStars parameter sets the number of stars to generate.
// bool generate(unsigned numStars, unsigned seed);
// 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.
// Renders the starfield from a local viewer's perspective. // The parameters specifiy the field of view.
// The parameters specifiy the field of view. void render(float fovY, float aspect, float nearZ, float alpha);
//
void render(float fovY, float aspect, float nearZ, float alpha);
// // Sets the resolution for FOV culling.
// Sets the resolution for FOV culling. //
// // The parameter determines the number of tiles in azimuthal
// The parameter determines the number of tiles in azimuthal // and altitudinal directions.
// and altitudinal directions. //
// // GPU resources are updated upon change in which case 'true'
// GPU resources are updated upon change in which case 'true' // is returned.
// is returned. bool setResolution(unsigned k);
//
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;
bool _starsLoaded;
//
// 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;
}; };

View file

@ -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})

View file

@ -18,25 +18,16 @@
#include "starfield/renderer/VertexOrder.h" #include "starfield/renderer/VertexOrder.h"
namespace starfield { namespace starfield {
class Controller { class Controller {
public: public:
Controller() : _tileResolution(20), _renderer(0l) { } Controller() : _tileResolution(20), _renderer(0l) { }
~Controller() { ~Controller() { delete _renderer; }
delete _renderer;
}
bool computeStars(unsigned numStars, unsigned seed); bool computeStars(unsigned numStars, unsigned seed);
bool setResolution(unsigned tileResolution); bool setResolution(unsigned tileResolution);
void render(float perspective, float angle, mat4 const& orientation, float alpha); void render(float perspective, float angle, mat4 const& orientation, float alpha);
private: private:
void retile(unsigned numStars, unsigned tileResolution); void retile(unsigned numStars, unsigned tileResolution);
void recreateRenderer(unsigned numStars, unsigned tileResolution); void recreateRenderer(unsigned numStars, unsigned tileResolution);
@ -45,7 +36,6 @@ namespace starfield {
unsigned _tileResolution; unsigned _tileResolution;
unsigned _numStars; unsigned _numStars;
Renderer* _renderer; Renderer* _renderer;
}; };
} }
#endif #endif