Commit aee5b257 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

+clipping planes: near and far

parent 35a34987
Pipeline #643 canceled with stages
......@@ -79,7 +79,9 @@ var SETTINGS = {
x: 0,
y: 0,
z: -0.12
}
},
'clipnear': -20000,
'clipfar' : 20000
// 'kml' : "scene.kml"
}
......@@ -128,6 +130,10 @@ function parseURL(){
case "slidingdrag": SETTINGS.slidingdrag = true; break;
case "shiftspeed": SETTINGS.shiftspeed = parseFloat(parameters[i][1]); break;
case "markersize": SETTINGS.markersize = parseFloat(parameters[i][1]); break;
case "clipnear": SETTINGS.clipNear = parseFloat(parameters[i][1]); break;
case "clipfar": SETTINGS.clipFar = parseFloat(parameters[i][1]); break;
case "basepath": SETTINGS.basepath = parameters[i][1]; break;
case "group": SETTINGS.group = parameters[i][1]; break;
case "path": SETTINGS.path = parameters[i][1]; break;
......@@ -280,6 +286,8 @@ function light_init(){
' <transform id=\'x3d_transform\' class=\'inline_wrapper\'>',
' <transform translation=\''+([SETTINGS.mountshift.x,SETTINGS.mountshift.y,SETTINGS.mountshift.z].join(','))+'\'>',
' <inline name="x3d_'+model_name+'" namespacename="x3d_'+model_name+'" url="'+model_url+'"></inline>',
' <clipplane id=\'clipfar_cp\' enabled="true" on="true" plane="0,0,1,20000"></clipplane>',
' <clipplane id=\'clipnear_cp\' enabled="true" on="true" plane="0,0,-1,20000"></clipplane>',
' </transform>',
' </transform>',
' </switch>',
......
......@@ -109,7 +109,10 @@ function menu_init(){
crosshair_init();
shiftspeed_init();
marker_size_color_init();
clipping_planes_init();
reset_view_init();
remove_markers_init();
align_init();
......@@ -165,6 +168,40 @@ function marker_size_color_init(){
}
function clipping_planes_init(){
$('#clipnear').on('change',function(e){
SETTINGS.clipnear = $(this).val();
if ($("#clipnear_cp")!==undefined){
var dist = $("#clipnear_cp").attr("plane");
if (dist!==undefined){
var vals = dist.split(",");
$("#clipnear_cp").attr("plane",[vals[0],vals[1],vals[2],-SETTINGS.clipnear].join(","));
}
}
});
$('#clipnear').change();
$('#clipfar').on('change',function(e)
{
SETTINGS.clipfar = $(this).val();
if ($("#clipfar_cp")!==undefined){
var dist = $("#clipfar_cp").attr("plane");
if (dist!==undefined){
var vals = dist.split(",");
$("#clipfar_cp").attr("plane",[vals[0],vals[1],vals[2],SETTINGS.clipfar].join(","));
}
}
});
$('#clipfar').change();
}
function reset_view_init(){
$("#reset_view").on('click',function(){
......
......@@ -171,6 +171,14 @@ Instructions:
<td>3D marker color</td>
<td><input id='markercolor' type='text' class='input donothide' /></td>
</tr>
<tr>
<td>Clipping plane near, m</td>
<td><input id='clipnear' type='text' class='input donothide' /></td>
</tr>
<tr>
<td>Clipping plane far, m</td>
<td><input id='clipfar' type='text' class='input donothide' /></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment