#include <dsp.h>
The adopted model primitive class 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:
| |
| static void | Init (void) |
| This function initializes the dsp module. | |
| static void | Help (void) |
| This function displays a help list of the possible program actions and their associated keys. | |
| static void | Model (void) |
| This function displays all primitives of current model using the OpenGL graphics system. | |
| static int | ZbfModel (void *zbuffer_canvas) |
| static void | ZbfBeginPoly (long int color, double nx, double ny, double nz) |
| This function starts to send a new polygon to the zbuffer module to display. | |
| static void | ZbfVertex (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. | |
| static void | ZbfEndPoly (void) |
| This function finishes the specification of a polygon to be displayed in zbuffer module. | |
| static void | GetPickRay (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). | |
| static long int | ShadeColor (Vec *normal, Vec *view, long int color) |
| Change color intensity taking into account polygon normal vector orientation with respect to view vector. | |
| static void | InvertMatrix (double mt[4][4], double imt[4][4]) |
| Function to invert a 4x4 matrix. | |
| static void | GetCamera (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. | |
| static int | GetViewVolume (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. | |
| static void | DisplayPrm (Prm *prm) |
| Function to display a solid version of a primitive with its corresponding color. | |
| static void | HighltPrm (Prm *prm) |
| Function to highlight a solid version of a primitive. | |
| static double | MIN_COLOR_INTENS = 0.50 |
| Constant for minimum color intensity. | |
| static Vec | view_vector = {0.0, 0.0, 0.0} |
| Current view vector. | |
| static char * | help_cmd [] |
| Help message commands. | |
| static char * | help_msg [] |
| Help message actions. | |
| static int | font_list_base = 0 |
| OpenGL font list for text. | |
Static Private Member Functions | |
| static double | get_red (long int color) |
| Given a long int coded color, get the red component intensity from 0 to 1. | |
| static double | get_green (long int color) |
| Given a long int coded color, get the green component intensity from 0 to 1. | |
| static double | get_blue (long int color) |
| Given a long int coded color, get the blue component intensity from 0 to 1. | |
| static void | VecUnit (Vec *a, Vec *b) |
| Function to normalize a 3D vector. | |
| static double | VecDot (Vec *a, Vec *b) |
| Function to compute the dot product between two 3D vectors. | |
| static void | DecodeColor (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). | |
| static long int | EncodeColor (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. | |
Classes | |
| struct | Vec |
| 3D vector struct More... | |
|
||||||||||||||||||||
|
Function to decode a long int coded color into the RGB components (in integer values between 0 and 255).
Definition at line 175 of file dsp.h. Referenced by ShadeColor(). |
|
|
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 329 of file dsp.cpp. References Prm::DisplaySolid(), get_blue(), get_green(), get_red(), and Prm::GetColor(). Referenced by Model(). |
|
||||||||||||||||
|
Function to encode RGB components (in integer values between 0 and 255) into a long int coded color.
Definition at line 196 of file dsp.h. Referenced by ShadeColor(), and ZbfModel(). |
|
|
Given a long int coded color, get the blue component intensity from 0 to 1.
Definition at line 130 of file dsp.h. Referenced by DisplayPrm(). |
|
|
Given a long int coded color, get the green component intensity from 0 to 1.
Definition at line 116 of file dsp.h. Referenced by DisplayPrm(). |
|
|
Given a long int coded color, get the red component intensity from 0 to 1.
Definition at line 102 of file dsp.h. Referenced by DisplayPrm(). |
|
||||||||||||||||||||||||||||||||||||||||
|
This function obtains the camera model viewing paramaters (in WC coordinates) from the current OpenGL model view matrix.
Definition at line 255 of file dsp.cpp. References InvertMatrix(). Referenced by ZbfModel(). |
|
||||||||||||||||||||||||||||||||||||
|
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 605 of file dsp.cpp. Referenced by Prj::Raster2WorldXY(). |
|
||||||||||||||||||||||||||||
|
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:
- -
- - Where: l = left r = right b = bottom t = top n = near (front) f = far (back)
Definition at line 288 of file dsp.cpp. Referenced by ZbfModel(). |
|
|
This function displays a help list of the possible program actions and their associated keys.
Definition at line 395 of file dsp.cpp. References font_list_base, help_cmd, and help_msg. Referenced by Prj::Help(). |
|
|
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 342 of file dsp.cpp. References Prm::HighltSolid(). Referenced by Model(). |
|
|
This function initializes the dsp module. It initializes some OpenGL parameters. Definition at line 361 of file dsp.cpp. References font_list_base, and Prj::Odatascreen. Referenced by Prj::Resize(). |
|
||||||||||||
|
Function to invert a 4x4 matrix.
Definition at line 153 of file dsp.cpp. Referenced by GetCamera(). |
|
|
This function displays all primitives of current model using the OpenGL graphics system.
Definition at line 491 of file dsp.cpp. References Prm::CheckSelected(), DisplayPrm(), Prm::First(), HighltPrm(), and Prm::Next(). Referenced by Prj::BuildDisplayList(). |
|
||||||||||||||||
|
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 125 of file dsp.cpp. References Prm::ABS(), DecodeColor(), EncodeColor(), MIN_COLOR_INTENS, and VecDot(). Referenced by ZbfBeginPoly(). |
|
||||||||||||
|
Function to compute the dot product between two 3D vectors.
Definition at line 161 of file dsp.h. References Dsp::Vec::x, Dsp::Vec::y, and Dsp::Vec::z. Referenced by ShadeColor(). |
|
||||||||||||
|
Function to normalize a 3D vector.
Definition at line 141 of file dsp.h. References Dsp::Vec::x, Dsp::Vec::y, and Dsp::Vec::z. Referenced by ZbfModel(). |
|
||||||||||||||||||||
|
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 576 of file dsp.cpp. References Zbf::BeginPoly(), ShadeColor(), view_vector, Dsp::Vec::x, Dsp::Vec::y, and Dsp::Vec::z. Referenced by Quad::DisplayZbuffer(), and Circ::DisplayZbuffer(). |
|
|
This function finishes the specification of a polygon to be displayed in zbuffer module.
Definition at line 598 of file dsp.cpp. References Zbf::EndPoly(). Referenced by Quad::DisplayZbuffer(), and Circ::DisplayZbuffer(). |
|
|
Definition at line 514 of file dsp.cpp. References T3d::Camera(), Prm::DisplayZbuffer(), EncodeColor(), Prm::First(), GetCamera(), GetViewVolume(), T3d::Identity(), Prm::Next(), T3d::NormalizeView(), T3d::Perspective(), VecUnit(), view_vector, Dsp::Vec::x, Dsp::Vec::y, and Dsp::Vec::z. Referenced by Prj::DspZbufferCanvas(). |
|
||||||||||||||||
|
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 590 of file dsp.cpp. References T3d::Transform(), and Zbf::Vertex(). Referenced by Quad::DisplayZbuffer(), and Circ::DisplayZbuffer(). |
|
|
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 73 of file dsp.cpp. Referenced by Help(). |
|
|
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 95 of file dsp.cpp. Referenced by Help(). |
|
|
Constant for minimum color intensity.
Definition at line 65 of file dsp.cpp. Referenced by ShadeColor(). |
|
|
Current view vector.
Definition at line 69 of file dsp.cpp. Referenced by ZbfBeginPoly(), and ZbfModel(). |
1.4.2-20050421