Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

CmdMaterial.C

Go to the documentation of this file.
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: CmdMaterial.C,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.32 $       $Date: 2019/01/17 21:20:58 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *  Commands for manipulating materials
00019  ***************************************************************************/
00020 
00021 #include "CmdMaterial.h"
00022 #include "MaterialList.h" // for MAT_XXX definitions
00023 #include "utilities.h"
00024 #include "config.h"
00025 #include "Inform.h"
00026 #include <stdlib.h>
00027 #include <ctype.h>
00028 
00030 
00031 CmdMaterialAdd::CmdMaterialAdd(const char *s, const char *copyfrom)
00032 : Command(MATERIAL_ADD) {
00033   name = copy = NULL;
00034   if (s)
00035     name = stringdup(s);
00036   if (copyfrom)
00037     copy = stringdup(copyfrom);
00038 }
00039 
00040 void CmdMaterialAdd::create_text(void) {
00041   *cmdText << "material add";
00042   if (name)
00043     *cmdText << " " << name;
00044   if (copy)
00045     *cmdText << " copy " << copy;
00046   *cmdText << ends;
00047 }
00048 
00049 CmdMaterialAdd::~CmdMaterialAdd(void) {
00050   delete [] name;
00051   delete [] copy;
00052 }
00053 
00055 
00056 CmdMaterialRename::CmdMaterialRename(const char *oldn, const char *newn) 
00057 : Command(MATERIAL_RENAME) {
00058   oldname = stringdup(oldn);
00059   newname = stringdup(newn);
00060 }
00061 
00062 void CmdMaterialRename::create_text(void) {
00063   *cmdText << "material rename " << oldname << " " << newname << ends;
00064 }
00065 
00066 CmdMaterialRename::~CmdMaterialRename(void) {
00067   delete [] oldname;
00068   delete [] newname;
00069 }
00070 
00072 
00073 CmdMaterialChange::CmdMaterialChange(const char *s, int p, float v)
00074 : Command(MATERIAL_CHANGE) {
00075   name = stringdup(s);
00076   property = p;
00077   val = v;
00078 }
00079 
00080 void CmdMaterialChange::create_text(void) {
00081   *cmdText << "material change ";
00082   switch (property) {
00083     case MAT_AMBIENT: *cmdText << "ambient "; break;
00084     case MAT_SPECULAR: *cmdText << "specular "; break;
00085     case MAT_DIFFUSE: *cmdText << "diffuse "; break;
00086     case MAT_SHININESS: *cmdText << "shininess "; break;
00087     case MAT_MIRROR: *cmdText << "mirror "; break;
00088     case MAT_OPACITY: *cmdText << "opacity "; break;
00089     case MAT_OUTLINE: *cmdText << "outline "; break;
00090     case MAT_OUTLINEWIDTH: *cmdText << "outlinewidth "; break;
00091     case MAT_TRANSMODE: *cmdText << "transmode "; break;
00092   }
00093   *cmdText << name << " " << val << ends;
00094 }
00095 
00096 CmdMaterialChange::~CmdMaterialChange(void) {
00097   delete [] name;
00098 }
00099 
00101 CmdMaterialDelete::CmdMaterialDelete(const char *s) 
00102 : Command(MATERIAL_DELETE) {
00103   name = stringdup(s);
00104 }
00105 
00106 void CmdMaterialDelete::create_text() {
00107   *cmdText << "material delete " << name << ends;
00108 }
00109 
00110 CmdMaterialDelete::~CmdMaterialDelete() {
00111   delete [] name;
00112 }
00113 
00114 void CmdMaterialDefault::create_text() {
00115   *cmdText << "material default " << ind << ends;
00116 }
00117 

Generated on Thu Dec 12 02:43:59 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002