ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

s_feedback.c
Go to the documentation of this file.
00001 /*
00002  * Mesa 3-D graphics library
00003  * Version:  7.0
00004  *
00005  * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
00006  *
00007  * Permission is hereby granted, free of charge, to any person obtaining a
00008  * copy of this software and associated documentation files (the "Software"),
00009  * to deal in the Software without restriction, including without limitation
00010  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00011  * and/or sell copies of the Software, and to permit persons to whom the
00012  * Software is furnished to do so, subject to the following conditions:
00013  *
00014  * The above copyright notice and this permission notice shall be included
00015  * in all copies or substantial portions of the Software.
00016  *
00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00018  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00020  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00021  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023  */
00024 
00025 #include "main/glheader.h"
00026 #include "main/colormac.h"
00027 #include "main/context.h"
00028 #include "main/enums.h"
00029 #include "main/feedback.h"
00030 #include "main/macros.h"
00031 
00032 #include "s_context.h"
00033 #include "s_feedback.h"
00034 #include "s_triangle.h"
00035 
00036 
00037 
00038 static void
00039 feedback_vertex(GLcontext * ctx, const SWvertex * v, const SWvertex * pv)
00040 {
00041    GLfloat win[4];
00042    const GLfloat *vtc = v->attrib[FRAG_ATTRIB_TEX0];
00043    const GLfloat *color = v->attrib[FRAG_ATTRIB_COL0];
00044 
00045    win[0] = v->attrib[FRAG_ATTRIB_WPOS][0];
00046    win[1] = v->attrib[FRAG_ATTRIB_WPOS][1];
00047    win[2] = v->attrib[FRAG_ATTRIB_WPOS][2] / ctx->DrawBuffer->_DepthMaxF;
00048    win[3] = 1.0F / v->attrib[FRAG_ATTRIB_WPOS][3];
00049 
00050    _mesa_feedback_vertex(ctx, win, color, v->attrib[FRAG_ATTRIB_CI][0], vtc);
00051 }
00052 
00053 
00054 /*
00055  * Put triangle in feedback buffer.
00056  */
00057 void
00058 _swrast_feedback_triangle(GLcontext *ctx, const SWvertex *v0,
00059                           const SWvertex *v1, const SWvertex *v2)
00060 {
00061    if (_swrast_culltriangle(ctx, v0, v1, v2)) {
00062       FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN);
00063       FEEDBACK_TOKEN(ctx, (GLfloat) 3); /* three vertices */
00064 
00065       if (ctx->Light.ShadeModel == GL_SMOOTH) {
00066          feedback_vertex(ctx, v0, v0);
00067          feedback_vertex(ctx, v1, v1);
00068          feedback_vertex(ctx, v2, v2);
00069       }
00070       else {
00071          feedback_vertex(ctx, v0, v2);
00072          feedback_vertex(ctx, v1, v2);
00073          feedback_vertex(ctx, v2, v2);
00074       }
00075    }
00076 }
00077 
00078 
00079 void
00080 _swrast_feedback_line(GLcontext *ctx, const SWvertex *v0,
00081                       const SWvertex *v1)
00082 {
00083    GLenum token = GL_LINE_TOKEN;
00084    SWcontext *swrast = SWRAST_CONTEXT(ctx);
00085 
00086    if (swrast->StippleCounter == 0)
00087       token = GL_LINE_RESET_TOKEN;
00088 
00089    FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) token);
00090 
00091    if (ctx->Light.ShadeModel == GL_SMOOTH) {
00092       feedback_vertex(ctx, v0, v0);
00093       feedback_vertex(ctx, v1, v1);
00094    }
00095    else {
00096       feedback_vertex(ctx, v0, v1);
00097       feedback_vertex(ctx, v1, v1);
00098    }
00099 
00100    swrast->StippleCounter++;
00101 }
00102 
00103 
00104 void
00105 _swrast_feedback_point(GLcontext *ctx, const SWvertex *v)
00106 {
00107    FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) GL_POINT_TOKEN);
00108    feedback_vertex(ctx, v, v);
00109 }
00110 
00111 
00112 void
00113 _swrast_select_triangle(GLcontext *ctx, const SWvertex *v0,
00114                         const SWvertex *v1, const SWvertex *v2)
00115 {
00116    if (_swrast_culltriangle(ctx, v0, v1, v2)) {
00117       const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
00118 
00119       _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs );
00120       _mesa_update_hitflag( ctx, v1->attrib[FRAG_ATTRIB_WPOS][2] * zs );
00121       _mesa_update_hitflag( ctx, v2->attrib[FRAG_ATTRIB_WPOS][2] * zs );
00122    }
00123 }
00124 
00125 
00126 void
00127 _swrast_select_line(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
00128 {
00129    const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
00130    _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs );
00131    _mesa_update_hitflag( ctx, v1->attrib[FRAG_ATTRIB_WPOS][2] * zs );
00132 }
00133 
00134 
00135 void
00136 _swrast_select_point(GLcontext *ctx, const SWvertex *v)
00137 {
00138    const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
00139    _mesa_update_hitflag( ctx, v->attrib[FRAG_ATTRIB_WPOS][2] * zs );
00140 }

Generated on Sat May 26 2012 04:19:32 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.