コード例 #1
0
ファイル: GContainer.cpp プロジェクト: darkstarx/eos_test
	void GContainer::do_draw()
	{
		utils::scoped_lock guard(m_list_lock);
		for (objects_t::const_iterator it = objects().begin(), end = objects().end(); it != end; ++it)
		{
			const GObjectSPtr &object = *it;
			object->draw();
		}
	}
コード例 #2
0
void CALifeSmartTerrainRegistry::add					(CSE_ALifeDynamicObject *object)
{
	CSE_ALifeSmartZone		*zone = smart_cast<CSE_ALifeSmartZone*>(object);
	if (!zone)
		return;

	OBJECTS::const_iterator	I = objects().find(object->ID);
	VERIFY					(I == objects().end());
	m_objects.insert		(std::make_pair(object->ID,zone));
}
コード例 #3
0
void IObject::Delete() 
{ 
	//objects().erase(objects().begin()+i); 
	for(int i=0; i< objects().size(); i++)
		if(objects()[i].get()==this)
		{
			objects().erase(objects().begin() + i);
			return;
		}
} 
コード例 #4
0
ファイル: alife_group_registry.cpp プロジェクト: 2asoft/xray
void CALifeGroupRegistry::add								(CSE_ALifeDynamicObject *object)
{
	CSE_ALifeOnlineOfflineGroup			*group = smart_cast<CSE_ALifeOnlineOfflineGroup*>(object);
	if (!group)
		return;

	OBJECTS::const_iterator				I = objects().find(group->ID);
	VERIFY								(I == objects().end());
	m_objects.insert					(std::make_pair(group->ID,group));
}
コード例 #5
0
ファイル: Cluster.cpp プロジェクト: orestv/Magister-code
float Cluster::diameter(AbstractMetric *pMetric) {
    float dist = -1, maxDist = -1;
    for (list<Object*>::iterator iO_outer = objects().begin();
            iO_outer != objects().end(); iO_outer++) {
        for (list<Object*>::iterator iO_inner = iO_outer;
                iO_inner != objects().end(); iO_inner++) {
            if (iO_inner == iO_outer)
                continue;
            dist = pMetric->distance(**iO_outer, **iO_inner);
            if (dist > maxDist)
                maxDist = dist;
        }
    }
    return dist;
}
コード例 #6
0
void executeDataProcessor( DataProcessorGenerator2D const& generator,
                           MultiBlock2D& object )
{
    std::vector<MultiBlock2D*> objects(1);
    objects[0] = &object;
    executeDataProcessor(generator, objects);
}
コード例 #7
0
void addInternalProcessor( DataProcessorGenerator3D const& generator,
                           MultiBlock3D& object, plint level )
{
    std::vector<MultiBlock3D*> objects(1);
    objects[0] = &object;
    addInternalProcessor(generator, objects, level);
}
コード例 #8
0
ファイル: IddFile.cpp プロジェクト: pepsi7959/OpenStudio
 std::vector<std::string> IddFile_Impl::groups() const {
   StringSet result;
   for (const IddObject& object : objects()) {
     result.insert(object.group());
   }
   return StringVector(result.begin(),result.end());
 }
コード例 #9
0
Foam::label Foam::sampledSurfaces::classifyFields()
{
    label nFields = 0;

    if (loadFromFiles_)
    {
        // Check files for a particular time
        IOobjectList objects(mesh_, mesh_.time().timeName());
        wordList allFields = objects.sortedNames();

        forAll(fieldSelection_, i)
        {
            labelList indices = findStrings(fieldSelection_[i], allFields);

            if (indices.size())
            {
                nFields += indices.size();
            }
            else
            {
                WarningInFunction
                    << "Cannot find field file matching "
                    << fieldSelection_[i] << endl;
            }
        }
    }
コード例 #10
0
ファイル: fca.c プロジェクト: ekolbey/study_notes
/* -------------------------------------------------------------------------- *
 * --------------- Compute the formal concepts by brute force --------------- *
 * -------------------------------------------------------------------------- */
int main(int argc, char const *argv[])
{
	for(int i = argc ; i-- ; )
		printf( "%s\n", argv[ i ] );

	char buffer[2][16];
	FILE *fout;
	fout = fopen( "concepts.txt", "w+" );
// Build concepts. It does not matter whether we traverse the space of
//  objects or the space of properties.
	for( int i = 0 ; i < ( 1 << G ) ; ++i ) {
		unsigned p = properties( i );
		unsigned o = objects( p );
// The concept is a pair (g, m) such that g. = m and .m = g. Equivalently
//  a formal concept is a pair (g, g.) such that .(g.) = g, i.e g is closed
//  in the concept matrix. I wonder if one can define a topology on this
//  discrete poset.
		if( o != i ) continue;

		display_objects( i, buffer[ 0 ] );
		display_properties( p, buffer[ 1 ] );
		// display_objects( ( ~i ) & ( ( 1 << G ) - 1 ), buffer[ 0 ] );
		fprintf( fout, "%.*s\t%.*s\n", G, buffer[ 0 ], M, buffer[ 1 ] );
	}
	fclose( fout );

	return 0;
}
コード例 #11
0
ファイル: assembly.cpp プロジェクト: appleseedhq/appleseed
bool Assembly::on_render_begin(
    const Project&          project,
    const BaseGroup*        parent,
    OnRenderBeginRecorder&  recorder,
    IAbortSwitch*           abort_switch)
{
    if (!Entity::on_render_begin(project, parent, recorder, abort_switch))
        return false;

    if (!BaseGroup::on_render_begin(project, parent, recorder, abort_switch))
        return false;

    bool success = true;
    success = success && invoke_on_render_begin(bsdfs(), project, this, recorder, abort_switch);
    success = success && invoke_on_render_begin(bssrdfs(), project, this, recorder, abort_switch);
    success = success && invoke_on_render_begin(edfs(), project, this, recorder, abort_switch);
    success = success && invoke_on_render_begin(surface_shaders(), project, this, recorder, abort_switch);
    success = success && invoke_on_render_begin(materials(), project, this, recorder, abort_switch);
    success = success && invoke_on_render_begin(lights(), project, this, recorder, abort_switch);
    success = success && invoke_on_render_begin(objects(), project, this, recorder, abort_switch);
    success = success && invoke_on_render_begin(object_instances(), project, this, recorder, abort_switch);
    success = success && invoke_on_render_begin(volumes(), project, this, recorder, abort_switch);

    return success;
}
コード例 #12
0
ファイル: tracking.cpp プロジェクト: hommeabeil/perception3d
// Callback Function for the subscribed ROS topic
void cloud_callback (const pcl::PCLPointCloud2ConstPtr& input){

    pcl::PointCloud<PointT>::Ptr objects(new pcl::PointCloud<PointT>);
    pcl::fromPCLPointCloud2(*input,*objects);
    cloud = objects;

    //Extract objects and store centroids
    if(!object_vector.empty()){object_vector.clear();}
    object_vector = segment_objects(objects,0.02,200,15000);
    storeObjectCentroids(object_vector);


    if(initialize_object_to_track){
        //object_to_track = addNormalsToPointCloud(object_vector[index_to_track]);
        object_to_track = object_vector[index_to_track];
        object_to_track->height = 1;
        object_to_track->width = object_to_track->size();
        initialize_object_to_track = false;
    }

    // depth_cloud_mutex.lock();
    if(first_time_tracking){
        setTrackerTarget();
        first_time_tracking = false;
    }
    track();
    // depth_cloud_mutex.unlock();


    //Update viewer
    if(showUI){
        printToPCLViewer();
    }
}
コード例 #13
0
ファイル: usage_d.c プロジェクト: Hobbitron/tmi2_fluffos_v3
void create() {
    mapping r;

    return;

    memory = memory_info() / 1000;
    users = sizeof(users());
// rusage() not available everywhere. If you really
// really need it, figure it out.
#if 0
    r = rusage();
#endif
    cpu = (r["utime"] + r["stime"]) / ( uptime() + 1 ) / 10.0;
    obs = sizeof(objects());

    pastobs = allocate(TRACK_NUM);
    pastusers = allocate(TRACK_NUM);
    pastmem = allocate(TRACK_NUM);
    pastcpu = allocate(TRACK_NUM);

    pastmem[counter] = memory;
    pastusers[counter] = users;
    pastobs[counter] = obs;
    pastcpu[counter] = cpu;

    lastmem = 0;
    lastusers = 0;
    lastcpu = 0.0;
    lastobs = 0;

    counter = 0;
    times = 0.0;

    call_out("sample", CALL_TIME);
}
コード例 #14
0
void executeDataProcessor( ReductiveDataProcessorGenerator3D& generator,
                           MultiBlock3D& object )
{
    std::vector<MultiBlock3D*> objects(1);
    objects[0] = &object;
    executeDataProcessor(generator, objects);
}
コード例 #15
0
ファイル: formation.cpp プロジェクト: hanguangming/Blitz
void G_Formation::change_soldier(const G_SoldierInfo *old_info, const G_SoldierInfo *new_info) noexcept {
    assert(old_info->is_hero() == new_info->is_hero());

    if (old_info->is_hero()) {
        ptr<G_FormationItem> old_item = remove_object(old_info->id());
        if (!old_item) {
            return;
        }
        G_FormationItem *new_item = probe_object(new_info->id(), new_info);
        if (new_item) {
            new_item->_soldier = old_item->_soldier;
            new_item->_x = old_item->_x;
            new_item->_y = old_item->_y;
        }
    }
    else {
        bool found = false;
        for (G_FormationItem *item : objects()) {
            if (item->_soldier == old_info) {
                item->_soldier = new_info;
                found = true;
            }
        }
        if (!found) {
            return;
        }
    }
    the_data()->_formation_opts.emplace_back();
    to_opt(the_data()->_formation_opts.back());
}
コード例 #16
0
int main(int argc, char *argv[])
{
    #include "addRegionOption.H"
    argList::validArgs.append("fieldName");
    #include "setRootCase.H"
    #include "createTime.H"
    #include "createNamedMesh.H"

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

    const word fieldName = args[1];

    IOobjectList objects(IOobjectList(mesh, mesh.time().timeName()));

    label processed = -1;
    processField<scalar>(mesh, objects, fieldName, processed);
    processField<vector>(mesh, objects, fieldName, processed);
    processField<sphericalTensor>(mesh, objects, fieldName, processed);
    processField<symmTensor>(mesh, objects, fieldName, processed);
    processField<tensor>(mesh, objects, fieldName, processed);

    if (processed == -1)
    {
        Info<< "Field " << fieldName << " not found" << endl;
    }

    Info<< "\nEnd\n" << endl;

    return 0;
}
コード例 #17
0
ファイル: mudinfo.c プロジェクト: mudchina/nitan3
int main(object me) 
{
        float value;
        mapping r;

        if (time() - me->query_temp("scan_time") < 10
           && ! wizardp(me))
                return notify_fail("等等,系统喘气中……\n");

        r = rusage();
        value = SCALE * (r["utime"] + r["stime"]) / uptime();

        write(NOR + WHT "\n\t\t         .__________ 系 统 资 讯 __________.\n");
        write(NOR + WHT "\t\t ─────────────────────────\n");
        write(NOR + WHT "\t\t 游戏的识别名称:  " + MUD_NAME + "\n");
        write(NOR + WHT "\t\t 界面系统的版本:  " + __VERSION__ + "\n");
        write(NOR + WHT "\t\t 系统函数库版本:  Nitan Mudlib Version 2.1\n");
        printf(NOR + WHT "\t\t CPU 使用百分比:  %f %% 被这个游戏使用中\n", value );
        write(NOR + WHT "\t\t CPU 的负担状况:  " + query_load_average() + "\n");
        printf(NOR + WHT "\t\t 共使用的记忆体:  %s bytes\n", memory_expression(memory_info()) );
        write(NOR + WHT "\t\t 线上使用者总数:  " + sizeof( users() ) + "  个人在线上\n");
        write(NOR + WHT "\t\t 注册使用者总数:  " + count_ppls() + "  个人在本游戏注册\n");
        write(NOR + WHT "\t\t 载入的物件总数:  " + sizeof( objects() ) + " 个物件\n");
        write(NOR + WHT "\t\t 心跳总数的资讯:  " + sizeof(heart_beats()) + " 个\n");
        write(NOR + WHT "\t\t 延迟呼叫数资讯:  " + sizeof(call_out_info()) + " 个\n");
        write(NOR + WHT "\t\t 系统负载的资讯:  " + query_load_average() + "\n");
        write(NOR + WHT "\t\t 讯息传输的资讯:  " + query_rusage_message() + "\n");
        write(NOR + WHT "\t\t 连续执行的时间:  " + dotime() + "\n");
        write(NOR + WHT "\t\t 游戏现在的状态:  " + STATUS + "\n" NOR);
        write(NOR + WHT "\t\t 游戏对 PK 限制:   每天不超过 8 人,每人不超过 2 次\n\n" NOR);

        me->set_temp("scan_time", time());

        return 1;
}
コード例 #18
0
void readFields
(
    PtrList<List<Type> >& values,
    const List<word>& fieldNames,
    const IOobjectList& cloudObjs
)
{
    IOobjectList objects(cloudObjs.lookupClass(IOField<Type>::typeName));

    forAll(fieldNames, j)
    {
        const IOobject* obj = objects.lookup(fieldNames[j]);
        if (obj != NULL)
        {
            Info<< "        reading field " << fieldNames[j] << endl;
            IOField<Type> newField(*obj);
            values.set(j, new List<Type>(newField.xfer()));
        }
        else
        {
            FatalErrorIn
            (
                "template<class Type>"
                "void readFields"
                "("
                    "PtrList<List<Type> >&, "
                    "const List<word>&, "
                    "const IOobjectList&"
                ")"
            )
                << "Unable to read field " << fieldNames[j]
                << abort(FatalError);
        }
    }
}
コード例 #19
0
tmp<Field<Type> > readParticleField
(
    const word& name,
    const IOobjectList cloudObjs
)
{
    IOobjectList objects(cloudObjs.lookupClass(IOField<Type>::typeName));

    const IOobject* obj = objects.lookup(name);
    if (obj != NULL)
    {
        IOField<Type> newField(*obj);
        return tmp<Field<Type> >(new Field<Type>(newField.xfer()));
    }

    FatalErrorIn
    (
        "template<class Type>"
        "void readParticleField"
        "("
            "const word&, "
            "const IOobjectList"
        ")"
    )
        << "error: cloud field name " << name << " not found"
        << abort(FatalError);

    return Field<Type>::null();
}
コード例 #20
0
Foam::label Foam::sampledSurfaces::classifyFields()
{
    label nFields = 0;
    clearFieldGroups();

    // check files for a particular time
    if (loadFromFiles_)
    {
        IOobjectList objects(mesh_, mesh_.time().timeName());
        wordList allFields = objects.sortedNames();

        labelList indices = findStrings(fieldSelection_, allFields);

        forAll(indices, fieldI)
        {
            const word& fieldName = allFields[indices[fieldI]];

            nFields += appendFieldGroup
            (
                fieldName,
                objects.find(fieldName)()->headerClassName()
            );
        }
    }
    else
    {
コード例 #21
0
ファイル: testutils.hpp プロジェクト: 8l/Mach7
inline long long test(Object* (*make)(int), int (*match)(Object*))
{
    size_t a = 0; // Accumulator to make sure compiler doesn't take some loop invariants out
    size_t j = 0; // Incremental number for the current path/object combination. Ensures all path get tested.
    std::vector<long long> medians(K); // Final verdict of medians for each of the K experiments
    std::vector<Object*>   objects(N);
    std::vector<long long> timings(M);

    for (size_t k = 0; k < K; ++k)
    {
        for (size_t n = 0; n < N; ++n)
            objects[n] = make(j++);

        for (size_t m = 0; m < M; ++m)
        {
            time_stamp liStart  = get_time_stamp();

            for (size_t i = 0; i < N; ++i)
                a += match(objects[i]);

            time_stamp liFinish = get_time_stamp();
            timings[m] = liFinish-liStart;
        }

        for (size_t n = 0; n < N; ++n)
            delete objects[n];

        medians[k] = display("test", timings); // We are looking for a median per N iterations
    }

    std::sort(medians.begin(), medians.end());
    return cycles(medians[K/2])/N;
}
コード例 #22
0
ファイル: gl2psTest.c プロジェクト: hirokemono/Kemorin_MHD
/* A more complex drawing function, using 2 separate viewports */
void draw_multi()
{
  GLint viewport[4];

  glScissor(0, 0, window_w, window_h);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  /* First viewport with triangles, teapot or torus, etc. */
  glViewport((GLint)(window_w * 0.05), (GLint)(window_h * 0.525),
             (GLsizei)(window_w * 0.9), (GLsizei)(window_h * 0.45));
  glScissor((GLint)(window_w * 0.05), (GLint)(window_h * 0.525),
            (GLsizei)(window_w * 0.9), (GLsizei)(window_h * 0.45));
  glClearColor(0.2, 0.2, 0.2, 0.);
  glGetIntegerv(GL_VIEWPORT, viewport);

  gl2psBeginViewport(viewport);

  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glOrtho(-1.3,1.3, -1.3,1.3, -1.3,1.3);
  glMatrixMode(GL_MODELVIEW);

  objects();
  triangles();
  extras();
  text();

  gl2psEndViewport();

  /* Second viewport with cube, image, etc. */
  glViewport((GLint)(window_w * 0.05), (GLint)(window_h * 0.025),
             (GLsizei)(window_w * 0.9), (GLsizei)(window_h * 0.45));
  glScissor((GLint)(window_w * 0.05), (GLint)(window_h * 0.025),
             (GLsizei)(window_w * 0.9), (GLsizei)(window_h * 0.45));
  glClearColor(0.8, 0.8, 0.8, 0.);
  glGetIntegerv(GL_VIEWPORT, viewport);

  gl2psBeginViewport(viewport);

  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glOrtho(-1.3,1.3, -1.3,1.3, -1.3,1.3);
  glMatrixMode(GL_MODELVIEW);

  glPushMatrix();
  glRotatef(rotation, 1., 1., 1.);
  image(-0.8, -0.3, GL_TRUE);
  cube();
  extras();
  image(-0.8, 0.4, GL_FALSE);
  glPopMatrix();

  gl2psEndViewport();

  glClearColor(0.5, 0.5, 0.5, 0.);
  glFlush();
}
コード例 #23
0
ファイル: Raytracer.cpp プロジェクト: frmimue/Raytracer
int main(int argv, char **argc) {

	Scene *scene = new Scene();

	std::ifstream sceneFile("scene.txt");

	if (!sceneFile)
		return 123;

	std::string s((std::istreambuf_iterator<char>(sceneFile)), std::istreambuf_iterator<char>());

	JsonGroup json(s);
	JsonArray objects(json.at("objects").Array());
	JsonArray lights(json.at("lights").Array());
	JsonGroup camera(json.at("camera").Group());

	Camera cam = Camera(Vector3D(camera.at("position").Array().at(0).Float(), camera.at("position").Array().at(1).Float(), camera.at("position").Array().at(2).Float()), Vector3D(camera.at("target").Array().at(0).Float(), camera.at("target").Array().at(1).Float(), camera.at("target").Array().at(2).Float()), camera.at("roll").Float());

	for (int i = 0; i < objects.size(); i++){
		JsonGroup object = objects.at(i).Group();

		if (object.at("type").String().compare("sphere") == 0){
			scene->add(new SphereObject(Vector3D(object.at("position").Array().at(0).Float(), object.at("position").Array().at(1).Float(), object.at("position").Array().at(2).Float()),
				object.at("radius").Float(), Color(object.at("color").Array().at(0).Integer(), object.at("color").Array().at(1).Integer(), object.at("color").Array().at(2).Integer()), object.at("reflection").Float(), object.at("refraction").Float(), object.at("ior").Float()));
		}

		if (object.at("type").String().compare("plane") == 0){
			scene->add(new PlaneObject(Vector3D(object.at("position").Array().at(0).Float(), object.at("position").Array().at(1).Float(), object.at("position").Array().at(2).Float()),
				Vector3D(object.at("normal").Array().at(0).Float(), object.at("normal").Array().at(1).Float(), object.at("normal").Array().at(2).Float()),
				Color(object.at("color").Array().at(0).Array().at(0).Integer(), object.at("color").Array().at(0).Array().at(1).Integer(), object.at("color").Array().at(0).Array().at(2).Integer()),
				Color(object.at("color").Array().at(1).Array().at(0).Integer(), object.at("color").Array().at(1).Array().at(1).Integer(), object.at("color").Array().at(1).Array().at(2).Integer()), object.at("reflection").Float(), object.at("refraction").Float(), object.at("ior").Float()));
		}

		if (object.at("type").String().compare("triangle") == 0){
			scene->add(new TriangleObject(Vector3D(object.at("vertices").Array().at(0).Array().at(0).Integer(), object.at("vertices").Array().at(0).Array().at(1).Integer(), object.at("vertices").Array().at(0).Array().at(2).Integer()),
				Vector3D(object.at("vertices").Array().at(1).Array().at(0).Integer(), object.at("vertices").Array().at(1).Array().at(1).Integer(), object.at("vertices").Array().at(1).Array().at(2).Integer()),
				Vector3D(object.at("vertices").Array().at(2).Array().at(0).Integer(), object.at("vertices").Array().at(2).Array().at(1).Integer(), object.at("vertices").Array().at(2).Array().at(2).Integer()),
				Color(object.at("color").Array().at(0).Integer(), object.at("color").Array().at(1).Integer(), object.at("color").Array().at(2).Integer()), object.at("reflection").Float(), object.at("refraction").Float(), object.at("ior").Float()));
		}
	}

	for (int i = 0; i < lights.size(); i++){
		JsonGroup light = lights.at(i).Group();

		if (light.at("type").String().compare("point") == 0){
			scene->add(new PointLight(Vector3D(light.at("position").Array().at(0).Float(), light.at("position").Array().at(1).Float(), light.at("position").Array().at(2).Float())));
		}

		if (light.at("type").String().compare("direction") == 0){
			scene->add(new DirectionLight(Vector3D(light.at("direction").Array().at(0).Float(), light.at("direction").Array().at(1).Float(), light.at("direction").Array().at(2).Float())));
		}
	}

    Renderer *renderer = new Renderer();
	PixelBuffer *buffer = renderer->render(scene, &cam, camera.at("resolution").Array().at(0).Integer(), camera.at("resolution").Array().at(1).Integer(), camera.at("raydepth").Integer());
	//buffer->savePPM("test.ppm");
	buffer->saveBMP("image.bmp");
    return 0;
}
コード例 #24
0
void executeDataProcessor( DataProcessorGenerator3D const& generator,
                           MultiBlock3D& object1, MultiBlock3D& object2 )
{
    std::vector<MultiBlock3D*> objects(2);
    objects[0] = &object1;
    objects[1] = &object2;
    executeDataProcessor(generator, objects);
}
コード例 #25
0
void executeDataProcessor( ReductiveDataProcessorGenerator2D& generator,
                           MultiBlock2D& object1, MultiBlock2D& object2 )
{
    std::vector<MultiBlock2D*> objects(2);
    objects[0] = &object1;
    objects[1] = &object2;
    executeDataProcessor(generator, objects);
}
コード例 #26
0
void addInternalProcessor( DataProcessorGenerator2D const& generator,
                           MultiBlock2D& object1, MultiBlock2D& object2,
                           plint level )
{
    std::vector<MultiBlock2D*> objects(2);
    objects[0] = &object1;
    objects[1] = &object2;
    addInternalProcessor(generator, objects, level);
}
コード例 #27
0
/**
 *  Function for creating and holding of shared context.
 *  Generation and uploading of new textures over some period with sleep time.
 */
void AsyncFetcher::run()
{
    LBASSERT( _sharedWindow );
    if( !_sharedWindow )
        return;

    _sharedWindow->makeCurrent();
    eq::util::ObjectManager objects( glewGetContext( ));
    lunchbox::Bufferb textureData( 64*64*4 );
    LBINFO << "async fetcher initialized" << std::endl;

    bool running = true;
    lunchbox::sleep( 1000 ); // imitate loading of the first texture
    for( uint8_t* i = 0; running; ++i )
    {
        // generate new texture
        eq::util::Texture* tx = objects.newEqTexture( i, GL_TEXTURE_2D );
        tx->init( GL_RGBA8, 64, 64 );

        int j = 0;
        lunchbox::RNG rng;
        for( int y = 0; y < 64; ++y )
        {
            for( int x = 0; x < 64; ++x )
            {
                const GLbyte rnd = rng.get< uint8_t >() % 127;
                const GLbyte val = (x / 8) % 2 == (y / 8) % 2 ? rnd : 0;
                textureData[ j++ ] = val;
                textureData[ j++ ] = val;
                textureData[ j++ ] = val;
                textureData[ j++ ] = val;
            }
        }
        tx->upload( 64, 64, textureData.getData( ));
        EQ_GL_CALL( glFinish( ));

        // add new texture to the pool
        _outQueue.push( TextureId( tx->getName(), i ));

        // imitate hard work of loading something else
        lunchbox::sleep( rng.get< uint32_t >() % 5000u );

        // clean unused textures
        const void* keyToDelete = 0;
        while( _inQueue.tryPop( keyToDelete ))
        {
            if( keyToDelete )
            {
                LBWARN << "Deleting eq texture " << keyToDelete << std::endl;
                objects.deleteEqTexture( keyToDelete );
            }
            else
                running = false;
        }
    }
    objects.deleteAll();
}
コード例 #28
0
int cmd_destold(string str) {
    object ob, act_ob, *obs;
    string msg, opt;
    int clean, global, l, s;

    act_ob = previous_object();
    seteuid(geteuid(act_ob));

    notify_fail( SYNTAX );
    if (!str || str == "")  return 0;

#ifdef GUEST_NO_DEST
    if (getuid(previous_object()) == "guest") {
	write ("Guest is not permitted to dest objects.\n") ;
	return 1 ;
    }
#endif

    if (str == "all")
	return dest_all(act_ob, 0);

    if (sscanf(str, "-%s %s", opt, str) == 2) {
	if (strsrch(opt, 'a') != -1)  clean = 1;
	if (strsrch(opt, 'g') != -1)  global = 1;
    }

    if (global) {
	if (!adminp(geteuid(act_ob))) {
	    write("Global Dest: Permission denied.\n");
	    return 1;
	}

	str = resolv_path("cwd", str);
	l = strlen(str);
	obs = objects();
	s = sizeof(obs);

	write("Global destructing: " + str + "\n");

	cnt = 0;
	while (s--) {
	    if (!obs[s])  continue;
	    if (strncmp(file_name(obs[s]), str, l) == 0) {
		if (clean)
		    dest_all(obs[s], 1);
		cnt++;
		if (obs[s]) {
		    catch(obs[s]->remove());
		    destruct(obs[s]);
		}
	    }
	}

	write("object(s) destructed: " + cnt + "\n");
    } else {
	if (!(ob = get_object(str))) {
コード例 #29
0
ファイル: gl2psTest.c プロジェクト: hirokemono/Kemorin_MHD
/* A simple drawing function, using the default viewport */
void draw_single()
{
  glScissor(0, 0, window_w, window_h);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  triangles();
  extras();
  objects();
  text();
  glFlush();
}
コード例 #30
0
CRhinoCommand::result CCommandSampleMeshDir::RunCommand( const CRhinoCommandContext& context )
{
  CRhinoGetObject go;
  go.SetGeometryFilter( CRhinoObject::mesh_object | CRhinoObject::surface_object | CRhinoObject::polysrf_object | CRhinoObject::instance_reference );
  go.SetCommandPrompt( L"Select mesh, surface, or polysurface objects" );
  go.GetObjects(1,0);
  if( go.Result() != CRhinoGet::object )
    return CRhinoCommand::cancel;

  int i = 0;
  ON_SimpleArray<const CRhinoObject*> objects( go.ObjectCount() );
  for( i = 0; i < go.ObjectCount(); i++ )
    objects.Append( go.Object(i).Object() );

  ON_ClassArray<CRhinoObjRef> render_meshes;
  int count = RhinoGetRenderMeshes( objects, render_meshes, true, false );
  if( count > 0 )
  {
    CMeshDirDrawCallback callback;
    callback.m_mesh_list.Reserve( count );
    for( i = 0; i < render_meshes.Count(); i++ )
    {
      const ON_Mesh* mesh = render_meshes[i].Mesh();
      if( mesh )
        callback.m_mesh_list.AppendNew().SetMesh( mesh );
    }

    CRhinoGetOption go;
    go.SetCommandPrompt( L"Press Enter when done" );
    go.AcceptNothing();
    go.AddCommandOptionToggle( RHCMDOPTNAME(L"FaceNormals"), RHCMDOPTVALUE(L"No"), RHCMDOPTVALUE(L"Yes"), m_draw_face_normals, &m_draw_face_normals );
    go.AddCommandOptionToggle( RHCMDOPTNAME(L"VertexNormals"), RHCMDOPTVALUE(L"No"), RHCMDOPTVALUE(L"Yes"), m_draw_vertex_normals, &m_draw_vertex_normals );

    CRhinoGet::result res = CRhinoGet::nothing;
    for( ;; )
    {
      callback.m_draw_face_normals = m_draw_face_normals;
      callback.m_draw_vertex_normals = m_draw_vertex_normals;

      CRhinoView::AddDrawCallback( &callback );
      context.m_doc.Redraw( CRhinoView::regenerate_display_hint );

      res = go.GetOption();
      CRhinoView::RemoveDrawCallback( &callback );

      if( res == CRhinoGet::option )
        continue;
      break;
    }
  }

  context.m_doc.Redraw( CRhinoView::regenerate_display_hint );
  
  return CRhinoCommand::success;
}