diff --git a/README.md b/README.md index 333fb2d..e7423e6 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,11 @@ - [TV](https://hifi.maki.cat/shaders/tv.fs) - [Water](https://hifi.maki.cat/shaders/water.fs) +

+Avatars + +- [Lumpy Space Princess](https://hifi.maki.cat/avatars/lsp.fst) +

Sites diff --git a/avatars/lsp.fbx b/avatars/lsp.fbx new file mode 100644 index 0000000..ac9b260 Binary files /dev/null and b/avatars/lsp.fbx differ diff --git a/avatars/lsp.fst b/avatars/lsp.fst new file mode 100644 index 0000000..ed654ca --- /dev/null +++ b/avatars/lsp.fst @@ -0,0 +1,14 @@ +name = Lumpy Space Princess +type = body+head +scale = 1 +filename = lsp.fbx +joint = jointRoot = Hips +joint = jointLean = Spine +joint = jointNeck = Neck +joint = jointHead = Head +joint = jointRightHand = RightHand +joint = jointLeftHand = LeftHand +freeJoint = RightArm +freeJoint = RightForeArm +freeJoint = LeftArm +freeJoint = LeftForeArm diff --git a/client-scripts/makisNametags/makisNametags3D.js b/client-scripts/makisNametags/makisNametags3D.js new file mode 100644 index 0000000..cc51533 --- /dev/null +++ b/client-scripts/makisNametags/makisNametags3D.js @@ -0,0 +1,299 @@ +// ┏┳┓┏━┓╻┏ ╻╻┏━┓ +// ┃┃┃┣━┫┣┻┓┃ ┗━┓ +// ╹ ╹╹ ╹╹ ╹╹ ┗━┛ +// ┏┓╻┏━┓┏┳┓┏━╸╺┳╸┏━┓┏━╸┏━┓ +// ┃┗┫┣━┫┃┃┃┣╸ ┃ ┣━┫┃╺┓┗━┓ +// ╹ ╹╹ ╹╹ ╹┗━╸ ╹ ╹ ╹┗━┛┗━┛ +// github.com/makitsune/hifi-stuff + +var config = null; +function loadConfig(newConfig) { + config = newConfig; + Settings.setValue("makisNametags", config); + + config.marginWidth /= 100; + config.marginHeight /= 100; + config.textSize /= 10; +} + +function getConfig() { + var currentConfig = JSON.parse(JSON.stringify(config)); + currentConfig.marginWidth *= 100; + currentConfig.marginHeight *= 100; + currentConfig.textSize *= 10; + return currentConfig; +} + +//var threeDeeTextURL = "https://maki.cat/3d-text.obj?font=apple_kid&scale=0.01&depth=0.05&frontEmission=ffffff&sideEmission=E91E63&text="; +var threeDeeTextURL = "https://maki.cat/3d-text.obj?font=apple_kid&scale=0.01&depth=0.05&frontEmission=ffffff&text="; + +var defaultConfig = { + enabled: true, + textSize: 1, + + marginWidth: 5, + marginHeight: 3, + + textColor: {red:255, green:255, blue:255}, + textOpacity: 1, + backgroundColor: {red:29, green:31, blue:33}, + backgroundOpacity: 0.5, + + heightOffset: 1, + facingAvatar: true, + + drawOwn: false, + debug: false +}; + +// validating config +var preConfig = Settings.getValue("makisNametags", defaultConfig); +Object.keys(defaultConfig).forEach(function (key){ + if (preConfig[key]==undefined) preConfig[key] = defaultConfig[key]; +}); +loadConfig(preConfig); + +var nametags = {}; // id: {avatar, overlay, displayName} +var reloadNametagsInterval = null; + +// script functions +function debug(msg) { print("DEBUG - "+msg); } + +function drawNametag(avatarID) { + if (!avatarID) return false; + if (nametags[avatarID+""]) return false; + + var avatar = AvatarList.getAvatar(avatarID); + var displayName = avatar.sessionDisplayName; + + //var headJointIndex = avatar.getJointIndex("Head"); + //var headTranslation = avatar.getJointTranslation("head"); + + var overlay = Overlays.addOverlay("model", { + parentID: avatarID, + //parentJointIndex: headJointIndex, + + //position: Vec3.sum(avatar.position, headTranslation), + + position: Vec3.sum(avatar.position, {x:0, + y:config.heightOffset*(0.5+avatar.scale/2), + z:0}), + + rotation: Quat.multiply( + Quat.cancelOutRollAndPitch(avatar.orientation), + Quat.fromPitchYawRollDegrees(0,180,0) + ), + + // position: Vec3.sum(avatar.getJointPosition("Head"), { + // x: 0, + // y: config.heightOffset, + // z: 0, + // }), + + url: threeDeeTextURL+displayName, + + visable: true, isSolid: false, + }); + + // add to nametags ^^ + var nametag = { + avatar: avatar, + overlay: overlay, + displayName: avatar.sessionDisplayName + }; + + nametags[avatarID+""] = nametag; + + return true; +} + +function drawAllNametags() { + var avatars = AvatarList.getAvatarIdentifiers(); + if (config.drawOwn) avatars.push(MyAvatar.sessionUUID); + + if (config.debug) var avatarCount = 0; + for (var i=0; i