openTRI 0.1
tri3d.h
1/*
2 * tri3d.h: Header for 3D Engine
3 * This file is part of the "tri Engine".
4 *
5 * Copyright (C) 2007 tri
6 * Copyright (C) 2007 Alexander Berl 'Raphael' <raphael@fx-world.org>
7 *
8 * $Id: $
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25#ifndef __TRI3D_H__
26#define __TRI3D_H__
27
28
29#include "triTypes.h"
30#include "triModel.h"
31
32
33
37
38// depth texture modes
39#define TRI3D_DEPTHTEXTURE_5650 0
40#define TRI3D_DEPTHTEXTURE_5551 1
41#define TRI3D_DEPTHTEXTURE_T16 2
42
43
44typedef void (*tri3dVertexShaderUVf)(triVertUVf* vout, triVertUVf* vin);
45
46
47
48void tri3dInit();
49void tri3dClose();
50
51void tri3dClear( triS32 col, triS32 stencil, triS32 depth );
52void tri3dEnable( triS32 what );
53void tri3dDisable( triS32 what );
54
55void tri3dPerspective( triFloat fov );
56void tri3dOrtho();
57
58
59void tri3dFilter( triS32 filter );
60
61// Enable rendering to the alpha channel of current render target
62void tri3dRenderToAlpha(triS32 enable);
63
64// Render buffers (glow texture, feedback buffer, etc)
65void tri3dRenderbufferCreate( triS32 n, triS32 psm, triS32 width, triS32 height );
66void tri3dRenderbufferClose( triU32 n );
67void tri3dRenderbufferSetTexture( triU32 n );
68void tri3dRenderbufferSetRendertarget( triU32 n );
69
70void tri3dRenderbufferToScreen( triS32 n, triS32 x, triS32 y );
71
72void tri3dFramebufferSetRendertarget();
73// Make the current framebuffer a texture source
74void tri3dFramebufferSetTexture();
75// Make the depthbuffer a texture source
76void tri3dDepthbufferSetTexture( triU32 mode, void* ramp );
77
78// Render source to rendertarget (unscaled) at postion x,y
79void tri3dRenderTexture( triFloat x, triFloat y, triFloat u0, triFloat v0, triFloat u1, triFloat v1 );
80// Render source fullscren to rendertarget
81void tri3dRenderFullscreenTexture( triFloat u0, triFloat v0, triFloat u1, triFloat v1 );
82
83// Draw a xstep x ystep grid onto rendertarget and apply a shader onto each vertex
84void tri3dGridShader( triS32 twidth, triS32 theight, triS32 ysteps, triS32 xsteps, tri3dVertexShaderUVf shader );
85
86// Apply a 4x4 percentage closer filter on the source and render it to rendertarget
87void tri3d4x4Pcf( triS32 twidth, triS32 theight );
88// 4x4 dithered PCF (less displaced)
89void tri3d4x4PcfDithered( triS32 twidth, triS32 theight );
90void tri3d3x3OverlapFilter( triS32 twidth, triS32 theight );
91
92
93// do a 5x5/9x9 convolution from rendertarget n1 to rendertarget n2
94// source and dest must have same size!
95void tri3d5x5_2stepConvolution( triS32 n1, triS32 n2 );
96void tri3d9x9_2stepConvolution( triS32 n1, triS32 n2 );
97
99
100#endif // __TRI3D_H__