PageRenderTime 17ms CodeModel.GetById 10ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/opengles/src/Utils.cpp

http://ftk.googlecode.com/
C++ | 70 lines | 26 code | 9 blank | 35 comment | 1 complexity | fc46cddae01e40b0585789ec535aef26 MD5 | raw file
 1// ==========================================================================
 2//
 3// Utils.cpp		Helper functions for 3D Rendering Library
 4//
 5// --------------------------------------------------------------------------
 6//
 7// 09-14-2004	Hans-Martin Will	initial version
 8//
 9// --------------------------------------------------------------------------
10//
11// Copyright (c) 2004, Hans-Martin Will. All rights reserved.
12// 
13// Redistribution and use in source and binary forms, with or without 
14// modification, are permitted provided that the following conditions are 
15// met:
16// 
17//	 *  Redistributions of source code must retain the above copyright
18// 		notice, this list of conditions and the following disclaimer. 
19//   *	Redistributions in binary form must reproduce the above copyright
20// 		notice, this list of conditions and the following disclaimer in the 
21// 		documentation and/or other materials provided with the distribution. 
22// 
23// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
25// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
26// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
27// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 
28// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
29// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
31// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
32// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
33// THE POSSIBILITY OF SUCH DAMAGE.
34//
35// ==========================================================================
36
37
38#include "stdafx.h"
39#include "Utils.h"
40
41
42namespace EGL {
43	void CopyVector(const Vec3D & vector, GLfixed *params) {
44		params[0] = vector.x();
45		params[1] = vector.y();
46		params[2] = vector.z();
47	}
48
49	void CopyVector(const Vec4D & vector, GLfixed *params) {
50		params[0] = vector.x();
51		params[1] = vector.y();
52		params[2] = vector.z();
53		params[3] = vector.w();
54	}
55
56	void CopyMatrix(const Matrix4x4& matrix, GLfixed *params) {
57		for (size_t index = 0; index < 16; ++index) {
58			params[index] = matrix.Element(index);
59		}
60	}
61
62	void CopyColor(const FractionalColor & color, GLfixed *params) {
63		params[0] = color.r;
64		params[1] = color.g;
65		params[2] = color.b;
66		params[3] = color.a;
67	}
68}
69
70