Skip to content

Commit 244ee20

Browse files
committed
Revert "Merge pull request #4356 from secondlife/geenz/dev-to-gltf"
This reverts commit 604e4f6, reversing changes made to edaf157.
1 parent 604e4f6 commit 244ee20

27 files changed

+523
-772
lines changed

.github/pull_request_template.md

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/build.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,10 @@ jobs:
218218
prefix=${ba[0]}
219219
if [ "$prefix" == "project" ]; then
220220
IFS='_' read -ra prj <<< "${ba[1]}"
221+
prj_str="${prj[*]}"
221222
# uppercase first letter of each word
222-
export viewer_channel="Second Life Project ${prj[*]^}"
223+
capitalized=$(echo "$prj_str" | awk '{for (i=1; i<=NF; i++) $i = toupper(substr($i,1,1)) substr($i,2); print}')
224+
export viewer_channel="Second Life Project $capitalized"
223225
elif [[ "$prefix" == "release" || "$prefix" == "main" ]];
224226
then
225227
export viewer_channel="Second Life Release"
@@ -455,7 +457,6 @@ jobs:
455457
prerelease: true
456458
generate_release_notes: true
457459
target_commitish: ${{ github.sha }}
458-
previous_tag: release
459460
append_body: true
460461
fail_on_unmatched_files: true
461462
files: |

indra/llappearance/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ set(llappearance_SOURCE_FILES
1414
llavatarjoint.cpp
1515
llavatarjointmesh.cpp
1616
lldriverparam.cpp
17+
lljointdata.h
1718
lllocaltextureobject.cpp
1819
llpolyskeletaldistortion.cpp
1920
llpolymesh.cpp

indra/llappearance/llavatarappearance.cpp

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,17 @@
2929
#include "llavatarappearance.h"
3030
#include "llavatarappearancedefines.h"
3131
#include "llavatarjointmesh.h"
32+
#include "lljointdata.h"
3233
#include "llstl.h"
3334
#include "lldir.h"
3435
#include "llpolymorph.h"
3536
#include "llpolymesh.h"
3637
#include "llpolyskeletaldistortion.h"
37-
#include "llstl.h"
3838
#include "lltexglobalcolor.h"
3939
#include "llwearabledata.h"
4040
#include "boost/bind.hpp"
4141
#include "boost/tokenizer.hpp"
42+
#include "v4math.h"
4243

4344
using namespace LLAvatarAppearanceDefines;
4445

@@ -71,11 +72,13 @@ class LLAvatarBoneInfo
7172
mChildren.clear();
7273
}
7374
bool parseXml(LLXmlTreeNode* node);
75+
glm::mat4 getJointMatrix();
7476

7577
private:
7678
std::string mName;
7779
std::string mSupport;
7880
std::string mAliases;
81+
std::string mGroup;
7982
bool mIsJoint;
8083
LLVector3 mPos;
8184
LLVector3 mEnd;
@@ -105,11 +108,17 @@ class LLAvatarSkeletonInfo
105108
S32 getNumBones() const { return mNumBones; }
106109
S32 getNumCollisionVolumes() const { return mNumCollisionVolumes; }
107110

111+
private:
112+
typedef std::vector<LLAvatarBoneInfo*> bone_info_list_t;
113+
static void getJointMatricesAndHierarhy(
114+
LLAvatarBoneInfo* bone_info,
115+
LLJointData& data,
116+
const glm::mat4& parent_mat);
117+
108118
private:
109119
S32 mNumBones;
110120
S32 mNumCollisionVolumes;
111121
LLAvatarAppearance::joint_alias_map_t mJointAliasMap;
112-
typedef std::vector<LLAvatarBoneInfo*> bone_info_list_t;
113122
bone_info_list_t mBoneInfoList;
114123
};
115124

@@ -1598,6 +1607,15 @@ bool LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node)
15981607
mSupport = "base";
15991608
}
16001609

1610+
// Skeleton has 133 bones, but shader only allows 110 (LL_MAX_JOINTS_PER_MESH_OBJECT)
1611+
// Groups can be used by importer to cut out unused groups of joints
1612+
static LLStdStringHandle group_string = LLXmlTree::addAttributeString("group");
1613+
if (!node->getFastAttributeString(group_string, mGroup))
1614+
{
1615+
LL_WARNS() << "Bone without group " << mName << LL_ENDL;
1616+
mGroup = "global";
1617+
}
1618+
16011619
if (mIsJoint)
16021620
{
16031621
static LLStdStringHandle pivot_string = LLXmlTree::addAttributeString("pivot");
@@ -1623,6 +1641,21 @@ bool LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node)
16231641
return true;
16241642
}
16251643

1644+
1645+
glm::mat4 LLAvatarBoneInfo::getJointMatrix()
1646+
{
1647+
glm::mat4 mat(1.0f);
1648+
// 1. Scaling
1649+
mat = glm::scale(mat, glm::vec3(mScale[0], mScale[1], mScale[2]));
1650+
// 2. Rotation (Euler angles rad)
1651+
mat = glm::rotate(mat, mRot[0], glm::vec3(1, 0, 0));
1652+
mat = glm::rotate(mat, mRot[1], glm::vec3(0, 1, 0));
1653+
mat = glm::rotate(mat, mRot[2], glm::vec3(0, 0, 1));
1654+
// 3. Position
1655+
mat = glm::translate(mat, glm::vec3(mPos[0], mPos[1], mPos[2]));
1656+
return mat;
1657+
}
1658+
16261659
//-----------------------------------------------------------------------------
16271660
// LLAvatarSkeletonInfo::parseXml()
16281661
//-----------------------------------------------------------------------------
@@ -1653,6 +1686,25 @@ bool LLAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node)
16531686
return true;
16541687
}
16551688

1689+
void LLAvatarSkeletonInfo::getJointMatricesAndHierarhy(
1690+
LLAvatarBoneInfo* bone_info,
1691+
LLJointData& data,
1692+
const glm::mat4& parent_mat)
1693+
{
1694+
data.mName = bone_info->mName;
1695+
data.mJointMatrix = bone_info->getJointMatrix();
1696+
data.mScale = glm::vec3(bone_info->mScale[0], bone_info->mScale[1], bone_info->mScale[2]);
1697+
data.mRotation = bone_info->mRot;
1698+
data.mRestMatrix = parent_mat * data.mJointMatrix;
1699+
data.mIsJoint = bone_info->mIsJoint;
1700+
data.mGroup = bone_info->mGroup;
1701+
for (LLAvatarBoneInfo* child_info : bone_info->mChildren)
1702+
{
1703+
LLJointData& child_data = data.mChildren.emplace_back();
1704+
getJointMatricesAndHierarhy(child_info, child_data, data.mRestMatrix);
1705+
}
1706+
}
1707+
16561708
//Make aliases for joint and push to map.
16571709
void LLAvatarAppearance::makeJointAliases(LLAvatarBoneInfo *bone_info)
16581710
{
@@ -1714,6 +1766,16 @@ const LLAvatarAppearance::joint_alias_map_t& LLAvatarAppearance::getJointAliases
17141766
return mJointAliasMap;
17151767
}
17161768

1769+
void LLAvatarAppearance::getJointMatricesAndHierarhy(std::vector<LLJointData> &data) const
1770+
{
1771+
glm::mat4 identity(1.f);
1772+
for (LLAvatarBoneInfo* bone_info : sAvatarSkeletonInfo->mBoneInfoList)
1773+
{
1774+
LLJointData& child_data = data.emplace_back();
1775+
LLAvatarSkeletonInfo::getJointMatricesAndHierarhy(bone_info, child_data, identity);
1776+
}
1777+
}
1778+
17171779

17181780
//-----------------------------------------------------------------------------
17191781
// parseXmlSkeletonNode(): parses <skeleton> nodes from XML tree

indra/llappearance/llavatarappearance.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@
3434
#include "lltexlayer.h"
3535
#include "llviewervisualparam.h"
3636
#include "llxmltree.h"
37+
#include "v4math.h"
3738

3839
class LLTexLayerSet;
3940
class LLTexGlobalColor;
4041
class LLTexGlobalColorInfo;
4142
class LLWearableData;
4243
class LLAvatarBoneInfo;
4344
class LLAvatarSkeletonInfo;
45+
class LLJointData;
4446

4547
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4648
// LLAvatarAppearance
@@ -153,7 +155,9 @@ class LLAvatarAppearance : public LLCharacter
153155
const avatar_joint_list_t& getSkeleton() { return mSkeleton; }
154156
typedef std::map<std::string, std::string, std::less<>> joint_alias_map_t;
155157
const joint_alias_map_t& getJointAliases();
156-
158+
typedef std::map<std::string, std::string> joint_parent_map_t; // matrix plus parent
159+
typedef std::map<std::string, glm::mat4> joint_rest_map_t;
160+
void getJointMatricesAndHierarhy(std::vector<LLJointData> &data) const;
157161

158162
protected:
159163
static bool parseSkeletonFile(const std::string& filename, LLXmlTree& skeleton_xml_tree);

indra/llappearance/lljointdata.h

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/**
2+
* @file lljointdata.h
3+
* @brief LLJointData class for holding individual joint data and skeleton
4+
*
5+
* $LicenseInfo:firstyear=2025&license=viewerlgpl$
6+
* Second Life Viewer Source Code
7+
* Copyright (C) 2025, Linden Research, Inc.
8+
*
9+
* This library is free software; you can redistribute it and/or
10+
* modify it under the terms of the GNU Lesser General Public
11+
* License as published by the Free Software Foundation;
12+
* version 2.1 of the License only.
13+
*
14+
* This library is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+
* Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public
20+
* License along with this library; if not, write to the Free Software
21+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22+
*
23+
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
24+
* $/LicenseInfo$
25+
*/
26+
27+
#ifndef LL_LLJOINTDATA_H
28+
#define LL_LLJOINTDATA_H
29+
30+
#include "v4math.h"
31+
32+
// may be just move LLAvatarBoneInfo
33+
class LLJointData
34+
{
35+
public:
36+
std::string mName;
37+
std::string mGroup;
38+
glm::mat4 mJointMatrix;
39+
glm::mat4 mRestMatrix;
40+
glm::vec3 mScale;
41+
LLVector3 mRotation;
42+
43+
typedef std::vector<LLJointData> bones_t;
44+
bones_t mChildren;
45+
46+
bool mIsJoint; // if not, collision_volume
47+
enum SupportCategory
48+
{
49+
SUPPORT_BASE,
50+
SUPPORT_EXTENDED
51+
};
52+
SupportCategory mSupport;
53+
void setSupport(const std::string& support)
54+
{
55+
if (support == "extended")
56+
{
57+
mSupport = SUPPORT_EXTENDED;
58+
}
59+
else
60+
{
61+
mSupport = SUPPORT_BASE;
62+
}
63+
}
64+
};
65+
66+
#endif //LL_LLJOINTDATA_H

indra/llprimitive/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ include(TinyGLTF)
1212

1313
set(llprimitive_SOURCE_FILES
1414
lldaeloader.cpp
15-
llgltfloader.cpp
1615
llgltfmaterial.cpp
1716
llmaterialid.cpp
1817
llmaterial.cpp
@@ -32,7 +31,6 @@ set(llprimitive_SOURCE_FILES
3231
set(llprimitive_HEADER_FILES
3332
CMakeLists.txt
3433
lldaeloader.h
35-
llgltfloader.h
3634
llgltfmaterial.h
3735
llgltfmaterial_templates.h
3836
legacy_object_types.h

0 commit comments

Comments
 (0)