示例#1
0
int main(int argc, char **argv)
{
    MapUchar onetwo;
    MapUchar rubbish;
    MapUchar newmap;
    char bufferot[0x80000];
    char bufferrubbish[0x80000];
    FILE *f;
    int i;
    Uchar j,k,iu;

    f=fopen("unicode1to2.map","rb");
    if (!f) return 1;
    fread(bufferot, 1, 20000,f);
    fclose(f);
    fread(bufferrubbish, 1, 0x80000, stdin);
    MapUcharLoad(rubbish, bufferrubbish);
    newmap = MapUcharCreate();
    MapUcharLoad(onetwo, bufferot);
    for (i=0; i<0x10000; i++) {
	iu=i;
	j=MapValue(rubbish, iu);
	k=MapValue(onetwo, j);
	if (k) MapUcharDefine(newmap, iu, k);
	else if (j) MapUcharDefine(newmap,iu,j);
    }
    MapUcharSave(newmap, stdout);
    return 0;
}
示例#2
0
文件: uniconv.c 项目: jff/mathspad
static Uchar *encode_12bit(unsigned char *source, Uchar *target, void *data)
{
    /* data contains a MapUchar for an 12-bit (mix 8&16 bit) encoding.
    ** Thus: a pair of characters is mapped to a single unicode character
    ** if that pair is defined, otherwise a single character character is
    ** is mapped.
    ** unknown characters are filtered out.
    */
    MapUchar mc=data;
    Uchar c;
    Uchar *res;
    res=target;
    if (!target) return NULL;
    if (!source) {
	*target=0;
	return target;
    }
    while (*source) {
	c=((source[0])<<8)|(source[1]);
	if ((*target=MapValue(mc,c))) {
	    source+=2;
	    target++;
	} else {
	    c=*source++;
	    if ((*target=MapValue(mc,c))) target++;
	}
    }
    *target=0;
    return res;
}
示例#3
0
local void object_ferrers(int npars, real *pars)
{
  int i,nx = Nx(iptr);
  int j,ny = Ny(iptr);
  int l, lmax;
  real A = 1.0;   /* peak */
  real h = 1.0;   /* size */
  real e = 0.0;   /* 1-b/a */
  real b = 0.0;   /* phi */
  real p = 1.0;   /* power factor */
  real x1,y1,x2,y2,x3,y3,r,arg,value;
  real amp,phi,sum;
  real sinb,cosb;

  if (npar > 0) A = pars[0];
  if (npar > 1) h = pars[1];
  if (npar > 2) e = pars[2];
  if (npar > 3) b = pars[3];
  if (npar > 4) p = pars[4];
  dprintf(0,"ferrers: %g %g %g %g %g\n",A,h,e,b,p);

  if (A==0) return;

  lmax = Qtotflux ? 2 : 1;

  sinb = sin(b*PI/180.0);
  cosb = cos(b*PI/180.0);

  for (l=0; l<lmax; l++) {     /* 1st loop: sum up the flux   if in 2nd loop: normalize */
    if (l==0) 
      sum = 0.0;
    else {
      A /= sum;
      dprintf(0,"ferrers: A->%g\n",A);
    } 
    for (j=0; j<ny; j++) {
      y1 = (j-center[1])*Dy(iptr) + Ymin(iptr);
      for (i=0; i<nx; i++) {
	x1 = (i-center[0])*Dx(iptr) + Xmin(iptr);
	
	x2 =  -x1*sinp - y1*cosp;
	y2 =  (x1*cosp - y1*sinp)/cosi;

	x3 =   x2*cosb - y2*sinb;
	y3 = (x2*sinb  + y2*cosb)/(1-e);

	r = (x3*x3+y3*y3)/(h*h);
	value = r < 1 ? A * pow(1.0-r, p) : 0.0;

	if (Qtotflux) {   
	  if (l==0) 
	    sum += value;
	  else
	    MapValue(iptr,i,j) = factor*MapValue(iptr,i,j) + value;
	} else
	  MapValue(iptr,i,j) = factor*MapValue(iptr,i,j) + value;
      } /* i */
    } /* j */
  } /* k */
}
示例#4
0
local void object_noise(int npars, real *pars)
{
  int i,j;
  int nx = Nx(iptr);
  int ny = Ny(iptr);
  double m = 1.0;
  double s = 1.0;

  if (npar > 0) m = pars[0];
  if (npar > 1) s = pars[1];

  dprintf(0,"noise:%g %g\n",m,s);

  if (s==0) return;

  if (Qtotflux) {
    m /= (nx*ny);
    s /= (nx*ny);
    dprintf(0,"noise: m->%g  s->%g\n",m,s);
  }
  
  for (j=0; j<ny; j++)
    for (i=0; i<nx; i++)
      MapValue(iptr,i,j) = factor*MapValue(iptr,i,j) + grandom(m,s);
}
示例#5
0
local void object_gauss(int npars, real *pars)
{
  int i,nx = Nx(iptr);
  int j,ny = Ny(iptr);
  real A = 1.0;
  real h = 1.0;
  real x1,y1,x2,y2,r,arg,value;

  if (npar > 0) A = pars[0];
  if (npar > 1) h = pars[1];
  dprintf(0,"gauss: %g %g\n",A,h);

  if (A==0) return;

  if (Qtotflux) {
    A /= (PI*h*h/surface);
    dprintf(0,"gauss: A->%g\n",A);
  }

  for (j=0; j<ny; j++) {
    y1 = (j-center[1])*Dy(iptr) + Ymin(iptr);
    for (i=0; i<nx; i++) {
      x1 = (i-center[0])*Dx(iptr) + Xmin(iptr);
      x2 =  -x1*sinp - y1*cosp;
      y2 =   x1*cosp - y1*sinp;
      r = sqrt(x2*x2 + sqr(y2/cosi));
      arg = r/h;
      dprintf(2,"%d %d : %g %g %g %g   %g\n",i,j,x1,y1,x2,y2,arg);
      value = (arg < 13) ?  A * exp(-0.5*arg*arg) : 0.0;
      MapValue(iptr,i,j)  = factor*MapValue(iptr,i,j) + value;
    }
  }
}
示例#6
0
文件: latexout.c 项目: jff/mathspad
char *char_latex(Char data, Bool math)
{
  if (!latexloaded) latex_autoload();
  if (data && math<5) {
    if (math) return MapValue(latexmath, data);
    return MapValue(latextext, data);
  } else return 0;
}
示例#7
0
void AppClass::Update(void)
{
	//Update the system's time
	m_pSystem->UpdateTime();

	//Update the mesh manager's time without updating for collision detection
	m_pMeshMngr->Update();

	//First person camera movement
	if (m_bFPC == true)
		CameraRotation();

	//Call the arcball method
	ArcBall();

	//Calculate delta and total times
	static double dTotalTime = 0.0; //Total time of the simulation
	double dDeltaTime = m_pSystem->LapClock(); //time difference between function calls
	dTotalTime += dDeltaTime; //Incrementing the time differences 

	float fStartTime = 0.0f;
	float fEndTime = 5.0f;
	float fAngle = MapValue(static_cast<float>(dTotalTime), fStartTime, fEndTime, 0.0f, 360.0f);
	m_m4Steve = glm::rotate(IDENTITY_M4, fAngle, REAXISZ);

	static float fStartHeight = 0.0f;
	static float fEndHeight = 5.0f;
	float fPercent = MapValue(static_cast<float>(dTotalTime), fStartTime, fEndTime, 0.0f, 1.0f);
	float fHeight = glm::lerp(fStartHeight, fEndHeight, fPercent);
	m_m4Steve = m_m4Steve * glm::translate(vector3(0.0f, fHeight, 0.0f));
	if (fPercent > 1.0f)
	{
		std::swap(fStartHeight, fEndHeight);
		dTotalTime = 0.0;
	}

	//Set the model matrix
	m_pMeshMngr->SetModelMatrix(m_m4Steve, "Steve");
	
	//Adds all loaded instance to the render list
	m_pMeshMngr->AddInstanceToRenderList("ALL");

	//Indicate the FPS
	int nFPS = m_pSystem->GetFPS();
	//Print info on the screen
	m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW);
	m_pMeshMngr->Print("Seconds:");
	m_pMeshMngr->PrintLine(std::to_string(dTotalTime), RERED);
	m_pMeshMngr->Print("FPS:");
	m_pMeshMngr->Print(std::to_string(nFPS), RERED);
}
示例#8
0
local void object_isothermal(int npars, real *pars)
{
  int i,nx = Nx(iptr);
  int j,ny = Ny(iptr);
  int l, lmax;
  real A = 1.0;   /* peak */
  real h = 1.0;   /* size */
  real p = -0.5;  /* power factor */
  real x1,y1,x2,y2,x3,y3,r,arg,value;
  real amp,phi,sum;
  real sinb,cosb;

  if (npar > 0) A = pars[0];
  if (npar > 1) h = pars[1];
  if (npar > 2) p = pars[2];
  dprintf(0,"isothermal: %g %g %g \n",A,h,p);

  if (A==0) return;

  lmax = Qtotflux ? 2 : 1;

  for (l=0; l<lmax; l++) {     /* 1st loop: sum up the flux   if in 2nd loop: normalize */
    if (l==0) 
      sum = 0.0;
    else {
      A /= sum;
      dprintf(0,"isothermal: A->%g\n",A);
    } 
    for (j=0; j<ny; j++) {
      y1 = (j-center[1])*Dy(iptr) + Ymin(iptr);
      for (i=0; i<nx; i++) {
	x1 = (i-center[0])*Dx(iptr) + Xmin(iptr);
	
	x2 =  -x1*sinp - y1*cosp;
	y2 =  (x1*cosp - y1*sinp)/cosi;

	r = (x2*x2+y2*y2)/(h*h);
	value = A * pow(1.0+r, p);

	if (Qtotflux) {   
	  if (l==0) 
	    sum += value;
	  else
	    MapValue(iptr,i,j) = factor*MapValue(iptr,i,j) + value;
	} else
	  MapValue(iptr,i,j) = factor*MapValue(iptr,i,j) + value;
      } /* i */
    } /* j */
  } /* k */
}
示例#9
0
文件: image.c 项目: jobovy/nemo
void ini_matrix(imageptr *iptr, int nx, int ny)
{
  int ix,iy;
	
  printf ("iptr @ %d    (sizeof = %d)\n",*iptr,sizeof(image));
	
  if (*iptr==0) {
    *iptr = (imageptr ) allocate((sizeof(image)));
    printf ("allocated image 'iptr' @ %d\n",*iptr);
    Frame(*iptr) = (real *) allocate (nx*ny*sizeof(real));
    printf ("Allocated frame @ %d\n",Frame(*iptr));
  } else {
    printf ("Image already allocated @ %d\n",*iptr);
    printf ("with Frame @ %d\n",Frame(*iptr));
  }
  Nx(*iptr) = nx;
  Ny(*iptr) = ny;
  Nz(*iptr) = 1;
  Xmin(*iptr) = 1.0;
  Ymin(*iptr) = 2.0;
  Zmin(*iptr) = 3.0;
  Dx(*iptr) = 0.1;
  Dy(*iptr) = 0.1;
  Dz(*iptr) = 0.1;
  Namex(*iptr) = NULL;        /* no axis names */
  Namey(*iptr) = NULL;
  Namez(*iptr) = NULL;
  Unit(*iptr)  = NULL;        /* no units */
  Mask(*iptr)  = NULL;

  set_iarray(*iptr);
  for (ix=0; ix<nx; ix++)
    for (iy=0; iy<ny; iy++)
      MapValue(*iptr,ix,iy)  = (ix*ny+iy)*0.1;
}
示例#10
0
文件: image.c 项目: jobovy/nemo
nemo_main()
{
    real frame[N][N];
    image f1;
    imageptr fp1, fp2;	/* or image *fp1 */
    stream instr,outstr;

    if (strcmp(getparam("mode"),"w")==0) {		/* write test */
	printf ("WRITING test (mode=w) foo.dat\n");
	outstr = stropen ("foo.dat","w");

	f1.frame = &frame[0][0];  /* compiler complained when = frame used ???? */
				  /* would be same as fp2->frame = ... */
	fp1 = &f1;		  /* to initialize structures, we need pointer to them */
	ini_matrix (&fp1,N,N);    /* ini_matrix MUST have pointer to pointer to image */
	
	fp2 = NULL;		  /* This is to check dynamic allocation of whole thing */
	ini_matrix (&fp2,N,N);

	write_image (outstr,fp2);
	write_image (outstr,&f1);		/* or fp1 */
	strclose(outstr);
	exit(0);
    } else {
	printf ("READING test (mode<>w) foo.dat\n");
	fp2=NULL;					/* read test */
	instr = stropen ("foo.dat","r");
	while (read_image(instr,&fp2)) {
            printf ("Read image\n");
            printf ("with MapValue(5,5)=%f\n",MapValue(fp2,5,5));
	}
	strclose(instr);
    }
}
示例#11
0
void AppClass::InitVariables(void)
{
	//Set the camera at a position other than the default
	m_pCameraMngr->SetPositionTargetAndView(
		vector3(0.0f, 0.0f, 35.0f),
		vector3(0.0f, 0.0f, 0.0f),
		REAXISY);

	m_nObjects = 100;

	m_pMatrix = new matrix4[m_nObjects];
	m_pSphere = new PrimitiveClass[m_nObjects];

	vector3 v3Start(-m_nObjects, 0.0f, 0.0f);
	vector3 v3End(m_nObjects, 0.0f, 0.0f);

	vector3 v3Current;
	
	for (uint i = 0; i < m_nObjects; i++)
	{
		float fPercent = MapValue(
									static_cast<float>(i), // Value to change
									0.0f,					// Original Min
									static_cast<float>(m_nObjects-1),//Original Max
									0.0f,					//New Min
									1.0f);					//Nem Max
		v3Current = glm::lerp(v3Start, v3End, fPercent);
		m_pSphere[i].GenerateSphere(0.5f, 5, RERED/*vector3(1.0f, 0.0f, 0.0f)*/);
		m_pMatrix[i] = glm::translate(v3Current);
	}
}
示例#12
0
/*
 *  create new map from scratch, using %x and %y as position parameters 
 *		0..nx-1 and 0..ny-1
 */
local void do_create(int nx, int ny,int nz)
{
    double m_min, m_max, total;
    real   fin[5], fout;
    int    ix, iy, iz;
    int    badvalues;
    
    m_min = HUGE; m_max = -HUGE;
    total = 0.0;		/* count total intensity in new map */
    badvalues = 0;		/* count number of bad operations */

    if (nz > 0) {
      warning("cube");
      if (!create_cube (&iptr, nx, ny, nz))	/* create default empty image */
        error("Could not create 3D image from scratch");
#if 0      
      Axis(iptr) = 1;      /* set linear axistype with a fits-style reference pixel */
#endif
      wcs_f2i(3,crpix,crval,cdelt,iptr);

      for (iz=0; iz<nz; iz++) {
        fin[2] = iz-crpix[2]+1;   /* crpix is 1 for first pixel (FITS convention) */
        for (iy=0; iy<ny; iy++) {
	  fin[1] = iy-crpix[1]+1;
	  for (ix=0; ix<nx; ix++) {
	    fout = 0.0;
	    CubeValue(iptr,ix,iy,iz) = fout;
	    m_min = MIN(m_min,fout);         /* and check for new minmax */
	    m_max = MAX(m_max,fout);
	    total += fout;                   /* add up totals */
	  }
        }
      }
    } else {
      warning("2d-map");
      if (!create_image (&iptr, nx, ny))	
        error("Could not create 2D image from scratch");
      wcs_f2i(2,crpix,crval,cdelt,iptr);

      for (iy=0; iy<ny; iy++) {
	fin[1] = iy;
	for (ix=0; ix<nx; ix++) {
	  fout = 0.0;
	  MapValue(iptr,ix,iy) = fout;
	  m_min = MIN(m_min,fout);         /* and check for new minmax */
	  m_max = MAX(m_max,fout);
	  total += fout;                   /* add up totals */
	}
      }
    } 
    
    MapMin(iptr) = m_min;
    MapMax(iptr) = m_max;

    dprintf(1,"New min and max in map are: %f %f\n",m_min,m_max);
    dprintf(1,"New total brightness/mass is %f\n",
			total*Dx(iptr)*Dy(iptr));
    if (badvalues)
    	warning ("There were %d bad operations in dofie",badvalues);
}
示例#13
0
nemo_main()
{
    imageptr iptr=NULL, optr=NULL;
    string *filename;
    stream instr, outstr;
    int i, j, i0, j0, nfiles;
    int nx, ny, nx1, ny1, ix, iy, n;

    nx = hasvalue("nx") ? getiparam("nx") : 0;
    ny = hasvalue("ny") ? getiparam("ny") : 0;
    
    filename = burststring(getparam("in")," ,\n");
    nfiles = xstrlen(filename,sizeof(string))-1;
    if (nx==0 && ny==0)
      error("Need at least one of nx= or ny=");
    else if (nx==0) {
      nx = nfiles/ny;
      dprintf(0,"nx=%d ny=%d nfiles=%d\n",nx,ny,nfiles);
      if (nfiles % ny) error("nfiles=%d/ny=%d does not divide evenly",nfiles,ny);
    } else if (ny==0) {
      ny = nfiles/nx;
      dprintf(0,"nx=%d ny=%d nfiles=%d\n",nx,ny,nfiles);
      if (nfiles % nx) error("nfiles=%d/nx=%d does not divide evenly",nfiles,nx);
    }

    for (iy=0, n=0; iy<ny; iy++) {
      for (ix=0; ix<nx; ix++, n++) {
	instr = stropen (filename[n],"r");
	read_image (instr,&iptr);               /* read image */
	strclose(instr);                        /* close image file */
	if (n==0) {
	  nx1 = Nx(iptr);
	  ny1 = Ny(iptr);
	  create_image(&optr,nx*nx1,ny*ny1);
	}
	i0 = ix*nx1;
	j0 = iy*ny1;
	for (j=0; j<ny1; j++)
	  for (i=0; i<nx1; i++)
	    MapValue(optr,i+i0,j+j0) = MapValue(iptr,i,j);
	i++;
      }
    }
    outstr = stropen(getparam("out"),"w");
    write_image(outstr,optr);
    strclose(outstr);
}
示例#14
0
local void object_bar(int npars, real *pars)
{
  int i,nx = Nx(iptr);
  int j,ny = Ny(iptr);
  real A = 1.0;
  real h = 1.0;
  real e = 0.0;
  real b = 0.0;
  real x1,y1,x2,y2,x3,y3,r,arg,value;
  real sinb,cosb,omba;

  if (npar > 0) A = pars[0];
  if (npar > 1) h = pars[1];
  if (npar > 2) e = pars[2];
  if (npar > 3) b = pars[3];
  dprintf(0,"bar: %g %g %g %g\n",A,h,e,b);

  sinb = sin(b*PI/180.0);
  cosb = cos(b*PI/180.0);

  if (A==0) return;

  if (Qtotflux) {
    A /= (PI*h*h*(1-e)/surface);
    dprintf(0,"bar: A->%g\n",A);
  }
  dprintf(1,"bar b=%g\n",b);

  for (j=0; j<ny; j++) {
    y1 = (j-center[1])*Dy(iptr) + Ymin(iptr);
    for (i=0; i<nx; i++) {
      x1 = (i-center[0])*Dx(iptr) + Xmin(iptr);

      x2 =  -x1*sinp - y1*cosp;
      y2 =   (x1*cosp - y1*sinp)/cosi;

      x3 =   x2*cosb - y2*sinb;
      y3 = (x2*sinb  + y2*cosb)/(1-e);

      r = sqrt(x3*x3+y3*y3);
      arg = r/h;
      value = (arg < 100) ? A * exp(-arg) : 0.0;
      MapValue(iptr,i,j) = factor*MapValue(iptr,i,j) + value;
    }
  }
}
示例#15
0
local void object_flat(int npars, real *pars)
{
  int i,j;
  int nx = Nx(iptr);
  int ny = Ny(iptr);
  real A = 1.0;

  if (A==0) return;

  if (npar > 0) A = pars[0];

  if (Qtotflux) A /= (nx*ny);

  for (j=0; j<ny; j++)
    for (i=0; i<nx; i++)
      MapValue(iptr,i,j) = factor*MapValue(iptr,i,j) + A;

}
示例#16
0
void AppClass::InitVariables(void)
{
	//m_selection = std::pair<int, int>(-1, -1);
	////Set the camera at a position other than the default
	//m_pCameraMngr->SetPositionTargetAndView(vector3(0.0f, 2.5f, 12.0f), vector3(0.0f, 2.5f, 11.0f), REAXISY);

	//m_pLightMngr->SetColor(REWHITE, 0);
	//m_pLightMngr->SetIntensity(0.1f, 0);
	//m_pLightMngr->SetColor(REWHITE, 1);
	//m_pLightMngr->SetIntensity(0.5f, 1);
	//m_pLightMngr->SetPosition(vector3(0.0f, 1.0f,-1.0f), 1);

	////Load a model onto the Mesh manager
	////m_pMeshMngr->LoadModel("tests\\Cubev.fbx", "Unikitty");
	//int nCubes = 10;
	//vector3 v3Start(-nCubes/2.0f, 0.0f, -nCubes / 2.0f);
	//m_pMeshMngr->LoadModel("Cube.obj", "ElCubo");
	//m_pMeshMngr->SetShaderProgramByName("ElCubo", "Phong");
	//for (uint n = 0; n < nCubes; n++)
	//{
	//	if (v3Start != vector3(0.0f))
	//	{
	//		String sName = "Cube_" + std::to_string(n);
	//		m_pMeshMngr->LoadModel("Cube.obj", sName, false, glm::translate(v3Start));
	//		m_pMeshMngr->SetShaderProgramByName(sName, "Phong");
	//	}
	//	v3Start += vector3(1.0f, 0.0f, 1.0f);
	//}

	m_pCameraMngr->SetPositionTargetAndView(
		vector3(0.0f, 2.5f, 12.0f),
		vector3(0.0f, 2.5f, 11.0f),
		vector3(0.0f, 1.0f, 0.0f));

	m_nObjects = 10;

	m_pSphere = new PrimitiveClass[m_nObjects];
	m_pMatrix = new matrix4[m_nObjects];

	vector3 v3Start(-static_cast<float>(m_nObjects),0.0f,0.0f);
	vector3 v3End(static_cast<float>(m_nObjects), 0.0f, 0.0f);
	vector3 v3Current = glm::lerp(v3Start,v3End,1.0f);

	for (uint i = 0; i < m_nObjects; i++)
	{
		float fPercent = MapValue(
			static_cast<float>(i),				//value to change
			0.0f,								//original min
			static_cast<float>(m_nObjects) -1,		//original max
			0.0f,								//new min
			1.0f								//new max
			);
		m_pSphere[i].GenerateSphere(0.5f, 5, RERED);
		vector3 v3Current = glm::lerp(v3Start, v3End, fPercent);
		m_pMatrix[i] = glm::translate(v3Current);
	}
}
示例#17
0
文件: uniconv.c 项目: jff/mathspad
static unsigned char *enfail_12bit(unsigned char *source, void *data)
{
    MapUchar mc=data;
    Uchar c;
    int n=0;
    if (!source) return NULL;
    while (*source) {
	c=((source[0])<<8)|(source[1]);
	if (MapValue(mc,c)) {
	    source+=2;
	    n++;
	} else {
	    c=*source++;
	    if (!MapValue(mc,c)) return source-1;
	}
    }
    return NULL;
}
示例#18
0
文件: uniconv.c 项目: jff/mathspad
static int enlen_12bit(unsigned char *source, void *data)
{
    MapUchar mc=data;
    Uchar c;
    int n=0;
    if (!source) return n;
    while (*source) {
	c=((source[0])<<8)|(source[1]);
	if (MapValue(mc,c)) {
	    source+=2;
	    n++;
	} else {
	    c=*source++;
	    if (MapValue(mc,c)) n++;
	}
    }
    return n;
}
示例#19
0
void AppClass::Update(void)
{
#pragma region Does not change anything here
	//Update the system's time
	m_pSystem->UpdateTime();

	//Update the mesh manager's time without updating for collision detection
	m_pMeshMngr->Update();
#pragma endregion

#pragma region Does not need changes but feel free to change anything here
	//Lets us know how much time has passed since the last call
	double fTimeSpan = m_pSystem->LapClock(); //Delta time (between frame calls)

	//cumulative time
	static double fRunTime = 0.0f; //How much time has passed since the program started
	fRunTime += fTimeSpan; 
#pragma endregion

#pragma region Your Code goes here

	float fPercent = MapValue(static_cast<float>(fRunTime), 0.0f, fDuration, 0.0f, 1.0f);	//makes a percentage based on how close fRuntime is getting to fDuration
	vector3 move = glm::lerp(movePoints[currentPoint], movePoints[nextPoint], fPercent);	//uses the above percentage to make a vector3 that is that percentage between currentPoint and nextPoint
	moving = glm::translate(move);	//takes the above vector3 and makes a mat4 translation
	m_pMeshMngr->SetModelMatrix(moving, "WallEye");		//applies that mat4 to the walleye

	//if it gets to the movement point
	if (fRunTime > fDuration) {
		//makes it so that the new currentPoint is the one we just got to
		currentPoint = nextPoint;
		//then make nextPoint the point after that
		nextPoint++;
		//sets runtime to zero for the next cycle
		fRunTime = 0;

		//if we are on the last point, set it so that the next movement point we go to is the first one
		if (currentPoint > 9) {
			nextPoint = 0;
		}
	}

#pragma endregion

#pragma region Does not need changes but feel free to change anything here
	//Adds all loaded instance to the render list
	m_pMeshMngr->AddInstanceToRenderList("ALL");

	//Indicate the FPS
	int nFPS = m_pSystem->GetFPS();

	//Print info on the screen
	m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW);
	m_pMeshMngr->Print("FPS:");
	m_pMeshMngr->Print(std::to_string(nFPS), RERED);
#pragma endregion
}
示例#20
0
文件: uniconv.c 项目: jff/mathspad
static unsigned char *enfail_8bit(unsigned char *source, void *data)
{
    MapUchar mc=data;
    Uchar c;
    if (!source) return NULL;
    while (*source) {
	c=*source++;
	if (!MapValue(mc,c)) return source-1;
    }
    return NULL;
}
示例#21
0
文件: unifont.c 项目: jff/mathspad
static int add_font_range(int fontnr, int attribpos, MapUchar encoding,
			  Uchar start, Uchar end)
{
    int i,j,k;
    MapInt change=NULL;
    j=attribpos;
    if (allchars[j]==empty_charmap) allchars[j]=MapIntCreate();
    change=allchars[j];
    /* optimisation:  skip empty submaps to reduce loops */
    for (i=start; i<=end; i++) {
	if (!(i%UNI_MAPSIZE) && EmptySubmap(encoding,i)) {
	    i=i+UNI_MAPSIZE-1;
	} else if ((j=MapValue(encoding, i))) {
            k=(fontnr<<16)+i;
            if (!MapValue(change,j)) MapIntDefine(change,j,k);
            if (!MapValue(def_charmap, j)) MapIntDefine(def_charmap, j, k);
        }
    }
    return 1;
}
示例#22
0
文件: uniconv.c 项目: jff/mathspad
static int enlen_8bit(unsigned char *source, void *data)
{
    MapUchar mc=data;
    Uchar c;
    int n=0;
    if (!source) return n;
    while (*source) {
	c=*source++;
	if (MapValue(mc,c)) n++;
    }
    return n;
}
示例#23
0
文件: uniconv.c 项目: jff/mathspad
static Uchar *defail_16bit(Uchar *source, void *data)
{
    MapUchar mc=data;
    Uchar c;
    if (!source) return NULL;
    while (*source) {
	c=*source++;
	c=MapValue(mc,c);
	if (!((c&0xff00) && (c&0x00ff))) return source-1;
    }
    return NULL;
}
示例#24
0
文件: uniconv.c 项目: jff/mathspad
static Uchar *defail_8bit(Uchar *source, void *data)
{
    MapUchar mc=data;
    Uchar c;
    if (!source) return NULL;
    while (*source) {
	c=*source++;
	c=MapValue(mc,c);
	if (!(c && c<256)) return source-1;
    }
    return NULL;
}
示例#25
0
文件: uniconv.c 项目: jff/mathspad
static int delen_8bit(Uchar *source, void *data)
{
    MapUchar mc=data;
    Uchar c;
    int n=0;
    if (!source) return n;
    while (*source) {
	c=*source++;
	c=MapValue(mc,c);
	if (c && c<256) n++;
    }
    return n;
}
示例#26
0
GlobalAlias* cloneGlobalAlias(Module &Dst, const GlobalAlias &OrigA,
                              ValueToValueMapTy &VMap,
                              ValueMaterializer *Materializer) {
  assert(OrigA.getAliasee() && "Original alias doesn't have an aliasee?");
  auto *NewA = GlobalAlias::create(OrigA.getValueType(),
                                   OrigA.getType()->getPointerAddressSpace(),
                                   OrigA.getLinkage(), OrigA.getName(), &Dst);
  NewA->copyAttributesFrom(&OrigA);
  VMap[&OrigA] = NewA;
  NewA->setAliasee(cast<Constant>(MapValue(OrigA.getAliasee(), VMap, RF_None,
                                           nullptr, Materializer)));
  return NewA;
}
示例#27
0
文件: unifont.c 项目: jff/mathspad
/* Currently, a default character table is used to remap all attributes
** at once. A better result would be achieved if the remapping uses a
** table to remap attributes, like LaTeX does. For example, an order
** on the available attribute groups creates an order on the
** possible attribute combinations:  replace the least important attribute
** by its default value and check if that glyph is available. Repeat this
** until a character is found. The remapping can be stored in a table,
** which can be replaced easily by a different table.
** (Attribute combinations are stored as integers, the table would just
**  remap each integer to a different integer until a fixed point is
**  reached.)
*/
CharInfo *default_character_info(Uchar c)
{
    int j,k;
    int ca,m;
    ca = remaptable[current_attr];

    k=j=m=0;
    while (ca!= -1 && m<10) {
      k=MapValue(allchars[ca], c);
      if (k) {
	j=k>>16;
	if (fontarr[j]->loaded==FONT_NOT_LOADED) {
	  fontarr[j]->loaded= load_system_font(fontarr[j]);
	}
	if (fontarr[j]->loaded!=FONT_SUCCESS) {
	  MapValue(allchars[ca],c)=0;
	  k=0;
	}
      }
      if (!k) {
	ca = remaptable[ca];
	m++;
      } else {
	break;
      }
    }
    if (!k) {
      k=MapValue(def_charmap, c);
      if (k) {
	j=k>>16;
	if (fontarr[j]->loaded==FONT_NOT_LOADED) {
	  fontarr[j]->loaded = load_system_font(fontarr[j]);
	}
	if (fontarr[j]->loaded!=FONT_SUCCESS) {
	  MapValue(def_charmap,c)=0;
	  k=0;
	}
      }
    }
示例#28
0
void AppClass::Update(void)
{
	//Update the system's time
	m_pSystem->UpdateTime();

	//Update the mesh manager's time without updating for collision detection
	m_pMeshMngr->Update();

	//First person camera movement
	if (m_bFPC == true)
		CameraRotation();

	//Call the arcball method
	ArcBall();

	//Lets us know how much time has passed since the last call
	double fTimeSpan = m_pSystem->LapClock();

	//cumulative time
	static double fRunTime = 0.0f;
	fRunTime += fTimeSpan;

	matrix4 mOrientation = glm::rotate(IDENTITY_M4, m_v3Rotation.x, vector3(1.0f, 0.0f, 0.0f));
	mOrientation = mOrientation * glm::rotate(IDENTITY_M4, m_v3Rotation.y, vector3(0.0f, 1.0f, 0.0f));
	mOrientation = mOrientation * glm::rotate(IDENTITY_M4, m_v3Rotation.z, vector3(0.0f, 0.0f, 1.0f));

	vector3 v3Start(0.0f, 0.0f, 0.0f);
	vector3 v3End(0.0f, 90.0f, 0.0f);
	static float fDifference = 0.0f;
	fDifference += 0.1f;
	fDifference = MapValue(static_cast<float>(fRunTime), 0.0f, 10.0f, 0.0f, 1.0f);

	float fPosition = glm::lerp(v3Start, v3End, fDifference).y;

	mOrientation = glm::rotate(IDENTITY_M4, fPosition, vector3(0.0f, 1.0f, 0.0f));

	m_pMeshMngr->SetModelMatrix(mOrientation, "Steve");
	
	//Adds all loaded instance to the render list
	m_pMeshMngr->AddInstanceToRenderList("ALL");

	//Indicate the FPS
	int nFPS = m_pSystem->GetFPS();
	//print info into the console
	//printf("FPS: %d            \r", nFPS);//print the Frames per Second
	//Print info on the screen
	m_pMeshMngr->PrintLine(m_pSystem->GetAppName(), REYELLOW);

	m_pMeshMngr->Print("FPS:");
	m_pMeshMngr->Print(std::to_string(nFPS), RERED);
}
示例#29
0
文件: uniconv.c 项目: jff/mathspad
static int delen_16bit(Uchar *source, void *data)
{
    MapUchar mc=data;
    Uchar c;
    int n=0;
    if (!source) return n;
    while (*source) {
	c=*source++;
	c=MapValue(mc,c);
	/* only add if both bytes are not zero */
	if ((c&0xff00) && (c&0x00ff)) n=n+2;
    }
    return n;
}
示例#30
0
void Enemy::move(double fTimeSpan)
{
	//cout << "calling update of" << name << endl;
	
	fRunTime += fTimeSpan;
	float flerp = MapValue(fRunTime, 0.0f, 10.0f, 0.0f, 1.0f);
	vector3 v3lerp = glm::lerp(pos, vector3(0,1,0), flerp);
	GameObject::SetModelMatrix(glm::translate(v3lerp) * glm::rotate(rotation, vector3(0,1,0)));
	/*
	meshManager->SetModelMatrix(glm::translate(v3lerp), name);
	BOMngr->SetModelMatrix(name, meshManager->GetModelMatrix(name));*/
	GameObject::Render();
	

}