// Adds the index of stored object to draw in the drawnObjects array, // after the last added, and only if the array is not full GLuint Scene::addObjectToDraw(GLuint indexStoredObject) { const size_t size = drawnObjects.size(); if (size >= maxDrawnObjects) throw std::runtime_error("maximum number of drawn objects reached"); drawnObjects.push_back(ObjectInstance(indexStoredObject, defaultShaderID, defaultTextureID0, defaultTextureID1, defaultTransformation, defaultColor)); return size; }
void Synthesizer::start(const Database &_database, ml::D3D11GraphicsDevice &_graphics, AssetManager &_assets, const SceneTemplate &_sceneTemplate, const string &architectureModelId, float architectureScale) { database = &_database; graphics = &_graphics; assets = &_assets; sceneTemplate = &_sceneTemplate; scene.id = "synthesis-" + architectureModelId + to_string(ml::util::randomUniform()); earlyTermination = false; verbose = true; //locator.init(_database, _graphics, _assets, _targetScan); scene.objects.clear(); scene.objects.push_back(ObjectInstance(&scene)); ObjectInstance &architecture = scene.objects[0]; architecture.object.modelId = architectureModelId; architecture.object.model = const_cast<Model *>(&database->models.getModel(architectureModelId)); architecture.object.contactType = ContactType::ContactUpright; architecture.object.scale = 1.0f; architecture.object.coordianteFrameRotation = 0.0f; architecture.object.distanceToWall = 0.0f; architecture.parentObjectInstanceIndex = -1; architecture.parentMeshIndex = -1; architecture.parentTriIndex = -1; architecture.parentUV = ml::vec2f::origin; architecture.contactNormal = vec3f::eZ; architecture.modelToWorld = mat4f::scale(architectureScale); architecture.worldBBox = architecture.modelToWorld * OBBf(architecture.object.model->bbox); architecture.contactPosition = vec3f::origin; architecture.contactNormal = vec3f::origin; scene.agents.clear(); scene.bbox = ml::bbox3f(architecture.worldBBox); scene.computeWallSegments(); candidateObjects.clear(); stage = SynthesizerStagePlaceAgents; }