Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenreader.cc
Go to the documentation of this file.
00001 /* 00002 ** License Applicability. Except to the extent portions of this file are 00003 ** made subject to an alternative license as permitted in the SGI Free 00004 ** Software License B, Version 1.1 (the "License"), the contents of this 00005 ** file are subject only to the provisions of the License. You may not use 00006 ** this file except in compliance with the License. You may obtain a copy 00007 ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 00008 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: 00009 ** 00010 ** http://oss.sgi.com/projects/FreeB 00011 ** 00012 ** Note that, as provided in the License, the Software is distributed on an 00013 ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS 00014 ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND 00015 ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A 00016 ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. 00017 ** 00018 ** Original Code. The Original Code is: OpenGL Sample Implementation, 00019 ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, 00020 ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. 00021 ** Copyright in any portions created by third parties is as indicated 00022 ** elsewhere herein. All Rights Reserved. 00023 ** 00024 ** Additional Notice Provisions: The application programming interfaces 00025 ** established by SGI in conjunction with the Original Code are The 00026 ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released 00027 ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version 00028 ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X 00029 ** Window System(R) (Version 1.3), released October 19, 1998. This software 00030 ** was created using the OpenGL(R) version 1.2.1 Sample Implementation 00031 ** published by SGI, but has not been independently verified as being 00032 ** compliant with the OpenGL(R) version 1.2.1 Specification. 00033 */ 00034 00035 /* 00036 * reader.c++ 00037 * 00038 * $Date: 2006-03-12 00:07:02 +0000 (Sun, 12 Mar 2006) $ $Revision: 1.1 $ 00039 * $Header: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/glu32/libnurbs/internals/reader.cc,v 1.1 2004/02/02 16:39:12 navaraf Exp $ 00040 */ 00041 00042 #include <stdio.h> 00043 #include "glimports.h" 00044 #include "nurbsconsts.h" 00045 #include "reader.h" 00046 #include "trimvertex.h" 00047 #include "simplemath.h" 00048 00049 //when read a pwlCurve, if two consecutive points are the same, then 00050 //eliminate one of them. This makes the tessellator more robust. The spec 00051 //assumes the application makes sure there are no redundant points. 00052 //but in Inspector, the trim curves seem to have redundant points a lot. 00053 //I guess other similar users may have the same problem. 00054 00055 #define ELIMINATE_REDUNDANT_POINTS 00056 00057 #ifdef ELIMINATE_REDUNDANT_POINTS 00058 #define equal(x,y) ( glu_abs(x-y) <= 0.00001) 00059 #endif 00060 00061 #ifdef ELIMINATE_REDUNDANT_POINTS 00062 O_pwlcurve::O_pwlcurve( long _type, long count, INREAL *array, long byte_stride, TrimVertex *trimpts ) 00063 { 00064 next = 0; 00065 used = 0; 00066 owner = 0; 00067 pts = trimpts; 00068 npts = (int) count; 00069 int i; 00070 00071 /* copy user data into internal trimming data structures */ 00072 switch( _type ) { 00073 case N_P2D: { 00074 TrimVertex *v = pts; 00075 TrimVertex *prev = NULL; 00076 int num = 0; 00077 int doit; 00078 for(i=0; i<count; i++) { 00079 doit = 1; 00080 if(prev != NULL) 00081 { 00082 if(equal(prev->param[0], array[0]) && equal(prev->param[1], array[1])) 00083 { 00084 doit = 0; 00085 } 00086 } 00087 00088 if(doit) 00089 { 00090 v->param[0] = (REAL) array[0]; 00091 v->param[1] = (REAL) array[1]; 00092 prev = v; 00093 v++; 00094 num++; 00095 } 00096 array = (INREAL *) (((char *) array) + byte_stride); 00097 } 00098 npts = num; 00099 break; 00100 } 00101 case N_P2DR: { 00102 TrimVertex *v = pts; 00103 for( TrimVertex *lastv = v + count; v != lastv; v++ ) { 00104 v->param[0] = (REAL) array[0] / (REAL) array[2]; 00105 v->param[1] = (REAL) array[1] / (REAL) array[2]; 00106 array = (INREAL *) (((char *) array) + byte_stride); 00107 } 00108 break; 00109 } 00110 } 00111 } 00112 #else 00113 O_pwlcurve::O_pwlcurve( long _type, long count, INREAL *array, long byte_stride, TrimVertex *trimpts ) 00114 { 00115 next = 0; 00116 used = 0; 00117 owner = 0; 00118 pts = trimpts; 00119 npts = (int) count; 00120 00121 /* copy user data into internal trimming data structures */ 00122 switch( _type ) { 00123 case N_P2D: { 00124 TrimVertex *v = pts; 00125 for( TrimVertex *lastv = v + count; v != lastv; v++ ) { 00126 v->param[0] = (REAL) array[0]; 00127 v->param[1] = (REAL) array[1]; 00128 array = (INREAL *) (((char *) array) + byte_stride); 00129 } 00130 break; 00131 } 00132 case N_P2DR: { 00133 TrimVertex *v = pts; 00134 for( TrimVertex *lastv = v + count; v != lastv; v++ ) { 00135 v->param[0] = (REAL) array[0] / (REAL) array[2]; 00136 v->param[1] = (REAL) array[1] / (REAL) array[2]; 00137 array = (INREAL *) (((char *) array) + byte_stride); 00138 } 00139 break; 00140 } 00141 } 00142 } 00143 #endif 00144 00145 00146 00147 00148 Generated on Sun May 27 2012 04:23:40 for ReactOS by
1.7.6.1
|