-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathvector_field.cpp
More file actions
175 lines (133 loc) · 4.21 KB
/
Copy pathvector_field.cpp
File metadata and controls
175 lines (133 loc) · 4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/*******************************************************
* Copyright (c) 2015-2019, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#include <common/chart_renderables.hpp>
#include <common/handle.hpp>
#include <fg/vector_field.h>
using namespace forge;
using forge::common::getVectorField;
fg_err fg_create_vector_field(fg_vector_field* pField, const unsigned pNPoints,
const fg_dtype pType,
const fg_chart_type pChartType) {
try {
ARG_ASSERT(1, (pNPoints > 0));
*pField = getHandle(
new common::VectorField(pNPoints, (forge::dtype)pType, pChartType));
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_retain_vector_field(fg_vector_field* pOut, fg_vector_field pIn) {
try {
ARG_ASSERT(1, (pIn != 0));
common::VectorField* temp =
new common::VectorField(getVectorField(pIn));
*pOut = getHandle(temp);
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_release_vector_field(fg_vector_field pField) {
try {
ARG_ASSERT(0, (pField != 0));
delete getVectorField(pField);
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_set_vector_field_color(fg_vector_field pField, const float pRed,
const float pGreen, const float pBlue,
const float pAlpha) {
try {
ARG_ASSERT(0, (pField != 0));
getVectorField(pField)->setColor(pRed, pGreen, pBlue, pAlpha);
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_set_vector_field_legend(fg_vector_field pField, const char* pLegend) {
try {
ARG_ASSERT(0, (pField != 0));
ARG_ASSERT(1, (pLegend != 0));
getVectorField(pField)->setLegend(pLegend);
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_get_vector_field_vertex_buffer(unsigned* pOut,
const fg_vector_field pField) {
try {
ARG_ASSERT(1, (pField != 0));
*pOut = getVectorField(pField)->vbo();
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_get_vector_field_color_buffer(unsigned* pOut,
const fg_vector_field pField) {
try {
ARG_ASSERT(1, (pField != 0));
*pOut = getVectorField(pField)->cbo();
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_get_vector_field_alpha_buffer(unsigned* pOut,
const fg_vector_field pField) {
try {
ARG_ASSERT(1, (pField != 0));
*pOut = getVectorField(pField)->abo();
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_get_vector_field_direction_buffer(unsigned* pOut,
const fg_vector_field pField) {
try {
ARG_ASSERT(1, (pField != 0));
*pOut = getVectorField(pField)->dbo();
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_get_vector_field_vertex_buffer_size(unsigned* pOut,
const fg_vector_field pField) {
try {
ARG_ASSERT(1, (pField != 0));
*pOut = (unsigned)getVectorField(pField)->vboSize();
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_get_vector_field_color_buffer_size(unsigned* pOut,
const fg_vector_field pField) {
try {
ARG_ASSERT(1, (pField != 0));
*pOut = (unsigned)getVectorField(pField)->cboSize();
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_get_vector_field_alpha_buffer_size(unsigned* pOut,
const fg_vector_field pField) {
try {
ARG_ASSERT(1, (pField != 0));
*pOut = (unsigned)getVectorField(pField)->aboSize();
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_get_vector_field_direction_buffer_size(unsigned* pOut,
const fg_vector_field pField) {
try {
ARG_ASSERT(1, (pField != 0));
*pOut = (unsigned)getVectorField(pField)->dboSize();
}
CATCHALL
return FG_ERR_NONE;
}