ModelEntitySP LightEntityFactory::createLightEntity(const string& name, const LightSP& light, const vector<AnimationStackSP>& allAnimStacks) { ModelFactory modelFactory; ModelSP model = modelFactory.createModel(name, BoundingSphere(Point4(), Light::getDebugRadius()), light, allAnimStacks); ModelEntitySP modelEntity = ModelEntitySP(new ModelEntity(name, model, 1.0f, 1.0f, 1.0f)); return modelEntity; }
ModelEntitySP PrimitiveEntityFactory::createCubePrimitiveEntity(const string& name, float scaleX, float scaleY, float scaleZ, const SurfaceMaterialSP& surfaceMaterial, const vector<AnimationStackSP>& allAnimStacks) const { ModelFactory modelFactory; GLUSshape shape; float halfExtend = 0.5f; glusCreateCubef(&shape, halfExtend); BoundingSphere boundingSphere; boundingSphere.setRadius(glusLengthf(halfExtend, halfExtend, halfExtend)); return ModelEntitySP(new ModelEntity(name, modelFactory.createModel(name, boundingSphere, shape, surfaceMaterial, allAnimStacks), scaleX, scaleY, scaleZ)); }
ModelEntitySP PrimitiveEntityFactory::createDomePrimitiveEntity(const string& name, float scaleX, float scaleY, float scaleZ, const SurfaceMaterialSP& surfaceMaterial) const { ModelFactory modelFactory; GLUSshape shape; float radius = 0.5f; uint32_t numberSlices = 32; glusCreateDomef(&shape, radius, numberSlices); BoundingSphere boundingSphere; boundingSphere.setRadius(radius); return ModelEntitySP(new ModelEntity(name, modelFactory.createModel(name, boundingSphere, shape, surfaceMaterial), scaleX, scaleY, scaleZ)); }
ModelEntitySP PrimitiveEntityFactory::createConePrimitiveEntity(const string& name, float scaleX, float scaleY, float scaleZ, const SurfaceMaterialSP& surfaceMaterial) const { ModelFactory modelFactory; GLUSshape shape; float halfExtend = 0.5f; float radius = 0.5f; uint32_t numberSlices = 32; uint32_t numberStacks = 32; glusCreateConef(&shape, halfExtend, radius, numberSlices, numberStacks); BoundingSphere boundingSphere; boundingSphere.setRadius(glusLengthf(halfExtend, radius, 0.0f)); return ModelEntitySP(new ModelEntity(name, modelFactory.createModel(name, boundingSphere, shape, surfaceMaterial), scaleX, scaleY, scaleZ)); }
ModelEntitySP PrimitiveEntityFactory::createTorusPrimitiveEntity(const string& name, float scaleX, float scaleY, float scaleZ, const SurfaceMaterialSP& surfaceMaterial, const vector<AnimationStackSP>& allAnimStacks) const { ModelFactory modelFactory; GLUSshape shape; float innerRadius = 0.25f; float outerRadius = 0.5f; uint32_t numberSlices = 32; uint32_t numberStacks = 32; glusCreateTorusf(&shape, innerRadius, outerRadius, numberSlices, numberStacks); BoundingSphere boundingSphere; boundingSphere.setRadius(outerRadius); return ModelEntitySP(new ModelEntity(name, modelFactory.createModel(name, boundingSphere, shape, surfaceMaterial, allAnimStacks), scaleX, scaleY, scaleZ)); }
// Choose a random number up to INT_MAX - 1, not INT_MAX, // because MbRandom adds 1 internally, causing an overflow MCMC::MCMC(Random& seeder, Settings& settings, ModelFactory& modelFactory) : _random(seeder.uniformInteger(0, INT_MAX - 1)) { _model = modelFactory.createModel(_random, settings); }