Exemplo n.º 1
0
void Renderer::drawStatic( const RuntimeMesh& mesh, const float4x4& worldTransform )
{
	standardGeometryDrawer.apply(*d3d);
	d3d->immediate_ctx->IASetInputLayout(standardGeometryDrawer.il);
	setupObjectData(worldTransform);
	drawImpl(mesh);
}
Exemplo n.º 2
0
void MapEditorToolBase::draw(QPainter* painter, MapWidget* widget)
{
	drawImpl(painter, widget);
	if (angle_helper->isActive())
		angle_helper->draw(painter, widget);
	if (snap_helper->getFilter() != SnappingToolHelper::NoSnapping)
		snap_helper->draw(painter, widget);
}
Exemplo n.º 3
0
void Renderer::drawAnimated( const RuntimeMesh& mesh, const float4x4& worldTransform, const float4x4* jointTransforms, int numJointTransforms )
{
	animatedGeometryDrawer.apply(*d3d);
	memcpy(objectAnimationCB.data.bone_transforms, jointTransforms, sizeof(float4x4) * numJointTransforms);			
	objectAnimationCB.sync();

	d3d->immediate_ctx->VSSetConstantBuffers(1, 1, &objectAnimationCB.cbuffer.p);
	setupObjectData(worldTransform);

	d3d->immediate_ctx->IASetInputLayout(animatedGeometryDrawer.il);

	drawImpl(mesh);
}
Exemplo n.º 4
0
 void CombatRadar::setAngle(float angle)
 {
   this->angle = angle * (3.1415f/180.0f);
   while (angle > 3.1415f) angle -= 3.1415f;
   drawImpl();
 }
Exemplo n.º 5
0
  void CombatRadar::update()
  {
		if (game->isPaused())
			return;

    int oldAmount = radarUnitsAmount;
    radarUnitsAmount = 0;

		LinkedList *ulist;

		if (SimpleOptions::getBool(DH_OPT_B_GUI_RADAR_SHOW_ALL))
		{
			ulist = game->units->getAllUnits();
		} else {
			ulist = game->units->getOwnedUnits(1);
		}

    LinkedListIterator iter = LinkedListIterator(ulist);

    while (iter.iterateAvailable())
    {
      Unit *u = (Unit *)iter.iterateNext();
      if (u->isActive() && !u->isDestroyed()
        && u->visibility.isInRadarByPlayer(player)
//        && u->visibility.isSeenByPlayer(player)
        && u->getUnitType()->getSize() >= RADAR_MIN_SIZE)
      {
        VC3 pos = u->getPosition();
        pos.x -= radarX;
        pos.z -= radarY;
        float distSq = pos.x * pos.x + pos.z * pos.z;
        if (distSq < RADAR_RANGE * RADAR_RANGE)
        {
          float dist = sqrtf(distSq);
          radarUnitDist[radarUnitsAmount] = dist * (RADAR_SIZE/2-RADAR_EDGE) / RADAR_RANGE;
					float angle;
					if (dist == 0)
						angle = 0;
					else
            angle = (float)acos(pos.x / dist);
          if (pos.z < 0) angle = -angle;
          radarUnitAngle[radarUnitsAmount] = angle;
          radarUnits[radarUnitsAmount] = u;

          OguiButton *b;
          if (radarUnitButs[radarUnitsAmount] == NULL)
          {
            b = ogui->CreateSimpleImageButton(win, 
              RADAR_SIZE/2-5, RADAR_SIZE/2-5, 9, 9, 
              NULL, NULL, NULL, COMBATW_RADARUNIT_START + radarUnitsAmount);
#ifdef PROJECT_SURVIVOR
						OguiAligner::align(b, OguiAligner::WIDESCREEN_FIX_RIGHT, ogui);
#endif
            radarUnitButs[radarUnitsAmount] = b;
          } else {
            b = radarUnitButs[radarUnitsAmount];
          }
          b->SetListener(this);
          b->SetReactMask(0);
          b->SetEventMask(OGUI_EMASK_CLICK);
					b->SetDisabled(true);
          if (game->isHostile(player, u->getOwner()))
          {
            if (u->getUnitType()->getSize() >= RADAR_BIG_SIZE)
            {
              b->SetDisabledImage(hostile2Image);
              radarUnitType[radarUnitsAmount] = RADAR_UNITTYPE_HOSTILE_BIG;
            } else {
              b->SetDisabledImage(hostile1Image);
              radarUnitType[radarUnitsAmount] = RADAR_UNITTYPE_HOSTILE_SMALL;
            }
          } else {
						if (u->getOwner() == player)
						{
							b->SetDisabledImage(NULL);
							radarUnitType[radarUnitsAmount] = RADAR_UNITTYPE_FRIENDLY_SMALL;
						} else {
							if (u->getUnitType()->getSize() >= RADAR_BIG_SIZE)
							{
								b->SetDisabledImage(friendly2Image);
								radarUnitType[radarUnitsAmount] = RADAR_UNITTYPE_FRIENDLY_BIG;
							} else {
								b->SetDisabledImage(friendly1Image);
								radarUnitType[radarUnitsAmount] = RADAR_UNITTYPE_FRIENDLY_SMALL;
							}
						}
          }

          radarUnitsAmount++;
          if (radarUnitsAmount >= COMBAT_RADAR_MAX_UNITS) break;
        }
      }
    }

    for (int i = radarUnitsAmount; i < oldAmount; i++)
    {
      delete radarUnitButs[i];
      radarUnitButs[i] = NULL;
    }

		if (radarScanBut != NULL)
		{
			int gt = (game->gameTimer % RADAR_SWEEP_TICK_INTERVAL);
			float ratio = (float)gt / RADAR_SWEEP_TICK_DURATION;

			if (ratio > 1.0f) ratio = 1.0f;
			int perc = (int)(ratio * 100.0f);

			int curSweep = game->gameTimer / RADAR_SWEEP_TICK_INTERVAL;
			if (curSweep > radarSweepNumber
				|| curSweep < radarSweepNumber - 5)
			{
				radarSweepNumber = curSweep;
				radarBeeped = false;

				if (win->IsVisible())
				{
#ifdef LEGACY_FILES
#ifndef PROJECT_SURVIVOR
					game->gameUI->playGUISound("Data/Sounds/Defaultfx/Radar/radar_sweep.wav");
#endif
#else
					game->gameUI->playGUISound("data/audio/sound/gui/hud/radar/radar_sweep.wav");
#endif
				}
			}

			int x = 1024 - (int)(RADAR_SIZE * (0.5f + ratio * 0.5f));
			int y = (int)(RADAR_SIZE * (0.5f - ratio * 0.5f));
			int sizeX = (int)(RADAR_SIZE * ratio);
			int sizeY = (int)(RADAR_SIZE * ratio);
			radarScanBut->Move(x, y);
			radarScanBut->Resize(sizeX, sizeY);
			radarScanBut->SetTransparency(perc);
#ifdef PROJECT_SURVIVOR
			OguiAligner::align(radarScanBut, OguiAligner::WIDESCREEN_FIX_RIGHT, ogui);
#endif
		}

    drawImpl();

		updateDirectionPointer();
  }
Exemplo n.º 6
0
void Nand2View::draw()
{
    drawImpl({CIRCUIT_HEIGHT / 4, CIRCUIT_HEIGHT * 3 / 4}, {CIRCUIT_HEIGHT / 2}, "&");
    DrawingHelper::drawCircle(beginPoint() + QPoint(CIRCUIT_WIDTH, CIRCUIT_HEIGHT / 2), 4, Qt::black);
}