1 /* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
3 * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
4 * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice including the dates of first publication and
14 * either this permission notice or a reference to
15 * http://oss.sgi.com/projects/FreeB/
16 * shall be included in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
23 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 * Except as contained in this notice, the name of Silicon Graphics, Inc.
27 * shall not be used in advertising or otherwise to promote the sale, use or
28 * other dealings in this Software without prior written authorization from
29 * Silicon Graphics, Inc.
32 #include "packrender.h"
35 ** Routines to pack evaluator maps into the transport buffer. Maps are
36 ** allowed to have extra arbitrary data, so these routines extract just
37 ** the information that the GL needs.
40 void __glFillMap1f(GLint k
, GLint order
, GLint stride
,
41 const GLfloat
*points
, GLubyte
*pc
)
44 /* Just copy the data */
45 __GLX_PUT_FLOAT_ARRAY(0, points
, order
* k
);
49 for (i
= 0; i
< order
; i
++) {
50 __GLX_PUT_FLOAT_ARRAY(0, points
, k
);
52 pc
+= k
* __GLX_SIZE_FLOAT32
;
57 void __glFillMap1d(GLint k
, GLint order
, GLint stride
,
58 const GLdouble
*points
, GLubyte
*pc
)
61 /* Just copy the data */
62 __GLX_PUT_DOUBLE_ARRAY(0, points
, order
* k
);
65 for (i
= 0; i
< order
; i
++) {
66 __GLX_PUT_DOUBLE_ARRAY(0, points
, k
);
68 pc
+= k
* __GLX_SIZE_FLOAT64
;
73 void __glFillMap2f(GLint k
, GLint majorOrder
, GLint minorOrder
,
74 GLint majorStride
, GLint minorStride
,
75 const GLfloat
*points
, GLfloat
*data
)
79 if ((minorStride
== k
) && (majorStride
== minorOrder
*k
)) {
80 /* Just copy the data */
81 __GLX_MEM_COPY(data
, points
, majorOrder
* majorStride
*
85 for (i
= 0; i
< majorOrder
; i
++) {
86 for (j
= 0; j
< minorOrder
; j
++) {
87 for (x
= 0; x
< k
; x
++) {
90 points
+= minorStride
;
93 points
+= majorStride
- minorStride
* minorOrder
;
97 void __glFillMap2d(GLint k
, GLint majorOrder
, GLint minorOrder
,
98 GLint majorStride
, GLint minorStride
,
99 const GLdouble
*points
, GLdouble
*data
)
103 if ((minorStride
== k
) && (majorStride
== minorOrder
*k
)) {
104 /* Just copy the data */
105 __GLX_MEM_COPY(data
, points
, majorOrder
* majorStride
*
111 x
= k
* __GLX_SIZE_FLOAT64
;
113 for (i
= 0; i
<majorOrder
; i
++) {
114 for (j
= 0; j
<minorOrder
; j
++) {
116 __GLX_MEM_COPY(data
, points
, x
);
118 for (x
= 0; x
<k
; x
++) {
122 points
+= minorStride
;
125 points
+= majorStride
- minorStride
* minorOrder
;