Exemplo n.º 1
0
    SDGeometryHandle compile_geometry(SDRenderMode mode, SDVec2* vertices, SDuint numVertices, SDuint* indices, SDuint numIndices) {
        kglt::MeshID new_mesh = stage()->new_mesh();

        {
            auto mesh = stage()->mesh(new_mesh);
            auto submesh = mesh->new_submesh(
                stage()->get_material_with_alias("diffuse_render"),
                (mode == SD_RENDER_MODE_TRIANGLES) ? kglt::MESH_ARRANGEMENT_TRIANGLES : kglt::MESH_ARRANGEMENT_LINES, true
            );

            for(SDuint i = 0; i < numVertices; ++i) {
                mesh->shared_data().position(vertices[i]);
                mesh->shared_data().diffuse(kglt::Colour::WHITE);
                mesh->shared_data().move_next();
            }

            for(SDuint i = 0; i < numIndices; ++i) {
                mesh->submesh(submesh).index_data().index(indices[i]);
            }

            mesh->submesh(submesh).index_data().done();
            mesh->shared_data().done();

        }

        kglt::ActorID new_actor = stage()->new_actor(new_mesh);
        return new_actor.value();
    }
Exemplo n.º 2
0
void Block::cloneFrom(Block * src, std::function<Value*(Value*)> outer_map) {
  std::unordered_map<Value*, Value*> local_map;
  auto env = [&](Value * v) {
    auto it = local_map.find(v);
    if(it != local_map.end())
      return it->second;
    return outer_map(v);
  };

  auto graph = owningGraph();
  for(auto input : src->inputs()) {
    local_map[input] = this->addInput()->copyMetadata(input)->setStage(input->stage());
    graph->setStage(std::max(graph->stage(), input->stage()));
  }
  for(auto node : src->nodes()) {
    auto new_node = this->appendNode(graph->createClone(node, env));
    new_node->setStage(node->stage());
    graph->setStage(std::max(graph->stage(), node->stage()));
    for(size_t i = 0; i < node->outputs().size(); ++i) {
      auto oo = node->outputs()[i];
      auto no = new_node->outputs()[i];
      local_map[oo] = no;
      no->copyMetadata(oo);
      no->setStage(oo->stage());
    }
  }
  for(auto output : src->outputs()) {
    this->registerOutput(env(output));
  }
}
Exemplo n.º 3
0
void StageManager::delete_stage(StageID s) {
    //Recurse through the tree, destroying all children
    auto st = stage(s);
    if(st) {
        stage(s)->apply_recursively_leaf_first(&ownable_tree_node_destroy, false);
        signal_stage_removed_(s);
    }

    StageManager::destroy(s);
}
Exemplo n.º 4
0
    KGLTGeometryRenderer(kglt::WindowBase& window, kglt::StageID stage_id=kglt::StageID()):
        window_(window),
        stage_id_(stage_id) {


        stage()->new_material_with_alias_from_file("diffuse_render", "kglt/materials/diffuse_render.kglm", false);

        auto mat = stage()->material(stage()->get_material_with_alias("diffuse_render"));
        mat->pass(0).set_polygon_mode(kglt::POLYGON_MODE_LINE);
    }
Exemplo n.º 5
0
QVariant ApplicationManager::data(const QModelIndex& index, int role) const {
    if (index.row() < 0 || index.row() >= m_runningApplications.size())
        return QVariant();

    auto app = m_runningApplications.at(index.row());
    switch(role) {
    case RoleAppId:
        return app->appId();
    case RoleName:
        return app->name();
    case RoleComment:
        return app->comment();
    case RoleIcon:
        return app->icon();
    case RoleStage:
        return app->stage();
    case RoleState:
        return app->state();
    case RoleFocused:
        return app->focused();
    case RoleSession:
        return QVariant::fromValue(app->session());
    case RoleFullscreen:
        return app->fullscreen();
    default:
        return QVariant();
    }
}
Exemplo n.º 6
0
void pipeline::

set_stage(std::string const& program_name , std::string const& stage_path) {

  program_iterator p_it(find_program(program_name));

  if(p_it != programs_.end()) {

    stage_iterator s_it(find_stage(stage_path));

    if(s_it == stages_.end()) {

      std::shared_ptr<stage> s(std::make_shared<stage>(stage(stage_path)));

      stages_.push_back(s);

      p_it->define_stage(s);
    }

    else {

      std::shared_ptr<stage> s(*s_it);

      p_it->define_stage(s);
    }
  }

  else {

    std::cerr << std::endl
              << "program [" << program_name << "] doesn't exist"
              << std::endl;
  }
}
Exemplo n.º 7
0
//parses a pipeline, returning command struct
//modifies global variable t
CMD *pipeline()
{
	CMD *cmd = 0, *tmp = 0;
	cmd = stage();
	while (t && ISPIPE(t->type))
	{
		if (!cmd)
		{
			DIE("Parse: null command\n");
			freeCMD(cmd);
			return 0;
		}
		if (cmd->toType != NONE)
		{
			DIE("Parse: two output redirects\n");
			freeCMD(cmd);
			return 0;
		}
		tmp = cmd;
		cmd = mallocCMD();
		cmd->type = t->type;
		cmd->left = tmp;
		t = t->next;
		cmd->right = pipeline();
		if (!cmd->right)
		{
			DIE("Parse: null command\n");
			freeCMD(cmd);
			return 0;
		}
	}
	return cmd;
}
Exemplo n.º 8
0
// Parse a single particle def
void ParticlesManager::parseParticleDef(parser::DefTokeniser& tok) {

	// Standard DEF, starts with "particle <name> {"
	tok.assertNextToken("particle");
	std::string name = tok.nextToken();
	tok.assertNextToken("{");
	
	ParticleDef pdef(name);

	// Any global keywords will come first, after which we get a series of 
	// brace-delimited stages.
	std::string token = tok.nextToken();
	while (token != "}") {
		if (token == "depthHack") {
			tok.skipTokens(1); // we don't care about depthHack
		}
		else if (token == "{") {
			
			// Parse stage
			ParticleStage stage(parseParticleStage(tok));
			
			// Append to the ParticleDef
			pdef.appendStage(stage);
		}
		
		// Get next token
		token = tok.nextToken();
	}
	
	// Add the ParticleDef to the map
	_particleDefs.insert(ParticleDefMap::value_type(name, pdef));
}
Exemplo n.º 9
0
JNIEXPORT void JNICALL Java_fr_in2p3_cc_storage_treqs_hsm_hpssJNI_NativeBridge_stage(
    JNIEnv* env, jobject js, jstring jFileName, jlong size) {
  const char * filename;

  int rc = -1;
  char message[1024];

  if (trace) {
    printf("> JNI stage\n");
  }

  // Converts Java Strings in char*;
  filename = (*env)->GetStringUTFChars(env, jFileName, JNI_FALSE);

  // Calls the Broker.
  rc = stage(filename, (long long unsigned int *)&size);

  // Release JNI components.
  (*env)->ReleaseStringUTFChars(env, jFileName, filename);

  // Throws an exception if there is a problem.
  if (rc != HPSS_E_NOERROR) {
    sprintf(message, "%d:stage", rc);
    throwJNIException(env, message);
  }

  if (trace) {
    printf("< JNI stage - %d\n", rc);
  }
}
Exemplo n.º 10
0
void Scene_Gang_Manager::tick(Time_Value &now) {
	if (ACTIVITY_CLOSE == this->switch_) {
		return ;
	}

	if (GANG_WAR_CREATE_16 == this->switch_) {
		if (stage() == 2) {
			index_ = 0;
		}
		match_arena_team();
		last_match_time_ = now;
		this->switch_ = GANG_WAR_CREATE_16_END;
	}

	if (ACTIVITY_READY == this->switch_) {
		match_arena_team();
		last_match_time_ = now;
		this->switch_ = ACTIVITY_MATCHED;
	}

	if (ACTIVITY_OPEN == this->switch_
			&& now - last_match_time_ > Time_Value(0)) {
		last_match_time_ = now;
		set_start_time(now);
		this->switch_ = ACTIVITY_FIGHT;
	}

}
Exemplo n.º 11
0
JNIEXPORT int hgs_start(char const* ip, int port, char const* path)
{
    LOGD("%s:%d %s", ip, port, path);
    //BOOST_ASSERT(oDecoderWrap);
    stage(1, __func__);

    int retval = 0;
#   if defined(TEST_WITH_VIDEO_FILE)
    test_.reset( new TestMain() );
    test_->thread.start();
#   else
    char uri[256];
    if (port == 554) {
        snprintf(uri,sizeof(uri), "rtsp://%s%s", ip, path);
    } else {
        snprintf(uri,sizeof(uri), "rtsp://%s:%d%s", ip, (int)port, path);
    }
    hgsnwk_init(ip, port, uri);

    //const char *ip = env->GetStringUTFChars(js_ip, 0);
    //env->ReleaseStringUTFChars(js_ip, ip);

    //{}/*=*/{
    //    nalu_data_sink* sink = new nalu_data_sink();
    //    sink_.reset(sink);
    //    hgs_run([sink](mbuffer b){ sink->pushbuf(std::move(b)); });
    //}
    hgsnwk_run( nwk_dataincoming );
#   endif
    LOGD("stage %d", stage_);
    return retval;
}
Exemplo n.º 12
0
//エージェント出力
void printBoy(Agent_status *agent,int stgnum)
{
    if (agent->ON_OFF == 0)
    {
        clear();
        stage(stgnum);
        //        mvaddch(agent->Y-2,agent->X,'B');
        //        mvaddch(agent->Y-1,agent->X,'O');
        mvaddch(agent->Y,  agent->X,'B');
    }
    else 
    {
        clear();
        stage(stgnum);
    }
}
Exemplo n.º 13
0
int main() {

  env;

  Player player(Vec2f(0.0f,0.0f),Vec2f(100,100),0.8f,300.0f);
  Wall wall(WallType::CIRCLE,Vec2f(-500, -100), Vec2f(200, 200), 0.8f);
  Stage stage(Vec2f(200, 500), Vec2f(100, 100));

  while (env.isOpen()) {
  
    env.begin();


    stage.Update(player);
    wall.Update(player);
    player.Update();

    stage.Draw();
    wall.Draw();
    player.Draw();
    
    if (stage.IsGoal())
    {
      break;
    }

    env.end();
  }
}
Exemplo n.º 14
0
string level_description(int level)
{
	if ( stage(level) < 3 )
		return BLU "第"+chinese_number( stage(level) )+"重 " NOR;
	else if ( stage(level) < 5 )
		return HIB "第"+chinese_number( stage(level) )+"重 " NOR;
	else if ( stage(level) < 7 )
		return YEL "第"+chinese_number( stage(level) )+"重 " NOR;
	else if ( stage(level) < 9 )
		return CYN "第"+chinese_number( stage(level) )+"重 " NOR;
	else 
		return HIW "第"+chinese_number( stage(level) )+"重 " NOR;
}
Exemplo n.º 15
0
string level_description(int level)
{
	if ( stage(level) < 3 )
		return HIB "第"+chinese_number( stage(level) )+"层 " NOR;
	else if ( stage(level) < 5 )
		return HIM "第"+chinese_number( stage(level) )+"层 " NOR;
	else if ( stage(level) < 7 )
		return WHT "第"+chinese_number( stage(level) )+"层 " NOR;
	else if ( stage(level) < 9 )
		return HIY "第"+chinese_number( stage(level) )+"层 " NOR;
	else 
		return HIW "第"+chinese_number( stage(level) )+"层 " NOR;
}
Exemplo n.º 16
0
complex<double> fast_equalizer::run(const complex<double>& sample) {
  complex<double> ret;
  vld_en[0] = stage(sample, 0, eqh[0], eql[0]);
  complex<double> tl;
  tl = stage_up_down(1, eql[0]);
  ret = tl + gains[0] * eqh[0];  // combine with 1st HPF
  return ret;
}
Exemplo n.º 17
0
void skill_improved(object me)
{
	//if stage increased, give bonus...?
	int level = (int)me->query_skill("ningxie-force", 1);
	if ( stage(level) == stage(level-1) + 1)
	{
		//this is to prevent ppls from abondoning skill to get bonus.
		if( (int)me->query("nx-force_bonus") < stage(level) )
		{
			me->set("nx-force_bonus", stage(level));
//			me->set("max_force", (int)me->query("max_force") + stage(level)*50 );
			// mon 12/13/98
			me->set("maximum_force", 
				(int)me->query("maximum_force") 
				+ stage(level)*50 );
			me->save();
			log_file("ningxie-force-bonus", ctime( time() )+": "
				+me->query("name")+"("+me->query("id")+")"
				+" got neili "+(stage(level)*50)+".\n");
			message_vision(HIW "$N突然觉得真气冲顶,飘然欲飞。原来是$N的冰谷凝血功进入了第"+chinese_number(stage(level))+"重境界!\n" NOR, me);

		}
	}
			
}
Exemplo n.º 18
0
bool TextureMaterialLayer::hasGlow() const
{
    for (int i = 0; i < stageCount(); ++i)
    {
        if (stage(i).glowStrength > .0001f)
            return true;
    }
    return false;
}
Exemplo n.º 19
0
int Scene_Gang_Manager::gang_war_create_16(void) {
	if (this->switch_ == ACTIVITY_CLOSE) {
		this->switch_ = GANG_WAR_CREATE_16;
		if (stage() == 2) {
			index_ = 0;
		}
	}
	return 0;
}
Exemplo n.º 20
0
int Scene_Gang_Manager::ready_activity(void) {
	if (this->switch_ == ACTIVITY_CLOSE) {
		this->switch_ = ACTIVITY_READY;
		if (stage() == 2) {
			index_ = 0;
		}
	}
	return 0;
}
Exemplo n.º 21
0
 BiquadFilterTestPatch(){
   registerParameter(PARAMETER_A, "Cutoff");
   registerParameter(PARAMETER_B, "Resonance");
   int stages=3;
   filter=BiquadFilter::create(stages);
   float cutoff=0.2;
   float resonance=2;
   //test setLowPass
   FloatArray coefficients=FloatArray::create(5*stages);
   FloatArray states=FloatArray::create(2*stages);
   FilterStage stage(coefficients, states);
   filter->setLowPass(cutoff, resonance);
   stage.setLowPass(cutoff, resonance);
   for(int k=0; k<stages; k++){ 
     for(int n=0; n<5; n++){
       float filterC=filter->getFilterStage(k).getCoefficients()[n];
       float stageC=stage.getCoefficients()[n];
       ASSERT(filterC==stageC, "Coefficients not initialized"); //check that filter coefficients are properly initialized
     }
   }
   int signalLength=100;
   
   FloatArray x=FloatArray::create(signalLength);
   FloatArray x1=FloatArray::create(signalLength);
   FloatArray y=FloatArray::create(signalLength);
   FloatArray y1=FloatArray::create(signalLength);
   x.noise();
   x1.copyFrom(x);
   
   filter->process(x1, y1, x1.getSize());
   //manually compute the filter
   float b0=filter->getFilterStage(0).getCoefficients()[0];
   float b1=filter->getFilterStage(0).getCoefficients()[1];
   float b2=filter->getFilterStage(0).getCoefficients()[2];
   float a1=filter->getFilterStage(0).getCoefficients()[3];
   float a2=filter->getFilterStage(0).getCoefficients()[4];
   for(int n=0; n<stages; n++){
     float d1=0;
     float d2=0;
     for(int n=0; n<x.getSize(); n++){ //manually apply filter, one stage
       y[n] = b0 * x[n] + d1;
       d1 = b1 * x[n] + a1 * y[n] + d2;
       d2 = b2 * x[n] + a2 * y[n];   
     }
     x.copyFrom(y); //copy the output to the input for the next iteration. INEFFICIENT
   }
   //done with the filter
   for(int n=0; n<x.getSize(); n++){
     // ASSERT(abs(y[n]-y1[n])<0.0001, "");//BiquadFilter.process(FloatArray, FloatArray) result"); //TODO: fails for non-arm
   }
   FloatArray::destroy(x);
   FloatArray::destroy(x1);
   FloatArray::destroy(y);
   FloatArray::destroy(y1);
   debugMessage("All tests passed");
 }
Exemplo n.º 22
0
void StageManager::delete_stage(StageID s) {
    try {
        //Recurse through the tree, destroying all children
        stage(s)->apply_recursively_leaf_first(&ownable_tree_node_destroy, false);
    } catch(DoesNotExist<Stage>&) {
        return;
    }

    StageManager::manager_delete(s);
}
Exemplo n.º 23
0
void Server::start()
{
	m_loading.setColor(Font::getColor());
	m_isRunning = true;
	sf::TcpListener listener;
	int port = 54000;
	while (listener.listen(port) != sf::Socket::Done && port < 54005)
	{
		port++;
	}
	if (port == 54005)
	{
		return;
	}
	sf::TcpSocket client;
	listener.setBlocking(false);
	client.setBlocking(false);
	PausableClock frameClock;
	while (m_isRunning)
	{
		sf::Event event;
        while (m_window.pollEvent(event))
		{
			switch (event.type)
			{
			case sf::Event::Closed:
				m_isRunning = false;
				m_window.close();
				break;
			case sf::Event::KeyPressed:
				if (event.key.code == sf::Keyboard::Escape)
				{
					m_isRunning = false;
				}
				break;
			default:
				break;
			}
		}
		if (listener.accept(client) == sf::Socket::Done)
		{
			break;
		}
		m_window.clear();
		m_background.animate(frameClock.restart());
		m_window.draw(m_background);
		m_window.draw(m_loading);
		m_window.display();
	}
	if (m_isRunning)
	{
		ServerStage stage(m_window, m_background, client);
		stage.play();
	}
}
Exemplo n.º 24
0
void Actor::set_mesh(MeshID mesh) {
    //Increment the ref-count on this mesh
    mesh_ = stage().mesh(mesh).lock();

    subactors_.clear();
    for(SubMeshIndex idx: mesh_->submesh_ids()) {
        subactors_.push_back(SubActor::create(*this, idx));
    }

    signal_mesh_changed_(id());
}
Exemplo n.º 25
0
string level_description(int level)
{
	if ( stage(level) < 1 )
		return HIR "第"+chinese_number( stage(level) )+"层 " NOR;
	else if ( stage(level) < 2 )
		return HIC "第"+chinese_number( stage(level) )+"层 " NOR;
	else if ( stage(level) < 3 )
		return HIB "第"+chinese_number( stage(level) )+"层 " NOR;
	else 
		return HIW "第"+chinese_number( stage(level) )+"层 " NOR;
}
Exemplo n.º 26
0
BitmapMovie::BitmapMovie(as_object* object, const BitmapMovieDefinition* def,
        DisplayObject* parent)
	:
	Movie(object, def, parent),
    _def(def)
{
    assert(def);
    assert(object);
    Bitmap* bm = new Bitmap(stage(), 0, def, this);

    const int depth = 1 + DisplayObject::staticDepthOffset;
    placeDisplayObject(bm, depth);
}
Exemplo n.º 27
0
void
JobInfoCommunicator::setupJobEnvironment( void )
{
#if HAVE_JOB_HOOKS
	if (m_hook_mgr) {
		int rval = m_hook_mgr->tryHookPrepareJob();
		switch (rval) {
		case -1:   // Error
			dprintf(D_ALWAYS, "tryHookPrepareJob failed\n");
			Starter->RemoteShutdownFast(0);
			return;
			break;

		case 0:    // Hook not configured
				// Call tryHookPrepareMachine here
		{
            std::string stage("execution");
            m_hook_mgr->setHookPrepareMachineStage(stage);
			int rval1 = m_hook_mgr->tryHookPrepareMachine();
			if(rval1 == -1) { // Error
				Starter->RemoteShutdownFast(0);
				return;
			}
			if(rval1 == 0) { // Hook not configured
				dprintf(D_ALWAYS, "tryHookPrepareMachine is not configured\n");
				// Do nothing here, just break and call
				// jobEnvironmentReady
                break;
			}
			if(rval1 == 1) {
				dprintf(D_ALWAYS, "tryHookPrepareMachine has been spawned.\n");
				return;
			}
		}	
			break;

		case 1:    // Spawned the hook.
				// We need to bail now, and let the handler call
				// jobEnvironmentReady() when the hook returns.
			dprintf(D_ALWAYS, "tryHookPrepareJob has been spawned\n");
			return;
			break;
		}
	}
#endif /* HAVE_JOB_HOOKS */

		// If we made it here, either we're not compiled for hook
		// support, or we didn't spawn a hook.  Either way, we're
		// done and should tell the starter we're ready.
	Starter->jobEnvironmentReady();
}
Exemplo n.º 28
0
IScene* CSceneStageSelect::NextScene()
{
	const auto& sm = gm()->GetObjects("StageMng");
	if (!sm.empty())
	{
		std::dynamic_pointer_cast<CStageMng>(sm[0])->LoadStage(stageName_);
	}
	else
	{
		ObjPtr stage(new CStageMng());
		InsertObject(stage);
		std::dynamic_pointer_cast<CStageMng>(stage)->LoadStage(stageName_);
	}
	return new CSceneMain();
}
Exemplo n.º 29
0
/** export results to json
 */
void Group::write( QJsonObject &json ) const
{
  json["name"] = name();
  json["stage"] = (int)stage();
  json["type"] = type();
  json["qualif"] = isQualif();

  MatchList ml = _matches;
  
  QJsonArray mArray;
  foreach( Match m, ml ) {
    QJsonObject mObj;
    m.write( mObj );
    mArray.append( mObj );
  }
DynamicsCapsuleShape::DynamicsCapsuleShape(const float radius, const float length)
: DynamicsShape(Dali::DynamicsShape::CAPSULE)
{
  DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (radius:%.1f length:%.1f)\n", __PRETTY_FUNCTION__, radius, length);

  StagePtr stage( Stage::GetCurrent() );
  DynamicsWorldPtr world( stage->GetDynamicsWorld() );
  DALI_ASSERT_ALWAYS( world && "No Dynamics World !");

  SceneGraph::DynamicsCapsuleShape* capsuleShape = new SceneGraph::DynamicsCapsuleShape( *world->GetSceneObject() );
  mDynamicsShape = capsuleShape;

  // Queue a message to ensure the underlying dynamics object is created in the update thread
  InitializeDynamicsCapsuleShapeMessage( stage->GetUpdateInterface(), *capsuleShape, radius, length );
}