Mirrored rendering by libvitaboy Renderer

The next task is to add functionality to the far library to make it suitable for use directly by libvitaboy Renderer.# Please enter the commit message for your changes. Lines starting
This commit is contained in:
Fatbag 2012-10-27 23:45:56 -05:00
parent 6393955683
commit bb904c4698
14 changed files with 116 additions and 75 deletions

View file

@ -16,6 +16,7 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <math.h>
#include "libvitaboy.hpp"
VBFile_t VBFile;
@ -51,6 +52,17 @@ float DotProduct(Rotation_t * q1, Rotation_t * q2){
return q1->x*q2->x + q1->y*q2->y + q1->z*q2->z + q1->w*q2->w;
}
void Normalize(Rotation_t * q){
float magnitude = q->x*q->x + q->y*q->y + q->z*q->z + q->w*q->w;
if(magnitude != 0){
magnitude = 1.0f/sqrt(magnitude);
q->x *= magnitude;
q->y *= magnitude;
q->z *= magnitude;
q->w *= magnitude;
}
}
void FindQuaternionMatrix(float * Matrix, Rotation_t * Quaternion){
float x2 = Quaternion->x * Quaternion->x;
float y2 = Quaternion->y * Quaternion->y;