-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3Dfunc.h
41 lines (35 loc) · 1.18 KB
/
3Dfunc.h
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
32
33
34
35
36
37
38
39
40
41
#ifndef _3DFUNC_H_
#define _3DFUNC_H_
#include "include/SDL2/SDL.h"
typedef struct{
float x;
float y;
float z;
} Vector3;
typedef struct{
Vector3 a;
Vector3 b;
} Boundry;
typedef struct Ray{
Vector3 pos;
Vector3 dir;
} Ray;
typedef struct Particle{
Vector3 pos;
Ray rays[360];//temp value repalce with vector later 1 ray per * of a circle.
} Particle;
Vector3 cast(Ray ray, Boundry wall, float interX, float interY);
void lookAt(Ray* ray, float x, float y);
void translate(SDL_Renderer* renderer, float x, float y);
void drawFilledSquare(SDL_Renderer* renderer, float x, float y, int size, SDL_Color color);
float dist(Vector3 v1, Vector3 v2);
Ray createRay(Vector3 pos, float angle);
Boundry createBoundry(float x1, float y1, float x2, float y2);
Vector3 createVector3(float x, float y, float z);
Particle createParticle(float x, float y);
void matmul(float matrix[3][3], Vector3 *vector);
float map(float value, float fromLow, float fromHigh, float toLow, float toHigh);
void projectPoint(Vector3* point3D, float distance);
void createSphere(const int size, Vector3 globe[size][size], const float r);
//create create rectangle, square and triangle (3d)
#endif