1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#include <stdio.h>
#include <stdlib.h>
float* algVector( float x, float y, float z, float w )
{
float* v = new float[4];
v[0] = x;
v[1] = y;
v[2] = z;
v[3] = w;
return v;
}
int main()
{
float* eye = algVector( 0,0,0,1 );
float* at = algVector( 0,0,0,1 );
float* up = algVector( 0,0,0,1 );
float fovy;
float nearp;
float farp;
int screenWidth;
int screenHeight;
char buffer[512] = "CAMERA 0. 1. 5. 0. 0. 0. 0. 1. 1. 100. 1. 100. 400 400\n";
printf("%d",sscanf( buffer, "CAMERA %1f %1f %1f %1f %1f %1f %1f %1f %1f %1f %1f %1f %d %d\n", &eye[0], &eye[1], &eye[2], &at[0], &at[1], &at[2], &up[0], &up[1], &up[2], &fovy, &nearp, &farp, &screenWidth, &screenHeight ));
printf("CAMERA %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %d %d\n",eye[0],eye[1],eye[2],at[0],at[1],at[2],up[0],up[1],up[2],fovy,nearp,farp,screenWidth,screenHeight );
delete[] eye;
delete[] at;
delete[] up;
return 0;
}
|