This commit is contained in:
Michaël Lemaire 2016-02-04 14:49:30 +01:00
parent 386d9d0258
commit dbb780f357
4 changed files with 7 additions and 8 deletions

View file

@ -44,8 +44,7 @@ CloudBasicLayerRenderer::CloudBasicLayerRenderer(SoftwareRenderer *parent) : Bas
*/
int CloudBasicLayerRenderer::findSegments(BaseCloudsModel *model, const Vector3 &start, const Vector3 &direction,
int max_segments, double max_inside_length, double max_total_length,
double *inside_length, double *total_length, CloudSegment *out_segments,
double base_detail) {
double *inside_length, double *total_length, CloudSegment *out_segments) {
double ymin, ymax;
int inside, segment_count;
double current_total_length, current_inside_length;
@ -175,10 +174,10 @@ Color CloudBasicLayerRenderer::getColor(BaseCloudsModel *model, const Vector3 &e
material.shininess = 3.0;
segment_count = findSegments(model, start, direction, 30, transparency_depth, max_length, &inside_length,
&total_length, segments, 0.001);
&total_length, segments);
for (i = segment_count - 1; i >= 0; i--) {
const Vector3 &location = segments[i].start;
Vector3 normal = model->getNormal(location, 1.0);
Vector3 normal = model->getNormal(location);
material.ambient = 1.0 - normal.getNorm() * 0.2;
material.reflection = 0.2 * normal.getNorm();
@ -222,7 +221,7 @@ bool CloudBasicLayerRenderer::alterLight(BaseCloudsModel *model, LightComponent
model->getAltitudeRange(&ymin, &ymax);
double light_traversal = (ymax - ymin) * 0.8 * light->color.getPower();
findSegments(model, start, direction, 30, light_traversal, end.sub(start).getNorm(), &inside_depth, &total_depth,
segments, 0.1);
segments);
if (light_traversal < 0.0001) {
factor = 0.0;

View file

@ -27,7 +27,7 @@ class SOFTWARESHARED_EXPORT CloudBasicLayerRenderer : public BaseCloudLayerRende
private:
int findSegments(BaseCloudsModel *model, const Vector3 &start, const Vector3 &direction, int max_segments,
double max_inside_length, double max_total_length, double *inside_length, double *total_length,
CloudSegment *out_segments, double base_detail);
CloudSegment *out_segments);
};
}
}

View file

@ -36,7 +36,7 @@ static inline Vector3 _getPseudoNormal(const BaseCloudsModel *model, const Vecto
return direction.scale(diff > 0.0 ? diff : 0.0);
}
Vector3 BaseCloudsModel::getNormal(const Vector3 &location, double quality) const
Vector3 BaseCloudsModel::getNormal(const Vector3 &location) const
{
double precision = 0.3;
Vector3 normal = VECTOR_ZERO;

View file

@ -42,7 +42,7 @@ class SOFTWARESHARED_EXPORT BaseCloudsModel {
* The length of the result vector indicates its relevance. A short vector marks an area
* where applying a normal vector is not relevant.
*/
virtual Vector3 getNormal(const Vector3 &location, double quality) const;
Vector3 getNormal(const Vector3 &location) const;
protected:
CloudLayerDefinition *layer;