Merge remote-tracking branch 'aleric/master'

This commit is contained in:
Latif Khalifa
2013-01-15 18:36:51 +01:00
3 changed files with 43 additions and 10 deletions

View File

@@ -3055,15 +3055,29 @@ S32 sculpt_sides(F32 detail)
// determine the number of vertices in both s and t direction for this sculpt
void sculpt_calc_mesh_resolution(U16 width, U16 height, U8 type, F32 detail, S32& s, S32& t)
bool sculpt_calc_mesh_resolution(U16 width, U16 height, U8 type, F32 detail, S32& s, S32& t)
{
//Singu Note: minimum number of vertices depend on stitching type.
S32 min_s = 1;
S32 min_t = 1;
if ((type == LL_SCULPT_TYPE_SPHERE) ||
(type == LL_SCULPT_TYPE_TORUS) ||
(type == LL_SCULPT_TYPE_CYLINDER))
min_s = 4;
if (type == LL_SCULPT_TYPE_TORUS)
min_t = 4;
// this code has the following properties:
// 1) the aspect ratio of the mesh is as close as possible to the ratio of the map
// while still using all available verts
// 2) the mesh cannot have more verts than is allowed by LOD
// 3) the mesh cannot have more verts than is allowed by the map
S32 max_vertices_lod = (S32)pow((double)sculpt_sides(detail), 2.0);
//Singu Note: Replaced float math mangling to get an integer square with just one multiplication.
S32 const sculptsides = sculpt_sides(detail);
S32 max_vertices_lod = sculptsides * sculptsides;
S32 max_vertices_map = width * height / 4;
S32 vertices;
@@ -3082,11 +3096,22 @@ void sculpt_calc_mesh_resolution(U16 width, U16 height, U8 type, F32 detail, S32
s = (S32)(F32) sqrt(((F32)vertices / ratio));
s = llmax(s, 4); // no degenerate sizes, please
s = llmax(s, min_s); // no degenerate sizes, please
t = vertices / s;
t = llmax(t, 4); // no degenerate sizes, please
t = llmax(t, min_t); // no degenerate sizes, please
s = vertices / t;
// Singu Note: return false if we failed to get enough vertices for this stitching
// type (due to not enough data, ie while the sculpt is still loading).
bool enough_data = s >= min_s;
if (!enough_data)
{
// Uses standard lod stepping for the sphere that will be shown.
s = t = sculptsides;
}
return enough_data;
}
// sculpt replaces generate() for sculpted surfaces
@@ -3113,7 +3138,14 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,
sculpt_detail = 4.0;
}
sculpt_calc_mesh_resolution(sculpt_width, sculpt_height, sculpt_type, sculpt_detail, requested_sizeS, requested_sizeT);
//Singu Note: this function returns false when sculpt_width and sculpt_height are too small.
// In that case requested_sizeS and requested_sizeT are set to the same values as should have happened
// when either of sculpt_width or sculpt_height had been zero.
if (!sculpt_calc_mesh_resolution(sculpt_width, sculpt_height, sculpt_type, sculpt_detail, requested_sizeS, requested_sizeT))
{
sculpt_level = -1;
data_is_empty = TRUE;
}
mPathp->generate(mParams.getPathParams(), sculpt_detail, 0, TRUE, requested_sizeS);
mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(), sculpt_detail, 0, TRUE, requested_sizeT);

View File

@@ -1688,8 +1688,8 @@ void LLFloaterSnapshot::Impl::freezeTime(bool on)
LLSnapshotLivePreview* previewp = getPreviewView();
if (on)
{
// stop all mouse events at fullscreen preview layer
sInstance->getParent()->setMouseOpaque(TRUE);
// Stop all mouse events at fullscreen preview layer.
gSnapshotFloaterView->setMouseOpaque(TRUE);
// can see and interact with fullscreen preview now
if (previewp)
@@ -1716,7 +1716,8 @@ void LLFloaterSnapshot::Impl::freezeTime(bool on)
}
else // turning off freeze frame mode
{
sInstance->getParent()->setMouseOpaque(FALSE);
gSnapshotFloaterView->setMouseOpaque(FALSE);
if (previewp)
{
previewp->setVisible(FALSE);

View File

@@ -348,7 +348,7 @@ bool LLWLDayCycle::hasReferencesTo(const LLWLParamKey& keyframe) const
void LLWLDayCycle::removeReferencesTo(const LLWLParamKey& keyframe)
{
lldebugs << "Removing references to key frame " << keyframe.toLLSD() << llendl;
F32 keytime;
F32 keytime = 0.f; // Avoid compiler warning.
bool might_exist;
do
{