<script language="JavaScript"
src="/js/Kribi3DPlayer.js"
type="text/javascript"></script>
<script
language="JavaScript"
src="/js/gFunct.js"
type="text/javascript"></script>
<script
language="JavaScript"
type="text/javascript">
var loadok = false;
var opening = false;
/*
------------------------------------------------------------ */
/* This function is invoked when the page is
loaded.
*Allows the
loading of plugins*/
window.onload = function () {
loadok = true;
}
/*
------------------------------------------------------------ */
/* This function is invoked every time the player
sends a message to the
* browser, we
use it to intercept the Ready event which is sent when
* the player is
ready to accept commands and the ModelOpened event which is
* sent when the
model has been loaded. */
function KribiPlayer_Tell(msg) {
var player = document.getElementById("KribiPlayer");
if (loadok) {
if (msg ==
"ModelOpened") {
// initialize the camera.
DefaultView_init();
} else if
(msg == "Refresh") {
if (!opening) {
// Wait for all the controls to be
opened, make sure that this will run only once.
opening = true;
player.Do("Model OpenAsync '" +
FullModelsPath() + "Stand_Modern_DD_v03_OP.kmo'");
}
}
}
}
/*
------------------------------------------------------------ */
// Set default
function DefaultView_init() {
var player = document.getElementById("KribiPlayer");
// Set the camera to its initial position.
player.Do("Camera EyesSeparation 65");
player.Do("Camera FieldOfView 60.08");
player.Do("Camera FrontClipDistance 0");
player.Do("Camera FrontClipPlane 0");
player.Do("Camera Orientation
60.1606,28.791,0");
player.Do("Camera Perspective 1");
player.Do("Camera Position
2869.98,4199.09,4123.38");
player.Do("Camera Scale 1");
player.Do("Camera Stereo 0");
// Enable realistic rendering.
player.Do("Renderer Shading Realistic");
// Set tool
CameraPlaneMove();
}
/*
------------------------------------------------------------ */
function refresh_DefaultView_init() {
var player = document.getElementById("KribiPlayer");
player.Do("Model OpenAsync '" +
FullModelsPath() + "Stand_Modern_DD_v03_OP.kmo'");
DefaultView_init();
changeImagesCamera('Camera_img1',
'/Resources/Kribi3DPlayer/images/Camera_CameraLookAt_Select.png');
}
/*
------------------------------------------------------------ */
// Tools
function CameraPlaneMove() {
// Set Tool CameraPlaneMove.
var player = document.getElementById("KribiPlayer");
player.Do("Tool SetCurrent 'CameraPlaneMove'");
var dd = player.Do("Tool GetCurrent ");
}
/*
------------------------------------------------------------ */
function InstanceHorizontalPlaneMove() {
// Set Tool InstanceHorizontalPlaneMove
var player = document.getElementById("KribiPlayer");
player.Do("Tool SetCurrent
'InstanceHorizontalPlaneMove'");
}
/*
------------------------------------------------------------ */
// Function
function DragProduct(ev, ref, itemName) {
var arrIstance_Orientation;
var
player = document.getElementById("KribiPlayer");
player.Do("Object DragDropPath
'http://www.inartis.com/" + ref + "','"
+ itemName + "'");
player.Do("View SelectionStyle None");
InstanceHorizontalPlaneMove();
changeImagesCamera('Camera_img2',
'/Resources/Kribi3DPlayer/images/Instance_MoveHorizontalPlane_Select.png');
if (!ev)
ev = window.event;
if (ev.preventDefault)
ev.preventDefault();
ev.returnValue = false;
//set slider value
if (player.Do("Instance
GetCurrent") != "null") {
arrIstance_Orientation = Vect3FromStr(player.Do("Instance Orientation"));
arrIstance_Orientation[0] = arrIstance_Orientation[0] % 360;
if (arrIstance_Orientation[0] < 0) {
arrIstance_Orientation[0] = 360 + arrIstance_Orientation[0];
}
$find("<%=
slider_Orientation_Yaw.ClientID
%>").set_value(arrIstance_Orientation[0]);
}
}
/*
------------------------------------------------------------ */
var arrIstance_Orientation;
function RotateFw45() {
try {
var player = document.getElementById("KribiPlayer");
var current = player.Do("Instance GetCurrent");
arrIstance_Orientation = Vect3FromStr(player.Do("Instance Orientation"));
arrIstance_Orientation[0] = arrIstance_Orientation[0] % 360
if (arrIstance_Orientation[0] < 0) {
arrIstance_Orientation[0] = 360 + arrIstance_Orientation[0]
}
var quoz;
quoz = parseInt(arrIstance_Orientation[0] / 45);
arrIstance_Orientation[0] = (45 * (quoz + 1));
player.Do("Instance Orientation " +
arrIstance_Orientation[0] + "," +
arrIstance_Orientation[1] + "," +
arrIstance_Orientation[2] + "");
$find("<%=
slider_Orientation_Yaw.ClientID
%>").set_value(arrIstance_Orientation[0]);
}
catch (err) {
//Handle errors
}
}
/*
------------------------------------------------------------ */
function RotateRw45() {
try {
var player = document.getElementById("KribiPlayer");
var current = player.Do("Instance GetCurrent");
arrIstance_Orientation = Vect3FromStr(player.Do("Instance Orientation"));
arrIstance_Orientation[0] = arrIstance_Orientation[0] % 360
if (arrIstance_Orientation[0] < 0) {
arrIstance_Orientation[0] = 360 + arrIstance_Orientation[0]
}
var quoz;
quoz = parseInt(arrIstance_Orientation[0] / 45);
arrIstance_Orientation[0] = (45 * (quoz - 1));
player.Do("Instance Orientation " +
arrIstance_Orientation[0] + "," +
arrIstance_Orientation[1] + "," +
arrIstance_Orientation[2] + "");
$find("<%=
slider_Orientation_Yaw.ClientID
%>").set_value(arrIstance_Orientation[0]);
}
catch (err) {
//Handle errors
}
}
/*
------------------------------------------------------------ */
// Event handlers.
/* Change the model orientation to reflect the
values stored in the
* orientation
sliders. */
function HandleValueChange_Orientation_Yaw() {
var player = document.getElementById("KribiPlayer");
var Orientation_Yaw = $find("<%=
slider_Orientation_Yaw.ClientID
%>").get_value();
var current = player.Do("Instance GetCurrent");
arrIstance_Orientation = Vect3FromStr(player.Do("Instance Orientation"));
player.Do("Instance Orientation " +
Orientation_Yaw + "," +
arrIstance_Orientation[1] + "," +
arrIstance_Orientation[2] + "");
}
/*
------------------------------------------------------------ */
function HandleValueChange_Camera_Zoom() {
var player = document.getElementById("KribiPlayer");
//player.Do("Tool SetCurrent
'CameraZoom'");
var Camera_Zoom = $find("<%=
slider_Camera_Zoom.ClientID
%>").get_value();
player.Do("Camera FieldOfView " + (100
- Camera_Zoom));
}
|