rem
stringlengths
0
126k
add
stringlengths
0
441k
context
stringlengths
15
136k
var yuiRTE = rteEditors[control.id]; yuiRTE.set("disabled", ! isRelevant);
if (ORBEON.util.Dom.hasClass(control, "xforms-group-begin-end")) { var parentDisabled = false; if (isRelevant) { var depth = 0; var current = control; while (true) { current = YAHOO.util.Dom.getPreviousSibling(current); if (current == null) break; if (YAHOO.util.Dom.hasClass(current, "xforms-group-begin-end")) { if (current.id.indexOf("group-end") == 0) depth++; if (current.id.indexOf("group-begin") == 0) { depth--; if (depth < 0 && YAHOO.util.Dom.hasClass(current, "xforms-disabled")) { parentDisabled = true; break; } } } } } if (isRelevant) ORBEON.util.Dom.removeClass(control, "xforms-disabled"); else ORBEON.util.Dom.addClass(control, "xforms-disabled"); if (!(isRelevant && parentDisabled)) { var depth = 1; var disabledChildrenDepth = 0; var current = control; while (true) { current = YAHOO.util.Dom.getNextSibling(current); if (current == null) break; if (YAHOO.util.Dom.hasClass(current, "xforms-group-begin-end")) { if (current.id.indexOf("group-begin") == 0) { depth++; if (YAHOO.util.Dom.hasClass(current, "xforms-disabled") || disabledChildrenDepth > 0) disabledChildrenDepth++; } else if (current.id.indexOf("group-end") == 0) { depth--; if (depth == 0) break; if (disabledChildrenDepth > 0) disabledChildrenDepth--; } } else { if (isRelevant && disabledChildrenDepth == 0) { ORBEON.util.Dom.removeClass(current, "xforms-disabled"); ORBEON.util.Dom.removeClass(current, "xforms-disabled-subsequent"); ORBEON.util.Dom.nudgeAferDelay(current); } if (!isRelevant) { ORBEON.util.Dom.addClass(current, "xforms-disabled-subsequent"); } } } } } else { var elementsToUpdate = [ control, ORBEON.xforms.Controls._getControlLHHA(control, "label"), ORBEON.xforms.Controls._getControlLHHA(control, "alert") ]; if (!isRelevant || (isRelevant && ORBEON.xforms.Controls.getHelpMessage(control) != "")) { elementsToUpdate.push(ORBEON.xforms.Controls._getControlLHHA(control, "help")); elementsToUpdate.push(ORBEON.xforms.Controls._getControlLHHA(control, "help-image")); } if (!isRelevant || (isRelevant && ORBEON.xforms.Controls.getHintMessage(control) != "")) elementsToUpdate.push(ORBEON.xforms.Controls._getControlLHHA(control, "hint")); for (var elementIndex = 0; elementIndex < elementsToUpdate.length; elementIndex++) { var element = elementsToUpdate[elementIndex]; if (element != null) { if (isRelevant) { ORBEON.util.Dom.removeClass(element, "xforms-disabled"); ORBEON.util.Dom.removeClass(element, "xforms-disabled-subsequent"); ORBEON.util.Dom.nudgeAferDelay(element); } else { ORBEON.util.Dom.addClass(element, "xforms-disabled-subsequent"); } } } var formFieldDisabled = ! isRelevant || ORBEON.xforms.Controls.isReadonly(control); function handleFormElement(element) { var tagName = element.tagName.toLowerCase(); if (tagName == "input" || tagName == "textarea" || tagName == "select" || tagName == "button") ORBEON.xforms.Controls.setDisabledOnFormElement(element, formFieldDisabled); return false; } handleFormElement(control); YAHOO.util.Dom.getElementsBy(handleFormElement, null, control);
setRelevant: function(control, isRelevant) { var yuiRTE = rteEditors[control.id]; yuiRTE.set("disabled", ! isRelevant); }
},
setRelevant: function(control, isRelevant) { var yuiRTE = rteEditors[control.id]; yuiRTE.set("disabled", ! isRelevant); }
if (!preventEvent)
if (!preventEvent && selectionIsSane())
function setSelection(ranges, preventEvent) { var axis, range, axes = plot.getAxes(); var o = plot.getOptions(); if (o.selection.mode == "y") { selection.first.x = 0; selection.second.x = plot.width(); } else { axis = ranges["xaxis"]? axes["xaxis"]: (ranges["x2axis"]? axes["x2axis"]: axes["xaxis"]); range = ranges["xaxis"] || ranges["x2axis"] || { from:ranges["x1"], to:ranges["x2"] } selection.first.x = axis.p2c(Math.min(range.from, range.to)); selection.second.x = axis.p2c(Math.max(range.from, range.to)); } if (o.selection.mode == "x") { selection.first.y = 0; selection.second.y = plot.height(); } else { axis = ranges["yaxis"]? axes["yaxis"]: (ranges["y2axis"]? axes["y2axis"]: axes["yaxis"]); range = ranges["yaxis"] || ranges["y2axis"] || { from:ranges["y1"], to:ranges["y2"] } selection.first.y = axis.p2c(Math.min(range.from, range.to)); selection.second.y = axis.p2c(Math.max(range.from, range.to)); } selection.show = true; plot.triggerRedrawOverlay(); if (!preventEvent) triggerSelectedEvent(); }
var oticks = axis.options.ticks, ticks = null;
var oticks = axis.options.ticks, ticks = [];
function setTicks(axis) { axis.ticks = []; var oticks = axis.options.ticks, ticks = null; if (oticks == null || (typeof oticks == "number" && oticks > 0)) ticks = axis.tickGenerator(axis); else if (oticks) { if ($.isFunction(oticks)) // generate the ticks ticks = oticks({ min: axis.min, max: axis.max }); else ticks = oticks; } // clean up/labelify the supplied ticks, copy them over var i, v; for (i = 0; i < ticks.length; ++i) { var label = null; var t = ticks[i]; if (typeof t == "object") { v = t[0]; if (t.length > 1) label = t[1]; } else v = t; if (label == null) label = axis.tickFormatter(v, axis); axis.ticks[i] = { v: v, label: label }; } }
if (this._type && this._type != type) { throw new Error("Attempting to set type " + type + "for item that already has type" + this._type); }
this.setType = function(type) { if (this._type && this._type != type) { throw new Error("Attempting to set type " + type + "for item that already has type" + this._type); } this._type = type; }
{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
var va=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},wa=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?wa:va,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?wa:va)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!== "form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length){a.liveFired=B;return la("submit",this,arguments)}});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13){a.liveFired=B;return la("submit",this,arguments)}})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};if(!c.support.changeBubbles){var V,
{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
var maxOutset = options.grid.borderWidth;
var maxOutset = 0;
function setupGrid() { var axes = getUsedAxes(), j, k; // compute axis intervals for (k = 0; k < axes.length; ++k) setRange(axes[k]); plotOffset.left = plotOffset.right = plotOffset.top = plotOffset.bottom = 0; if (options.grid.show) { // make the ticks for (k = 0; k < axes.length; ++k) { setupTickGeneration(axes[k]); setTicks(axes[k]); snapRangeToTicks(axes[k], axes[k].ticks); } // find labelWidth/Height, do this on all, not just // used as we might need to reserve space for unused // too if their labelWidth/Height is set for (j = 0; j < xaxes.length; ++j) measureTickLabels(xaxes[j]); for (j = 0; j < yaxes.length; ++j) measureTickLabels(yaxes[j]); // compute the axis boxes, start from the outside (reverse order) for (j = xaxes.length - 1; j >= 0; --j) computeAxisBox(xaxes[j]); for (j = yaxes.length - 1; j >= 0; --j) computeAxisBox(yaxes[j]); // make sure we've got enough space for things that // might stick out var maxOutset = options.grid.borderWidth; for (var i = 0; i < series.length; ++i) maxOutset = Math.max(maxOutset, 2 * (series[i].points.radius + series[i].points.lineWidth/2)); for (var a in plotOffset) plotOffset[a] = Math.max(maxOutset, plotOffset[a]); } plotWidth = canvasWidth - plotOffset.left - plotOffset.right; plotHeight = canvasHeight - plotOffset.bottom - plotOffset.top; // now we got the proper plotWidth/Height, we can compute the scaling for (k = 0; k < axes.length; ++k) setTransformationHelpers(axes[k]); if (options.grid.show) { for (k = 0; k < axes.length; ++k) fixupAxisBox(axes[k]); insertAxisLabels(); } insertLegend(); }
for (var a in plotOffset)
for (var a in plotOffset) { plotOffset[a] += options.grid.borderWidth;
function setupGrid() { var axes = getUsedAxes(), j, k; // compute axis intervals for (k = 0; k < axes.length; ++k) setRange(axes[k]); plotOffset.left = plotOffset.right = plotOffset.top = plotOffset.bottom = 0; if (options.grid.show) { // make the ticks for (k = 0; k < axes.length; ++k) { setupTickGeneration(axes[k]); setTicks(axes[k]); snapRangeToTicks(axes[k], axes[k].ticks); } // find labelWidth/Height, do this on all, not just // used as we might need to reserve space for unused // too if their labelWidth/Height is set for (j = 0; j < xaxes.length; ++j) measureTickLabels(xaxes[j]); for (j = 0; j < yaxes.length; ++j) measureTickLabels(yaxes[j]); // compute the axis boxes, start from the outside (reverse order) for (j = xaxes.length - 1; j >= 0; --j) computeAxisBox(xaxes[j]); for (j = yaxes.length - 1; j >= 0; --j) computeAxisBox(yaxes[j]); // make sure we've got enough space for things that // might stick out var maxOutset = options.grid.borderWidth; for (var i = 0; i < series.length; ++i) maxOutset = Math.max(maxOutset, 2 * (series[i].points.radius + series[i].points.lineWidth/2)); for (var a in plotOffset) plotOffset[a] = Math.max(maxOutset, plotOffset[a]); } plotWidth = canvasWidth - plotOffset.left - plotOffset.right; plotHeight = canvasHeight - plotOffset.bottom - plotOffset.top; // now we got the proper plotWidth/Height, we can compute the scaling for (k = 0; k < axes.length; ++k) setTransformationHelpers(axes[k]); if (options.grid.show) { for (k = 0; k < axes.length; ++k) fixupAxisBox(axes[k]); insertAxisLabels(); } insertLegend(); }
var isVisited = ORBEON.util.Dom.hasClass(control, "xforms-visited");
var isVisited = YAHOO.util.Dom.hasClass(control, "xforms-visited");
setValid: function(control, newValid) { // Update class xforms-invalid on the control var isValid; var isVisited = ORBEON.util.Dom.hasClass(control, "xforms-visited"); if (newValid != null) { isValid = newValid != "false"; if (isValid) { ORBEON.util.Dom.removeClass(control, "xforms-invalid"); ORBEON.util.Dom.removeClass(control, "xforms-invalid-visited"); } else { ORBEON.util.Dom.addClass(control, "xforms-invalid"); if (isVisited) ORBEON.util.Dom.addClass(control, "xforms-invalid-visited"); } } else { isValid = ORBEON.xforms.Controls.isValid(control); } // Update class on alert element var alertElement = ORBEON.xforms.Controls._getControlLHHA(control, "alert"); if (alertElement != null) { // Some controls don't have an alert if (isValid) { ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-active"); ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-active-visited"); ORBEON.util.Dom.addClass(alertElement, "xforms-alert-inactive"); } else { ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-inactive"); ORBEON.util.Dom.addClass(alertElement, "xforms-alert-active"); if (isVisited) ORBEON.util.Dom.addClass(alertElement, "xforms-alert-active-visited"); } } // If the control is now valid and there is an alert tooltip for this control, get rid of it var alertTooltip = ORBEON.xforms.Globals.alertTooltipForControl[control.id]; if (alertTooltip != null && alertTooltip != true) { if (isValid) { // Prevent the tooltip from becoming visible on mouseover alertTooltip.cfg.setProperty("disabled", true); // If visible, hide the tooltip right away, otherwise it will only be hidden a few seconds later alertTooltip.hide(); } else { // When a control becomes invalid and it always has a tooltip, this means that the tooltip got disabled // when the control previously became valid, so now re-enable it alertTooltip.cfg.setProperty("disabled", false); } } },
ORBEON.util.Dom.removeClass(control, "xforms-invalid"); ORBEON.util.Dom.removeClass(control, "xforms-invalid-visited");
YAHOO.util.Dom.removeClass(control, "xforms-invalid"); YAHOO.util.Dom.removeClass(control, "xforms-invalid-visited");
setValid: function(control, newValid) { // Update class xforms-invalid on the control var isValid; var isVisited = ORBEON.util.Dom.hasClass(control, "xforms-visited"); if (newValid != null) { isValid = newValid != "false"; if (isValid) { ORBEON.util.Dom.removeClass(control, "xforms-invalid"); ORBEON.util.Dom.removeClass(control, "xforms-invalid-visited"); } else { ORBEON.util.Dom.addClass(control, "xforms-invalid"); if (isVisited) ORBEON.util.Dom.addClass(control, "xforms-invalid-visited"); } } else { isValid = ORBEON.xforms.Controls.isValid(control); } // Update class on alert element var alertElement = ORBEON.xforms.Controls._getControlLHHA(control, "alert"); if (alertElement != null) { // Some controls don't have an alert if (isValid) { ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-active"); ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-active-visited"); ORBEON.util.Dom.addClass(alertElement, "xforms-alert-inactive"); } else { ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-inactive"); ORBEON.util.Dom.addClass(alertElement, "xforms-alert-active"); if (isVisited) ORBEON.util.Dom.addClass(alertElement, "xforms-alert-active-visited"); } } // If the control is now valid and there is an alert tooltip for this control, get rid of it var alertTooltip = ORBEON.xforms.Globals.alertTooltipForControl[control.id]; if (alertTooltip != null && alertTooltip != true) { if (isValid) { // Prevent the tooltip from becoming visible on mouseover alertTooltip.cfg.setProperty("disabled", true); // If visible, hide the tooltip right away, otherwise it will only be hidden a few seconds later alertTooltip.hide(); } else { // When a control becomes invalid and it always has a tooltip, this means that the tooltip got disabled // when the control previously became valid, so now re-enable it alertTooltip.cfg.setProperty("disabled", false); } } },
ORBEON.util.Dom.addClass(control, "xforms-invalid"); if (isVisited) ORBEON.util.Dom.addClass(control, "xforms-invalid-visited");
YAHOO.util.Dom.addClass(control, "xforms-invalid"); if (isVisited) YAHOO.util.Dom.addClass(control, "xforms-invalid-visited");
setValid: function(control, newValid) { // Update class xforms-invalid on the control var isValid; var isVisited = ORBEON.util.Dom.hasClass(control, "xforms-visited"); if (newValid != null) { isValid = newValid != "false"; if (isValid) { ORBEON.util.Dom.removeClass(control, "xforms-invalid"); ORBEON.util.Dom.removeClass(control, "xforms-invalid-visited"); } else { ORBEON.util.Dom.addClass(control, "xforms-invalid"); if (isVisited) ORBEON.util.Dom.addClass(control, "xforms-invalid-visited"); } } else { isValid = ORBEON.xforms.Controls.isValid(control); } // Update class on alert element var alertElement = ORBEON.xforms.Controls._getControlLHHA(control, "alert"); if (alertElement != null) { // Some controls don't have an alert if (isValid) { ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-active"); ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-active-visited"); ORBEON.util.Dom.addClass(alertElement, "xforms-alert-inactive"); } else { ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-inactive"); ORBEON.util.Dom.addClass(alertElement, "xforms-alert-active"); if (isVisited) ORBEON.util.Dom.addClass(alertElement, "xforms-alert-active-visited"); } } // If the control is now valid and there is an alert tooltip for this control, get rid of it var alertTooltip = ORBEON.xforms.Globals.alertTooltipForControl[control.id]; if (alertTooltip != null && alertTooltip != true) { if (isValid) { // Prevent the tooltip from becoming visible on mouseover alertTooltip.cfg.setProperty("disabled", true); // If visible, hide the tooltip right away, otherwise it will only be hidden a few seconds later alertTooltip.hide(); } else { // When a control becomes invalid and it always has a tooltip, this means that the tooltip got disabled // when the control previously became valid, so now re-enable it alertTooltip.cfg.setProperty("disabled", false); } } },
ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-active"); ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-active-visited"); ORBEON.util.Dom.addClass(alertElement, "xforms-alert-inactive");
YAHOO.util.Dom.removeClass(alertElement, "xforms-alert-active"); YAHOO.util.Dom.removeClass(alertElement, "xforms-alert-active-visited"); YAHOO.util.Dom.addClass(alertElement, "xforms-alert-inactive");
setValid: function(control, newValid) { // Update class xforms-invalid on the control var isValid; var isVisited = ORBEON.util.Dom.hasClass(control, "xforms-visited"); if (newValid != null) { isValid = newValid != "false"; if (isValid) { ORBEON.util.Dom.removeClass(control, "xforms-invalid"); ORBEON.util.Dom.removeClass(control, "xforms-invalid-visited"); } else { ORBEON.util.Dom.addClass(control, "xforms-invalid"); if (isVisited) ORBEON.util.Dom.addClass(control, "xforms-invalid-visited"); } } else { isValid = ORBEON.xforms.Controls.isValid(control); } // Update class on alert element var alertElement = ORBEON.xforms.Controls._getControlLHHA(control, "alert"); if (alertElement != null) { // Some controls don't have an alert if (isValid) { ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-active"); ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-active-visited"); ORBEON.util.Dom.addClass(alertElement, "xforms-alert-inactive"); } else { ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-inactive"); ORBEON.util.Dom.addClass(alertElement, "xforms-alert-active"); if (isVisited) ORBEON.util.Dom.addClass(alertElement, "xforms-alert-active-visited"); } } // If the control is now valid and there is an alert tooltip for this control, get rid of it var alertTooltip = ORBEON.xforms.Globals.alertTooltipForControl[control.id]; if (alertTooltip != null && alertTooltip != true) { if (isValid) { // Prevent the tooltip from becoming visible on mouseover alertTooltip.cfg.setProperty("disabled", true); // If visible, hide the tooltip right away, otherwise it will only be hidden a few seconds later alertTooltip.hide(); } else { // When a control becomes invalid and it always has a tooltip, this means that the tooltip got disabled // when the control previously became valid, so now re-enable it alertTooltip.cfg.setProperty("disabled", false); } } },
ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-inactive"); ORBEON.util.Dom.addClass(alertElement, "xforms-alert-active"); if (isVisited) ORBEON.util.Dom.addClass(alertElement, "xforms-alert-active-visited");
YAHOO.util.Dom.removeClass(alertElement, "xforms-alert-inactive"); YAHOO.util.Dom.addClass(alertElement, "xforms-alert-active"); if (isVisited) YAHOO.util.Dom.addClass(alertElement, "xforms-alert-active-visited");
setValid: function(control, newValid) { // Update class xforms-invalid on the control var isValid; var isVisited = ORBEON.util.Dom.hasClass(control, "xforms-visited"); if (newValid != null) { isValid = newValid != "false"; if (isValid) { ORBEON.util.Dom.removeClass(control, "xforms-invalid"); ORBEON.util.Dom.removeClass(control, "xforms-invalid-visited"); } else { ORBEON.util.Dom.addClass(control, "xforms-invalid"); if (isVisited) ORBEON.util.Dom.addClass(control, "xforms-invalid-visited"); } } else { isValid = ORBEON.xforms.Controls.isValid(control); } // Update class on alert element var alertElement = ORBEON.xforms.Controls._getControlLHHA(control, "alert"); if (alertElement != null) { // Some controls don't have an alert if (isValid) { ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-active"); ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-active-visited"); ORBEON.util.Dom.addClass(alertElement, "xforms-alert-inactive"); } else { ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-inactive"); ORBEON.util.Dom.addClass(alertElement, "xforms-alert-active"); if (isVisited) ORBEON.util.Dom.addClass(alertElement, "xforms-alert-active-visited"); } } // If the control is now valid and there is an alert tooltip for this control, get rid of it var alertTooltip = ORBEON.xforms.Globals.alertTooltipForControl[control.id]; if (alertTooltip != null && alertTooltip != true) { if (isValid) { // Prevent the tooltip from becoming visible on mouseover alertTooltip.cfg.setProperty("disabled", true); // If visible, hide the tooltip right away, otherwise it will only be hidden a few seconds later alertTooltip.hide(); } else { // When a control becomes invalid and it always has a tooltip, this means that the tooltip got disabled // when the control previously became valid, so now re-enable it alertTooltip.cfg.setProperty("disabled", false); } } },
if (newValid && alertTooltip != null && alertTooltip != true) alertTooltip.destroy(); ORBEON.xforms.Globals.alertTooltipForControl[control.id] = null;
if (alertTooltip != null && alertTooltip != true) { if (isValid) { alertTooltip.cfg.setProperty("disabled", true); alertTooltip.hide(); } else { alertTooltip.cfg.setProperty("disabled", false); } }
setValid: function(control, newValid) { // Update class xforms-invalid on the control var isValid; var isVisited = ORBEON.util.Dom.hasClass(control, "xforms-visited"); if (newValid != null) { isValid = newValid != "false"; if (isValid) { ORBEON.util.Dom.removeClass(control, "xforms-invalid"); ORBEON.util.Dom.removeClass(control, "xforms-invalid-visited"); } else { ORBEON.util.Dom.addClass(control, "xforms-invalid"); if (isVisited) ORBEON.util.Dom.addClass(control, "xforms-invalid-visited"); } } else { isValid = ORBEON.xforms.Controls.isValid(control); } // Update class on alert element var alertElement = ORBEON.xforms.Controls._getControlLHHA(control, "alert"); if (alertElement != null) { // Some controls don't have an alert if (isValid) { ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-active"); ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-active-visited"); ORBEON.util.Dom.addClass(alertElement, "xforms-alert-inactive"); } else { ORBEON.util.Dom.removeClass(alertElement, "xforms-alert-inactive"); ORBEON.util.Dom.addClass(alertElement, "xforms-alert-active"); if (isVisited) ORBEON.util.Dom.addClass(alertElement, "xforms-alert-active-visited"); } } // If the control is now valid and there is an alert tooltip for this control, destroy it var alertTooltip = ORBEON.xforms.Globals.alertTooltipForControl[control.id]; if (newValid && alertTooltip != null && alertTooltip != true) alertTooltip.destroy(); ORBEON.xforms.Globals.alertTooltipForControl[control.id] = null; },
if (! ORBEON.util.Dom.hasClass(control, "xforms-incremental") || ORBEON.xforms.Globals.currentFocusControlId != control.id) {
if (! YAHOO.util.Dom.hasClass(control, "xforms-incremental") || ORBEON.xforms.Globals.currentFocusControlId != control.id) {
setValue: function(control, newValue) { // Don't update the textarea with HTML from the server while the user is typing, otherwise the user // loses their cursor position. This lets us have a certain level of support for incremental rich text areas, // however, ignoring server values means that the visual state of the RTE can become out of sync // with the server value (for example, the result of a calculation wouldn't be visible until focus moved // out of the field). if (! ORBEON.util.Dom.hasClass(control, "xforms-incremental") || ORBEON.xforms.Globals.currentFocusControlId != control.id) { var yuiRTE = rteEditors[control.id]; yuiRTE.setEditorHTML(newValue); } },
var footerMessage = ""; if (onBerlinDe) { footerMessage = '<b><a href="http: + 'is powered by <a href="http: } else { footerMessage = '<b><a href="http: + 'are powered by <a href="http: }
function setWorkspaceInfos() { if (workspaceInfos == null) { // ### Improve Exception Handling alert("Sorry. The workspace you tried to access is not properly configured by the administrator."); } else { var footer = '<span id="footerImprint"><a href="'+workspaceInfos.imprint+'">Impressum / Haftungshinweise</a></span>'; footer += '<span id="footerPoweredBy">'+footerMessage+'</span>'; jQuery("#kafooter").html(footer); jQuery("#sideBarLogo").attr('src', ''+IMAGES_URL+workspaceInfos.logo+''); jQuery("#sideBarLogo").attr('title', ''+workspaceInfos.name+''); jQuery("#sideBarLogo").attr('alt', ''+workspaceInfos.name+' Logo'); jQuery("#sideBarLogoLink").attr('href', workspaceInfos.homepage); log("set sideBar to: " + jQuery("#sideBarLogo").attr('src') + " and logo is: " + jQuery("#sideBarLogo").attr('title')); } }
if (workspaceInfos == null) { alert("Sorry. The workspace you tried to access is not properly configured by the administrator."); } else { var footer = '<span id="footerImprint"><a href="'+workspaceInfos.imprint+'">Impressum / Haftungshinweise</a></span>'; footer += '<span id="footerPoweredBy">'+footerMessage+'</span>'; jQuery("#kafooter").html(footer); jQuery("#sideBarLogo").attr('src', ''+IMAGES_URL+workspaceInfos.logo+''); jQuery("#sideBarLogo").attr('title', ''+workspaceInfos.name+''); jQuery("#sideBarLogo").attr('alt', ''+workspaceInfos.name+' Logo'); jQuery("#sideBarLogoLink").attr('href', workspaceInfos.homepage); log("set sideBar to: " + jQuery("#sideBarLogo").attr('src') + " and logo is: " + jQuery("#sideBarLogo").attr('title')); }
var footer = '<span id="footerImprint"><a href="'+workspaceImprint+'">Impressum / Haftungshinweise</a></span>'; footer += '<span id="footerPoweredBy">'+footerMessage+'</span>'; jQuery("#kafooter").html(footer); jQuery("#sideBarLogo").attr('src', '' + IMAGES_URL + workspaceLogo); jQuery("#sideBarLogo").attr('title', 'A KiezAtlas 1.7 Logo'); jQuery("#sideBarLogo").attr('alt', mapTitle + ' Logo'); jQuery("#sideBarLogoLink").attr('href', workspaceHomepage); if (debug) log("set sideBar to: " + jQuery("#sideBarLogo").attr('src') + " and logo is: " + jQuery("#sideBarLogo").attr('title'));
function setWorkspaceInfos() { var footerMessage = ""; if (onBerlinDe) { footerMessage = '<b><a href="http://www.kiezatlas.de">Kiezatlas</a></b> ' + 'is powered by <a href="http://www.deepamehta.de">DeepaMehta</a>'; } else { footerMessage = '<b><a href="http://www.kiezatlas.de">Kiezatlas <i>Labs</i></a></b> ' + 'are powered by <a href="http://www.deepamehta.de">DeepaMehta</a>'; } if (workspaceInfos == null) { // ### Improve Exception Handling alert("Sorry. The workspace you tried to access is not properly configured by the administrator."); } else { var footer = '<span id="footerImprint"><a href="'+workspaceInfos.imprint+'">Impressum / Haftungshinweise</a></span>'; footer += '<span id="footerPoweredBy">'+footerMessage+'</span>'; jQuery("#kafooter").html(footer); jQuery("#sideBarLogo").attr('src', ''+IMAGES_URL+workspaceInfos.logo+''); jQuery("#sideBarLogo").attr('title', ''+workspaceInfos.name+''); jQuery("#sideBarLogo").attr('alt', ''+workspaceInfos.name+' Logo'); jQuery("#sideBarLogoLink").attr('href', workspaceInfos.homepage); log("set sideBar to: " + jQuery("#sideBarLogo").attr('src') + " and logo is: " + jQuery("#sideBarLogo").attr('title')); } }
this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); }
this.shipLaunchedFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); }
this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); }
this.shipLaunchedFromStation = function () { performCleanUp(); }
this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); }
this.shipLaunchedFromStation = function () { performCleanUp(); }
shouldNotThrow: function (func, args, this_context) {
shouldNotThrow: function (func, args, this_context, callback) {
shouldNotThrow: function (func, args, this_context) { try { func.apply(this_context, args); } catch (e) { throw new AssertFailedException('Caught <' + e + '>'); } },
throw new AssertFailedException('Caught <' + e + '>');
var exception = new AssertFailedException('Caught <' + e + '>'); if (callback) { callback(exception); } else { throw exception; }
shouldNotThrow: function (func, args, this_context) { try { func.apply(this_context, args); } catch (e) { throw new AssertFailedException('Caught <' + e + '>'); } },
shouldThrow: function (func, args, this_context) {
shouldThrow: function (func, args, this_context, callback) {
shouldThrow: function (func, args, this_context) { try { func.apply(this_context, args); } catch (e) { return; } throw new AssertFailedException('No exception was thrown'); },
return;
var passed = true;
shouldThrow: function (func, args, this_context) { try { func.apply(this_context, args); } catch (e) { return; } throw new AssertFailedException('No exception was thrown'); },
throw new AssertFailedException('No exception was thrown');
if (!passed) { var exception = new AssertFailedException('No exception was thrown'); if (callback) { callback(exception); } else { throw exception; } }
shouldThrow: function (func, args, this_context) { try { func.apply(this_context, args); } catch (e) { return; } throw new AssertFailedException('No exception was thrown'); },
Popup.get_popup().slideDown(500);
Popup.get_popup().show();
show: function() { Popup.get_popup().slideDown(500); },
c.css({position:"relative",top:0,left:0})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments);a={options:a[1],duration:a[2],callback:a[3]};var b=f.effects[c];return b&&!f.fx.off?b.call(this,a):this},_show:f.fn.show,show:function(c){if(!c|| typeof c=="number"||f.fx.speeds[c])return this._show.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(!c||typeof c=="number"||f.fx.speeds[c])return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(!c||typeof c=="number"||f.fx.speeds[c]||typeof c=="boolean"||f.isFunction(c))return this.__toggle.apply(this,
k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(l(c))return this._show.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(l(c))return this._hide.apply(this,arguments);else{var a=
c.css({position:"relative",top:0,left:0})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments);a={options:a[1],duration:a[2],callback:a[3]};var b=f.effects[c];return b&&!f.fx.off?b.call(this,a):this},_show:f.fn.show,show:function(c){if(!c||typeof c=="number"||f.fx.speeds[c])return this._show.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(!c||typeof c=="number"||f.fx.speeds[c])return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(!c||typeof c=="number"||f.fx.speeds[c]||typeof c=="boolean"||f.isFunction(c))return this.__toggle.apply(this,
this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;e.elem=this.elem;if(e()&&c.timers.push(e)&&!ba)ba=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;
this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
if (itemView instanceof browser.ItemReferenceView) {
if (itemView instanceof browser.views.ItemReferenceView) {
this.showAt = function(itemView, preventLayout) { if (this._focusedItem) { this._focusedItem.unsubscribe(this._layoutHandler); } this._focusedView = itemView; this._focusedView.subscribe('Resize', bind(this, '_layoutHandler')); if (!preventLayout) { this.getElement(); // to force createContent this.layout(); this.appendTo(document.body); } if (itemView instanceof browser.ItemReferenceView) { this._element.className = 'ItemFocus onReferenceItemView'; } else if (itemView instanceof browser.ItemValueView) { this._element.className = 'ItemFocus onValueItemView'; } else { this._element.className = 'ItemFocus'; } }
} else if (itemView instanceof browser.ItemValueView) {
} else if (itemView instanceof browser.views.ItemValueView) {
this.showAt = function(itemView, preventLayout) { if (this._focusedItem) { this._focusedItem.unsubscribe(this._layoutHandler); } this._focusedView = itemView; this._focusedView.subscribe('Resize', bind(this, '_layoutHandler')); if (!preventLayout) { this.getElement(); // to force createContent this.layout(); this.appendTo(document.body); } if (itemView instanceof browser.ItemReferenceView) { this._element.className = 'ItemFocus onReferenceItemView'; } else if (itemView instanceof browser.ItemValueView) { this._element.className = 'ItemFocus onValueItemView'; } else { this._element.className = 'ItemFocus'; } }
function showCal(id,dateField)
function showCal(id,dateField,dateFormat)
function showCal(id,dateField){ var x = document.getElementById(id); x.innerHTML = ''; var dp = new Ext.DatePicker({ renderTo:id, format:"m/d/y", idField:dateField }); //get the element var el = document.getElementById(dateField); if(el.value != "") { selectedDate = new Date(el.value); if (isNaN(selectedDate.getTime())) { selectedDate = ''; el.value = ''; } else dp.setValue(selectedDate); } dp.addListener("select", onSelect);}
var dp = new Ext.DatePicker({ renderTo:id, format:"m/d/y", idField:dateField });
var dp = new Ext.DatePicker({ renderTo:id, format:dateFormat, idField:dateField });
function showCal(id,dateField){ var x = document.getElementById(id); x.innerHTML = ''; var dp = new Ext.DatePicker({ renderTo:id, format:"m/d/y", idField:dateField }); //get the element var el = document.getElementById(dateField); if(el.value != "") { selectedDate = new Date(el.value); if (isNaN(selectedDate.getTime())) { selectedDate = ''; el.value = ''; } else dp.setValue(selectedDate); } dp.addListener("select", onSelect);}
selectedDate = new Date(el.value);
splitChar = "."; if (el.value.indexOf("-") != -1) { splitChar = "-"; } if (el.value.indexOf("/") != -1) { splitChar = "/"; } var splitDate = el.value.split(splitChar); var year = null; var month = null; var day = null; dateFormat = dateFormat.replace(splitChar, ""); dateFormat = dateFormat.replace(splitChar, ""); for(i=0; i < dateFormat.length; i++) { switch (dateFormat.charAt(i)) { case "Y": year = splitDate[i]; break; case "m": month = splitDate[i]; break; case "d": day = splitDate[i]; break; } } selectedDate = new Date(year,(month-1),day);
function showCal(id,dateField){ var x = document.getElementById(id); x.innerHTML = ''; var dp = new Ext.DatePicker({ renderTo:id, format:"m/d/y", idField:dateField }); //get the element var el = document.getElementById(dateField); if(el.value != "") { selectedDate = new Date(el.value); if (isNaN(selectedDate.getTime())) { selectedDate = ''; el.value = ''; } else dp.setValue(selectedDate); } dp.addListener("select", onSelect);}
ORBEON.util.Dom.removeClass(divElement, "xforms-initially-hidden");
YAHOO.util.Dom.removeClass(divElement, "xforms-initially-hidden");
showDialog: function(controlId, neighbor) { var divElement = YAHOO.util.Dom.get(controlId); var yuiDialog = ORBEON.xforms.Globals.dialogs[controlId]; // Take out the focus from the current control. This is particularly important with non-modal dialogs // opened with a minimal trigger, otherwise we have a dotted line around the link after it opens. if (ORBEON.xforms.Globals.currentFocusControlId != null) { var focusedElement = YAHOO.util.Dom.get(ORBEON.xforms.Globals.currentFocusControlId); if (focusedElement != null) focusedElement.blur(); } // Render the dialog if needed if (YAHOO.util.Dom.hasClass(divElement, "xforms-initially-hidden")) { ORBEON.util.Dom.removeClass(divElement, "xforms-initially-hidden"); yuiDialog.render(); } // Reapply those classes. Those are classes added by YUI when creating the dialog, but they are then removed // by YUI if you close the dialog using the "X". So when opening the dialog, we add those again, just to make sure. // A better way to handle this would be to create the YUI dialog every time when we open it, instead of doing this // during initialization. ORBEON.util.Dom.addClass(yuiDialog.innerElement, "yui-module"); ORBEON.util.Dom.addClass(yuiDialog.innerElement, "yui-overlay"); ORBEON.util.Dom.addClass(yuiDialog.innerElement, "yui-panel"); // Fixes cursor Firefox issue; more on this in dialog init code yuiDialog.element.style.display = "block"; // Show the dialog yuiDialog.show(); // Make sure that this dialog is on top of everything else yuiDialog.cfg.setProperty("zIndex", ORBEON.xforms.Globals.lastDialogZIndex++); // Position the dialog either at the center of the viewport or relative of a neighbor if (neighbor == null) { // Center dialog in page, if not positioned relative to other element yuiDialog.center(); } else { // Align dialog relative to neighbor yuiDialog.cfg.setProperty("context", [neighbor, "tl", "bl"]); yuiDialog.align(); } },
ORBEON.util.Dom.addClass(yuiDialog.innerElement, "yui-module"); ORBEON.util.Dom.addClass(yuiDialog.innerElement, "yui-overlay"); ORBEON.util.Dom.addClass(yuiDialog.innerElement, "yui-panel");
YAHOO.util.Dom.addClass(yuiDialog.innerElement, "yui-module"); YAHOO.util.Dom.addClass(yuiDialog.innerElement, "yui-overlay"); YAHOO.util.Dom.addClass(yuiDialog.innerElement, "yui-panel");
showDialog: function(controlId, neighbor) { var divElement = YAHOO.util.Dom.get(controlId); var yuiDialog = ORBEON.xforms.Globals.dialogs[controlId]; // Take out the focus from the current control. This is particularly important with non-modal dialogs // opened with a minimal trigger, otherwise we have a dotted line around the link after it opens. if (ORBEON.xforms.Globals.currentFocusControlId != null) { var focusedElement = YAHOO.util.Dom.get(ORBEON.xforms.Globals.currentFocusControlId); if (focusedElement != null) focusedElement.blur(); } // Render the dialog if needed if (YAHOO.util.Dom.hasClass(divElement, "xforms-initially-hidden")) { ORBEON.util.Dom.removeClass(divElement, "xforms-initially-hidden"); yuiDialog.render(); } // Reapply those classes. Those are classes added by YUI when creating the dialog, but they are then removed // by YUI if you close the dialog using the "X". So when opening the dialog, we add those again, just to make sure. // A better way to handle this would be to create the YUI dialog every time when we open it, instead of doing this // during initialization. ORBEON.util.Dom.addClass(yuiDialog.innerElement, "yui-module"); ORBEON.util.Dom.addClass(yuiDialog.innerElement, "yui-overlay"); ORBEON.util.Dom.addClass(yuiDialog.innerElement, "yui-panel"); // Fixes cursor Firefox issue; more on this in dialog init code yuiDialog.element.style.display = "block"; // Show the dialog yuiDialog.show(); // Make sure that this dialog is on top of everything else yuiDialog.cfg.setProperty("zIndex", ORBEON.xforms.Globals.lastDialogZIndex++); // Position the dialog either at the center of the viewport or relative of a neighbor if (neighbor == null) { // Center dialog in page, if not positioned relative to other element yuiDialog.center(); } else { // Align dialog relative to neighbor yuiDialog.cfg.setProperty("context", [neighbor, "tl", "bl"]); yuiDialog.align(); } },
if (YAHOO.util.Dom.hasClass(formErrorPanel.element, "xforms-initially-hidden")) { ORBEON.util.Dom.removeClass(formErrorPanel.element, "xforms-initially-hidden"); formErrorPanel.render(); }
showError: function(title, details, formID) { ORBEON.xforms.Events.errorEvent.fire({title: title, details: details }); if (!ORBEON.xforms.Globals.requestIgnoreErrors && ORBEON.util.Utils.getProperty(SHOW_ERROR_DIALOG_PROPERTY) == "true") { var formErrorPanel = ORBEON.xforms.Globals.formErrorPanel[formID]; if (formErrorPanel) { // Render the dialog if needed if (YAHOO.util.Dom.hasClass(formErrorPanel.element, "xforms-initially-hidden")) { ORBEON.util.Dom.removeClass(formErrorPanel.element, "xforms-initially-hidden"); formErrorPanel.render(); } formErrorPanel.element.style.display = "block"; formErrorPanel.errorTitleDiv.innerHTML = title; formErrorPanel.errorDetailsDiv.innerHTML = details; formErrorPanel.show(); formErrorPanel.center(); } } },
if (!ORBEON.xforms.Globals.requestIgnoreErrors && ORBEON.util.Properties.showErrorDialog.get() == "true") {
if (!ORBEON.xforms.Globals.requestIgnoreErrors && ORBEON.util.Properties.showErrorDialog.get()) {
showError: function(title, details, formID) { ORBEON.xforms.Events.errorEvent.fire({title: title, details: details }); if (!ORBEON.xforms.Globals.requestIgnoreErrors && ORBEON.util.Properties.showErrorDialog.get() == "true") { var formErrorPanel = ORBEON.xforms.Globals.formErrorPanel[formID]; if (formErrorPanel) { // Render the dialog if needed formErrorPanel.element.style.display = "block"; formErrorPanel.errorTitleDiv.innerHTML = title; formErrorPanel.errorDetailsDiv.innerHTML = details; formErrorPanel.show(); formErrorPanel.center(); } } },
document.getElementById('pe_preview').style.display = 'none';
var preview = document.getElementById('pe_preview'); if (preview) document.getElementById('pe_preview').style.display = 'none';
function showhideProfileEditorDiv(selected, selindex) { // Reset the current selected navbar tab var cnavbar = document.getElementById('current'); if (cnavbar) cnavbar.id = ''; // Cycle thru the navlist child elements - buiding an array of just the link items var navbar = document.getElementById('navlist'); var menuitems = new Array(7); var item = 0; for (var i=0 ;i < navbar.childNodes.length ; i++ ) { if (navbar.childNodes[i].nodeName.toLowerCase() == 'li') { menuitems[item] = navbar.childNodes[i]; item++; } } // Now that I have just the link items I can set the selected tab using the passed selected Item number // Set the <a tag to have an id called 'current' var menuitem = menuitems[selindex]; for (var j=0 ;j < menuitem.childNodes.length ; j++ ) { if (menuitem.childNodes[j].nodeName.toLowerCase() == 'a') menuitem.childNodes[j].id = 'current'; } // Reset or show all the main divs - editor tab sections // Object profilepanels defined in profile.thtml after page is generated for( var divid in profilepanels){ if (selected != divid) { document.getElementById(divid).style.display = 'none'; } else { document.getElementById(divid).style.display = ''; } } document.getElementById('pe_preview').style.display = 'none'; if (selected != 'pe_preview') { document.getElementById('save_button').style.display = ''; } else if (selected == 'pe_preview') { document.getElementById('pe_preview').style.display = ''; document.getElementById('save_button').style.display = 'none'; } else { document.getElementById('pe_preview').style.display = ''; document.getElementById('save_button').style.display = 'none'; }}
document.getElementById('pe_preview').style.display = '';
if (preview) document.getElementById('pe_preview').style.display = '';
function showhideProfileEditorDiv(selected, selindex) { // Reset the current selected navbar tab var cnavbar = document.getElementById('current'); if (cnavbar) cnavbar.id = ''; // Cycle thru the navlist child elements - buiding an array of just the link items var navbar = document.getElementById('navlist'); var menuitems = new Array(7); var item = 0; for (var i=0 ;i < navbar.childNodes.length ; i++ ) { if (navbar.childNodes[i].nodeName.toLowerCase() == 'li') { menuitems[item] = navbar.childNodes[i]; item++; } } // Now that I have just the link items I can set the selected tab using the passed selected Item number // Set the <a tag to have an id called 'current' var menuitem = menuitems[selindex]; for (var j=0 ;j < menuitem.childNodes.length ; j++ ) { if (menuitem.childNodes[j].nodeName.toLowerCase() == 'a') menuitem.childNodes[j].id = 'current'; } // Reset or show all the main divs - editor tab sections // Object profilepanels defined in profile.thtml after page is generated for( var divid in profilepanels){ if (selected != divid) { document.getElementById(divid).style.display = 'none'; } else { document.getElementById(divid).style.display = ''; } } document.getElementById('pe_preview').style.display = 'none'; if (selected != 'pe_preview') { document.getElementById('save_button').style.display = ''; } else if (selected == 'pe_preview') { document.getElementById('pe_preview').style.display = ''; document.getElementById('save_button').style.display = 'none'; } else { document.getElementById('pe_preview').style.display = ''; document.getElementById('save_button').style.display = 'none'; }}
this._focusIndex = this._addPanel(item);
this._addPanel(item);
this.showItem = function(item) { // debugger; if (this._panelsByItem[item]) { this.focusPanel(this._panelsByItem[item]); } else { this._blurFocusedPanel(); this._focusIndex = this._addPanel(item); this.focusPanel(this._panelsByIndex[this._focusIndex]); } }
jQuery("#progContainer").html('<b>' + progressVal + '</b><br/><img src="img/aLoading.gif" alt="Loading">');
jQuery("#progContainer").html('<b>' + progressVal + '</b><br/><img src="../pages/be.de/img/aLoading.gif" alt="Loading">');
function showProgressInSideBar(progressVal) { // sideBarControl /*showSideBar*/(305); // jQuery("#sideBarCategoriesTable").empty(); // '<a href="javascript:clearCriteriaSelection();">Auswahl aufheben</a>'); // sideContent jQuery("#progContainer").html('<b>' + progressVal + '</b><br/><img src="img/aLoading.gif" alt="Loading">'); jQuery("#progContainer").show('fast'); }
1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?
e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/<tbody/i,eb=/<|&#?\w+;/,Ca=/<(?:script|object|embed|option|style)/i,Da=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/\=([^="'>\s]+\/)>/g,P={option:[1,
1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?
a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length},
a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
(function(c){c.effects.slide=function(d){return this.queue(function(){var a=c(this),h=["position","top","left"],e=c.effects.setMode(a,d.options.mode||"show"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a).css({overflow:"hidden"});var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true}):a.outerWidth({margin:true}));if(e=="show")a.css(f,b=="pos"?-g:g);var i={};i[f]=(e=="show"?b=="pos"? "+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
{version:"1.8.2",animations:{slide:function(a,b){a=c.extend({easing:"swing",duration:300},a,b);if(a.toHide.size())if(a.toShow.size()){var d=a.toShow.css("overflow"),f=0,g={},e={},k;b=a.toShow;k=b[0].style.width;b.width(parseInt(b.parent().width(),10)-parseInt(b.css("paddingLeft"),10)-parseInt(b.css("paddingRight"),10)-(parseInt(b.css("borderLeftWidth"),10)||0)-(parseInt(b.css("borderRightWidth"),10)||0));c.each(["height","paddingTop","paddingBottom"],function(i,h){e[h]="hide";i=(""+c.css(a.toShow[0], h)).match(/^([\d+-.]+)(.*)$/);g[h]={value:i[1],unit:i[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(e,{step:function(i,h){if(h.prop=="height")f=h.end-h.start===0?0:(h.now-h.start)/(h.end-h.start);a.toShow[0].style[h.prop]=f*g[h.prop].value+g[h.prop].unit},duration:a.duration,easing:a.easing,complete:function(){a.autoHeight||a.toShow.css("height","");a.toShow.css("width",k);a.toShow.css({overflow:d});a.complete()}})}else a.toHide.animate({height:"hide"}, a);else a.toShow.animate({height:"show"},a)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery);
(function(c){c.effects.slide=function(d){return this.queue(function(){var a=c(this),h=["position","top","left"],e=c.effects.setMode(a,d.options.mode||"show"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a).css({overflow:"hidden"});var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true}):a.outerWidth({margin:true}));if(e=="show")a.css(f,b=="pos"?-g:g);var i={};i[f]=(e=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
if (axis.options.autoscaleMargin != null && ticks.length > 0) {
if (axis.options.autoscaleMargin && ticks.length > 0) {
function snapRangeToTicks(axis, ticks) { if (axis.options.autoscaleMargin != null && ticks.length > 0) { // snap to ticks if (axis.options.min == null) axis.min = Math.min(axis.min, ticks[0].v); if (axis.options.max == null && ticks.length > 1) axis.max = Math.max(axis.max, ticks[ticks.length - 1].v); } }
return utils.string.smart_split(this.contents);
return string_utils.smart_split(this.contents);
split_contents: function () { return utils.string.smart_split(this.contents); }
var start = function() {
var start = function(item) {
var start = function() { state = { item: $(this).parents(settings.items), min: null, max: null, delta: 0 }; $(document).bind('mousemove.orderable', change); $(document).bind('mouseup.orderable', stop); $(document).mousemove(); return false; };
item: $(this).parents(settings.items),
item: item,
var start = function() { state = { item: $(this).parents(settings.items), min: null, max: null, delta: 0 }; $(document).bind('mousemove.orderable', change); $(document).bind('mouseup.orderable', stop); $(document).mousemove(); return false; };
return false;
var start = function() { state = { item: $(this).parents(settings.items), min: null, max: null, delta: 0 }; $(document).bind('mousemove.orderable', change); $(document).bind('mouseup.orderable', stop); $(document).mousemove(); return false; };
var finServer = new server.Server(finDatabase);
var finItemStore = new server.ItemSetRedisStore(args.redisClient) var finServer = new server.Server(finDatabase, finItemStore);
this.startServer = function(args) { var finDatabase = new server.Database(args.db); finDatabase.ensureExists(); var finServer = new server.Server(finDatabase); return net.listen(finServer, (args.transport || 'csp'), { port: args.port || 5555 }); }
this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); }
this.shipLaunchedFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); }
this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); }
log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\".");
log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + (this.shadersSupported ? "supported" : "not supported") + ".");
this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); }
log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + ".");
var startString = "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString; if (shady) { startString += ", texture image unit count is " + debugConsole.glFragmentShaderTextureUnitCount; } startString += "."; log("materialTest.start", startString);
this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.originalHUD = player.ship.hud; this.shipWillLaunchFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + "."); player.ship.hud = "oolite_material_test_suite_blank_hud.plist"; this.runNextTest(); }
log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\".");
log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\".");
this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); }
this.originalDisplayFPS = debugConsole.displayFPS;
this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + "."); this.runNextTest(); }
this.shipLaunchedFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); }
this.shipWillLaunchFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); }
this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + "."); this.runNextTest(); }
player.ship.hud = "oolite_material_test_suite_blank_hud.plist";
this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + "."); this.runNextTest(); }
this.originalReducedDetailMode = debugConsole.reducedDetailMode;
this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.originalHUD = player.ship.hud; this.shipWillLaunchFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; var shady = false; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; shady = true; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; shady = true; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); var startString = "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString; if (shady) { startString += ", texture image unit count is " + debugConsole.glFragmentShaderTextureUnitCount; } startString += "."; log("materialTest.start", startString); player.ship.hud = "oolite_material_test_suite_blank_hud.plist"; this.runNextTest(); }
log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + (this.shadersSupported ? "supported" : "not supported") + ".");
log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + ".");
this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + (this.shadersSupported ? "supported" : "not supported") + "."); this.runNextTest(); }
this.shipLaunchedFromStation = function () { performCleanUp(); }
this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); }
this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); }
log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported.");
log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active.");
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
this.testCount = 16;
this.shadyTestCount = 16; this.nonShadyTestCount = 7; this.shadersSupported = (debugConsole.shaderMode != "SHADERS_NOT_SUPPORTED");
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
debugConsole.script.runShaderTestSuite = function ()
debugConsole.script.runMaterialTestSuite = function ()
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
worldScripts[scriptName].runShaderTestSuite();
worldScripts[scriptName].runMaterialTestSuite();
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
this.runShaderTestSuite = function ()
this.runMaterialTestSuite = function ()
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite.");
debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite.");
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this))
var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText(this.shadersSupported ? "oolite_material_test_count_full_shaders" : "oolite_material_test_count_no_shaders", substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this))
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen.");
log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen.");
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); }
this.shipLaunchedFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); }
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\".");
log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + (this.shadersSupported ? "supported" : "not supported") + ".");
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
if (testIndex > this.testCount)
if (testIndex > this.settingsByPass[this.passID].maxIndex)
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
if (this.passID == 1)
var maxPass = this.shadersSupported ? 3 : 1; if (this.passID < maxPass)
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
this.passID = 2;
this.passID++;
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
log("shaderTest.complete", "Shader test suite complete.");
log("materialTest.complete", "Shader test suite complete.");
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
var modelName = "oolite_shader_test_suite_" + testIndex;
var modelName = passData.rolePrefix + testIndex;
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"];
var testDesc = ship.scriptInfo["oolite_material_test_suite_label"];
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL";
debugConsole.shaderMode = passData.shaderMode;
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ").");
var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ").");
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");
log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
log("temp", "Debug console: " + debugConsole);
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } log("temp", "Debug console: " + debugConsole); // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText("oolite_material_test_count_" + debugConsole.maximumShaderMode, substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (substitutions.count_string === null) { log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); return; } if (!mission.runScreen({ titleKey: "oolite_material_test_title", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Run on startup. this.missionScreenOpportunity = function () { delete this.missionScreenOpportunity; this.runMaterialTestSuite(); } // User-callable initiation function, if debug console is installed. var scriptName = this.name; if (debugConsole.script !== undefined) { debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.originalHUD = player.ship.hud; this.shipWillLaunchFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; var shady = false; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; shady = true; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; shady = true; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); var startString = "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString; if (shady) { startString += ", texture image unit count is " + debugConsole.glFragmentShaderTextureUnitCount; } startString += "."; log("materialTest.start", startString); player.ship.hud = "oolite_material_test_suite_blank_hud.plist"; this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.debugFlags = this.originalDebugFlags; player.ship.hud = this.originalHUD; delete this.passID; delete this.maxPassID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipWillLaunchFromStation; delete this.originalHUD; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { if (this.passID < this.maxPassID) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var substitutions = { gl_vendor_string: debugConsole.glVendorString, gl_renderer_string: debugConsole.glRendererString, gl_tex_image_unit_count: debugConsole.glFragmentShaderTextureUnitCount }; var message = expandMissionText((this.maxPassID == 1) ? "oolite_material_test_completion_no_shaders" : "oolite_material_test_completion_shaders", substitutions); log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); mission.runScreen({ titleKey: "oolite_material_test_title", message: message }, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc, background: "oolite_material_test_suite_backdrop.png" }; if (!mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed.");};
var message = expandMissionText((this.maxPassID == 1) ? "oolite_material_test_completion_no_shaders" : "oolite_material_test_completion_shaders", substitutions);
var message = expandMissionText(shady ? "oolite_material_test_completion_no_shaders" : "oolite_material_test_completion_shaders", substitutions);
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } log("temp", "Debug console: " + debugConsole); // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText("oolite_material_test_count_" + debugConsole.maximumShaderMode, substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (substitutions.count_string === null) { log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); return; } if (!mission.runScreen({ titleKey: "oolite_material_test_title", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Run on startup. this.missionScreenOpportunity = function () { delete this.missionScreenOpportunity; this.runMaterialTestSuite(); } // User-callable initiation function, if debug console is installed. var scriptName = this.name; if (debugConsole.script !== undefined) { debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.originalHUD = player.ship.hud; this.shipWillLaunchFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; var shady = false; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; shady = true; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; shady = true; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); var startString = "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString; if (shady) { startString += ", texture image unit count is " + debugConsole.glFragmentShaderTextureUnitCount; } startString += "."; log("materialTest.start", startString); player.ship.hud = "oolite_material_test_suite_blank_hud.plist"; this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.debugFlags = this.originalDebugFlags; player.ship.hud = this.originalHUD; delete this.passID; delete this.maxPassID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipWillLaunchFromStation; delete this.originalHUD; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { if (this.passID < this.maxPassID) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var substitutions = { gl_vendor_string: debugConsole.glVendorString, gl_renderer_string: debugConsole.glRendererString, gl_tex_image_unit_count: debugConsole.glFragmentShaderTextureUnitCount }; var message = expandMissionText((this.maxPassID == 1) ? "oolite_material_test_completion_no_shaders" : "oolite_material_test_completion_shaders", substitutions); log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); mission.runScreen({ titleKey: "oolite_material_test_title", message: message }, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc, background: "oolite_material_test_suite_backdrop.png" }; if (!mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed.");};
var scriptName = this.name; debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); }
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText("oolite_material_test_count_" + debugConsole.maximumShaderMode, substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (substitutions.count_string === null) { log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); return; } if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.originalHUD = player.ship.hud; this.shipWillLaunchFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + "."); player.ship.hud = "oolite_material_test_suite_blank_hud.plist"; this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.debugFlags = this.originalDebugFlags; player.ship.hud = this.originalHUD; delete this.passID; delete this.maxPassID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipWillLaunchFromStation; delete this.originalHUD; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { if (this.passID < this.maxPassID) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc, background: "oolite_material_test_suite_backdrop.png" }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");};
if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this))
if (!mission.runScreen({ titleKey: "oolite_material_test_title", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this))
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText("oolite_material_test_count_" + debugConsole.maximumShaderMode, substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (substitutions.count_string === null) { log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); return; } if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.originalHUD = player.ship.hud; this.shipWillLaunchFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + "."); player.ship.hud = "oolite_material_test_suite_blank_hud.plist"; this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.debugFlags = this.originalDebugFlags; player.ship.hud = this.originalHUD; delete this.passID; delete this.maxPassID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipWillLaunchFromStation; delete this.originalHUD; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { if (this.passID < this.maxPassID) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc, background: "oolite_material_test_suite_backdrop.png" }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");};
log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + ".");
var startString = "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString; if (shady) { startString += ", texture image unit count is " + debugConsole.glFragmentShaderTextureUnitCount; } startString += "."; log("materialTest.start", startString);
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText("oolite_material_test_count_" + debugConsole.maximumShaderMode, substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (substitutions.count_string === null) { log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); return; } if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.originalHUD = player.ship.hud; this.shipWillLaunchFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + "."); player.ship.hud = "oolite_material_test_suite_blank_hud.plist"; this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.debugFlags = this.originalDebugFlags; player.ship.hud = this.originalHUD; delete this.passID; delete this.maxPassID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipWillLaunchFromStation; delete this.originalHUD; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { if (this.passID < this.maxPassID) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc, background: "oolite_material_test_suite_backdrop.png" }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");};
var config =
var substitutions =
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText("oolite_material_test_count_" + debugConsole.maximumShaderMode, substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (substitutions.count_string === null) { log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); return; } if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.originalHUD = player.ship.hud; this.shipWillLaunchFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + "."); player.ship.hud = "oolite_material_test_suite_blank_hud.plist"; this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.debugFlags = this.originalDebugFlags; player.ship.hud = this.originalHUD; delete this.passID; delete this.maxPassID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipWillLaunchFromStation; delete this.originalHUD; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { if (this.passID < this.maxPassID) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc, background: "oolite_material_test_suite_backdrop.png" }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");};
title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log."
gl_vendor_string: debugConsole.glVendorString, gl_renderer_string: debugConsole.glRendererString, gl_tex_image_unit_count: debugConsole.glFragmentShaderTextureUnitCount
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText("oolite_material_test_count_" + debugConsole.maximumShaderMode, substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (substitutions.count_string === null) { log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); return; } if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.originalHUD = player.ship.hud; this.shipWillLaunchFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + "."); player.ship.hud = "oolite_material_test_suite_blank_hud.plist"; this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.debugFlags = this.originalDebugFlags; player.ship.hud = this.originalHUD; delete this.passID; delete this.maxPassID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipWillLaunchFromStation; delete this.originalHUD; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { if (this.passID < this.maxPassID) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc, background: "oolite_material_test_suite_backdrop.png" }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");};
Mission.runScreen(config, function () {});
mission.runScreen({ titleKey: "oolite_material_test_title", message: message }, function () {});
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText("oolite_material_test_count_" + debugConsole.maximumShaderMode, substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (substitutions.count_string === null) { log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); return; } if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.originalHUD = player.ship.hud; this.shipWillLaunchFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + "."); player.ship.hud = "oolite_material_test_suite_blank_hud.plist"; this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.debugFlags = this.originalDebugFlags; player.ship.hud = this.originalHUD; delete this.passID; delete this.maxPassID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipWillLaunchFromStation; delete this.originalHUD; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { if (this.passID < this.maxPassID) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc, background: "oolite_material_test_suite_backdrop.png" }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");};
if (!Mission.runScreen(config, this.runNextTest, this))
if (!mission.runScreen(config, this.runNextTest, this))
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText("oolite_material_test_count_" + debugConsole.maximumShaderMode, substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (substitutions.count_string === null) { log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); return; } if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.originalHUD = player.ship.hud; this.shipWillLaunchFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + "."); player.ship.hud = "oolite_material_test_suite_blank_hud.plist"; this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.debugFlags = this.originalDebugFlags; player.ship.hud = this.originalHUD; delete this.passID; delete this.maxPassID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipWillLaunchFromStation; delete this.originalHUD; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { if (this.passID < this.maxPassID) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc, background: "oolite_material_test_suite_backdrop.png" }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");};
log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");
log("materialTest.loaded", "Material test suite is installed.");
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText("oolite_material_test_count_" + debugConsole.maximumShaderMode, substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (substitutions.count_string === null) { log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); return; } if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.originalHUD = player.ship.hud; this.shipWillLaunchFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + "."); player.ship.hud = "oolite_material_test_suite_blank_hud.plist"; this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.debugFlags = this.originalDebugFlags; player.ship.hud = this.originalHUD; delete this.passID; delete this.maxPassID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipWillLaunchFromStation; delete this.originalHUD; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { if (this.passID < this.maxPassID) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc, background: "oolite_material_test_suite_backdrop.png" }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");};
testRig.$registerTest("Vector3D.toString", function () { var v = new Vector3D(42, 17, 163); var string = v.toString(); require.value("string", string, "(42, 17, 163)"); }); testRig.$registerTest("Vector3D.toSource", function () { var v = new Vector3D(42, 17, 163); var source = v.toSource(); require.value("source", source, "Vector3D(42, 17, 163)"); });
this.startUp = function (){ var testRig = worldScripts["oolite-script-test-rig"]; var require = testRig.$require; function degToRad(value) { return Math.PI * value / 180; } testRig.$registerTest("Vector3D constructor", function () { var basic = new Vector3D(1, 2, 3); require.instance("basic", basic, Vector3D); var noNew = Vector3D(1, 2, 3); require.instance("noNew", noNew, Vector3D); var fromArray = Vector3D([1, 2, 3]); require.instance("fromArray", fromArray, Vector3D); }); testRig.$registerTest("Vector3D properties", function () { var v = new Vector3D(1, 2, 3); require.vector("v", v, [1, 2, 3]); v.x = 4; v.y = 5; v.z = 6; require.vector("v", v, [4, 5, 6]); }); testRig.$registerTest("Vector3D.add", function () { var v = new Vector3D(1, 2, 3); var u = new Vector3D(4, 5, 6); var sum = v.add(u); require.vector("sum", sum, [5, 7, 9]); var sum2 = u.add(v); require.vector("sum2", sum2, [5, 7, 9]); var sumCastFromArray = v.add([1, 1, 1]); require.vector("sumCastFromArray", sumCastFromArray, [2, 3, 4]); }); testRig.$registerTest("Vector3D.angleTo", function () { var v = new Vector3D(0, 1, 0); var ninetyDegrees = new Vector3D(1, 0, 0); require.near("ninetyDegrees", ninetyDegrees, degToRad(90), 1e-6); var fortyfiveDegrees = new Vector3D(0, 100, 100); require.near("fortyfiveDegrees", fortyfiveDegrees, degToRad(45), 1e-6); var opposite = new Vector3D(0, 0, 0).subtract(v).angleTo(v); require.near("opposite", opposite, Math.PI, 1e-6); }); testRig.$registerTest("Vector3D.cross", function () { var v = new Vector3D(1, 0, 0); var u = new Vector3D(0, 1, 0); var cross = v.cross(u); require.vector("cross", cross, [0, 0, 1]); }); testRig.$registerTest("Vector3D.direction", function () { var direction1 = new Vector3D(100, 0, 0).direction(); require.vector("direction1", direction1, [1, 0, 0]); var direction2 = new Vector3D(13, -59, 62).direction(); require.vector("direction2", direction2, [0.15017115046799, -0.681545990585492, 0.716200871462721]); }); testRig.$registerTest("Vector3D.distanceTo", function () { var v = new Vector3D(10, 10, 10); var u = new Vector3D(30, 20, 10); var distance = v.distanceTo(u); var correct = v.subtract(u).magnitude(); // Correct assuming subtract and magnitude work, tested elsewhere. require.near("distance", distance, correct, 1e-6); }); testRig.$registerTest("Vector3D.dot", function () { var v = new Vector3D(1, 0, 0); var u = new Vector3D(0, 0, 1); var w = new Vector3D(5, 5, 0); var dot1 = v.dot(v); require.near("dot1", dot1, 1, 1e-6); var dot2 = v.dot(u); require.near("dot2", dot2, 0, 1e-6); var dot3 = v.dot(w); require.near("dot3", dot3, Math.cos(degToRad(45)) * Math.sqrt(5 * 5 + 5 * 5), 1e-6); }); // TODO: fromCoordinateSystem() testRig.$registerTest("Vector3D.magnitude", function () { var magnitude1 = new Vector3D(0, 0, 0).magnitude(); require.near("magnitude1", magnitude1, 0, 1e-6); var magnitude2 = new Vector3D(1, 0, 0).magnitude(); require.near("magnitude2", magnitude2, 1, 1e-6); var magnitude3 = new Vector3D(10, 0, 0).magnitude(); require.near("magnitude3", magnitude3, 10, 1e-6); var magnitude4 = new Vector3D(3, 4, 0).magnitude(); require.near("magnitude4", magnitude4, 5, 1e-6); }); testRig.$registerTest("Vector3D.multiply", function () { var product1 = new Vector3D(1, 1, 0).multiply(5); require.vector("product1", product1, [5, 5, 0]); var product2 = new Vector3D(42, -3, 9).multiply(-3); require.vector("product2", product2, [-126, 9, -27]); }); // TODO: rotateBy() // TODO: rotationTo() testRig.$registerTest("Vector3D.subtract", function () { var v = new Vector3D(1, 2, 3); var u = new Vector3D(4, 5, 6); var diff = v.subtract(u); require.vector("diff", diff, [-3, -3, -3]); var diff2 = u.subtract(v); require.vector("diff2", diff2, [3, 3, 3]); var diffCastFromArray = v.subtract([1, 1, 1]); require.vector("diffCastFromArray", diffCastFromArray, [0, 1, 2]); }); testRig.$registerTest("Vector3D.squaredDistanceTo", function () { var v = new Vector3D(10, 10, 10); var u = new Vector3D(30, 20, 10); var sqDistance = v.squaredDistanceTo(u); var correct = v.subtract(u).squaredMagnitude(); // Correct assuming subtract and squaredMagnitude work, tested elsewhere. require.near("sqDistance", sqDistance, correct, 1e-6); }); testRig.$registerTest("Vector3D.squaredMagnitude", function () { var sqMagnitude1 = new Vector3D(0, 0, 0).squaredMagnitude(); require.near("sqMagnitude1", sqMagnitude1, 0, 1e-6); var sqMagnitude2 = new Vector3D(1, 0, 0).squaredMagnitude(); require.near("sqMagnitude2", sqMagnitude2, 1, 1e-6); var sqMagnitude3 = new Vector3D(10, 0, 0).squaredMagnitude(); require.near("sqMagnitude3", sqMagnitude3, 100, 1e-6); var sqMagnitude4 = new Vector3D(3, 4, 0).squaredMagnitude(); require.near("sqMagnitude4", sqMagnitude4, 25, 1e-6); }); testRig.$registerTest("Vector3D.toArray", function () { var array = new Vector3D(1, 2, 3).toArray(); require.instance("array", array, Array); require.property("array", array, "length", 3); require.property("array", array, 0, 1); require.property("array", array, 1, 2); require.property("array", array, 2, 3); }); // TODO: toCoordinateSystem() testRig.$registerTest("Vector3D.tripleProduct", function () { var u = new Vector3D(5, 7, 3); var v = new Vector3D(1, 5, -6); var w = new Vector3D(2, -1, 4); var tripleProduct = u.tripleProduct(v, w); require.near("tripleProduct", tripleProduct, -75); }); testRig.$registerTest("Vector3D.interpolate", function () { var u = new Vector3D(-10, 6, 3); var v = new Vector3D(-1, 0, 0); var interp1 = Vector3D.interpolate(u, v, 0); require.vector("interp1", interp1, [-10, 6, 3]); var interp2 = Vector3D.interpolate(u, v, 1); require.vector("interp2", interp2, [-1, 0, 0]); var interp3 = Vector3D.interpolate(u, v, 1/3); require.vector("interp3", interp3, [-7, 4, 2]); var interp4 = Vector3D.interpolate(u, v, 2); require.vector("interp4", interp4, [8, -6, -3]); }); testRig.$registerTest("Vector3D.random", function () { // Doesn’t test distribution, just that results are in valid range. var i; for (i = 0; i < 20; i++) { var random = Vector3D.random(3); require.instance("random", random, Vector3D); require("random.magnitude() <= 3", random.magnitude() <= 3); } }); testRig.$registerTest("Vector3D.randomDirection", function () { // Doesn’t test distribution, just that results are in valid range. var i; for (i = 0; i < 20; i++) { var random = Vector3D.randomDirection(3); require.instance("random", random, Vector3D); require.near("random.magnitude()", random.magnitude(), 3); } }); testRig.$registerTest("Vector3D.randomDirectionAndLength", function () { // Doesn’t test distribution, just that results are in valid range. var i; for (i = 0; i < 20; i++) { var random = Vector3D.randomDirectionAndLength(3); require.instance("random", random, Vector3D); require("random.magnitude() <= 3", random.magnitude() <= 3); } });}
log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\".");
log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\".");
this.startUp = function(){ if (debugConsole === undefined) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); } else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); } else { this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL rendrer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Actually run the test. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + "."); var config = { model: "oolite_shader_test_suite_" + testIndex, title: "", message: "\n\n\n" + testLabel }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console."); }};
debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK;
debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION;
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); return; } if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); return; } this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");};
this.originalDisplayFPS = debugConsole.displayFPS;
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText("oolite_material_test_count_" + debugConsole.maximumShaderMode, substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (substitutions.count_string === null) { log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); return; } if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + "."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.maxPassID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { if (this.passID < this.maxPassID) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");};
this.shipLaunchedFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); }
this.originalHUD = player.ship.hud; this.shipWillLaunchFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); }
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText("oolite_material_test_count_" + debugConsole.maximumShaderMode, substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (substitutions.count_string === null) { log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); return; } if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + "."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.maxPassID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { if (this.passID < this.maxPassID) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");};
debugConsole.displayFPS = this.originalDisplayFPS;
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText("oolite_material_test_count_" + debugConsole.maximumShaderMode, substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (substitutions.count_string === null) { log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); return; } if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + "."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.maxPassID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { if (this.passID < this.maxPassID) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");};
debugConsole.displayFPS = true;
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText("oolite_material_test_count_" + debugConsole.maximumShaderMode, substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (substitutions.count_string === null) { log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); return; } if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + "."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.maxPassID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { if (this.passID < this.maxPassID) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");};
message: "\n\n\n" + testLabel + "\n" + testDesc
message: "\n\n\n" + testLabel + "\n" + testDesc, background: "oolite_material_test_suite_backdrop.png"
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText("oolite_material_test_count_" + debugConsole.maximumShaderMode, substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (substitutions.count_string === null) { log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); return; } if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + "."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.maxPassID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { if (this.passID < this.maxPassID) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");};
message: "\n\n\n" + testLabel + "\n" + testDesc,
message: "\n\n" + testLabel + "\n" + testDesc,
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText("oolite_material_test_count_" + debugConsole.maximumShaderMode, substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (substitutions.count_string === null) { log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); return; } if (!mission.runScreen({ titleKey: "oolite_material_test_title", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Run on startup. this.missionScreenOpportunity = function () { delete this.missionScreenOpportunity; this.runMaterialTestSuite(); } // User-callable initiation function, if debug console is installed. var scriptName = this.name; if (debugConsole.script !== undefined) { debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.originalHUD = player.ship.hud; this.shipWillLaunchFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } var supportString; var shady = false; switch (debugConsole.maximumShaderMode) { case "SHADERS_NOT_SUPPORTED": supportString = "not supported"; this.maxPassID = 1; break; case "SHADERS_SIMPLE": supportString = "supported in simple mode only"; this.maxPassID = 2; shady = true; break; case "SHADERS_FULL": supportString = "fully supported"; this.maxPassID = 3; shady = true; break; default: log("materialTest.error.unknownMode", "Shader test suite cannot run because maximum shader mode \"" + debugConsole.maximumShaderMode + "\" is not recognised."); this.performCleanUp(); return; } debugConsole.writeLogMarker(); var startString = "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString; if (shady) { startString += ", texture image unit count is " + debugConsole.glFragmentShaderTextureUnitCount; } startString += "."; log("materialTest.start", startString); player.ship.hud = "oolite_material_test_suite_blank_hud.plist"; this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.debugFlags = this.originalDebugFlags; player.ship.hud = this.originalHUD; delete this.passID; delete this.maxPassID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipWillLaunchFromStation; delete this.originalHUD; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { if (this.passID < this.maxPassID) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. var shady = this.maxPassID == 1; this.performCleanUp(); var substitutions = { gl_vendor_string: debugConsole.glVendorString, gl_renderer_string: debugConsole.glRendererString, gl_tex_image_unit_count: debugConsole.glFragmentShaderTextureUnitCount }; var message = expandMissionText(shady ? "oolite_material_test_completion_no_shaders" : "oolite_material_test_completion_shaders", substitutions); log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); mission.runScreen({ titleKey: "oolite_material_test_title", message: message }, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc, background: "oolite_material_test_suite_backdrop.png" }; if (!mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed.");};
if (debugConsole === undefined)
delete this.startUp; try { var console = debugConsole; } catch (e)
this.startUp = function(){ if (debugConsole === undefined) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); } else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); } else { this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console."); }};
else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED")
if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED")
this.startUp = function(){ if (debugConsole === undefined) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); } else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); } else { this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console."); }};
else
this.testCount = 16; var scriptName = this.name; debugConsole.script.runShaderTestSuite = function ()
this.startUp = function(){ if (debugConsole === undefined) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); } else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); } else { this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: β€œ" + debugConsole.glVendorString + "”\n" + "Renderer: β€œ" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console."); }};