예제 #1
0
파일: Renderer.cpp 프로젝트: zackgomez/rts
void Renderer::startRender() {
  renderdt_ = Clock::secondsSince(lastRender_);
  lastRender_ = Clock::now();

  renderdt_ *= timeMultiplier_;

  gameTime_ += renderdt_;

  glClearColor(0.f, 0.f, 0.f, 0.f);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  glEnable(GL_DEPTH_TEST);
  glEnable(GL_BLEND);
  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

  // Set up matrices
  float aspect = resolution_.x / resolution_.y;
  float fov = 60.f;
  getProjectionStack().clear();
  getProjectionStack().current() = glm::perspective(fov, aspect, 0.1f, 100.f);
  getViewStack().clear();
  getViewStack().current() = camera_.calculateViewMatrix();

  // Set up lights
  // TODO(zack): read light pos from map config
  auto lightPos = applyMatrix(getViewStack().current(), glm::vec3(-5, -5, 10));
  setParam("renderer.lightPos", lightPos);
  setParam("renderer.light.ambient", glm::vec3(0.1f));
  setParam("renderer.light.diffuse", glm::vec3(1.f));
  setParam("renderer.light.specular", glm::vec3(1.f));
}
예제 #2
0
bool ConditionDamage::addDamage(int32_t rounds, int32_t time, int32_t value)
{
	if(rounds == -1) //periodic damage
	{
		setParam(CONDITIONPARAM_TICKINTERVAL, time);
		setParam(CONDITIONPARAM_TICKS, -1);

		periodDamage = value;
		return true;
	}

	if(periodDamage > 0)
		return false;

	//rounds, time, damage
	for(int32_t i = 0; i < rounds; ++i)
	{
		IntervalInfo damageInfo;
		damageInfo.interval = time;
		damageInfo.timeLeft = time;
		damageInfo.value = value;

		damageList.push_back(damageInfo);
		if(getTicks() != -1)
			setTicks(getTicks() + damageInfo.interval);
	}

	return true;
}
예제 #3
0
bool ConditionDamage::addDamage(int32_t rounds, int32_t time, int32_t value)
{
	time = std::max<int32_t>(time, EVENT_CREATURE_THINK_INTERVAL);
	if (rounds == -1) {
		//periodic damage
		periodDamage = value;
		setParam(CONDITION_PARAM_TICKINTERVAL, time);
		setParam(CONDITION_PARAM_TICKS, -1);
		return true;
	}

	if (periodDamage > 0) {
		return false;
	}

	//rounds, time, damage
	for (int32_t i = 0; i < rounds; ++i) {
		IntervalInfo damageInfo;
		damageInfo.interval = time;
		damageInfo.timeLeft = time;
		damageInfo.value = value;

		damageList.push_back(damageInfo);

		if (ticks != -1) {
			setTicks(ticks + damageInfo.interval);
		}
	}

	return true;
}
예제 #4
0
GetLatestVersionRequest::GetLatestVersionRequest(const QString& client_id,
                                                 const QString& client_version)
    : SeafileApiRequest(QUrl(kLatestVersionUrl), SeafileApiRequest::METHOD_GET)
{
    setParam("id", client_id.left(8));
    setParam("v", QString(kOsName) + "-" + client_version);
}
예제 #5
0
MLProcDelayOutput::MLProcDelayOutput()
{
	setParam("order", 0);
	setParam("backwards", 0);
	mpDelayInputProc = 0;
	mReadIndex = 0;
	mLengthMask = 0;
}
예제 #6
0
MLProcMatrix::MLProcMatrix()
{
	setParam("in", 0.);
	setParam("out", 0.);
    mInputs = mOutputs = 0;
//	debug() << "MLProcMatrix constructor\n";
	clearConnections();
}
예제 #7
0
MLProcRingBuffer::MLProcRingBuffer()
{
	// defaults
	// TODO set from component->engine.
	//  will want downsampling for viewing when running at 96k or higher...
	setParam("length", kMLRingBufferDefaultSize);	
	setParam("mode", eMLRingBufferNoTrash);
	mTrig1 = -1.f;
}
예제 #8
0
void
Sinful::setNoUDP(bool flag)
{
	if( !flag ) {
		setParam("noUDP",NULL);
	}
	else {
		setParam("noUDP","");
	}
}
예제 #9
0
bool GPRSHTTP::init(int timeout)
{
    if(timeout > 1000 || timeout < 30)
    {
        _error_condition = SIM900_ERROR_INVALID_HTTP_TIMEOUT;
        if(SIM900_DEBUG_OUTPUT)
        {
            SIM900_DEBUG_OUTPUT_STREAM->println(get_error_message(SIM900_ERROR_INVALID_HTTP_TIMEOUT));
        }
        return false;
    }
    int connected = isCGATT();
    if(connected == -1)
    {
        return false;
    }
    delay(1000);

    if(connected == 1) {
        stopBearer(1, 0);
    }

    if(!startBearer(5, 2000))
    {
        return false;
    }

    initialized = HTTPINIT(5, 2000);
    if(!initialized)
    {
        return false;
    }

    //Set the CID
    if(!setParam("CID", _cid))
    {
        return false;
    }

    //Set the URL
    if(!setParam("URL", url))
    {
        return false;
    }

    //Set the HTTP Timeout
    if(!setParam("TIMEOUT", timeout))
    {
        return false;
    }

    Serial.print("URL: ");
    Serial.println(url);
    return true;
}
예제 #10
0
//------------------------------------//
// Main
//------------------------------------//
void AnaEField()
{

  // Make Canvas 
  TCanvas* can = makeCanvas("can");
  can->SetLogy();
  can->SetGridx();
  can->SetGridy();

  // Define the function here with parameters:
  // [0] = L
  // [1] = freq
  // [2] = k
  // [3] = n
  // [4] = sqrt(2pi) * mu * mu0
  TString func = "[4]*[0]*[1]*sin(x/57.2957)*exp(-pow([2]*[0],2)*pow(cos(x/57.2957)-1/[3],2)/2)";
  //TString func = "[4]*[1]*sin(x/57.2957)*exp(-pow([2]*[0],2)*pow(cos(x/57.2957)-1/[3],2)/2)";
  //TString func = "[4]*[0]*[1]*exp(-pow([2]*[0],2)*pow(cos(x/57.2957)-1/[3],2)/2)";

  // Now fix some of the variables:
  double freq = 1e9; //600e6; // Hz
  double c    = 3e8;   // m/s
  double n    = 1.3; //1.78;
  double k    = 2*TMath::Pi() * n * freq/c; // 1/m
  double Const= sqrt(2*TMath::Pi()) * 4 * TMath::Pi() * 1e-7 * 1;

  // Make a dummy histogram
  TH1F* h = makeHist("h",100,0,90,"Angle [deg]", "Field Strength",kBlack,0);
  h->Fill(1e10);
  h->SetMinimum(10);
  h->SetMaximum(3000);
  h->Draw();

  // Make two instances of the function
  TF1* f0 = new TF1("f0",func.Data(),0,90);
  setParam(f0,1.2,freq,k,n,Const,kBlack);

  TF1* f1 = new TF1("f1",func.Data(),0,90);
  setParam(f1,0.1,freq,k,n,Const,kBlue);
 
  // Draw
  f0->Draw("same");
  f1->Draw("same");
  
  // Add Legend
  TLegend* leg = makeLegend(0.15,0.3,0.7,0.9);
  leg->SetHeader("f = 600 MHz");
  leg->AddEntry(f0,"L = 1.2m","l");
  leg->AddEntry(f1,"L = 0.1m","l");
  leg->Draw("same");
  
  //can->SaveAs("../plots/quickAnalytic_600MHz.png");

}
예제 #11
0
void KisColorSelector::setConfiguration(Configuration conf)
{
    m_configuration = conf;

    if(m_mainComponent!=0) {
        Q_ASSERT(m_subComponent!=0);
        m_mainComponent->setGeometry(0, 0, 0, 0);
        m_subComponent->setGeometry(0, 0, 0, 0);

        m_mainComponent->disconnect();
        m_subComponent->disconnect();
    }

    switch (m_configuration.mainType) {
    case Square:
        m_mainComponent=m_square;
        break;
    case Wheel:
        m_mainComponent=m_wheel;
        break;
    case Triangle:
        m_mainComponent=m_triangle;
        break;
    default:
        Q_ASSERT(false);
    }

    switch (m_configuration.subType) {
    case Ring:
        m_subComponent=m_ring;
        break;
    case Slider:
        m_subComponent=m_slider;
        break;
    default:
        Q_ASSERT(false);
    }

    connect(m_mainComponent, SIGNAL(paramChanged(qreal,qreal,qreal,qreal,qreal)),
            m_subComponent,  SLOT(setParam(qreal,qreal,qreal,qreal,qreal)), Qt::UniqueConnection);
    connect(m_subComponent,  SIGNAL(paramChanged(qreal,qreal,qreal,qreal,qreal)),
            m_mainComponent, SLOT(setParam(qreal,qreal,qreal,qreal, qreal)), Qt::UniqueConnection);

    connect(m_mainComponent, SIGNAL(update()), m_signalCompressor, SLOT(start()), Qt::UniqueConnection);
    connect(m_subComponent,  SIGNAL(update()), m_signalCompressor, SLOT(start()), Qt::UniqueConnection);
    
    m_mainComponent->setConfiguration(m_configuration.mainTypeParameter, m_configuration.mainType);
    m_subComponent->setConfiguration(m_configuration.subTypeParameter, m_configuration.subType);

    QResizeEvent event(QSize(width(), height()), QSize());
    resizeEvent(&event);
}
  Material()
  {
    _ambient = (GLfloat*)malloc(sizeof(GLfloat)*4);
    _diffuse = (GLfloat*)malloc(sizeof(GLfloat)*4);;
    _specular = (GLfloat*)malloc(sizeof(GLfloat)*4);
    _emission = (GLfloat*)malloc(sizeof(GLfloat)*4);    

    setParam(AMBIENT, 0.0, 0.0, 0.0, 1.0);
    setParam(DIFFUSE, 0.0, 0.0, 0.0, 1.0);
    setParam(SPECULAR, 0.0, 0.0, 0.0, 1.0);
    setParam(EMISSION, 0.1, 0.1, 0.1, 1.0);
    _shininess = 0.0;
  }
예제 #13
0
void APGSeeker::loadDefaults()
{
    APSequentialSeeker::loadDefaults();

    setParam("windowSize", 200);
    setParam("minDurationToBeConsidered", param("windowSize"));
    setParam("duration", transformSecondsToNumberOfPoints(/*8*/20));
    setParam("allowedDistance", transformSecondsToNumberOfPoints(2));
    setParam("peakWindowSize", 16);

    //	setParam("needsCleanUp", false);
    //	setParam("needsLog", true);
}
예제 #14
0
/**
 * Set program version.
 */
    void
OptionAgent::prepareVersion()
{
#ifdef VERSION
    setParam("version", VERSION);
#else
    setParam("version", "0.0.1");
#endif
#ifdef PACKAGE
    setParam("package", PACKAGE);
#else
    setParam("package", "A game");
#endif
}
예제 #15
0
void LCGWSpinBBHNR1::config(ezxml_t xmlbloc)
{
	//! *** Read sky position, polarization and name
	configBase(xmlbloc);
	
	//! ** Reset declination to compute quantities related to sky position 
	setParam(0, Beta);
	
	
	ezxml_t param;
	for(param = ezxml_child(xmlbloc,"Param"); param; param = param->next){
		
		//! *** Read ecliptic lattitude 
		if(MT->wcmp(ezxml_attr(param,"Name"),"EclipticLatitude"))
			setParam(0, MT->gXMLAngle(param));
		
		//! *** Read ecliptic colattitude 
		if(MT->wcmp(ezxml_attr(param,"Name"),"EclipticColatitude"))
			setParam(0, M_PI/2. - MT->gXMLAngle(param));
		
		//! *** Read ecliptic longitude
		if(MT->wcmp(ezxml_attr(param,"Name"),"EclipticLongitude"))
			setParam(1, MT->gXMLAngle(param));
		
		//! *** Read polarization
		if(MT->wcmp(ezxml_attr(param,"Name"),"Polarization"))
			setParam(2, MT->gXMLAngle(param));
		
		
		if(MT->wcmp(ezxml_attr(param,"Name"),"TotalMass"))
			setParam(3, MT->gXMLAstroMass(param) );
		
		if(MT->wcmp(ezxml_attr(param,"Name"),"CoalescenceTime"))
			setParam(4, MT->gXMLTime(param) );
		
		if(MT->wcmp(ezxml_attr(param,"Name"),"Distance"))
			setParam(5, MT->gXMLAstroDistance(param) );
		
		if(MT->wcmp(ezxml_attr(param,"Name"),"PolarAngleTotalMomentuminSBB"))
			setParam(6, MT->gXMLAngle(param) );
		
		if(MT->wcmp(ezxml_attr(param,"Name"),"AzimuthalAngleTotalMomentuminSBB"))
			setParam(7, MT->gXMLAngle(param) );
		
		//if(MT->wcmp(ezxml_attr(param,"Name"),"FileName"))
		//	MT->stripcopy((*param).txt,NRFileName);
		
	}
}
예제 #16
0
파일: getBP.c 프로젝트: tsupo/bookey
int
main( int argc, char *argv[] )
{
    BOOL    useProxy = FALSE;
    char    ibID[MAX_USERIDLEN];
    int     numOfClips = 0;
    MyClip  *mp = NULL;

    if ( argc <= 1 ) {
        usage();
        return ( 0 );
    }

    memset( ibID, 0x00, MAX_USERIDLEN );

    if ( argc >= 2 )
        setParam( argc, argv, ibID, &useProxy );

    if ( !(ibID[0]) )
        return ( 0 );

    if ( useProxy )
        setUseProxy( useProxy );

    /* BlogPeople IB へ登録済みのブックマークを取得 */
    mp = getIB( ibID, &numOfClips );
    if ( mp && (numOfClips > 0) ) {
        /*  BlogPeople IB 情報を OPML ファイルへ書き出す */
        outputOPML( mp, numOfClips,
                    "BlogPeople Instant Bookmarks", UTF8, stdout );
        free( mp );
    }

    return ( 1 );
}
예제 #17
0
Component* PlayerComponent::create(std::vector<Panel *>& touchPanel, Point startPosition)
{
	auto comp = PlayerComponent::create();
	comp->setParam(touchPanel, startPosition);

	return comp;
}
예제 #18
0
void
LOCA::Abstract::Group::setParamsMulti(const vector<int>& paramIDs, 
		const NOX::Abstract::MultiVector::DenseMatrix& vals)
{
  for (unsigned int i=0; i<paramIDs.size(); i++)
    setParam(paramIDs[i], vals(i,0));
}
예제 #19
0
int main(int argc, char **argv)
{
        struct event timeout[N];
        struct ST_EventWithDescription stEvent[N];
        int time_interval[N];
        int i = 0;

        struct timeval tv;
        struct event_base *base;
        int flag = 0;

        setTimeIntervalArr(time_interval, N);

        if(argc == 2 && !strcmp(argv[1], "-p"))
            flag = EV_PERSIST;
        else
            flag = 0;
        base = event_base_new();
        evutil_timerclear(&tv);

        for(i = 0; i < N; ++i)
        {
            char buf[BUFFER] = {0};
            sprintf(buf, "task_%d", i+1);
            setParam(stEvent+i, timeout+i, time_interval[i], buf);
            event_assign(timeout+i, base, -1, flag, timeout_cb,(void *)(stEvent+i));
            event_add(timeout+i, &tv);
        }

        evutil_gettimeofday(&lasttime, NULL);
        event_base_dispatch(base);
    return 0;
}
void
LOCA::MultiContinuation::ConstrainedGroup::setParam(std::string paramID, double val)
{
  const LOCA::ParameterVector& p = grpPtr->getParams();
  int id = p.getIndex(paramID);
  setParam(id, val);
}
예제 #21
0
LOCAL int ICACHE_FLASH_ATTR setCity(const char *value, uint valueLen)
{
	if (setParam(config.city, sizeof(config.city), value, valueLen) == OK)
	{
		os_memset(config.cityDisplayed, 0, sizeof(config.cityDisplayed));
		int i;
		for (i = 0; i < valueLen; i++)
		{
			if (value[i] == '_')
			{
				config.cityDisplayed[i] = ' ';
			}
			else if (value[i] == ',')
			{
				config.cityDisplayed[i] = '\0';
				break;
			}
			else
			{
				config.cityDisplayed[i] = value[i];
			}
		}
		os_memset(retain.cityId, 0, sizeof(retain.cityId));
		retainWrite(&retain);
		return OK;
	}
	return ERROR;
}
// Enable or disable the low-speed optimization option. With LSPD_OPT enabled,
//  motion starts from 0 instead of MIN_SPEED and low-speed optimization keeps
//  the driving sine wave prettier than normal until MIN_SPEED is reached.
void AutoDriver::setLoSpdOpt(boolean enable)
{
  unsigned long temp = getParam(MIN_SPEED);
  if (enable) temp |= 0x00001000; // Set the LSPD_OPT bit
  else        temp &= 0xffffefff; // Clear the LSPD_OPT bit
  setParam(MIN_SPEED, temp);
}
예제 #23
0
파일: winch.cpp 프로젝트: okymd/winchEmu
//--------------------------------------------------------------
void Winch::init(ofPoint winchXzPosition) {
    winchXzPosi = winchXzPosition;
	setParam(DEFAULT_ACC, DEFAULT_DEC, DEFAULT_MAX_SPEED);
	bottle.set(BOTTLE_RADIUS,BOTTLE_LENGTH);
	bottle.setResolution(32,8);

	for(int i=0;i<3;i++){
		sphere[i].set(2,32);
	}

	//model.loadModel("bop_object_model.3ds");
	//load the squirrel model - the 3ds and the texture file need to be in the same folder
//	if(!bModelLoaded){
//		model.loadModel("squirrel/NewSquirrel.3ds", 1);
//		model.setRotation(0, 90, 1, 0, 0);
//		model.setRotation(1, 180, 0, 1, 0);
//
//		texMetal.loadImage("Fiberglass0017_1_S.jpg");
//
//
//		bModelLoaded=true;
//	}

	// shininess is a value between 0 - 128, 128 being the most shiny //
	material.setShininess( 128 );
    // the light highlight of the material //
	material.setSpecularColor(ofColor(255, 255, 255, 255));

}
예제 #24
0
        void doHit()
        {
            int flight;
            f32 flightTime = 0;
            
            reset();

			setParam(m_hitParam);
            
            getClissionSystem()->setDetectObjects(COLLISION_OBJECT_TABLE|COLLISION_OBJECT_NET|COLLISION_OBJECT_FLOOR);
           // getClissionSystem()->setDetectObjects(COLLISION_OBJECT_TABLE|COLLISION_OBJECT_FLOOR);

            flight = makeFlight();

		    while (true)
            {
                flight = rebound(flight);
                if (flight < 0)
				{
					break;
				}

                f32 time =  getSegDuration(flight);
				if (time < 0.01 && getSegSequence(flight) > 6)
				{
					break;
				}
            }   
        }
예제 #25
0
void
LOCA::Homotopy::DeflatedGroup::
setParam(string paramID, double val)
{
  int id = paramVec.getIndex(paramID);
  setParam(id, val);
}
KisShadeSelectorLine::KisShadeSelectorLine(QWidget *parent) :
    KisShadeSelectorLineBase(parent), m_displayHelpText(false)
{
    setParam(0, 0, 0, 0, 0, 0);
    updateSettings();
    setMouseTracking(true);
}
예제 #27
0
파일: MNM.cpp 프로젝트: jmamma/mididuino
void MNMClass::setMachine(uint8_t track, uint8_t idx) {
  assignMachine(track, kit.models[idx]);
    for (int i = 0; i < 56; i++) {
    setParam(track, i, kit.parameters[idx][i]);
  }
  setTrackLevel(track, kit.levels[idx]);
}
void TaskManager::raiseDesperationLevel()
{
    if (desperation_mode_ == level_1)
    {
        desperation_mode_ = level_2;
    }
    else
    {
      if (desperation_mode_ == level_2 && task_ != "pick")
      {
        desperation_mode_ = level_3;
      }
      else
      {
        if (desperation_mode_ == level_3 && task_ != "pick")
        {
          desperation_mode_ = level_4;
        }
        else
        {
          desperation_mode_ = level_1;
        }
      }
    }

    setParam("/apc/task_manager/desperation", desperation_mode_);
}
예제 #29
0
void MateriaPrimaDetail::newClicked()
{
	if (!validate(nomeEdit) && !validate(precoEdit))
	{
		QMessageBox::warning(this, "Admin",
			QString::fromUtf8("Há campos vazios"));
	}

	else
	{
		query.bindValue(":nome", nomeEdit->text());
		query.bindValue(":tipo", tipoComboBox->currentIndex());
		query.bindValue(":preco_por_kilo", precoEdit->text());

		if (!query.exec())
		{
			QMessageBox::warning(this, "Admin",
				QString::fromUtf8("Houve um erro ao inserir\1%1").arg(query.lastError().text()));
		}

		ParameterList param;
		param["mode"] = "new";
		setParam(param);

		emit dataChanged();
	}
}
예제 #30
0
파일: MNM.cpp 프로젝트: anupam19/mididuino
void MNMClass::setMachine(uint8_t track, MNMMachine *machine) {
  assignMachine(track, machine->model);
  for (int i = 0; i < 56; i++) {
    setParam(track, i, machine->params[i]);
  }
  setTrackLevel(track, machine->level);
}