Skip to content

Alpha gamma parameters #2668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 25 commits into
base: archive/develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d7468ce
Add TE support for texture gamma on legacy content.
Geenz Aug 16, 2024
f9ccf42
Double check we got the thing.
Geenz Aug 16, 2024
ece86be
Merge branch 'develop' into geenz/feat/legacy-alpha-params
Geenz Aug 21, 2024
7f48533
Add the message for overriding very specific parameters regardless of…
Geenz Aug 24, 2024
ad5a207
Hacked together UI for the new message.
Geenz Aug 27, 2024
2ed476f
Make sure we're getting the value before we send it anywhere.
Geenz Aug 30, 2024
dcaec2b
Merge branch 'develop' into geenz/feat/legacy-alpha-params
Geenz Sep 18, 2024
624e8da
fix for alpha-gamma-bypass prototype (#2538)
AndrewMeadows Sep 18, 2024
5977c2b
Merge branch 'develop' into geenz/feat/legacy-alpha-params
Geenz Sep 20, 2024
0a879c4
#2323 Make sure DrawInfos are working mostly as intended.
Geenz Sep 23, 2024
53958ec
#2323 Make sure we're registering alpha gamma with face registration.
Geenz Sep 23, 2024
3288bba
Switch to use TEM_CHANGE_COLOR
Geenz Sep 23, 2024
44344e8
#2655 update alpha gamma drop down position
maxim-productengine Sep 24, 2024
947169b
Don't disable alpha gamma ctrl
maxim-productengine Sep 24, 2024
d362cff
Merge pull request #2663 from secondlife/maxim/2655-alpha-gamma-pos
maxim-productengine Sep 24, 2024
3de5748
Merge branch 'develop' into geenz/feat/legacy-alpha-params
Geenz Sep 24, 2024
071f356
Fix alpha gamma only applies after deselecting an object and minor cl…
Sep 26, 2024
f7ebf43
Merge branch 'develop' into geenz/feat/legacy-alpha-params
Sep 26, 2024
d34d3b7
Fix warning failing linux build
Sep 26, 2024
4f60168
Merge branch 'develop' into geenz/feat/legacy-alpha-params
Geenz Sep 27, 2024
62c7450
Merge branch 'develop' into geenz/feat/legacy-alpha-params
Geenz Oct 16, 2024
e7a7a30
Update message_template.msg.sha1
Geenz Oct 16, 2024
9c3b6e6
Merge branch 'develop' into geenz/feat/legacy-alpha-params
Geenz Nov 12, 2024
278bb9f
group obj-editors can alpha-gamma no-mod objs
AndrewMeadows Nov 20, 2024
a276e19
Merge pull request #3022 from secondlife/leviathan/post-qa-alpha-gamma
AndrewMeadows Nov 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions indra/llmessage/message_prehash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1402,6 +1402,8 @@ char const* const _PREHASH_HoverHeight = LLMessageStringTable::getInstance()->ge
char const* const _PREHASH_Experience = LLMessageStringTable::getInstance()->getString("Experience");
char const* const _PREHASH_ExperienceID = LLMessageStringTable::getInstance()->getString("ExperienceID");
char const* const _PREHASH_LargeGenericMessage = LLMessageStringTable::getInstance()->getString("LargeGenericMessage");
char const* const _PREHASH_ObjectBypassModUpdate = LLMessageStringTable::getInstance()->getString("ObjectBypassModUpdate");
char const* const _PREHASH_PropertyID = LLMessageStringTable::getInstance()->getString("PropertyID");
char const* const _PREHASH_GameControlInput = LLMessageStringTable::getInstance()->getString("GameControlInput");
char const* const _PREHASH_AxisData = LLMessageStringTable::getInstance()->getString("AxisData");
char const* const _PREHASH_MetaData = LLMessageStringTable::getInstance()->getString("MetaData");
2 changes: 2 additions & 0 deletions indra/llmessage/message_prehash.h
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,8 @@ extern char const* const _PREHASH_HoverHeight;
extern char const* const _PREHASH_Experience;
extern char const* const _PREHASH_ExperienceID;
extern char const* const _PREHASH_LargeGenericMessage;
extern char const* const _PREHASH_ObjectBypassModUpdate;
extern char const* const _PREHASH_PropertyID;
extern char const* const _PREHASH_GameControlInput;
extern char const* const _PREHASH_AxisData;
extern char const* const _PREHASH_MetaData;
Expand Down
535 changes: 235 additions & 300 deletions indra/llprimitive/llprimitive.cpp

Large diffs are not rendered by default.

63 changes: 41 additions & 22 deletions indra/llprimitive/llprimitive.h
Original file line number Diff line number Diff line change
Expand Up @@ -399,27 +399,42 @@ class LLRenderMaterialParams : public LLNetworkData
// more obvious. This should be refactored to remove the duplication, at which
// point we can fix the names as well.
// - Vir
struct LLTEContents
class LLTEContents
{
static const U32 MAX_TES = 45;

LLUUID image_data[MAX_TES];
LLColor4U colors[MAX_TES];
F32 scale_s[MAX_TES];
F32 scale_t[MAX_TES];
S16 offset_s[MAX_TES];
S16 offset_t[MAX_TES];
S16 image_rot[MAX_TES];
U8 bump[MAX_TES];
U8 media_flags[MAX_TES];
U8 glow[MAX_TES];
LLMaterialID material_ids[MAX_TES];

static const U32 MAX_TE_BUFFER = 4096;
U8 packed_buffer[MAX_TE_BUFFER];

U32 size;
U32 face_count;
public:
static const size_t MAX_TES = 45;
static const size_t MAX_TE_BUFFER = 4096;

// delete the default ctor
LLTEContents() = delete;

// please use ctor which expects the number of textures as argument
LLTEContents(size_t N);

~LLTEContents();

U8 getNumTEs() const { return (U8)(num_textures); }

private:
U8* data; // one big chunk of data
size_t num_textures;

public:
// re-cast offsets into data
LLUUID* image_ids;
LLMaterialID* material_ids;
LLColor4U* colors;
F32* scale_s;
F32* scale_t;
S16* offset_s;
S16* offset_t;
S16* rot;
U8* bump;
U8* media_flags;
U8* glow;
U8* alpha_gamma;
// Note: we keep larger elements near the front so they are always 16-byte aligned,
// even for odd num_textures, and byte-sized elements to the back.
};

class LLPrimitive : public LLXform
Expand Down Expand Up @@ -482,6 +497,7 @@ class LLPrimitive : public LLXform
virtual S32 setTEBumpShiny(const U8 te, const U8 bump);
virtual S32 setTEMediaTexGen(const U8 te, const U8 media);
virtual S32 setTEBumpmap(const U8 te, const U8 bump);
virtual S32 setTEAlphaGamma(const U8 te, const U8 alphagamma);
virtual S32 setTETexGen(const U8 te, const U8 texgen);
virtual S32 setTEShiny(const U8 te, const U8 shiny);
virtual S32 setTEFullbright(const U8 te, const U8 fullbright);
Expand All @@ -496,12 +512,15 @@ class LLPrimitive : public LLXform

void copyTEs(const LLPrimitive *primitive);
S32 packTEField(U8 *cur_ptr, U8 *data_ptr, U8 data_size, U8 last_face_index, EMsgVariableType type) const;

S32 packTEMessageBuffer(U8* packed_buffer) const;
bool packTEMessage(LLMessageSystem *mesgsys) const;
bool packTEMessage(LLDataPacker &dp) const;

S32 unpackTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num); // Variable num of blocks
S32 unpackTEMessage(LLDataPacker &dp);
S32 parseTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num, LLTEContents& tec);
S32 applyParsedTEMessage(LLTEContents& tec);
static S32 parseTEMessage(U8* packed_buffer, U32 data_size, LLTEContents& tec);
S32 applyParsedTEMessage(const LLTEContents& tec);

#ifdef CHECK_FOR_FINITE
inline void setPosition(const LLVector3& pos);
Expand Down
11 changes: 10 additions & 1 deletion indra/llprimitive/llprimtexturelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry& te)
return TEM_CHANGE_NONE;
}

// we're changing an existing entry
// we're changing an existing entry
llassert(mEntryList[index]);
delete (mEntryList[index]);
mEntryList[index] = te.newCopy();
Expand Down Expand Up @@ -298,6 +298,15 @@ S32 LLPrimTextureList::setBumpMap(const U8 index, const U8 bump)
return TEM_CHANGE_NONE;
}

S32 LLPrimTextureList::setAlphaGamma(const U8 index, const U8 gamma)
{
if (index < mEntryList.size())
{
return mEntryList[index]->setAlphaGamma(gamma);
}
return TEM_CHANGE_NONE;
}

S32 LLPrimTextureList::setBumpShiny(const U8 index, const U8 bump_shiny)
{
if (index < mEntryList.size())
Expand Down
1 change: 1 addition & 0 deletions indra/llprimitive/llprimtexturelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class LLPrimTextureList
S32 setMediaTexGen(const U8 index, const U8 media);
S32 setBumpMap(const U8 index, const U8 bump);
S32 setBumpShiny(const U8 index, const U8 bump_shiny);
S32 setAlphaGamma(const U8 index, const U8 gamma);
S32 setTexGen(const U8 index, const U8 texgen);
S32 setShiny(const U8 index, const U8 shiny);
S32 setFullbright(const U8 index, const U8 t);
Expand Down
29 changes: 25 additions & 4 deletions indra/llprimitive/lltextureentry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "v4color.h"

const U8 DEFAULT_BUMP_CODE = 0; // no bump or shininess
const U8 DEFAULT_ALPHA_GAMMA = 100; // Gamma 1 (linear) for alpha blending

const LLTextureEntry LLTextureEntry::null;

Expand Down Expand Up @@ -64,15 +65,15 @@ LLTextureEntry::LLTextureEntry()
, mSelected(false)
, mMaterialUpdatePending(false)
{
init(LLUUID::null,1.f,1.f,0.f,0.f,0.f,DEFAULT_BUMP_CODE);
init(LLUUID::null, 1.f, 1.f, 0.f, 0.f, 0.f, DEFAULT_BUMP_CODE, DEFAULT_ALPHA_GAMMA);
}

LLTextureEntry::LLTextureEntry(const LLUUID& tex_id)
: mMediaEntry(NULL)
, mSelected(false)
, mMaterialUpdatePending(false)
{
init(tex_id,1.f,1.f,0.f,0.f,0.f,DEFAULT_BUMP_CODE);
init(tex_id, 1.f, 1.f, 0.f, 0.f, 0.f, DEFAULT_BUMP_CODE, DEFAULT_ALPHA_GAMMA);
}

LLTextureEntry::LLTextureEntry(const LLTextureEntry &rhs)
Expand All @@ -95,6 +96,7 @@ LLTextureEntry &LLTextureEntry::operator=(const LLTextureEntry &rhs)
mRotation = rhs.mRotation;
mColor = rhs.mColor;
mBump = rhs.mBump;
mAlphaGamma = rhs.mAlphaGamma;
mMediaFlags = rhs.mMediaFlags;
mGlow = rhs.mGlow;
mMaterialID = rhs.mMaterialID;
Expand Down Expand Up @@ -135,16 +137,17 @@ LLTextureEntry &LLTextureEntry::operator=(const LLTextureEntry &rhs)
return *this;
}

void LLTextureEntry::init(const LLUUID& tex_id, F32 scale_s, F32 scale_t, F32 offset_s, F32 offset_t, F32 rotation, U8 bump)
void LLTextureEntry::init(const LLUUID& tex_id, F32 scale_s, F32 scale_t, F32 offset_s, F32 offset_t, F32 rotation, U8 bump, U8 alphagamma)
{
setID(tex_id);
mID = tex_id;

mScaleS = scale_s;
mScaleT = scale_t;
mOffsetS = offset_s;
mOffsetT = offset_t;
mRotation = rotation;
mBump = bump;
mAlphaGamma = alphagamma;
mMediaFlags = 0x0;
mGlow = 0;
mMaterialID.clear();
Expand Down Expand Up @@ -181,6 +184,7 @@ bool LLTextureEntry::operator!=(const LLTextureEntry &rhs) const
if (mRotation != rhs.mRotation) return(true);
if (mColor != rhs.mColor) return (true);
if (mBump != rhs.mBump) return (true);
if (mAlphaGamma != rhs.mAlphaGamma) return (true);
if (mMediaFlags != rhs.mMediaFlags) return (true);
if (mGlow != rhs.mGlow) return (true);
if (mMaterialID != rhs.mMaterialID) return (true);
Expand All @@ -197,6 +201,7 @@ bool LLTextureEntry::operator==(const LLTextureEntry &rhs) const
if (mRotation != rhs.mRotation) return(false);
if (mColor != rhs.mColor) return (false);
if (mBump != rhs.mBump) return (false);
if (mAlphaGamma != rhs.mAlphaGamma) return (false);
if (mMediaFlags != rhs.mMediaFlags) return false;
if (mGlow != rhs.mGlow) return false;
if (mMaterialID != rhs.mMaterialID) return (false);
Expand All @@ -221,6 +226,7 @@ void LLTextureEntry::asLLSD(LLSD& sd) const
sd["offsett"] = mOffsetT;
sd["imagerot"] = mRotation;
sd["bump"] = getBumpShiny();
sd["alphagamma"] = getAlphaGamma();
sd["fullbright"] = getFullbright();
sd["media_flags"] = mMediaFlags;
if (hasMedia()) {
Expand Down Expand Up @@ -274,6 +280,11 @@ bool LLTextureEntry::fromLLSD(const LLSD& sd)
{
setBumpShiny( sd[w].asInteger() );
} else goto fail;
w = "alphagamma";
if (sd.has(w))
{
setAlphaGamma(sd[w].asInteger());
} // else goto fail;
w = "fullbright";
if (sd.has(w))
{
Expand Down Expand Up @@ -472,6 +483,16 @@ S32 LLTextureEntry::setBumpShinyFullbright(U8 bump)
return TEM_CHANGE_NONE;
}

S32 LLTextureEntry::setAlphaGamma(U8 alpha_gamma)
{
if (mAlphaGamma != alpha_gamma)
{
mAlphaGamma = alpha_gamma;
return TEM_CHANGE_COLOR;
}
return TEM_CHANGE_NONE;
}

S32 LLTextureEntry::setMediaTexGen(U8 media)
{
S32 result = TEM_CHANGE_NONE;
Expand Down
7 changes: 6 additions & 1 deletion indra/llprimitive/lltextureentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class LLTextureEntry
virtual LLTextureEntry* newBlank() const;
virtual LLTextureEntry* newCopy() const;

void init(const LLUUID& tex_id, F32 scale_s, F32 scale_t, F32 offset_s, F32 offset_t, F32 rotation, U8 bump);
void init(const LLUUID& tex_id, F32 scale_s, F32 scale_t, F32 offset_s, F32 offset_t, F32 rotation, U8 bump, U8 alphagamma);

bool hasPendingMaterialUpdate() const { return mMaterialUpdatePending; }
bool isSelected() const { return mSelected; }
Expand All @@ -128,6 +128,8 @@ class LLTextureEntry
S32 setBumpShiny(U8 bump);
S32 setBumpShinyFullbright(U8 bump);

S32 setAlphaGamma(U8 alpha_gamma);

S32 setMediaFlags(U8 media_flags);
S32 setTexGen(U8 texGen);
S32 setMediaTexGen(U8 media);
Expand Down Expand Up @@ -156,6 +158,8 @@ class LLTextureEntry
U8 getBumpShiny() const { return mBump & TEM_BUMP_SHINY_MASK; }
U8 getBumpShinyFullbright() const { return mBump; }

U8 getAlphaGamma() const { return mAlphaGamma; }

U8 getMediaFlags() const { return mMediaFlags & TEM_MEDIA_MASK; }
LLTextureEntry::e_texgen getTexGen() const { return LLTextureEntry::e_texgen(mMediaFlags & TEM_TEX_GEN_MASK); }
U8 getMediaTexGen() const { return mMediaFlags; }
Expand Down Expand Up @@ -233,6 +237,7 @@ class LLTextureEntry
LLColor4 mColor;
U8 mBump; // Bump map, shiny, and fullbright
U8 mMediaFlags; // replace with web page, movie, etc.
U8 mAlphaGamma; // Fixed point gamma correction for alpha blending.
F32 mGlow;
bool mMaterialUpdatePending;
LLMaterialID mMaterialID;
Expand Down
Loading
Loading