mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-16 22:30:42 +02:00
uniform sampling of ellipsoid points
This commit is contained in:
parent
ea50133146
commit
432a3f1610
3 changed files with 19 additions and 4 deletions
|
@ -239,7 +239,7 @@ ParticleEffectEntityRenderer::CpuParticle ParticleEffectEntityRenderer::createPa
|
|||
azimuth = azimuthStart + (TWO_PI + azimuthFinish - azimuthStart) * randFloat();
|
||||
}
|
||||
|
||||
if (emitDimensions == Vectors::ZERO || shapeType == ShapeType::SHAPE_TYPE_NONE) {
|
||||
if (emitDimensions == Vectors::ZERO) {
|
||||
// Point
|
||||
emitDirection = glm::quat(glm::vec3(PI_OVER_TWO - elevation, 0.0f, azimuth)) * Vectors::UNIT_Z;
|
||||
} else {
|
||||
|
@ -265,9 +265,10 @@ ParticleEffectEntityRenderer::CpuParticle ParticleEffectEntityRenderer::createPa
|
|||
default: {
|
||||
float radiusScale = 1.0f;
|
||||
if (emitRadiusStart < 1.0f) {
|
||||
float randRadius =
|
||||
emitRadiusStart + randFloatInRange(0.0f, particle::MAXIMUM_EMIT_RADIUS_START - emitRadiusStart);
|
||||
radiusScale = 1.0f - std::pow(1.0f - randRadius, 3.0f);
|
||||
float innerRadiusCubed = emitRadiusStart * emitRadiusStart * emitRadiusStart;
|
||||
float outerRadiusCubed = 1.0f; // pow(particle::MAXIMUM_EMIT_RADIUS_START, 3);
|
||||
float randRadiusCubed = randFloatInRange(innerRadiusCubed, outerRadiusCubed);
|
||||
radiusScale = std::cbrt(randRadiusCubed);
|
||||
}
|
||||
|
||||
glm::vec3 radii = radiusScale * 0.5f * emitDimensions;
|
||||
|
|
|
@ -723,6 +723,19 @@ void ParticleEffectEntityItem::debugDump() const {
|
|||
}
|
||||
|
||||
void ParticleEffectEntityItem::setShapeType(ShapeType type) {
|
||||
switch (type) {
|
||||
case SHAPE_TYPE_NONE:
|
||||
case SHAPE_TYPE_HULL:
|
||||
case SHAPE_TYPE_SIMPLE_HULL:
|
||||
case SHAPE_TYPE_SIMPLE_COMPOUND:
|
||||
case SHAPE_TYPE_STATIC_MESH:
|
||||
// these types are unsupported for ParticleEffectEntity
|
||||
type = particle::DEFAULT_SHAPE_TYPE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
withWriteLock([&] {
|
||||
if (type != _shapeType) {
|
||||
_shapeType = type;
|
||||
|
|
|
@ -266,6 +266,7 @@ enum class EntityVersion : PacketVersion {
|
|||
ModelScale,
|
||||
ReOrderParentIDProperties,
|
||||
CertificateTypeProperty,
|
||||
ParticleShapeType,
|
||||
|
||||
// Add new versions above here
|
||||
NUM_PACKET_TYPE,
|
||||
|
|
Loading…
Reference in a new issue