|
From: <cn...@us...> - 2009-10-02 06:49:00
|
Revision: 548
http://hgengine.svn.sourceforge.net/hgengine/?rev=548&view=rev
Author: cnlohr
Date: 2009-10-02 06:48:51 +0000 (Fri, 02 Oct 2009)
Log Message:
-----------
at least make the system compile with SSE actually enabled
Modified Paths:
--------------
Mercury2/src/MercuryMath.h
Mercury2/src/MercuryMatrix.cpp
Modified: Mercury2/src/MercuryMath.h
===================================================================
--- Mercury2/src/MercuryMath.h 2009-10-02 06:48:35 UTC (rev 547)
+++ Mercury2/src/MercuryMath.h 2009-10-02 06:48:51 UTC (rev 548)
@@ -2,6 +2,9 @@
#define _MERCURYMATH_H
#include <math.h>
+#ifdef HGENGINE
+#include <configuration.h>
+#endif
#ifdef USE_SSE
#include <xmmintrin.h>
Modified: Mercury2/src/MercuryMatrix.cpp
===================================================================
--- Mercury2/src/MercuryMatrix.cpp 2009-10-02 06:48:35 UTC (rev 547)
+++ Mercury2/src/MercuryMatrix.cpp 2009-10-02 06:48:51 UTC (rev 548)
@@ -1,9 +1,22 @@
#include "MercuryMatrix.h"
#include <MercuryLog.h>
+float base_matrix_identity[16] = {
+ 1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f };
+
MercuryMatrix::MercuryMatrix()
{
- *this = Identity();
+#ifdef USE_SSE
+ m_matrix[0] = _mm_load1_ps( &base_matrix_identity[0] );
+ m_matrix[1] = _mm_load1_ps( &base_matrix_identity[4] );
+ m_matrix[2] = _mm_load1_ps( &base_matrix_identity[8] );
+ m_matrix[3] = _mm_load1_ps( &base_matrix_identity[12] );
+#else
+ Copy16f(m_matrix[0], base_matrix_identity );
+#endif
}
const MercuryMatrix& MercuryMatrix::operator=(const MercuryMatrix& m)
@@ -28,14 +41,19 @@
const MercuryMatrix& MercuryMatrix::Identity()
{
- if (IdentityMatrix.m_matrix[0][0] != 1.0f)
+ static bool bSetIdentity = false;
+
+ if (!bSetIdentity)
{
- float identity[16] = {
- 1.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 1.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 1.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f };
- Copy16f(MercuryMatrix::IdentityMatrix.m_matrix[0], identity );
+ bSetIdentity = true;
+#ifdef USE_SSE
+ MercuryMatrix::IdentityMatrix.m_matrix[0] = _mm_load1_ps( &base_matrix_identity[0] );
+ MercuryMatrix::IdentityMatrix.m_matrix[1] = _mm_load1_ps( &base_matrix_identity[4] );
+ MercuryMatrix::IdentityMatrix.m_matrix[2] = _mm_load1_ps( &base_matrix_identity[8] );
+ MercuryMatrix::IdentityMatrix.m_matrix[3] = _mm_load1_ps( &base_matrix_identity[12] );
+#else
+ Copy16f(MercuryMatrix::IdentityMatrix.m_matrix[0], base_matrix_identity );
+#endif
}
return IdentityMatrix;
@@ -212,7 +230,8 @@
MercuryMatrix MercuryMatrix::IdentityMatrix;
/*
- * Copyright (c) 2006 Joshua Allen
+ * Copyright (c) 2006-2009 Joshua Allen
+ * Charles Lohr
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|