diff options
| author | Stijn Buys <ingar@osirion.org> | 2009-04-16 19:36:15 +0000 | 
|---|---|---|
| committer | Stijn Buys <ingar@osirion.org> | 2009-04-16 19:36:15 +0000 | 
| commit | 6ab4021827e91303ac6fe2276f5567810b7e0496 (patch) | |
| tree | 82c50c5a4bdc63da51c5bee9c122d165fd872aa6 /src/render | |
| parent | a95028547981614e06ea7a6d22b853b85418cea3 (diff) | |
updated a few help messages, added 3d modelview to the buy menu
Diffstat (limited to 'src/render')
| -rw-r--r-- | src/render/camera.cc | 24 | ||||
| -rw-r--r-- | src/render/camera.h | 9 | ||||
| -rw-r--r-- | src/render/draw.cc | 6 | ||||
| -rw-r--r-- | src/render/draw.h | 5 | 
4 files changed, 37 insertions, 7 deletions
| diff --git a/src/render/camera.cc b/src/render/camera.cc index ba056d0..092cc26 100644 --- a/src/render/camera.cc +++ b/src/render/camera.cc @@ -374,6 +374,30 @@ void Camera::frustum()  	gl::translate(-1.0f * camera_eye);  } +void Camera::frustum_default(float distance, float cx, float cy) +{ +	// Change to the projection matrix and set our viewing volume large enough for the skysphere +	gl::matrixmode(GL_PROJECTION); +	gl::loadidentity(); + +	// note: the factor 2.0f probably has to be 1.0f/frustum_size +	gl::translate(2.0f*(-State::width() * 0.5f + cx)/State::width() , 2.0f*(State::height() * 0.5f - cy)/State::height(), 0.0f); + +	gl::frustum(-camera_frustum_size, camera_frustum_size, -camera_frustum_size/State::aspect(), camera_frustum_size/State::aspect(), camera_frustum_front, 1023.0f); + +	gl::matrixmode(GL_MODELVIEW); +	gl::loadidentity(); + +	// map world coordinates to opengl coordinates +	gl::rotate(90.0f, 0.0f, 1.0f, 0.0f); +	gl::rotate(-90.0f, 1.0f , 0.0f, 0.0f); + +	gl::translate(distance+1.0f, 0.0f, 0.0f); + +	// extra model rotation +	gl::rotate(-core::application()->time() / 8.0f *360.0f , 0.0f, 0.0f, 1.0f); +} +  void Camera::ortho()  {  	// switch to orthographic projection diff --git a/src/render/camera.h b/src/render/camera.h index 400c4b0..349aef8 100644 --- a/src/render/camera.h +++ b/src/render/camera.h @@ -43,11 +43,16 @@ public:  	/// progress the camera  	static void frame(float elapsed); -	/// enable frustum projection -	/** The frustum projection is used to draw the world +	/// enable camera frustum projection +	/** The camera frustum projection is used to draw the world  	 */  	static void frustum(); +	/// enable default frustum projection +	/** The default frustum projection is used to draw Gui 3D models +	 */ +	static void frustum_default(float distance, float cx, float cy); +  	/// enable orthographic projection  	/** The ortographic projetion is used to draw the user interface  	 */ diff --git a/src/render/draw.cc b/src/render/draw.cc index 6762b64..5784347 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -539,12 +539,8 @@ void draw_fragment(model::Fragment *fragment, bool draw_details)  void draw_model_fragments(model::Model *model,  	const math::Color & color_primary, const math::Color & color_secondary, -	const bool detail = true, const bool power = true, const float thrust = 0.0f) +	const bool detail, const bool power, const float thrust)  { - -	if (!model) -		return; -  	// default material, lighted and geometry color  	const model::Material *material = 0;  	bool use_light = true;		// gl::disable(GL_LIGHTING) is set diff --git a/src/render/draw.h b/src/render/draw.h index bb42067..14a9767 100644 --- a/src/render/draw.h +++ b/src/render/draw.h @@ -26,6 +26,11 @@ void reset();  /// draw a sphere  void draw_sphere(math::Color const & color, float radius); +/// draw a model +void draw_model_fragments(model::Model *model, +	const math::Color & color_primary, const math::Color & color_secondary, +	const bool detail = true, const bool power = true, const float thrust = 0.0f); +  class Stats {  public:  	static void clear(); | 
