summaryrefslogtreecommitdiff
path: root/src/post/goom/v3d.h
diff options
context:
space:
mode:
authorThibaut Mattern <tmattern@users.sourceforge.net>2003-09-14 15:39:23 +0000
committerThibaut Mattern <tmattern@users.sourceforge.net>2003-09-14 15:39:23 +0000
commitf3da42db0b3c3f01c2f65471c99f1678990c3063 (patch)
treeaa58468cad366b90b6d25f1d1eb7ac101af5f864 /src/post/goom/v3d.h
parentf60312c6034431a59f0ef1bfb6a9b41f1c2eac99 (diff)
downloadxine-lib-f3da42db0b3c3f01c2f65471c99f1678990c3063.tar.gz
xine-lib-f3da42db0b3c3f01c2f65471c99f1678990c3063.tar.bz2
New files of the "new" goom version.
CVS patchset: 5377 CVS date: 2003/09/14 15:39:23
Diffstat (limited to 'src/post/goom/v3d.h')
-rwxr-xr-xsrc/post/goom/v3d.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/post/goom/v3d.h b/src/post/goom/v3d.h
new file mode 100755
index 000000000..dcf74fd65
--- /dev/null
+++ b/src/post/goom/v3d.h
@@ -0,0 +1,59 @@
+#ifndef _V3D_H
+#define _V3D_H
+
+#include <math.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "mathtools.h"
+
+typedef struct {
+ float x,y,z;
+} v3d;
+
+typedef struct {
+ int x,y;
+} v2d;
+
+/*
+ * projete le vertex 3D sur le plan d'affichage
+ * retourne (0,0) si le point ne doit pas etre affiche.
+ *
+ * bonne valeur pour distance : 256
+ */
+#define V3D_TO_V2D(v3,v2,width,height,distance) \
+{ \
+ int Xp, Yp; \
+ if (v3.z > 2) { \
+ F2I((distance * v3.x / v3.z),Xp) ; \
+ F2I((distance * v3.y / v3.z),Yp) ; \
+ v2.x = Xp + (width>>1); \
+ v2.y = -Yp + (height>>1); \
+ } \
+ else v2.x=v2.y=-666; \
+}
+
+/*
+ * rotation selon Y du v3d vi d'angle a (cosa=cos(a), sina=sin(a))
+ * centerz = centre de rotation en z
+ */
+#define Y_ROTATE_V3D(vi,vf,sina,cosa)\
+{\
+ vf.x = vi.x * cosa - vi.z * sina;\
+ vf.z = vi.x * sina + vi.z * cosa;\
+ vf.y = vi.y;\
+}
+
+/*
+ * translation
+ */
+#define TRANSLATE_V3D(vsrc,vdest)\
+{\
+ vdest.x += vsrc.x;\
+ vdest.y += vsrc.y;\
+ vdest.z += vsrc.z;\
+}
+
+#define MUL_V3D(lf,v) {v.x*=lf;v.y*=lf;v.z*=lf;}
+
+#endif