| 192 | } |
| 193 | |
| 194 | void CurveGeometry::updateBuffer(RTCBufferType type, unsigned int slot) |
| 195 | { |
| 196 | if (type == RTC_BUFFER_TYPE_INDEX) |
| 197 | { |
| 198 | if (slot != 0) |
| 199 | throw_RTCError(RTC_ERROR_INVALID_ARGUMENT, "invalid buffer slot"); |
| 200 | curves.setModified(); |
| 201 | } |
| 202 | else if (type == RTC_BUFFER_TYPE_VERTEX) |
| 203 | { |
| 204 | if (slot >= vertices.size()) |
| 205 | throw_RTCError(RTC_ERROR_INVALID_ARGUMENT, "invalid buffer slot"); |
| 206 | vertices[slot].setModified(); |
| 207 | } |
| 208 | else if (type == RTC_BUFFER_TYPE_NORMAL) |
| 209 | { |
| 210 | if (slot >= normals.size()) |
| 211 | throw_RTCError(RTC_ERROR_INVALID_ARGUMENT, "invalid buffer slot"); |
| 212 | normals[slot].setModified(); |
| 213 | } |
| 214 | else if (type == RTC_BUFFER_TYPE_TANGENT) |
| 215 | { |
| 216 | if (slot >= tangents.size()) |
| 217 | throw_RTCError(RTC_ERROR_INVALID_ARGUMENT, "invalid buffer slot"); |
| 218 | tangents[slot].setModified(); |
| 219 | } |
| 220 | else if (type == RTC_BUFFER_TYPE_NORMAL_DERIVATIVE) |
| 221 | { |
| 222 | if (slot >= dnormals.size()) |
| 223 | throw_RTCError(RTC_ERROR_INVALID_ARGUMENT, "invalid buffer slot"); |
| 224 | dnormals[slot].setModified(); |
| 225 | } |
| 226 | else if (type == RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE) |
| 227 | { |
| 228 | if (slot >= vertexAttribs.size()) |
| 229 | throw_RTCError(RTC_ERROR_INVALID_ARGUMENT, "invalid buffer slot"); |
| 230 | vertexAttribs[slot].setModified(); |
| 231 | } |
| 232 | else if (type == RTC_BUFFER_TYPE_FLAGS) |
| 233 | { |
| 234 | if (slot != 0) |
| 235 | throw_RTCError(RTC_ERROR_INVALID_ARGUMENT, "invalid buffer slot"); |
| 236 | flags.setModified(); |
| 237 | } |
| 238 | else |
| 239 | { |
| 240 | throw_RTCError(RTC_ERROR_INVALID_ARGUMENT, "unknown buffer type"); |
| 241 | } |
| 242 | |
| 243 | Geometry::update(); |
| 244 | } |
| 245 | |
| 246 | void CurveGeometry::setTessellationRate(float N) { |
| 247 | tessellationRate = clamp((int)N,1,16); |
nothing calls this directly
no test coverage detected