#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "iup.h"
#include "cd.h"
#include "prj.h"
#include "prm.h"
#include "dsp.h"
#include "t3d.h"
#include "zbf.h"
Include dependency graph for dsp.c:
Go to the source code of this file.
Display module | |
The adopted model data structure is described in header file "prm.h", which also contains code color definitions. The basic graphics system used to display primitives is OpenGL. Please refer to OpenGL documentation for additional information. See specification of public functions of this module in hearder file "dsp.h". Revisions:
| |
#define | get_red(_) ((double)(((_) >> 16) & 0xff) / 255.0) |
Given a long int coded color, get the red component intensity from 0 to 1. | |
#define | get_green(_) ((double)(((_) >> 8) & 0xff) / 255.0) |
Given a long int coded color, get the green component intensity from 0 to 1. | |
#define | get_blue(_) ((double)(((_) >> 0) & 0xff) / 255.0) |
Given a long int coded color, get the blue component intensity from 0 to 1. | |
#define | MIN_COLOR_INTENS 0.50 |
Macro definition for minimum color intensity. | |
void | dspVecUnit (Vec3d *a, Vec3d *b) |
Function to normalize a 3D vector. | |
double | dspVecDot (Vec3d *a, Vec3d *b) |
Function to compute the dot product between two 3D vectors. | |
void | dspDecodeColor (long int color, unsigned char *red, unsigned char *green, unsigned char *blue) |
Function to decode a long int coded color into the RGB components (in integer values between 0 and 255). | |
long int | dspEncodeColor (unsigned char red, unsigned char green, unsigned char blue) |
Function to encode RGB components (in integer values between 0 and 255) into a long int coded color. | |
long int | dspShadeColor (Vec3d *normal, Vec3d *view, long int color) |
Change color intensity taking into account polygon normal vector orientation with respect to view vector. | |
void | dspInvertMatrix (double mt[4][4], double imt[4][4]) |
Function to invert a 4x4 matrix. | |
void | dspGetCamera (double *eyex, double *eyey, double *eyez, double *refx, double *refy, double *refz, double *vupx, double *vupy, double *vupz) |
This function obtains the camera model viewing paramaters (in WC coordinates) from the current OpenGL model view matrix. | |
int | dspGetViewVolume (double *left, double *right, double *bottom, double *top, double *front, double *back) |
This function obtains the view volume limits (in the eye coordinate system) from the current OpenGL projection matrix. | |
void | dspPrm (Prm *prm) |
Function to display a solid version of a primitive with its corresponding color. | |
void | dspHighltPrm (Prm *prm) |
Function to highlight a solid version of a primitive. | |
void | dspInit (void) |
This function initializes the dsp module. | |
void | dspHelp (void) |
This function displays a help list of the possible program actions and their associated keys. | |
void | dspModel (void) |
This function displays all primitives of current model using the OpenGL graphics system. | |
int | dspZbfModel (void *Gzbuffercanvas) |
void | dspZbfBeginPoly (long int color, double nx, double ny, double nz) |
This function starts to send a new polygon to the zbuffer module to display. | |
void | dspZbfVertex (double x, double y, double z) |
This function project a polygon vertex and send it to the zbuffer module in the process of displaying a face. | |
void | dspZbfEndPoly (void) |
This function finishes the specification of a polygon to be displayed in zbuffer module. | |
void | dspGetPickRay (int x, int y, double *frontx, double *fronty, double *frontz, double *backx, double *backy, double *backz) |
Given a mouse location point in raster canvas coordinates, this function returns the corresponding pick ray in world coordinates (WC). | |
Vec3d | view_vector |
Current view vector. | |
char * | help_cmd [] |
Help message commands. | |
char * | help_msg [] |
Help message actions. | |
int | font_list_base |
OpenGL font list for text. |
|
Given a long int coded color, get the blue component intensity from 0 to 1.
Definition at line 83 of file dsp.c. Referenced by dspPrm(). |
|
Given a long int coded color, get the green component intensity from 0 to 1.
Definition at line 79 of file dsp.c. Referenced by dspPrm(). |
|
Given a long int coded color, get the red component intensity from 0 to 1.
Definition at line 75 of file dsp.c. Referenced by dspPrm(). |
|
Macro definition for minimum color intensity.
Definition at line 87 of file dsp.c. Referenced by dspShadeColor(). |
|
Function to decode a long int coded color into the RGB components (in integer values between 0 and 255).
Definition at line 172 of file dsp.c. Referenced by dspShadeColor(). |
|
Function to encode RGB components (in integer values between 0 and 255) into a long int coded color.
Definition at line 186 of file dsp.c. Referenced by dspShadeColor(), and dspZbfModel(). |
|
This function obtains the camera model viewing paramaters (in WC coordinates) from the current OpenGL model view matrix.
Definition at line 336 of file dsp.c. References dspInvertMatrix(). Referenced by dspZbfModel(). |
|
Given a mouse location point in raster canvas coordinates, this function returns the corresponding pick ray in world coordinates (WC). A pick ray is a line between a point on the front (near) plane and a point on the back (far) plane. These two points correspond to the given point location in raster coordinates.
Definition at line 741 of file dsp.c. Referenced by prjRaster2WorldXY(). |
|
This function obtains the view volume limits (in the eye coordinate system) from the current OpenGL projection matrix. It assumes that the projection matrix has the following forms for orthographic and perspective projections:
l = left r = right b = bottom t = top n = near (front) f = far (back) The function return value is a flag indicating the type of projection. In case of perspective projection, a true (1) status is returned. In case of orthographic projection, a false (0) status is returned. Definition at line 424 of file dsp.c. Referenced by dspZbfModel(). |
|
This function displays a help list of the possible program actions and their associated keys.
Definition at line 542 of file dsp.c. References font_list_base, help_cmd, and help_msg. Referenced by prjHelp(). |
|
Function to highlight a solid version of a primitive. The solid version is a prism that has the 2D primitive as its base and height equal to the primitive height. This function displays the edges of the prism in red and draws red marks at its vertices.
Definition at line 491 of file dsp.c. Referenced by dspModel(). |
|
This function initializes the dsp module. It initializes some OpenGL parameters. Definition at line 508 of file dsp.c. References font_list_base, and Odatascreen. Referenced by prjResize(). |
|
Function to invert a 4x4 matrix.
Definition at line 231 of file dsp.c. Referenced by dspGetCamera(). |
|
This function displays all primitives of current model using the OpenGL graphics system.
Definition at line 638 of file dsp.c. References dspHighltPrm(), dspPrm(), prmCheckSelected(), prmFirst(), and prmNext(). Referenced by prjBuildDisplayList(). |
|
Function to display a solid version of a primitive with its corresponding color. The solid version is a prism that has the 2D primitive as its base and height equal to the primitive height.
Definition at line 472 of file dsp.c. References get_blue, get_green, get_red, and prmGetColor(). Referenced by dspModel(). |
|
Change color intensity taking into account polygon normal vector orientation with respect to view vector. All computations should be performed in object coordinates. Definition at line 201 of file dsp.c. References ABS, dspDecodeColor(), dspEncodeColor(), dspVecDot(), and MIN_COLOR_INTENS. Referenced by dspZbfBeginPoly(). |
|
Function to compute the dot product between two 3D vectors.
Definition at line 162 of file dsp.c. References pnt3d::x, pnt3d::y, and pnt3d::z. Referenced by dspShadeColor(). |
|
Function to normalize a 3D vector.
Definition at line 146 of file dsp.c. References pnt3d::x, pnt3d::y, and pnt3d::z. Referenced by dspZbfModel(). |
|
This function starts to send a new polygon to the zbuffer module to display. It displays with the given coded color and changes the color intensity taking into account the given polygon normal vector orientation with respect to view vector.
Definition at line 712 of file dsp.c. References dspShadeColor(), pnt3d::x, pnt3d::y, pnt3d::z, and zbfBeginPoly(). Referenced by circDisplayZbuffer(), and quadDisplayZbuffer(). |
|
This function finishes the specification of a polygon to be displayed in zbuffer module.
Definition at line 734 of file dsp.c. References zbfEndPoly(). Referenced by circDisplayZbuffer(), and quadDisplayZbuffer(). |
|
Definition at line 661 of file dsp.c. References dspEncodeColor(), dspGetCamera(), dspGetViewVolume(), dspVecUnit(), pnt3d::x, pnt3d::y, and pnt3d::z. Referenced by prjDspZbufferCanvas(). |
|
This function project a polygon vertex and send it to the zbuffer module in the process of displaying a face. To project a vertex means to transform it from modeling (object) coordinates to normalized screen coordinates.
Definition at line 726 of file dsp.c. References t3dTransform(), and zbfVertex(). Referenced by circDisplayZbuffer(), and quadDisplayZbuffer(). |
|
OpenGL font list for text.
|
|
Initial value: { "Tecle:", "H (de Help)", "Ctrl+Q (de Quit)", "Ctrl+I (de Info)", "Ctrl+O (de Open)", "Ctrl+S (de Snap shot)", "R (de Reset view)", "F (de Fit)" , "P (de Perspec.)", "O (de Ortogr.)", "X (de Proj. X)", "Y (de Proj. Y)", "Z (de Proj. Z)", "Ctrl+M (de Manip.)", "Ctrl+N (de Naveg.)", "Ctrl+Z (de Zoom)" }
Definition at line 91 of file dsp.c. Referenced by dspHelp(). |
|
Initial value: { " ", "==> Exibe este help", "==> Sai do programa", "==> Informacoes sobre o programa", "==> Abre modelo de arquivo", "==> Desenha o modelo usando CD", "==> Inicializa projecao", "==> Ajusta modelo na janela" , "==> Projecao conica", "==> Projecao cilindrica", "==> Projecao ortografica no plano X", "==> Projecao ortografica no plano Y", "==> Projecao ortografica no plano Z", "==> Mouse manipula modelo", "==> Mouse controla navegacao", "==> Mouse controla zoom" }
Definition at line 113 of file dsp.c. Referenced by dspHelp(). |
|
Current view vector.
|