summaryrefslogtreecommitdiff
path: root/indra/llprimitive/lltextureentry.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llprimitive/lltextureentry.h')
-rw-r--r--indra/llprimitive/lltextureentry.h99
1 files changed, 74 insertions, 25 deletions
diff --git a/indra/llprimitive/lltextureentry.h b/indra/llprimitive/lltextureentry.h
index 960d97ba0c..437b85e03f 100644
--- a/indra/llprimitive/lltextureentry.h
+++ b/indra/llprimitive/lltextureentry.h
@@ -2,30 +2,25 @@
* @file lltextureentry.h
* @brief LLTextureEntry base class
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,9 +31,13 @@
#include "v4color.h"
#include "llsd.h"
+// These bits are used while unpacking TEM messages to tell which aspects of
+// the texture entry changed.
+const S32 TEM_CHANGE_NONE = 0x0;
const S32 TEM_CHANGE_COLOR = 0x1;
const S32 TEM_CHANGE_TEXTURE = 0x2;
-const S32 TEM_INVALID = 0x4;
+const S32 TEM_CHANGE_MEDIA = 0x4;
+const S32 TEM_INVALID = 0x8;
const S32 TEM_BUMPMAP_COUNT = 32;
@@ -63,10 +62,13 @@ const S32 TEM_MEDIA_MASK = 0x01;
const S32 TEM_TEX_GEN_MASK = 0x06;
const S32 TEM_TEX_GEN_SHIFT = 1;
+// forward declarations
+class LLMediaEntry;
class LLTextureEntry
{
public:
+ static LLTextureEntry* newTextureEntry();
typedef enum e_texgen
{
@@ -81,14 +83,18 @@ public:
LLTextureEntry(const LLTextureEntry &rhs);
LLTextureEntry &operator=(const LLTextureEntry &rhs);
- ~LLTextureEntry();
+ virtual ~LLTextureEntry();
bool operator==(const LLTextureEntry &rhs) const;
bool operator!=(const LLTextureEntry &rhs) const;
LLSD asLLSD() const;
+ void asLLSD(LLSD& sd) const;
operator LLSD() const { return asLLSD(); }
- bool fromLLSD(LLSD& sd);
+ bool fromLLSD(const LLSD& sd);
+
+ 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);
@@ -98,7 +104,11 @@ public:
S32 setColor(const LLColor3 &color);
S32 setAlpha(const F32 alpha);
S32 setScale(F32 s, F32 t);
+ S32 setScaleS(F32 s);
+ S32 setScaleT(F32 t);
S32 setOffset(F32 s, F32 t);
+ S32 setOffsetS(F32 s);
+ S32 setOffsetT(F32 t);
S32 setRotation(F32 theta);
S32 setBumpmap(U8 bump);
@@ -112,7 +122,7 @@ public:
S32 setMediaTexGen(U8 media);
S32 setGlow(F32 glow);
- const LLUUID &getID() const { return mID; }
+ virtual const LLUUID &getID() const { return mID; }
const LLColor4 &getColor() const { return mColor; }
void getScale(F32 *s, F32 *t) const { *s = mScaleS; *t = mScaleT; }
void getOffset(F32 *s, F32 *t) const { *s = mOffsetS; *t = mOffsetT; }
@@ -129,9 +139,37 @@ public:
U8 getTexGen() const { return mMediaFlags & TEM_TEX_GEN_MASK; }
U8 getMediaTexGen() const { return mMediaFlags; }
F32 getGlow() const { return mGlow; }
+
+ // *NOTE: it is possible for hasMedia() to return true, but getMediaData() to return NULL.
+ // CONVERSELY, it is also possible for hasMedia() to return false, but getMediaData()
+ // to NOT return NULL.
+ bool hasMedia() const { return (bool)(mMediaFlags & MF_HAS_MEDIA); }
+ LLMediaEntry* getMediaData() const { return mMediaEntry; }
+
+ // Completely change the media data on this texture entry.
+ void setMediaData(const LLMediaEntry &media_entry);
+ // Returns true if media data was updated, false if it was cleared
+ bool updateMediaData(const LLSD& media_data);
+ // Clears media data, and sets the media flags bit to 0
+ void clearMediaData();
+ // Merges the given LLSD of media fields with this media entry.
+ // Only those fields that are set that match the keys in
+ // LLMediaEntry will be affected. If no fields are set or if
+ // the LLSD is undefined, this is a no-op.
+ void mergeIntoMediaData(const LLSD& media_fields);
+
+ // Takes a media version string (an empty string or a previously-returned string)
+ // and returns a "touched" string, touched by agent_id
+ static std::string touchMediaVersionString(const std::string &in_version, const LLUUID &agent_id);
+ // Given a media version string, return the version
+ static U32 getVersionFromMediaVersionString(const std::string &version_string);
+ // Given a media version string, return the UUID of the agent
+ static LLUUID getAgentIDFromMediaVersionString(const std::string &version_string);
+ // Return whether or not the given string is actually a media version
+ static bool isMediaVersionString(const std::string &version_string);
// Media flags
- enum { MF_NONE = 0x0, MF_WEB_PAGE = 0x1 };
+ enum { MF_NONE = 0x0, MF_HAS_MEDIA = 0x1 };
public:
F32 mScaleS; // S, T offset
@@ -141,6 +179,14 @@ public:
F32 mRotation; // anti-clockwise rotation in rad about the bottom left corner
static const LLTextureEntry null;
+
+ // LLSD key defines
+ static const char* OBJECT_ID_KEY;
+ static const char* OBJECT_MEDIA_DATA_KEY;
+ static const char* MEDIA_VERSION_KEY;
+ static const char* TEXTURE_INDEX_KEY;
+ static const char* TEXTURE_MEDIA_DATA_KEY;
+
protected:
LLUUID mID; // Texture GUID
LLColor4 mColor;
@@ -148,6 +194,9 @@ protected:
U8 mMediaFlags; // replace with web page, movie, etc.
F32 mGlow;
+ // Note the media data is not sent via the same message structure as the rest of the TE
+ LLMediaEntry* mMediaEntry; // The media data for the face
+
// NOTE: when adding new data to this class, in addition to adding it to the serializers asLLSD/fromLLSD and the
// message packers (e.g. LLPrimitive::packTEMessage) you must also implement its copy in LLPrimitive::copyTEs()