summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llmessage/llpartdata.cpp78
-rw-r--r--indra/llmessage/llpartdata.h36
-rw-r--r--indra/lscript/lscript_compile/indra.l14
3 files changed, 117 insertions, 11 deletions
diff --git a/indra/llmessage/llpartdata.cpp b/indra/llmessage/llpartdata.cpp
index 26cafa025f..c0fd3c9542 100644
--- a/indra/llmessage/llpartdata.cpp
+++ b/indra/llmessage/llpartdata.cpp
@@ -37,12 +37,18 @@
+const S32 PS_PART_DATA_GLOW_BLEND_SIZE = 4;
const S32 PS_PART_DATA_BLOCK_SIZE = 4 + 2 + 4 + 4 + 2 + 2; // 18
-const S32 PS_DATA_BLOCK_SIZE = 68 + PS_PART_DATA_BLOCK_SIZE; // 68 + 18 = 86
+const S32 PS_DATA_BLOCK_SIZE = 68 + PS_PART_DATA_BLOCK_SIZE + PS_PART_DATA_GLOW_BLEND_SIZE; // 68 + 18 + 4 = 90
const F32 MAX_PART_SCALE = 4.f;
+bool LLPartData::hasGlow() const
+{
+ return mStartGlow > 0.f || mEndGlow > 0.f;
+}
+
BOOL LLPartData::pack(LLDataPacker &dp)
{
LLColor4U coloru;
@@ -56,6 +62,14 @@ BOOL LLPartData::pack(LLDataPacker &dp)
dp.packFixed(mStartScale.mV[1], "pdstartscaley", FALSE, 3, 5);
dp.packFixed(mEndScale.mV[0], "pdendscalex", FALSE, 3, 5);
dp.packFixed(mEndScale.mV[1], "pdendscaley", FALSE, 3, 5);
+
+ if (hasGlow() || hasBlendFunc())
+ {
+ dp.packU8(mStartGlow * 255,"pdstartglow");
+ dp.packU8(mEndGlow * 255,"pdendglow");
+ dp.packU8(mBlendFuncSource,"pdblendsource");
+ dp.packU8(mBlendFuncDest,"pdblenddest");
+ }
return TRUE;
}
@@ -68,6 +82,11 @@ LLSD LLPartData::asLLSD() const
sd["pdendcolor"] = ll_sd_from_color4(mEndColor);
sd["pdstartscale"] = ll_sd_from_vector2(mStartScale);
sd["pdendscale"] = ll_sd_from_vector2(mEndScale);
+ sd["pdstartglow"] = mStartGlow;
+ sd["pdendglow"] = mEndGlow;
+ sd["pdblendsource"] = (S32)mBlendFuncSource;
+ sd["pdblenddest"] = (S32)mBlendFuncDest;
+
return sd;
}
@@ -79,6 +98,12 @@ bool LLPartData::fromLLSD(LLSD& sd)
mEndColor = ll_color4_from_sd(sd["pdendcolor"]);
mStartScale = ll_vector2_from_sd(sd["pdstartscale"]);
mEndScale = ll_vector2_from_sd(sd["pdendscale"]);
+
+ mStartGlow = sd.has("pdstartglow") ? sd["pdstartglow"].asReal() : 0.f;
+ mEndGlow = sd.has("pdendglow") ? sd["pdendglow"].asReal() : 0.f;
+ mBlendFuncSource = sd.has("pdblendsource") ? (U8)sd["pdblendsource"].asInteger() : LL_PART_BF_SOURCE_ALPHA;
+ mBlendFuncDest = sd.has("pdblenddest") ? (U8)sd["pdblenddest"].asInteger() : LL_PART_BF_ONE_MINUS_SOURCE_ALPHA;
+
return true;
}
@@ -98,6 +123,18 @@ BOOL LLPartData::unpack(LLDataPacker &dp)
dp.unpackFixed(mStartScale.mV[1], "pdstartscaley", FALSE, 3, 5);
dp.unpackFixed(mEndScale.mV[0], "pdendscalex", FALSE, 3, 5);
dp.unpackFixed(mEndScale.mV[1], "pdendscaley", FALSE, 3, 5);
+
+ if (dp.hasNext())
+ {
+ U8 tmp_glow = 0;
+ dp.unpackU8(tmp_glow,"pdstartglow");
+ mStartGlow = tmp_glow / 255.f;
+ dp.unpackU8(tmp_glow,"pdendglow");
+ mEndGlow = tmp_glow / 255.f;
+ dp.unpackU8(mBlendFuncSource,"pdblendsource");
+ dp.unpackU8(mBlendFuncDest,"pdblenddest");
+ }
+
return TRUE;
}
@@ -148,6 +185,18 @@ void LLPartData::setEndAlpha(const F32 alpha)
mEndColor.mV[3] = alpha;
}
+// static
+bool LLPartData::validBlendFunc(S32 func)
+{
+ if (func >= 0
+ && func < LL_PART_BF_COUNT
+ && func != UNSUPPORTED_DEST_ALPHA
+ && func != UNSUPPORTED_ONE_MINUS_DEST_ALPHA)
+ {
+ return true;
+ }
+ return false;
+}
LLPartSysData::LLPartSysData()
{
@@ -160,6 +209,10 @@ LLPartSysData::LLPartSysData()
mPartData.mStartScale = LLVector2(1.f, 1.f);
mPartData.mEndScale = LLVector2(1.f, 1.f);
mPartData.mMaxAge = 10.0;
+ mPartData.mBlendFuncSource = LLPartData::LL_PART_BF_SOURCE_ALPHA;
+ mPartData.mBlendFuncDest = LLPartData::LL_PART_BF_ONE_MINUS_SOURCE_ALPHA;
+ mPartData.mStartGlow = 0.f;
+ mPartData.mEndGlow = 0.f;
mMaxAge = 0.0;
mStartAge = 0.0;
@@ -264,14 +317,16 @@ BOOL LLPartSysData::isNullPS(const S32 block_num)
{
return TRUE;
}
- else if (size != PS_DATA_BLOCK_SIZE)
+
+ gMessageSystem->getBinaryData("ObjectData", "PSBlock", ps_data_block, PS_DATA_BLOCK_SIZE, block_num, PS_DATA_BLOCK_SIZE);
+
+ if (size > PS_DATA_BLOCK_SIZE)
{
- llwarns << "PSBlock is wrong size for particle system data - got " << size << ", expecting " << PS_DATA_BLOCK_SIZE << llendl;
+ //size is too big, newer particle version unsupported
return TRUE;
}
- gMessageSystem->getBinaryData("ObjectData", "PSBlock", ps_data_block, PS_DATA_BLOCK_SIZE, block_num, PS_DATA_BLOCK_SIZE);
- LLDataPackerBinaryBuffer dp(ps_data_block, PS_DATA_BLOCK_SIZE);
+ LLDataPackerBinaryBuffer dp(ps_data_block, size);
dp.unpackU32(crc, "crc");
if (crc == 0)
@@ -296,10 +351,13 @@ BOOL LLPartSysData::packBlock()
U8 ps_data_block[PS_DATA_BLOCK_SIZE];
LLDataPackerBinaryBuffer dp(ps_data_block, PS_DATA_BLOCK_SIZE);
+
pack(dp);
+ S32 size = dp.getCurrentSize();
+
// Add to message
- gMessageSystem->addBinaryData("PSBlock", ps_data_block, PS_DATA_BLOCK_SIZE);
+ gMessageSystem->addBinaryData("PSBlock", ps_data_block, size);
return TRUE;
}
@@ -312,16 +370,16 @@ BOOL LLPartSysData::unpackBlock(const S32 block_num)
// Check size of block
S32 size = gMessageSystem->getSize("ObjectData", block_num, "PSBlock");
- if (size != PS_DATA_BLOCK_SIZE)
+ if (size > PS_DATA_BLOCK_SIZE)
{
- llwarns << "PSBlock is wrong size for particle system data - got " << size << ", expecting " << PS_DATA_BLOCK_SIZE << llendl;
+ // Larger packets are newer and unsupported
return FALSE;
}
// Get from message
- gMessageSystem->getBinaryData("ObjectData", "PSBlock", ps_data_block, PS_DATA_BLOCK_SIZE, block_num, PS_DATA_BLOCK_SIZE);
+ gMessageSystem->getBinaryData("ObjectData", "PSBlock", ps_data_block, size, block_num, PS_DATA_BLOCK_SIZE);
- LLDataPackerBinaryBuffer dp(ps_data_block, PS_DATA_BLOCK_SIZE);
+ LLDataPackerBinaryBuffer dp(ps_data_block, size);
unpack(dp);
return TRUE;
diff --git a/indra/llmessage/llpartdata.h b/indra/llmessage/llpartdata.h
index a4ef058b30..19207d994d 100644
--- a/indra/llmessage/llpartdata.h
+++ b/indra/llmessage/llpartdata.h
@@ -70,7 +70,12 @@ enum LLPSScriptFlags
LLPS_SRC_TARGET_UUID,
LLPS_SRC_OMEGA,
LLPS_SRC_ANGLE_BEGIN,
- LLPS_SRC_ANGLE_END
+ LLPS_SRC_ANGLE_END,
+
+ LLPS_PART_BLEND_FUNC_SOURCE,
+ LLPS_PART_BLEND_FUNC_DEST,
+ LLPS_PART_START_GLOW,
+ LLPS_PART_END_GLOW
};
@@ -89,6 +94,9 @@ public:
operator LLSD() const {return asLLSD(); }
bool fromLLSD(LLSD& sd);
+ bool hasGlow() const;
+ bool hasBlendFunc() const;
+
// Masks for the different particle flags
enum
{
@@ -102,6 +110,7 @@ public:
LL_PART_TARGET_LINEAR_MASK = 0x80, // Particle uses a direct linear interpolation
LL_PART_EMISSIVE_MASK = 0x100, // Particle is "emissive", instead of being lit
LL_PART_BEAM_MASK = 0x200, // Particle is a "beam" connecting source and target
+ LL_PART_RIBBON_MASK = 0x400, // Particles are joined together into one continuous triangle strip
// Not implemented yet!
//LL_PART_RANDOM_ACCEL_MASK = 0x100, // Particles have random acceleration
@@ -113,6 +122,23 @@ public:
LL_PART_DEAD_MASK = 0x80000000,
};
+ enum
+ {
+ LL_PART_BF_ONE = 0,
+ LL_PART_BF_ZERO = 1,
+ LL_PART_BF_DEST_COLOR = 2,
+ LL_PART_BF_SOURCE_COLOR = 3,
+ LL_PART_BF_ONE_MINUS_DEST_COLOR = 4,
+ LL_PART_BF_ONE_MINUS_SOURCE_COLOR = 5,
+ UNSUPPORTED_DEST_ALPHA = 6,
+ LL_PART_BF_SOURCE_ALPHA = 7,
+ UNSUPPORTED_ONE_MINUS_DEST_ALPHA = 8,
+ LL_PART_BF_ONE_MINUS_SOURCE_ALPHA = 9,
+ LL_PART_BF_COUNT = 10
+ };
+
+ static bool validBlendFunc(S32 func);
+
void setFlags(const U32 flags);
void setMaxAge(const F32 max_age);
void setStartScale(const F32 xs, F32 ys);
@@ -137,6 +163,12 @@ public:
LLVector3 mPosOffset; // Offset from source if using FOLLOW_SOURCE
F32 mParameter; // A single floating point parameter
+
+ F32 mStartGlow;
+ F32 mEndGlow;
+
+ U8 mBlendFuncSource;
+ U8 mBlendFuncDest;
};
@@ -187,6 +219,8 @@ public:
void clampSourceParticleRate();
friend std::ostream& operator<<(std::ostream& s, const LLPartSysData &data); // Stream a
+
+ S32 getdataBlockSize() const;
public:
// Public because I'm lazy....
diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l
index 307a5561a0..3f844d0fd1 100644
--- a/indra/lscript/lscript_compile/indra.l
+++ b/indra/lscript/lscript_compile/indra.l
@@ -355,6 +355,10 @@ extern "C" { int yyerror(const char *fmt, ...); }
"PSYS_PART_END_SCALE" { count(); yylval.ival = LLPS_PART_END_SCALE; return (INTEGER_CONSTANT); }
"PSYS_PART_MAX_AGE" { count(); yylval.ival = LLPS_PART_MAX_AGE; return (INTEGER_CONSTANT); }
+"PSYS_PART_BLEND_FUNC_SOURCE" { count(); yylval.ival = LLPS_PART_BLEND_FUNC_SOURCE; return (INTEGER_CONSTANT); }
+"PSYS_PART_BLEND_FUNC_DEST" { count(); yylval.ival = LLPS_PART_BLEND_FUNC_DEST; return (INTEGER_CONSTANT); }
+"PSYS_PART_START_GLOW" { count(); yylval.ival = LLPS_PART_START_GLOW; return (INTEGER_CONSTANT); }
+"PSYS_PART_END_GLOW" { count(); yylval.ival = LLPS_PART_END_GLOW; return (INTEGER_CONSTANT); }
"PSYS_PART_WIND_MASK" { count(); yylval.ival = LLPartData::LL_PART_WIND_MASK; return(INTEGER_CONSTANT); }
"PSYS_PART_INTERP_COLOR_MASK" { count(); yylval.ival = LLPartData::LL_PART_INTERP_COLOR_MASK; return(INTEGER_CONSTANT); }
@@ -365,6 +369,16 @@ extern "C" { int yyerror(const char *fmt, ...); }
"PSYS_PART_TARGET_POS_MASK" { count(); yylval.ival = LLPartData::LL_PART_TARGET_POS_MASK; return(INTEGER_CONSTANT); }
"PSYS_PART_EMISSIVE_MASK" { count(); yylval.ival = LLPartData::LL_PART_EMISSIVE_MASK; return(INTEGER_CONSTANT); }
"PSYS_PART_TARGET_LINEAR_MASK" { count(); yylval.ival = LLPartData::LL_PART_TARGET_LINEAR_MASK; return(INTEGER_CONSTANT); }
+"PSYS_PART_RIBBON_MASK" { count(); yylval.ival = LLPartData::LL_PART_RIBBON_MASK; return(INTEGER_CONSTANT); }
+
+"PSYS_PART_BF_ONE" { count(); yylval.ival = LLPartData::LL_PART_BF_ONE; return(INTEGER_CONSTANT); }
+"PSYS_PART_BF_ZERO" { count(); yylval.ival = LLPartData::LL_PART_BF_ZERO; return(INTEGER_CONSTANT); }
+"PSYS_PART_BF_DEST_COLOR" { count(); yylval.ival = LLPartData::LL_PART_BF_DEST_COLOR; return(INTEGER_CONSTANT); }
+"PSYS_PART_BF_SOURCE_COLOR" { count(); yylval.ival = LLPartData::LL_PART_BF_SOURCE_COLOR; return(INTEGER_CONSTANT); }
+"PSYS_PART_BF_ONE_MINUS_DEST_COLOR" { count(); yylval.ival = LLPartData::LL_PART_BF_ONE_MINUS_DEST_COLOR; return(INTEGER_CONSTANT); }
+"PSYS_PART_BF_ONE_MINUS_SOURCE_COLOR" { count(); yylval.ival = LLPartData::LL_PART_BF_ONE_MINUS_SOURCE_COLOR; return(INTEGER_CONSTANT); }
+"PSYS_PART_BF_SOURCE_ALPHA" { count(); yylval.ival = LLPartData::LL_PART_BF_SOURCE_ALPHA; return(INTEGER_CONSTANT); }
+"PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA" { count(); yylval.ival = LLPartData::LL_PART_BF_ONE_MINUS_SOURCE_ALPHA; return(INTEGER_CONSTANT); }
"PSYS_SRC_MAX_AGE" { count(); yylval.ival = LLPS_SRC_MAX_AGE; return(INTEGER_CONSTANT); }