| 196 | } |
| 197 | |
| 198 | bool IndexBuffer::SetTriangle(uint32_t i, uint32_t v0, uint32_t v1, uint32_t v2) |
| 199 | { |
| 200 | if (ValidPrimitiveType(IP_HAS_TRIANGLES)) |
| 201 | { |
| 202 | if (mData && i < mNumPrimitives) |
| 203 | { |
| 204 | if (mElementSize == sizeof(uint32_t)) |
| 205 | { |
| 206 | if (mPrimitiveType == IP_TRIMESH) |
| 207 | { |
| 208 | uint32_t* index = 3 * static_cast<size_t>(i) + Get<uint32_t>(); |
| 209 | *index++ = v0; |
| 210 | *index++ = v1; |
| 211 | *index = v2; |
| 212 | } |
| 213 | else if (mPrimitiveType == IP_TRISTRIP) |
| 214 | { |
| 215 | uint32_t* index = static_cast<size_t>(i) + Get<uint32_t>(); |
| 216 | index[0] = v0; |
| 217 | if (i & 1) |
| 218 | { |
| 219 | index[2] = v1; |
| 220 | index[1] = v2; |
| 221 | } |
| 222 | else |
| 223 | { |
| 224 | index[1] = v1; |
| 225 | index[2] = v2; |
| 226 | } |
| 227 | } |
| 228 | else if (mPrimitiveType == IP_TRIMESH_ADJ) |
| 229 | { |
| 230 | LogError("IP_TRIMESH_ADJ not yet supported."); |
| 231 | } |
| 232 | else if (mPrimitiveType == IP_TRISTRIP_ADJ) |
| 233 | { |
| 234 | LogError("IP_TRISTRIP_ADJ not yet supported."); |
| 235 | } |
| 236 | } |
| 237 | else |
| 238 | { |
| 239 | if (mPrimitiveType == IP_TRIMESH) |
| 240 | { |
| 241 | uint16_t* index = 3 * static_cast<size_t>(i) + Get<uint16_t>(); |
| 242 | *index++ = static_cast<uint16_t>(v0); |
| 243 | *index++ = static_cast<uint16_t>(v1); |
| 244 | *index = static_cast<uint16_t>(v2); |
| 245 | } |
| 246 | else if (mPrimitiveType == IP_TRISTRIP) |
| 247 | { |
| 248 | uint16_t* index = i + Get<uint16_t>(); |
| 249 | index[0] = static_cast<uint16_t>(v0); |
| 250 | if (i & 1) |
| 251 | { |
| 252 | index[2] = static_cast<uint16_t>(v1); |
| 253 | index[1] = static_cast<uint16_t>(v2); |
| 254 | } |
| 255 | else |
no outgoing calls
no test coverage detected