Example #1
0
File: scp.c Project: rdebath/sgt
/*
 *  Wait for a response from the other side.
 *  Return 0 if ok, -1 if error.
 */
static int response(void)
{
    char ch, resp, rbuf[2048];
    int p;

    if (ssh_recv(&resp, 1) <= 0)
	bump("Lost connection");

    p = 0;
    switch (resp) {
      case 0:		/* ok */
	return (0);
      default:
	rbuf[p++] = resp;
	/* fallthrough */
      case 1:		/* error */
      case 2:		/* fatal error */
	do {
	    if (ssh_recv(&ch, 1) <= 0)
		bump("Protocol error: Lost connection");
	    rbuf[p++] = ch;
	} while (p < sizeof(rbuf) && ch != '\n');
	rbuf[p-1] = '\0';
	if (resp == 1)
	    fprintf(stderr, "%s\n", rbuf);
	else
	    bump("%s", rbuf);
	errs++;
	return (-1);
    }
}
Example #2
0
bool
RGetNextEvent(	
	word				mask,
	REventRecord*	event)
{
	/* return next event to user */

	word ret = 0;
	REventRecord *found;

	if (joyHandle)
		PollJoystick();

	found = evHead;
	while (found != evTail){	/* scan all events in evQueue */
		if (found->type & mask){
			ret = 1;
			break;
		}
		found = bump(found);
	}

	if (ret){		/* give it to him and blank it out */
		memcpy((memptr) event, (memptr) found, sizeof(REventRecord));
		found->type = nullEvt;
		evHead = bump(evHead);
	} else {
		MakeNullEvent(event);	/* use his storage */
	}
	return(ret);
}
Example #3
0
void initializeRobot()
{
	const byte max = 127;
	//Lift raises at max speed until top button is pressed.
	motor[Lift] = max;
	while (!SensorValue(LiftTouchHigh))	{}
	motor[Lift] = 0;
	nMotorEncoder[Lift] = 0; // THIS VALUE MUST BE THE VALUE OF THE POSITION OF THE TOUCH SENSOR
	while (SensorValue(LiftTouchHigh))
		bump(Lift, false);
	//Reset Lift encoder. UNCOMMENT IF LIFT ENCODER IS WIRED.
	nMotorEncoder[Lift] = 0;
	//Move Lift down to center.
	bump(Lift, false);

	//Arm retracts at max speed until button is pressed.
	motor[Arm] = -max;
	while (!SensorValue(ArmTouch))	{}
	motor[Arm] = 0;
	nMotorEncoder[Arm] = 0; // THIS VALUE MUST BE THE VALUE OF THE POSITION OF THE TOUCH SENSOR
	while (SensorValue(ArmTouch))
	bump(Arm, true);

	//Reset all drive encoders. UNCOMMENT IF DRIVER ENCODERS ARE WIRED.
	//resetDriveEncoders();
	//Set Scoop to full down position.
	servo[Scoop] = 255;
}
Example #4
0
void
RPostEvent(
	REventRecord*	event)
{
	// add event to evQueue at evTail, bump evHead if == evTail

	event->when = RTickCount();
	memcpy((memptr) evTail, (memptr) event, sizeof(REventRecord));
	evTail = bump(evTail);
	if (evTail == evHead)	/* throw away oldest */
		evHead = bump(evHead);
}
Example #5
0
File: scp.c Project: rdebath/sgt
/*
 *  Initialize the Win$ock driver.
 */
static void init_winsock(void)
{
    WORD winsock_ver;
    WSADATA wsadata;

    winsock_ver = MAKEWORD(1, 1);
    if (WSAStartup(winsock_ver, &wsadata))
	bump("Unable to initialise WinSock");
    if (LOBYTE(wsadata.wVersion) != 1 ||
	HIBYTE(wsadata.wVersion) != 1)
	bump("WinSock version is incompatible with 1.1");
}
Example #6
0
bool
REventAvail(
	word				mask,
	REventRecord*	event)
{
	// return but don't remove

	word ret = 0;
	REventRecord *found;

	found = evHead;
	while (found != evTail){	/* scan all events in evQueue */
		if (found->type & mask){
			ret = 1;
			break;
		}
		found = bump(found);
	}

	/* a null REventRecord pointer says just return result */
	if (event){
		if (ret)
			memcpy((memptr) event, (memptr) found, sizeof(REventRecord));
		else
			MakeNullEvent(event);

	}

	return(ret);
}
Example #7
0
/*****************************************************************************************************************
	Detect if Player is Out Side of Game Area
******************************************************************************************************************/
void Player::EdgeDectection()
{
	Vector3 bump(2, 2, 0); // bump player off edge so they don't get stuck
	// right/eastern edge check
	if ((m_position.m_x + PLAYER_EDGE) >= SCREEN_W)
	{
		m_position -= bump;
		Bounce(BOUNCE);
	}
	// top/northern edge check
	else if ((m_position.m_y + PLAYER_EDGE) >= SCREEN_H)
	{
		m_position -= bump;
		Bounce(BOUNCE);
	}
	// left/western edge check
	else if ((m_position.m_x - PLAYER_EDGE) <= 0)
	{
		m_position += bump;
		Bounce(BOUNCE);
	}
	// bottom/southern edge check
	else if ((m_position.m_y - PLAYER_EDGE) <= 0)
	{
		m_position += bump;
		Bounce(BOUNCE);
	}
	// if player manages to exist game space, reset
	if (m_position.m_x > SCREEN_W || m_position.m_x < 0 || m_position.m_y > SCREEN_H || m_position.m_y < 0)
	{
		Reset();
	}
}
Example #8
0
File: scp.c Project: rdebath/sgt
void ssh_get_password(char *prompt, char *str, int maxlen)
{
    HANDLE hin, hout;
    DWORD savemode, i;

    if (password) {
	strncpy(str, password, maxlen);
	str[maxlen-1] = '\0';
	password = NULL;
	return;
    }

    hin = GetStdHandle(STD_INPUT_HANDLE);
    hout = GetStdHandle(STD_OUTPUT_HANDLE);
    if (hin == INVALID_HANDLE_VALUE || hout == INVALID_HANDLE_VALUE)
	bump("Cannot get standard input/output handles");

    GetConsoleMode(hin, &savemode);
    SetConsoleMode(hin, (savemode & (~ENABLE_ECHO_INPUT)) |
		   ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT);

    WriteFile(hout, prompt, strlen(prompt), &i, NULL);
    ReadFile(hin, str, maxlen-1, &i, NULL);

    SetConsoleMode(hin, savemode);

    if ((int)i > maxlen) i = maxlen-1; else i = i - 2;
    str[i] = '\0';

    WriteFile(hout, "\r\n", 2, &i, NULL);
}
Example #9
0
//C.5.2.2
bool VaapiDecoderH265::DPB::init(const PicturePtr& picture,
     const H265SliceHdr *const slice,  const H265NalUnit *const nalu, bool newStream)
{
    forEach(markUnusedReference);
    if (!initReference(picture, slice, nalu, newStream))
        return false;
    if (isIrap(nalu) && picture->m_noRaslOutputFlag && !newStream) {
        bool noOutputOfPriorPicsFlag;
        //TODO how to check C.5.2.2 item 1's second otherwise
        if (isCra(nalu))
            noOutputOfPriorPicsFlag = true;
        else
            noOutputOfPriorPicsFlag = slice->no_output_of_prior_pics_flag;
        clearRefSet();
        if (!noOutputOfPriorPicsFlag) {
            removeUnused();
            bumpAll();
        }
        m_pictures.clear();
        return true;
    }
    removeUnused();
    const H265PPS* const pps = slice->pps;
    const H265SPS* const sps = pps->sps;
    while (checkReorderPics(sps) || checkLatency(sps) || checkDpbSize(sps))
        bump();

    return true;
}
Example #10
0
void solve()
{
  std::vector<int64_t> values(steps + 1, 1);
  for (auto i = 0; i < steps; ++i)
    bump(values);
  std::cout << values[steps] << "\n";
}
Example #11
0
File: scp.c Project: rdebath/sgt
/*
 *  We will copy files from a remote server to the local machine.
 */
static void tolocal(int argc, char *argv[])
{
    char *src, *targ, *host, *user;
    char *cmd;

    if (argc != 2)
	bump("More than one remote source not supported");

    src = argv[0];
    targ = argv[1];

    /* Separate host from filename */
    host = src;
    src = colon(src);
    if (src == NULL)
	bump("Local to local copy not supported");
    *src++ = '\0';
    if (*src == '\0')
	src = ".";
    /* Substitute "." for empty filename */

    /* Separate username and hostname */
    user = host;
    host = strrchr(host, '@');
    if (host == NULL) {
	host = user;
	user = NULL;
    } else {
	*host++ = '\0';
	if (*user == '\0')
	    user = NULL;
    }

    cmd = smalloc(strlen(src) + 100);
    sprintf(cmd, "scp%s%s%s%s -f %s",
	    verbose ? " -v" : "",
	    recursive ? " -r" : "",
	    preserve ? " -p" : "",
	    targetshouldbedirectory ? " -d" : "",
	    src);
    do_cmd(host, user, cmd);
    sfree(cmd);

    sink(targ);
}
Example #12
0
void PhysicsEngine::removeObject(ObjectMotionState* object) {
    // wake up anything touching this object
    bump(object);
    removeContacts(object);

    btRigidBody* body = object->getRigidBody();
    assert(body);
    _dynamicsWorld->removeRigidBody(body);
}
Example #13
0
      // bump something to the top of the lru
      bool bump(const key_type & key)
      {
         iterator itr = find(key);

         if(itr == m_lru.end())
            return false;

         return bump(itr);
      }
Example #14
0
void msm6242_device::update_rtc_registers()
{
	// get the absolute current time, in ticks
	UINT64 curtime = current_time();

	// how long as it been since we last updated?
	UINT64 delta = curtime - m_last_update_time;

	// set current time
	m_last_update_time = curtime;

	// no delta?  just return
	if (delta == 0)
		return;

	// ticks
	if ((m_tick % 200) != (int)((delta + m_tick) % 0x200))
		irq(IRQ_64THSECOND);
	delta = bump(RTC_TICKS, delta, 0, 0x8000);
	if (delta == 0)
		return;

	// seconds
	irq(IRQ_SECOND);
	delta = bump(RTC_SECOND, delta, 0, 60);
	if (delta == 0)
		return;

	// minutes
	irq(IRQ_MINUTE);
	delta = bump(RTC_MINUTE, delta, 0, 60);
	if (delta == 0)
		return;

	// hours
	irq(IRQ_HOUR);
	delta = bump(RTC_HOUR, delta, 0, 24);
	if (delta == 0)
		return;

	// days
	while(delta--)
		advance_days();
}
Example #15
0
Radiance3 RayTracer::L_indirectImpulses(const shared_ptr<Surfel>& surfel, const Vector3& wo, ThreadData& threadData, int bouncesLeft) const {
    Surfel::ImpulseArray impulseArray;
    surfel->getImpulses(PathDirection::EYE_TO_SOURCE, wo, impulseArray);

    Radiance3 L;
    for (int i = 0; i < impulseArray.size(); ++i) {
        const Surfel::Impulse& impulse = impulseArray[i];
        L += L_in(bump(surfel, impulse.direction), impulse.direction, threadData, bouncesLeft) * impulse.magnitude;
    }

    return L;
}
Example #16
0
bool VaapiDecoderH265::DPB::add(const PicturePtr& picture, const H265SliceHdr* const lastSlice)
{
    const H265PPS* const pps = lastSlice->pps;
    const H265SPS* const sps = pps->sps;

    forEach(addLatency);
    picture->m_picLatencyCount = 0;
    picture->m_isReference = true;
    m_pictures.insert(picture);
    while (checkReorderPics(sps) || checkLatency(sps))
        bump();
    return true;
}
void
Upgrade::collision(void* p_c_object, int c_object, CollisionType type)
{
  Player* pplayer = NULL;

  if(type == COLLISION_BUMP) {
    if(c_object == CO_PLAYER)
      pplayer = (Player*) p_c_object;
    bump(pplayer);
    return;
  }

  switch (c_object)
    {
    case CO_PLAYER:
      /* Remove the upgrade: */

      /* p_c_object is CO_PLAYER, so assign it to pplayer */
      pplayer = (Player*) p_c_object;

      /* Affect the player: */

      if (kind == UPGRADE_GROWUP)
        {
          play_sound(sounds[SND_EXCELLENT], SOUND_CENTER_SPEAKER);
          pplayer->grow();
        }
      else if (kind == UPGRADE_ICEFLOWER)
        {
          play_sound(sounds[SND_COFFEE], SOUND_CENTER_SPEAKER);
          pplayer->grow();
          pplayer->got_coffee = true;
        }
      else if (kind == UPGRADE_HERRING)
        {
          play_sound(sounds[SND_HERRING], SOUND_CENTER_SPEAKER);
          pplayer->invincible_timer.start(TUX_INVINCIBLE_TIME);
          World::current()->play_music(HERRING_MUSIC);
        }
      else if (kind == UPGRADE_1UP)
        {
          if(player_status.lives < MAX_LIVES) {
            player_status.lives++;
            play_sound(sounds[SND_LIFEUP], SOUND_CENTER_SPEAKER);
          }
        }

      remove_me();
      return;
    }
}
Example #18
0
File: scp.c Project: rdebath/sgt
/*
 *  Open an SSH connection to user@host and execute cmd.
 */
static void do_cmd(char *host, char *user, char *cmd)
{
    char *err, *realhost;

    if (host == NULL || host[0] == '\0')
	bump("Empty host name");

    /* Try to load settings for this host */
    do_defaults(host);
    if (cfg.host[0] == '\0') {
	/* No settings for this host; use defaults */
	strncpy(cfg.host, host, sizeof(cfg.host)-1);
	cfg.host[sizeof(cfg.host)-1] = '\0';
	cfg.port = 22;
    }

    /* Set username */
    if (user != NULL && user[0] != '\0') {
	strncpy(cfg.username, user, sizeof(cfg.username)-1);
	cfg.username[sizeof(cfg.username)-1] = '\0';
    } else if (cfg.username[0] == '\0') {
	bump("Empty user name");
    }

    if (cfg.protocol != PROT_SSH)
	cfg.port = 22;

    if (portnumber)
	cfg.port = portnumber;

    err = ssh_init(cfg.host, cfg.port, cmd, &realhost);
    if (err != NULL)
	bump("ssh_init: %s", err);
    if (verbose && realhost != NULL)
	fprintf(stderr, "Connected to %s\n", realhost);

    connection_open = 1;
}
Example #19
0
void RayTracer::traceOnePhoton(int ignoreX, int ignoreY, int threadID) {
    ThreadData& threadData(m_threadData[threadID]);

    Photon photon;
    emitPhoton(*threadData.rnd, photon);

    const float MIN_POWER_THRESHOLD = 0.001f / m_settings.photon.numEmitted;

    float probabilityHint = 1.0;

    for (int numBounces = 0;
            (numBounces < m_settings.photon.numBounces) &&
            (photon.power.sum() > MIN_POWER_THRESHOLD);
            ++numBounces) {
        // Find the first surface
        float distance = finf();
        const shared_ptr<Surfel>& surfel = castRay(photon.position, -photon.wi, distance, false);

        if (isNull(surfel)) {
            return;
        }

        // Store the photon (if this is not the first bounce and it is
        // not a purely specular surface)
        if ((numBounces > 0) && surfel->nonZeroFiniteScattering()) {
            photon.effectRadius = photonEffectRadius(probabilityHint);

            // Update photon position. Store it slightly before it hit the surface
            // to improve filtering later.
            photon.position = surfel->position + photon.wi * min(photon.effectRadius, distance) / 4;

            // Store a copy of this photon
            m_photonList[threadID].append(photon);
        }

        // Scatter
        Color3  weight;
        Vector3 wo;
        float   probabilityScale;
        surfel->scatter(PathDirection::SOURCE_TO_EYE, photon.wi, true, *threadData.rnd, weight, wo, probabilityScale);

        probabilityHint *= probabilityScale;

        // Update photon power and direction
        photon.power *= weight;
        photon.wi = -wo;

        photon.position = bump(surfel, wo);
    }
}
Example #20
0
static void
lmsr_adapt_i (LMSR lms)
{
  int i, j, k;
  REAL sum_sq, scl1, scl2;
  COMPLEX accum, error;

  scl1 = (REAL) (1.0 - rate * leak);

  for (i = 0; i < ssiz; i++)
    {

      dlay (dptr) = CXBdata (lms->signal, i);
      accum = cxzero;
      sum_sq = 0;

      for (j = 0; j < asiz; j+=2)
		{
			k = wrap (j);
			sum_sq += Csqrmag (dlay (k));
			accum.re += afil (j).re * dlay (k).re;
			accum.im += afil (j).im * dlay (k).im;

			k = wrap (j+1);
			sum_sq += Csqrmag (dlay (k));
			accum.re += afil (j+1).re * dlay (k).re;
			accum.im += afil (j+1).im * dlay (k).im;
		}

      error = Csub(cssig(i),accum);
	  cssig(i) = error;
//     ssig_i (i) = error.im;
//	  ssig (i) = error.re;

      scl2 = (REAL) (rate / (sum_sq + 1.19e-7));
      error = Cscl(error,scl2);
      for (j = 0; j < asiz; j+=2)
		{
			k = wrap (j);
			afil (j).re = afil (j).re * scl1 + error.re * dlay (k).re;
			afil (j).im = afil (j).im * scl1 + error.im * dlay (k).im;

			k = wrap (j+1);
			afil (j+1).re = afil (j+1).re * scl1 + error.re * dlay (k).re;
			afil (j+1).im = afil (j+1).im * scl1 + error.im * dlay (k).im;
		}

      dptr = bump (dptr);
    }
}
Example #21
0
File: scp.c Project: rdebath/sgt
/*
 *  We will issue a list command to get a remote directory.
 */
static void get_dir_list(int argc, char *argv[])
{
    char *src, *host, *user;
    char *cmd, *p, *q;
    char c;

    src = argv[0];

    /* Separate host from filename */
    host = src;
    src = colon(src);
    if (src == NULL)
	bump("Local to local copy not supported");
    *src++ = '\0';
    if (*src == '\0')
	src = ".";
    /* Substitute "." for empty filename */

    /* Separate username and hostname */
    user = host;
    host = strrchr(host, '@');
    if (host == NULL) {
	host = user;
	user = NULL;
    } else {
	*host++ = '\0';
	if (*user == '\0')
	    user = NULL;
    }

    cmd = smalloc(4*strlen(src) + 100);
    strcpy(cmd, "ls -la '");
    p = cmd + strlen(cmd);
    for (q = src; *q; q++) {
	if (*q == '\'') {
	    *p++ = '\''; *p++ = '\\'; *p++ = '\''; *p++ = '\'';
	} else {
	    *p++ = *q;
	}
    }
    *p++ = '\'';
    *p = '\0';
    
    do_cmd(host, user, cmd);
    sfree(cmd);

    while (ssh_recv(&c, 1) > 0)
	fputc(c, stdout);	       /* thank heavens for buffered I/O */
}
Example #22
0
      /// Gets a value given a key.  Returns false if not in lru.
      bool get(const key_type & key, mapped_type & value, bool bbump = true)
      {
         iterator itr = find(key);

         if(itr == m_lru.end())
            return false;

         // first, move the iterator to the tail of the lru
         if(bbump)
            bump(itr);

         // now get the value
         value = itr->second;
         return true;
      }
Example #23
0
static void
roll_up				(vbi_page *		pg,
				 int			first_row,
				 int			last_row)
{
	ushort scol, *canvas = ximgdata + 45 * DISP_WIDTH;
	vbi_rgba col;
	int i, j;

#if 1 /* soft */

	sh_first = first_row;
	sh_last = last_row;
	shift = 26;
	bump(step, FALSE);

	canvas += 48 + (((last_row * CELL_HEIGHT) + CELL_HEIGHT - step)
			* DISP_WIDTH);
	col = pg->color_map[pg->text[last_row * pg->columns].background];
	scol = RGB565 (col);

	for (j = 0; j < step; ++j) {
		if (pg->text[last_row * pg->columns].opacity
		    == VBI_TRANSPARENT_SPACE) {
			for (i = 0; i < CELL_WIDTH * pg->columns; ++i)
				canvas[i] = RGB565 (COLORKEY);
		} else {
			for (i = 0; i < CELL_WIDTH * pg->columns; ++i)
				canvas[i] = scol;
		}

		canvas += DISP_WIDTH;
	}

#else /* at once */

	memmove (canvas + first_row * CELL_HEIGHT * DISP_WIDTH,
		 canvas + (first_row + 1) * CELL_HEIGHT * DISP_WIDTH,
		 (last_row - first_row) * CELL_HEIGHT * DISP_WIDTH * 2);

	draw_video (48, 45 + last_row * CELL_HEIGHT,
		    DISP_WIDTH - 48, CELL_HEIGHT);

#endif

	XPutImage (display, window, gc, ximage,
		   0, 0, 0, 0, DISP_WIDTH, DISP_HEIGHT);
}
Example #24
0
File: 191.c Project: nuestand/Euler
int main(){
  char opt[] = {'A', 'L', 'O'};
  char prize[17];
  int i;
  int count = 0;
  
  for(i=0;i<16;i++) prize[i] = opt[2];
  prize[16] = 0;
  
  for(;;){
    if(!(strstr(prize, "AAA") || strstr(prize, "LL")) total++;
    bump(prize);
  }
  
  return 0;
}
Example #25
0
int
main()
{
	session_t sess;
	datum id;
	time_t create_time, last_seen;
	bool do_allow;
	char *reason;

	openlog("dorian/query", LOG_PID, LOG_MAIL);
	for (;;) {
		do_allow = false;
		if ((sess = sess_req(stdin)) == NULL)
			break;

		/* white listing */
		for_each(i, whitelist_prefix)
			if (!strncasecmp(whitelist_prefix[i], sess->attr[Krecipient],
						strlen(whitelist_prefix[i]))) {
				do_allow = true;
				reason = "whitelist address";
				break;
			}

		if (!do_allow) {
			sess_derive_key(sess, &id);
			{
				if (seen(id, &create_time, &last_seen)) {
					if (create_time < expired()) {
						bump(id, create_time);
						do_allow = true;
						reason = "in database";
					}
				} else
					add(id);
			}
			free(id.dptr);
		}
		sess_free(&sess);
		if (do_allow)
			allow(reason);
		else
			defer();
	}
	closelog();
	return 0;
}
Example #26
0
File: gabump.c Project: Stray/CBofN
void compute_fitness(char **pop, double *fit, double *normfit)
{
  int i;
  double sum;

  sum = 0;
  /* For each member of the popluation... */
  for(i = 0; i < size; i++) {
    /* Let the raw fitness be the output of the bump function. */
    fit[i] = bump(str2num(&pop[i][0]));
    /* Sum up the scores so that they can be normalized below. */
    sum += fit[i];
  }
  /* Normalize all fitnesses between [0:1]. */
  for(i = 0; i < size; i++)
    normfit[i] = fit[i] / sum;
}
Example #27
0
// enable or disable the flashing for when the window
// becomes active or inactive.
void CFlashingCursor::EnableFlashing(bool newActive)
{
	if (fActive != newActive)
	{
		fActive = newActive;
		
		if (!newActive)
		{
			if (flashstate)
				erase();
		}
		else
		{
			bump();
			draw();
		}
	}
}
Example #28
0
static void
render				(vbi_page *		pg,
				 int			row)
{
	/* ushort *canvas = ximgdata + 48 + 45 * DISP_WIDTH; */

	if (shift > 0) {
		bump(shift, FALSE);
		draw_video (48, 45 + sh_last * CELL_HEIGHT,
			    DISP_WIDTH - 48, CELL_HEIGHT);
	}

	draw_row (ximgdata + 48 + (45 + row * CELL_HEIGHT) * DISP_WIDTH,
		  pg, row);

	XPutImage (display, window, gc, ximage,
		   0, 0, 0, 0, DISP_WIDTH, DISP_HEIGHT);
}
Example #29
0
static void
xevent				(int			nap_usec)
{
	while (XPending (display)) {
		XNextEvent (display, &event);

		switch (event.type) {
		case KeyPress:
		{
			int c = XLookupKeysym (&event.xkey, 0);

			switch (c) {
			case 'q':
			case 'c':
				exit (EXIT_SUCCESS);

			case '1' ... '8':
				pgno = c - '1' + 1;
				reset ();
				return;

			case XK_F1 ... XK_F8:
				pgno = c - XK_F1 + 1;
				reset ();
				return;
			}

			break;
		}

		case Expose:
			XPutImage (display, window, gc, ximage,
				   0, 0, 0, 0, DISP_WIDTH, DISP_HEIGHT);
			break;

		case ClientMessage:
			exit (EXIT_SUCCESS);
		}
	}

	bump (step, TRUE);

	usleep (nap_usec / 4);
}
Example #30
0
Demo::Demo(App* _app) : GApplet(_app), app(_app) {

    if (! fileExists("texture.jpg")) {
        // Go into the right directory
        chdir("Cg_Shader_Demo");
    }

    texture = Texture::fromFile("texture.jpg");

    GImage bump("bump.jpg");
    GImage normal;

	GImage::computeNormalMap(bump, normal);

    normalMap = Texture::fromGImage("Normal Map", normal);

    parallaxPP = PixelProgram::fromFile("parallaxPP.pp");
    parallaxVP = VertexProgram::fromFile("parallaxVP.vp");
}