mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 09:28:46 +02:00
Exploring the hologram
This commit is contained in:
parent
d0d771ce1e
commit
76f204b5aa
1 changed files with 55 additions and 14 deletions
|
@ -24,7 +24,8 @@
|
||||||
//*****************************************************
|
//*****************************************************
|
||||||
// Holo
|
// Holo
|
||||||
//*****************************************************
|
//*****************************************************
|
||||||
|
const SECONDARY_CAMERA_RESOLUTION = 1024; // width/height multiplier, in pixels
|
||||||
|
|
||||||
function Holo(config) {
|
function Holo(config) {
|
||||||
this.baseEntityProperties = {
|
this.baseEntityProperties = {
|
||||||
name: "Holo-base",
|
name: "Holo-base",
|
||||||
|
@ -47,50 +48,86 @@
|
||||||
shape: "Cylinder",
|
shape: "Cylinder",
|
||||||
shapeType:"box",
|
shapeType:"box",
|
||||||
"position": inFrontOf(8, Vec3.sum(MyAvatar.position, { x: 0, y: -1, z: 0 })),
|
"position": inFrontOf(8, Vec3.sum(MyAvatar.position, { x: 0, y: -1, z: 0 })),
|
||||||
"rotation": Quat.multiply(MyAvatar.orientation, { w: 0, x: 0, y: 1, z: 0 }),
|
"rotation": MyAvatar.orientation,
|
||||||
lifetime: config.lifetime,
|
lifetime: config.lifetime,
|
||||||
}
|
}
|
||||||
this.baseEntity = Entities.addEntity( this.baseEntityProperties );
|
this.baseEntity = Entities.addEntity( this.baseEntityProperties );
|
||||||
this.baseEntityProperties = Entities.getEntityProperties(this.baseEntity);
|
this.baseEntityProperties = Entities.getEntityProperties(this.baseEntity);
|
||||||
|
|
||||||
|
var DIM = {x: 6.0, y: 3.0, z: 0.0};
|
||||||
|
|
||||||
this.screenEntityProperties = {
|
this.screenEntityProperties = {
|
||||||
name: "Holo-screen",
|
name: "Holo-screen",
|
||||||
|
"visible": false,
|
||||||
"collisionless": true,
|
"collisionless": true,
|
||||||
"color": {
|
"color": {
|
||||||
"blue": 239,
|
"blue": 239,
|
||||||
"red": 180,
|
"red": 180,
|
||||||
"green": 0
|
"green": 0
|
||||||
},
|
},
|
||||||
"dimensions": {
|
"dimensions": DIM,
|
||||||
"x": 5,
|
|
||||||
"y": 0.1,
|
|
||||||
"z": 5,
|
|
||||||
},
|
|
||||||
"grab": {
|
"grab": {
|
||||||
"grabbable": false,
|
"grabbable": false,
|
||||||
},
|
},
|
||||||
"ignoreForCollisions": true,
|
"ignoreForCollisions": true,
|
||||||
type: "Shape",
|
type: "Shape",
|
||||||
shape: "Cylinder",
|
shape: "Box",
|
||||||
"position": inFrontOf(8, Vec3.sum(MyAvatar.position, { x: 0, y: -0.9, z: 0 })),
|
parentID: this.baseEntity,
|
||||||
"rotation": Quat.multiply(MyAvatar.orientation, { w: 0, x: 0, y: 1, z: 0 }),
|
localPosition: { x: 0, y: DIM.y * 0.5, z: 0 },
|
||||||
|
localRotation: { w: 1, x: 0, y: 0, z: 0 },
|
||||||
lifetime: config.lifetime,
|
lifetime: config.lifetime,
|
||||||
}
|
}
|
||||||
this.screenEntity = Entities.addEntity( this.screenEntityProperties );
|
this.screenEntity = Entities.addEntity( this.screenEntityProperties );
|
||||||
this.screenEntityProperties = Entities.getEntityProperties(this.screenEntity);
|
this.screenEntityProperties = Entities.getEntityProperties(this.screenEntity);
|
||||||
|
|
||||||
var DIM = {x: 5.0, y: 5.0, z: 0.0};
|
this.screenOutEntityProperties = {
|
||||||
|
name: "Holo-screen-out",
|
||||||
|
"visible": false,
|
||||||
|
"collisionless": true,
|
||||||
|
"color": {
|
||||||
|
"blue": 239,
|
||||||
|
"red": 180,
|
||||||
|
"green": 0
|
||||||
|
},
|
||||||
|
"dimensions": DIM,
|
||||||
|
"grab": {
|
||||||
|
"grabbable": false,
|
||||||
|
},
|
||||||
|
"ignoreForCollisions": true,
|
||||||
|
type: "Shape",
|
||||||
|
shape: "Box",
|
||||||
|
parentID: this.screenEntity,
|
||||||
|
// localRotation: { w: 0, x: 0, y: 1, z: 0 },
|
||||||
|
lifetime: config.lifetime,
|
||||||
|
}
|
||||||
|
this.screenOutEntity = Entities.addEntity( this.screenOutEntityProperties );
|
||||||
|
this.screenOutEntityProperties = Entities.getEntityProperties(this.screenOutEntity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var spectatorCameraConfig = Render.getConfig("SecondaryCamera");
|
||||||
|
Render.getConfig("SecondaryCameraJob.ToneMapping").curve = 0;
|
||||||
|
spectatorCameraConfig.enableSecondaryCameraRenderConfigs(true);
|
||||||
|
spectatorCameraConfig.portalProjection = true;
|
||||||
|
spectatorCameraConfig.portalEntranceEntityId = this.screenOutEntity;
|
||||||
|
spectatorCameraConfig.attachedEntityId = this.screenEntity;
|
||||||
|
|
||||||
|
spectatorCameraConfig.resetSizeSpectatorCamera(DIM.x * SECONDARY_CAMERA_RESOLUTION,
|
||||||
|
DIM.y * SECONDARY_CAMERA_RESOLUTION);
|
||||||
this.screen = Overlays.addOverlay("image3d", {
|
this.screen = Overlays.addOverlay("image3d", {
|
||||||
url: "resource://spectatorCameraFrame",
|
url: "resource://spectatorCameraFrame",
|
||||||
emissive: true,
|
emissive: true,
|
||||||
parentID: this.screenEntity,
|
parentID: this.screenEntity,
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
localRotation: { w: 1, x: 0, y: 0, z: 0 },
|
localRotation: { w: 1, x: 0, y: 0, z: 0 },
|
||||||
localPosition: { x: 0, y: 4.0, z: 0.0 },
|
localPosition: { x: 0, y: 0.0, z: 0.0 },
|
||||||
dimensions: DIM,
|
dimensions: {
|
||||||
|
x: (DIM.y > DIM.x ? DIM.y : DIM.x),
|
||||||
|
y: -(DIM.y > DIM.x ? DIM.y : DIM.x),
|
||||||
|
z: 0
|
||||||
|
},
|
||||||
lifetime: config.lifetime,
|
lifetime: config.lifetime,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Holo.prototype.kill = function () {
|
Holo.prototype.kill = function () {
|
||||||
|
@ -102,6 +139,10 @@
|
||||||
Entities.deleteEntity(this.screenEntity);
|
Entities.deleteEntity(this.screenEntity);
|
||||||
// this.entity = null
|
// this.entity = null
|
||||||
}
|
}
|
||||||
|
if (this.screenOutEntity) {
|
||||||
|
Entities.deleteEntity(this.screenOutEntity);
|
||||||
|
// this.entity = null
|
||||||
|
}
|
||||||
if (this.screen) {
|
if (this.screen) {
|
||||||
Overlays.deleteOverlay(this.view);
|
Overlays.deleteOverlay(this.view);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue