00001 /*************************************************************************** 00002 *cr 00003 *cr (C) Copyright 1995-2019 The Board of Trustees of the 00004 *cr University of Illinois 00005 *cr All Rights Reserved 00006 *cr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * RCS INFORMATION: 00011 * 00012 * $RCSfile: CmdDisplay.C,v $ 00013 * $Author: johns $ $Locker: $ $State: Exp $ 00014 * $Revision: 1.84 $ $Date: 2019/01/17 21:20:58 $ 00015 * 00016 *************************************************************************** 00017 * DESCRIPTION: 00018 * These are the Commands that control the various aspects 00019 * of the display, like, the clipping planes, eye separation, etc. 00020 * 00021 ***************************************************************************/ 00022 00023 #include <stdlib.h> 00024 #include <string.h> 00025 #include <ctype.h> 00026 00027 #if defined(ARCH_AIX4) 00028 #include <strings.h> 00029 #endif 00030 00031 #include "config.h" 00032 #include "CmdDisplay.h" 00033 #include "utilities.h" 00034 #include "Inform.h" 00035 00036 // These are the Command:: enums used by this file: 00037 // DISP_STEREO, DISP_STEREOSWAP, DISP_CACHEMODE, 00038 // DISP_RENDERMODE, DISP_PROJ, DISP_EYESEP, 00039 // DISP_FOCALLEN, DISP_LIGHT_ON, DISP_LIGHT_HL, DISP_LIGHT_ROT, 00040 // DISP_MATERIALS_CHANGE, DISP_CLIP, DISP_DEPTHCUE, DISP_ANTIALIAS, 00041 // DISP_SCRHEIGHT, DISP_SCRDIST, CMD_AXES, CMD_STAGE 00042 00043 void CmdResetView::create_text(void) { 00044 *cmdText << "display resetview" << ends; 00045 } 00046 00047 CmdResetView::CmdResetView() 00048 : Command(Command::DISP_RESETVIEW) { } 00049 00050 void CmdDisplayStereo::create_text(void) { 00051 *cmdText << "display stereo " << mode << ends; 00052 } 00053 CmdDisplayStereo::CmdDisplayStereo(const char *newmode) 00054 : Command(Command::DISP_STEREO) { 00055 mode = stringdup(newmode); 00056 } 00057 CmdDisplayStereo::~CmdDisplayStereo() { 00058 delete [] mode; 00059 } 00060 00061 00062 void CmdDisplayStereoSwap::create_text(void) { 00063 *cmdText << "display stereoswap " << (onoff ? "on" : "off") << ends; 00064 } 00065 CmdDisplayStereoSwap::CmdDisplayStereoSwap(int turnon) 00066 : Command(Command::DISP_STEREOSWAP) { 00067 onoff = turnon; 00068 } 00069 00070 00071 void CmdDisplayCacheMode::create_text(void) { 00072 *cmdText << "display cachemode " << mode << ends; 00073 } 00074 CmdDisplayCacheMode::CmdDisplayCacheMode(const char *newmode) 00075 : Command(Command::DISP_CACHEMODE) { 00076 mode = stringdup(newmode); 00077 } 00078 CmdDisplayCacheMode::~CmdDisplayCacheMode() { 00079 delete [] mode; 00080 } 00081 00082 00083 void CmdDisplayRenderMode::create_text(void) { 00084 *cmdText << "display rendermode " << mode << ends; 00085 } 00086 CmdDisplayRenderMode::CmdDisplayRenderMode(const char *newmode) 00087 : Command(Command::DISP_RENDERMODE) { 00088 mode = stringdup(newmode); 00089 } 00090 CmdDisplayRenderMode::~CmdDisplayRenderMode() { 00091 delete [] mode; 00092 } 00093 00094 00095 void CmdDisplayProj::create_text(void) { 00096 *cmdText << "display projection " << projection << ends; 00097 } 00098 00099 CmdDisplayProj::CmdDisplayProj(const char *proj) 00100 : Command(Command::DISP_PROJ) { 00101 projection = stringdup(proj); 00102 } 00103 CmdDisplayProj::~CmdDisplayProj() { 00104 delete [] projection; 00105 } 00106 00107 void CmdDisplayEyesep::create_text(void) { 00108 *cmdText << "display eyesep " << sep << ends; 00109 } 00110 00111 CmdDisplayEyesep::CmdDisplayEyesep(float newsep) 00112 : Command(Command::DISP_EYESEP), sep(newsep) {} 00113 00114 void CmdDisplayFocallen::create_text(void) { 00115 *cmdText << "display focallength " << flen << ends; 00116 } 00117 00118 CmdDisplayFocallen::CmdDisplayFocallen(float newlen) 00119 : Command(Command::DISP_FOCALLEN), flen(newlen) {} 00120 00122 void CmdDisplayScreenHeight::create_text(void) { 00123 *cmdText << "display height " << val << ends; 00124 } 00125 00126 CmdDisplayScreenHeight::CmdDisplayScreenHeight(float newval) 00127 : Command(Command::DISP_SCRHEIGHT) { 00128 val = newval; 00129 } 00130 00131 00133 void CmdDisplayScreenDistance::create_text(void) { 00134 *cmdText << "display distance " << val << ends; 00135 } 00136 00137 CmdDisplayScreenDistance::CmdDisplayScreenDistance(float newval) 00138 : Command(Command::DISP_SCRDIST) { 00139 val = newval; 00140 } 00141 00142 00143 void CmdDisplayAAOn::create_text(void) { 00144 *cmdText << "display antialias " << (onoff ? "on" : "off") << ends; 00145 } 00146 00147 CmdDisplayAAOn::CmdDisplayAAOn(int turnon) 00148 : Command(Command::DISP_ANTIALIAS) { 00149 onoff = turnon; 00150 } 00151 00152 void CmdDisplayDepthcueOn::create_text(void) { 00153 *cmdText << "display depthcue " << (onoff ? "on" : "off") << ends; 00154 } 00155 00156 CmdDisplayDepthcueOn::CmdDisplayDepthcueOn(int turnon) 00157 : Command(Command::DISP_DEPTHCUE) { 00158 onoff = turnon; 00159 } 00160 00161 void CmdDisplayCullingOn::create_text(void) { 00162 *cmdText << "display culling " << (onoff ? "on" : "off") << ends; 00163 } 00164 00165 CmdDisplayCullingOn::CmdDisplayCullingOn(int turnon) 00166 : Command(Command::DISP_CULLING) { 00167 onoff = turnon; 00168 } 00169 00170 void CmdDisplayBackgroundGradientOn::create_text(void) { 00171 *cmdText << "display backgroundgradient " << (onoff ? "on" : "off") << ends; 00172 } 00173 00174 CmdDisplayBackgroundGradientOn::CmdDisplayBackgroundGradientOn(int turnon) 00175 : Command(Command::DISP_BACKGROUNDGRADIENT) { 00176 onoff = turnon; 00177 } 00178 00179 void CmdDisplayFPSOn::create_text() { 00180 *cmdText << "display fps " << (onoff ? "on" : "off") << ends; 00181 } 00182 00183 CmdDisplayFPSOn::CmdDisplayFPSOn(int turnon) 00184 : Command(Command::DISP_FPS) { 00185 onoff = turnon; 00186 } 00187 00188 void CmdDisplayClip::create_text(void) { 00189 *cmdText << "display " << (changenear ? "near" : "far"); 00190 *cmdText << "clip " << (setval ? "set " : "add "); 00191 *cmdText << amount << ends; 00192 } 00193 00194 CmdDisplayClip::CmdDisplayClip(int ischangenear, int issetval, 00195 float newamt) 00196 : Command(Command::DISP_CLIP) { 00197 changenear = ischangenear; 00198 setval = issetval; 00199 amount = newamt; 00200 } 00201 00203 00204 void CmdDisplayCueMode::create_text(void) { 00205 *cmdText << "display cuemode " << mode << ends; 00206 } 00207 00208 void CmdDisplayCueStart::create_text(void) { 00209 *cmdText << "display cuestart " << value << ends; 00210 } 00211 00212 void CmdDisplayCueEnd::create_text(void) { 00213 *cmdText << "display cueend " << value << ends; 00214 } 00215 00216 void CmdDisplayCueDensity::create_text(void) { 00217 *cmdText << "display cuedensity " << value << ends; 00218 } 00219 00221 void CmdDisplayShadowOn::create_text(void) { 00222 *cmdText << "display shadows " << (onoff ? "on" : "off") << ends; 00223 } 00224 00225 CmdDisplayShadowOn::CmdDisplayShadowOn(int turnon) 00226 : Command(Command::DISP_SHADOW) { 00227 onoff = turnon; 00228 } 00229 00230 00232 void CmdDisplayAOOn::create_text(void) { 00233 *cmdText << "display ambientocclusion " << (onoff ? "on" : "off") << ends; 00234 } 00235 00236 CmdDisplayAOOn::CmdDisplayAOOn(int turnon) 00237 : Command(Command::DISP_AO) { 00238 onoff = turnon; 00239 } 00240 00241 void CmdDisplayAOAmbient::create_text(void) { 00242 *cmdText << "display aoambient " << value << ends; 00243 } 00244 00245 void CmdDisplayAODirect::create_text(void) { 00246 *cmdText << "display aodirect " << value << ends; 00247 } 00248 00249 00251 void CmdDisplayDoFOn::create_text(void) { 00252 *cmdText << "display dof " << (onoff ? "on" : "off") << ends; 00253 } 00254 00255 CmdDisplayDoFOn::CmdDisplayDoFOn(int turnon) 00256 : Command(Command::DISP_DOF) { 00257 onoff = turnon; 00258 } 00259 00260 void CmdDisplayDoFFNumber::create_text(void) { 00261 *cmdText << "display dof_fnumber " << value << ends; 00262 } 00263 00264 void CmdDisplayDoFFocalDist::create_text(void) { 00265 *cmdText << "display dof_focaldist " << value << ends; 00266 } 00267 00268 00270 void CmdDisplayAxes::create_text(void) { 00271 *cmdText << "axes location " << pos << ends; 00272 } 00273 00274 void CmdDisplayStageLocation::create_text() { 00275 *cmdText << "stage location " << pos << ends; 00276 } 00277 00278 void CmdDisplayStagePanels::create_text() { 00279 *cmdText << "stage panels " << num << ends; 00280 } 00281 00282 void CmdDisplayStageSize::create_text() { 00283 *cmdText << "stage size " << sz << ends; 00284 } 00285 00286 void CmdDisplayLightOn::create_text(void) { 00287 *cmdText << "light " << n << (onoff ? " on" : " off") << ends; 00288 } 00289 00290 void CmdDisplayLightHL::create_text(void) { 00291 *cmdText << "light " << n << (hl ? " highlight" : " unhighlight") << ends; 00292 } 00293 00294 void CmdDisplayLightRot::create_text(void) { 00295 *cmdText << "light " << n << " rot " << axis << " " << theta << ends; 00296 } 00297 00298 void CmdDisplayLightMove::create_text() { 00299 *cmdText << "light " << n << " pos { " << pos[0] << " " << pos[1] << " " 00300 << pos[2] << ends; 00301 } 00302