|
From: <axl...@us...> - 2008-12-04 01:59:29
|
Revision: 38
http://hgengine.svn.sourceforge.net/hgengine/?rev=38&view=rev
Author: axlecrusher
Date: 2008-12-04 01:59:28 +0000 (Thu, 04 Dec 2008)
Log Message:
-----------
load from XML
Modified Paths:
--------------
Mercury2/src/Viewport.cpp
Mercury2/src/Viewport.h
Modified: Mercury2/src/Viewport.cpp
===================================================================
--- Mercury2/src/Viewport.cpp 2008-12-04 01:55:03 UTC (rev 37)
+++ Mercury2/src/Viewport.cpp 2008-12-04 01:59:28 UTC (rev 38)
@@ -2,6 +2,8 @@
#include <GL/gl.h>
//#include <GL/glut.h>
+REGISTER_NODE_TYPE(Viewport);
+
void Viewport::Render()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -13,7 +15,7 @@
void Viewport::Perspective( float fov, float aspect, float znear, float zfar )
{
float xmin, xmax, ymin, ymax;
-
+
ymax = znear * TAN(fov * Q_PI / 360.0);
ymin = -ymax;
xmin = ymin * aspect;
@@ -48,6 +50,16 @@
m_frustum.Transpose(); //XXX fix it to remove this
}
+void Viewport::LoadFromXML(const XMLNode& node)
+{
+ Perspective( StrToFloat(node.Attribute("fov")),
+ StrToFloat(node.Attribute("aspect")),
+ StrToFloat(node.Attribute("near")),
+ StrToFloat(node.Attribute("far")));
+
+ RenderableNode::LoadFromXML(node);
+}
+
/***************************************************************************
* Copyright (C) 2008 by Joshua Allen *
* *
Modified: Mercury2/src/Viewport.h
===================================================================
--- Mercury2/src/Viewport.h 2008-12-04 01:55:03 UTC (rev 37)
+++ Mercury2/src/Viewport.h 2008-12-04 01:59:28 UTC (rev 38)
@@ -6,6 +6,7 @@
virtual void Render();
void Perspective( float fov, float aspect, float znear, float zfar );
+ virtual void LoadFromXML(const XMLNode& node);
GENRTTI(Viewport);
private:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|