| 25 | // -------------------------------------------------------------------------------------------------------------------- |
| 26 | |
| 27 | EmbreeStaticMesh::EmbreeStaticMesh(shared_ptr<EmbreeScene> scene, |
| 28 | int numVertices, |
| 29 | int numTriangles, |
| 30 | int numMaterials, |
| 31 | const Vector3f* vertices, |
| 32 | const Triangle* triangles, |
| 33 | const int* materialIndices, |
| 34 | const Material* materials) |
| 35 | : mScene(scene) |
| 36 | , mNumVertices(numVertices) |
| 37 | , mNumTriangles(numTriangles) |
| 38 | , mMaterialIndices(numTriangles) |
| 39 | { |
| 40 | initialize(*scene, vertices, triangles); |
| 41 | |
| 42 | memcpy(mMaterialIndices.data(), materialIndices, numTriangles * sizeof(int)); |
| 43 | |
| 44 | mMaterials.resize(numMaterials); |
| 45 | mMaterialsToUpdate.resize(numMaterials); |
| 46 | memcpy(mMaterials.data(), materials, numMaterials * sizeof(Material)); |
| 47 | memcpy(mMaterialsToUpdate.data(), materials, numMaterials * sizeof(Material)); |
| 48 | |
| 49 | convertMaterials(); |
| 50 | } |
| 51 | |
| 52 | EmbreeStaticMesh::EmbreeStaticMesh(shared_ptr<EmbreeScene> scene, |
| 53 | const Serialized::StaticMesh* serializedObject) |