1 | /* Copyright (c) 2001, Stanford University
|
---|
2 | * All rights reserved
|
---|
3 | *
|
---|
4 | * See the file LICENSE.txt for information on redistributing this software.
|
---|
5 | */
|
---|
6 |
|
---|
7 | #include "unpacker.h"
|
---|
8 | #include "cr_error.h"
|
---|
9 | #include "cr_mem.h"
|
---|
10 |
|
---|
11 |
|
---|
12 | void crUnpackMap2d(void)
|
---|
13 | {
|
---|
14 | GLenum target = READ_DATA(sizeof(int) + 0, GLenum);
|
---|
15 | GLdouble u1 = READ_DOUBLE(sizeof(int) + 4);
|
---|
16 | GLdouble u2 = READ_DOUBLE(sizeof(int) + 12);
|
---|
17 | GLint ustride = READ_DATA(sizeof(int) + 20, GLint);
|
---|
18 | GLint uorder = READ_DATA(sizeof(int) + 24, GLint);
|
---|
19 | GLdouble v1 = READ_DOUBLE(sizeof(int) + 28);
|
---|
20 | GLdouble v2 = READ_DOUBLE(sizeof(int) + 36);
|
---|
21 | GLint vstride = READ_DATA(sizeof(int) + 44, GLint);
|
---|
22 | GLint vorder = READ_DATA(sizeof(int) + 48, GLint);
|
---|
23 |
|
---|
24 | int n_points = READ_DATA(0, int) - (sizeof(int) + 52);
|
---|
25 | GLdouble *points;
|
---|
26 |
|
---|
27 | if (n_points & 0x7)
|
---|
28 | crError("crUnpackMap2d: n_points=%d, expected multiple of 8\n", n_points);
|
---|
29 | points = (GLdouble *) crAlloc(n_points);
|
---|
30 | crMemcpy(points, DATA_POINTER(sizeof(int) + 52, GLdouble), n_points);
|
---|
31 |
|
---|
32 | cr_unpackDispatch.Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
|
---|
33 | points);
|
---|
34 | crFree(points);
|
---|
35 |
|
---|
36 | INCR_VAR_PTR();
|
---|
37 | }
|
---|
38 |
|
---|
39 | void crUnpackMap2f(void)
|
---|
40 | {
|
---|
41 | GLenum target = READ_DATA(sizeof(int) + 0, GLenum);
|
---|
42 | GLfloat u1 = READ_DATA(sizeof(int) + 4, GLfloat);
|
---|
43 | GLfloat u2 = READ_DATA(sizeof(int) + 8, GLfloat);
|
---|
44 | GLint ustride = READ_DATA(sizeof(int) + 12, GLint);
|
---|
45 | GLint uorder = READ_DATA(sizeof(int) + 16, GLint);
|
---|
46 | GLfloat v1 = READ_DATA(sizeof(int) + 20, GLfloat);
|
---|
47 | GLfloat v2 = READ_DATA(sizeof(int) + 24, GLfloat);
|
---|
48 | GLint vstride = READ_DATA(sizeof(int) + 28, GLint);
|
---|
49 | GLint vorder = READ_DATA(sizeof(int) + 32, GLint);
|
---|
50 | GLfloat *points = DATA_POINTER(sizeof(int) + 36 , GLfloat);
|
---|
51 |
|
---|
52 | cr_unpackDispatch.Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
|
---|
53 | points);
|
---|
54 | INCR_VAR_PTR();
|
---|
55 | }
|
---|
56 |
|
---|
57 | void crUnpackMap1d(void)
|
---|
58 | {
|
---|
59 | GLenum target = READ_DATA(sizeof(int) + 0, GLenum);
|
---|
60 | GLdouble u1 = READ_DOUBLE(sizeof(int) + 4);
|
---|
61 | GLdouble u2 = READ_DOUBLE(sizeof(int) + 12);
|
---|
62 | GLint stride = READ_DATA(sizeof(int) + 20, GLint);
|
---|
63 | GLint order = READ_DATA(sizeof(int) + 24, GLint);
|
---|
64 |
|
---|
65 | int n_points = READ_DATA(0, int) - (sizeof(int) + 28);
|
---|
66 | GLdouble *points;
|
---|
67 |
|
---|
68 | if (n_points & 0x7)
|
---|
69 | crError("crUnpackMap1d: n_points=%d, expected multiple of 8\n", n_points);
|
---|
70 | points = (GLdouble *) crAlloc(n_points);
|
---|
71 | crMemcpy(points, DATA_POINTER(sizeof(int) + 28, GLdouble), n_points);
|
---|
72 |
|
---|
73 | cr_unpackDispatch.Map1d(target, u1, u2, stride, order, points);
|
---|
74 | crFree(points);
|
---|
75 |
|
---|
76 | INCR_VAR_PTR();
|
---|
77 | }
|
---|
78 |
|
---|
79 | void crUnpackMap1f(void)
|
---|
80 | {
|
---|
81 | GLenum target = READ_DATA(sizeof(int) + 0, GLenum);
|
---|
82 | GLfloat u1 = READ_DATA(sizeof(int) + 4, GLfloat);
|
---|
83 | GLfloat u2 = READ_DATA(sizeof(int) + 8, GLfloat);
|
---|
84 | GLint stride = READ_DATA(sizeof(int) + 12, GLint);
|
---|
85 | GLint order = READ_DATA(sizeof(int) + 16, GLint);
|
---|
86 | GLfloat *points = DATA_POINTER(sizeof(int) + 20, GLfloat);
|
---|
87 |
|
---|
88 | cr_unpackDispatch.Map1f(target, u1, u2, stride, order, points);
|
---|
89 | INCR_VAR_PTR();
|
---|
90 | }
|
---|