00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #include <stdio.h>
00042 #include <string.h>
00043 #ifndef __UNIX_
00044 #include <malloc.h>
00045 #endif
00046 #include "mensagem.h"
00047 #include "memvirtu.h"
00048 #include "lowparam.h"
00049 #include "lowmacro.h"
00050 #include "lowsolid.h"
00051 #include "mancommd.h"
00052 #include "disdispl.h"
00053
00054 #ifdef __Extended_Version
00055 void MSD_execNameCreateCamera(void)
00056 {
00057 char name1[15];
00058 float f1, f2, f3, f4, f5, f6, f7;
00059 int i1, i2, i3, i4;
00060
00061 while (12 != sscanf(restbuf, "%s %f %f %f %f %f %f %f %d %d %d %d",
00062 name1, &f1, &f2, &f3, &f4, &f5, &f6, &f7,
00063 &i1, &i2, &i3, &i4))
00064 {
00065 printf(MEN_CamaraParametros, NAM_CreateCamara, "nome");
00066 if (!lineins("? "))
00067 {
00068 return;
00069 }
00070 }
00071 MSD_highNameCreateCamera(name1, f1, f2, f3, f4, f5, f6, f7, i1, i2, i3, i4);
00072 }
00073
00074 #endif
00075
00076 int MSD_highNameCreateCamera(char *name, real Ex, real Ey, real Ez,
00077 real Rx, real Ry, real Rz, real scale,
00078 int mode, int hidtype, int dash, int smooth)
00079 {
00080 CTYPE *cptr;
00081 int cn;
00082
00083 if (MSD_getCameraIdFromName(name) != -1)
00084 {
00085 fprintf(stderr, MEN_CamaraJaExiste,
00086 NAM_CreateCamara, name);
00087 return(ERROR);
00088 }
00089 if ((cn = MSD_highCreateCamera(Ex, Ey, Ez, Rx, Ry, Rz, scale, mode,
00090 hidtype, dash, smooth)) != -1)
00091 {
00092 cptr = MSD_getCamera(cn);
00093 strcpy(cptr->cname, name);
00094 return(SUCCESS);
00095 }
00096 return(ERROR);
00097 }
00098
00099 #ifdef __Extended_Version
00100 void MSD_execCreateCamera(void)
00101 {
00102 float f1, f2, f3, f4, f5, f6, f7;
00103 int i1, i2, i3, i4;
00104
00105 while (11 != sscanf(restbuf, "%f %f %f %f %f %f %f %d %d %d %d",
00106 &f1, &f2, &f3, &f4, &f5, &f6, &f7, &i1, &i2, &i3, &i4))
00107 {
00108 printf(MEN_CamaraParametros, NAM_CreateCamara, "");
00109 if (!lineins("? "))
00110 {
00111 return;
00112 }
00113 }
00114 printf("Id = %d\n", MSD_highCreateCamera(f1, f2, f3, f4, f5, f6, f7, i1,
00115 i2, i3, i4));
00116 }
00117
00118 #endif
00119
00120 int MSD_highCreateCamera(real Ex, real Ey, real Ez,
00121 real Rx, real Ry, real Rz, real scale,
00122 int mode, int hidtype, int dash, int smooth)
00123 {
00124 Id cn;
00125
00126 cn = MSD_getMaxCameraId();
00127 return(MSD_lowCreateCamera(cn, Ex, Ey, Ez, Rx, Ry, Rz, scale, mode,
00128 hidtype, dash, smooth) == (CTYPE *)NIL ? -1 : cn);
00129 }
00130
00131 int MSD_middleCreateCamera(Id cn, real Ex, real Ey, real Ez, real Rx,
00132 real Ry, real Rz, real scale, int mode,
00133 int hidtype, int dash, int smooth)
00134 {
00135 return(MSD_lowCreateCamera(cn, Ex, Ey, Ez, Rx, Ry, Rz, scale, mode,
00136 hidtype, dash, smooth) != (CTYPE *)NIL);
00137 }
00138
00139 CTYPE *MSD_lowCreateCamera(Id cn, real Ex, real Ey, real Ez,
00140 real Rx, real Ry, real Rz, real scale,
00141 int mode, int hidtype, int dash, int smooth)
00142 {
00143 CTYPE *cptr;
00144
00145 if ((cptr = (CTYPE *)malloc(sizeof(CTYPE))) != (CTYPE *)NIL)
00146 {
00147 ++camused;
00148 cptr->nxt = camary;
00149 cptr->cn = cn;
00150 if (!MSD_highCheckCamera(Ex, Ey, Ez, Rx, Ry, Rz, scale, mode, hidtype,
00151 dash, smooth))
00152 {
00153 fprintf(stderr, MEN_CamaraParametroIncorreto,
00154 NAM_CreateCamara);
00155 return((CTYPE *)NIL);
00156 }
00157 MSD_highSetCamera(cptr, Ex, Ey, Ez, Rx, Ry, Rz, scale, mode, hidtype,
00158 dash, smooth);
00159 return(camary = cptr);
00160 }
00161 return((CTYPE *)NIL);
00162 }