418093565c6e4c898383fa502995e11c3118387e
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.
41 __glFillMap1f(GLint k
, GLint order
, GLint stride
,
42 const GLfloat
* points
, GLubyte
* pc
)
45 /* Just copy the data */
46 __GLX_PUT_FLOAT_ARRAY(0, points
, order
* k
);
51 for (i
= 0; i
< order
; i
++) {
52 __GLX_PUT_FLOAT_ARRAY(0, points
, k
);
54 pc
+= k
* __GLX_SIZE_FLOAT32
;
60 __glFillMap1d(GLint k
, GLint order
, GLint stride
,
61 const GLdouble
* points
, GLubyte
* pc
)
64 /* Just copy the data */
65 __GLX_PUT_DOUBLE_ARRAY(0, points
, order
* k
);
69 for (i
= 0; i
< order
; i
++) {
70 __GLX_PUT_DOUBLE_ARRAY(0, points
, k
);
72 pc
+= k
* __GLX_SIZE_FLOAT64
;
78 __glFillMap2f(GLint k
, GLint majorOrder
, GLint minorOrder
,
79 GLint majorStride
, GLint minorStride
,
80 const GLfloat
* points
, GLfloat
* data
)
84 if ((minorStride
== k
) && (majorStride
== minorOrder
* k
)) {
85 /* Just copy the data */
86 __GLX_MEM_COPY(data
, points
, majorOrder
* majorStride
*
90 for (i
= 0; i
< majorOrder
; i
++) {
91 for (j
= 0; j
< minorOrder
; j
++) {
92 for (x
= 0; x
< k
; x
++) {
95 points
+= minorStride
;
98 points
+= majorStride
- minorStride
* minorOrder
;
103 __glFillMap2d(GLint k
, GLint majorOrder
, GLint minorOrder
,
104 GLint majorStride
, GLint minorStride
,
105 const GLdouble
* points
, GLdouble
* data
)
109 if ((minorStride
== k
) && (majorStride
== minorOrder
* k
)) {
110 /* Just copy the data */
111 __GLX_MEM_COPY(data
, points
, majorOrder
* majorStride
*
117 x
= k
* __GLX_SIZE_FLOAT64
;
119 for (i
= 0; i
< majorOrder
; i
++) {
120 for (j
= 0; j
< minorOrder
; j
++) {
122 __GLX_MEM_COPY(data
, points
, x
);
124 for (x
= 0; x
< k
; x
++) {
128 points
+= minorStride
;
131 points
+= majorStride
- minorStride
* minorOrder
;