PageRenderTime 244ms CodeModel.GetById 161ms app.highlight 3ms RepoModel.GetById 77ms app.codeStats 0ms

/opengles/src/MatrixStack.h

http://ftk.googlecode.com/
C++ Header | 85 lines | 31 code | 18 blank | 36 comment | 0 complexity | 3f297b2d11d13cf0ebfbed4202238ef2 MD5 | raw file
 1#ifndef EGL_MATRIX_STACK_H
 2#define EGL_MATRIX_STACK_H 1
 3
 4// ==========================================================================
 5//
 6// MatrixStack.h	Matrix Stack Class for 3D Rendering Library
 7//
 8// --------------------------------------------------------------------------
 9//
10// 08-08-2003	Hans-Martin Will	initial version
11// 10-04-2003	Hans-Martin Will	rework against new matrix class
12//
13// --------------------------------------------------------------------------
14//
15// Copyright (c) 2004, Hans-Martin Will. All rights reserved.
16// 
17// Redistribution and use in source and binary forms, with or without 
18// modification, are permitted provided that the following conditions are 
19// met:
20// 
21//	 *  Redistributions of source code must retain the above copyright
22// 		notice, this list of conditions and the following disclaimer. 
23//   *	Redistributions in binary form must reproduce the above copyright
24// 		notice, this list of conditions and the following disclaimer in the 
25// 		documentation and/or other materials provided with the distribution. 
26// 
27// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
29// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
30// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
31// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 
32// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
33// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
35// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
36// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
37// THE POSSIBILITY OF SUCH DAMAGE.
38//
39// ==========================================================================
40
41
42
43#include "OGLES.h"
44#include "fixed.h"
45#include "linalg.h"
46
47
48namespace EGL {
49
50	class MatrixStack {
51
52	public:
53
54		MatrixStack(I32 maxStackElements = 2);
55		~MatrixStack();
56
57		bool PopMatrix(void);
58		bool PushMatrix(void);
59
60		void MultMatrix(const Matrix4x4 &matrix);
61
62		void LoadIdentity(void);
63		void LoadMatrix(const Matrix4x4 &matrix);
64
65		inline Matrix4x4 & CurrentMatrix() {
66			return m_Stack[m_StackPointer];
67		}
68
69		inline I32 GetStackSize() const {
70			return m_StackSize;
71		}
72
73		inline I32 GetCurrentStackSize() const {
74			return m_StackPointer + 1;
75		}
76
77	private:
78
79		Matrix4x4	*m_Stack;
80		I32			m_StackPointer;
81		I32			m_StackSize;
82	};
83}
84
85#endif //ndef EGL_MATRIX_STACK_H