当前位置: 首页>>代码示例>>C++>>正文


C++ RGBColor函数代码示例

本文整理汇总了C++中RGBColor函数的典型用法代码示例。如果您正苦于以下问题:C++ RGBColor函数的具体用法?C++ RGBColor怎么用?C++ RGBColor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了RGBColor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RGBColor

void 												
World::build(void) {
	int num_samples = 16;
	
	vp.set_hres(400);
	vp.set_vres(400); 
	vp.set_samples(num_samples);
	vp.set_max_depth(0);
	
	background_color = RGBColor(0.5);
	
	tracer_ptr = new RayCast(this);
	
	Pinhole* pinhole_ptr = new Pinhole;
	pinhole_ptr->set_eye(2, 3.5, 5);
	pinhole_ptr->set_lookat(0,0,0); 
	pinhole_ptr->set_view_distance(800.0);
	pinhole_ptr->compute_uvw();
	set_camera(pinhole_ptr);
	
	Directional* light_ptr = new Directional;
	light_ptr->set_direction(14, 20, 25);  
	light_ptr->scale_radiance(1.75);  
	light_ptr->set_shadows(true);
	add_light(light_ptr);

	Image* image_ptr = new Image;					
	image_ptr->read_ppm_file("F:/Documents/Visual Studio 2005/Projects/Rytracer/TextureFiles/ppm/CountryScene.ppm");
	CylindricalMap* map_ptr = new CylindricalMap;   
	ImageTexture* texture_ptr = new ImageTexture(image_ptr); 
	texture_ptr->set_mapping(map_ptr);

	SV_Matte* sv_matte_ptr = new SV_Matte;		
	sv_matte_ptr->set_ka(0.40);
	sv_matte_ptr->set_kd(0.95);
	sv_matte_ptr->set_cd(texture_ptr);

	OpenCylinder* cylinder_ptr = new OpenCylinder;
	cylinder_ptr->set_material(sv_matte_ptr); 
	add_object(cylinder_ptr);
}
开发者ID:matthiascy,项目名称:crocus-raytracer,代码行数:41,代码来源:build20.cpp

示例2: _DrawBeveledRect

/*!	\brief Actually draws the zoom button

	Unless a subclass has a particularly large button, it is probably
	unnecessary to check the update rectangle.

	\param tab The \a tab to update.
	\param direct Draw without double buffering.
	\param rect The area of the button to update.
*/
void
WinDecorator::_DrawZoom(Decorator::Tab* tab, bool direct, BRect rect)
{
	_DrawBeveledRect(rect, tab->zoomPressed);

	// Draw the Zoom box

	BRect zoomBox(rect);
	zoomBox.InsetBy(2, 2);
	zoomBox.InsetBy(1, 0);
	zoomBox.bottom--;
	zoomBox.right--;

	if (true)
		zoomBox.OffsetBy(1, 1);

	fDrawingEngine->SetHighColor(RGBColor(0,0,0));
	fDrawingEngine->StrokeRect(zoomBox);
	zoomBox.InsetBy(1, 1);
	fDrawingEngine->StrokeLine(zoomBox.LeftTop(), zoomBox.RightTop());
}
开发者ID:Paradoxianer,项目名称:haiku,代码行数:30,代码来源:WinDecorator.cpp

示例3: DrawBeveledRect

void
WinDecorator::_DrawZoom(BRect r)
{
	DrawBeveledRect(r,GetZoom());
	
	// Draw the Zoom box

	BRect rect(r);
	rect.InsetBy(2,2);
	rect.InsetBy(1,0);
	rect.bottom--;
	rect.right--;
	
	if (GetZoom())
		rect.OffsetBy(1,1);

	fDrawingEngine->SetHighColor(RGBColor(0,0,0));
	fDrawingEngine->StrokeRect(rect);
	rect.InsetBy(1,1);
	fDrawingEngine->StrokeLine(rect.LeftTop(),rect.RightTop());
	
}
开发者ID:mmanley,项目名称:Antares,代码行数:22,代码来源:WinDecorator.cpp

示例4: RGBColor

Floor::Floor(int screenWidth, int screenHeight) {
    COLOR[0] = RGBColor(0.32f, 0.48f, 0.25f, 1.0f);  // collina
    COLOR[1] = RGBColor(0.57f, 0.79f, 0.83f, 1.0f);  // primavera
    COLOR[2] = RGBColor(0.38f, 0.82f, 0.89f, 1.0f);  // estate
    COLOR[3] = RGBColor(0.41f, 0.59f, 0.61f, 1.0f);  // autunno
    COLOR[4] = RGBColor(0.66f, 0.66f, 0.66f, 1.0f);  // inverno
    COLOR[5] = RGBColor(0.20f, 0.70f, 0.10f, 1.0f);  // erba

    this->width = screenWidth;
    this->height = screenHeight;

    int vectorSize = this->width * this->height;
    this->pixels = new float[vectorSize * 3];
    this->pixels_copy = new float[vectorSize * 3];
    int snowSize = this->width * (this->height / 2);
    this->snow_pixels = new float[snowSize * 3]();
}
开发者ID:wil93,项目名称:seasons,代码行数:17,代码来源:model.cpp

示例5: RGB24Buffer

RGB24Buffer *QTFileLoader::RGB24BufferFromQImage(QImage *image)
{
    if (image == NULL)
        return NULL;

    RGB24Buffer *result = new RGB24Buffer(image->height(), image->width(), false);

    /**
     * TODO: Make this faster using .bits() method.
     * So far don't want to mess with possible image formats
     *
     */
    for (int i = 0; i < image->height(); i++)
    {
        for (int j = 0; j < image->width(); j++)
        {
            QRgb pixel = image->pixel(j,i);
            result->element(i,j) = RGBColor(qRed(pixel), qGreen(pixel), qBlue(pixel));
        }
    }

    return result;
}
开发者ID:ArsenyChernyaev,项目名称:corecvs,代码行数:23,代码来源:qtFileLoader.cpp

示例6: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QMainWindow* window = new QMainWindow();
    RenderGui::Viewer* viewer = new RenderGui::Viewer();
    window->setCentralWidget(viewer);
    window->show();

    int width = 640;
    int height = 480;

    SimpleScene scene;
    PhongMaterial metal(scene,
            RGBColor(0.1,0.1,0.1),
            RGBColor(0.8,0.8,0.8),
            RGBColor(0.8,0.8,0.8),
            2.0);

//    Sphere sphere(Coord(0,0,4), metal);
//    scene.push_obj(&sphere);

    Plane triangle(Vector3d(1.0,0.0,1.0),
            Vector3d(0.0,1.0,1.0),
            Vector3d(0.0,0.0,1.0),
            metal);
    scene.push_obj(&triangle);

    PhongPointLight light(Coord(-5, -0.2, -0.2),
            RGBColor(0.2,0.2,0.2),
            RGBColor(0.2,0.2,0.2),
            RGBColor(0.2,0.2,0.2));
    scene.push_light(&light);

    Coord cam(0,0,-1);
    SimpleRaytracer raytracer(scene);
    QImageBuffer buffer(width, height);
    raytracer.render(buffer, 60, cam);

    //buffer.setPixel(50, 50, ColorOps::white);
    viewer->showImage(buffer.qimage());

    return a.exec();
}
开发者ID:mtao,项目名称:tests,代码行数:44,代码来源:main.cpp

示例7: AllColors

void ColorGenerator::Generate(Vector<RGBColor> &Result, const Vec3f &Scale)
{
    const UINT ColorCount = Result.Length();
    KMeansClustering<Vec3f, Vec3fKMeansMetric> Clustering;
    
    Vector<Vec3f> AllColors(ColorCount * 25);
    const UINT AllColorsCount = AllColors.Length();
    for(UINT Index = 0; Index < AllColorsCount; Index++)
    {
        Vec3f CurColor = Vec3f(rnd(), rnd(), rnd());
        while(CurColor.x + CurColor.y + CurColor.z < 0.5f)
        {
            CurColor = Vec3f(rnd(), rnd(), rnd());
        }
        AllColors[Index] = Vec3f(CurColor.x * Scale.x, CurColor.y * Scale.y, CurColor.z * Scale.z);
    }

    Clustering.Cluster(AllColors, ColorCount, 20, false);

    for(UINT ColorIndex = 0; ColorIndex < ColorCount; ColorIndex++)
    {
        Result[ColorIndex] = RGBColor(Clustering.ClusterCenter(ColorIndex));
    }
}
开发者ID:ghsoftco,项目名称:basecode14,代码行数:24,代码来源:ColorGenerator.cpp

示例8: Assert

void StateManager::LoadVertexColor(RGBColor &C, UINT Index)
{
    for(UINT i = 0; i < VertexDeclaration.Length(); i++)
    {
        const D3D9Base::D3DVERTEXELEMENT9 &Decl = VertexDeclaration[i];
        if(Decl.Usage == D3DDECLUSAGE_COLOR && Decl.UsageIndex == 0)
        {
            StreamInfo &Stream = VBufferStreams[Decl.Stream];
            Assert(Stream.StreamData != NULL, "Reference to unbound stream");
            BYTE *ByteStream = (BYTE *)(Stream.StreamData->Buffer.CArray() + Stream.OffsetInBytes + Index * Stream.Stride + Decl.Offset);
            float *FloatStream = (float *)ByteStream;
            Vec4f Result = Vec4f(0.0f, 0.0f, 0.0f, 0.0f);
            if(Decl.Type == D3DDECLTYPE_D3DCOLOR)
            {
                C = RGBColor(ByteStream[0], ByteStream[1], ByteStream[2], ByteStream[3]);
                return;
            }
            else
            {
                SignalError(String("Unsupported type: ") + String(UINT(Decl.Type)));
            }
        }
    }
}
开发者ID:zhanrnl,项目名称:danmaku-ai,代码行数:24,代码来源:StateManager.cpp

示例9: throw

// ===========================================================================
// member method definitions
// ===========================================================================
GUIVisualizationSettings::GUIVisualizationSettings() throw()
        : name(""), antialiase(false), dither(false), vehicleQuality(0),
        backgroundColor(RGBColor((SUMOReal) 1, (SUMOReal) 1, (SUMOReal) 1)),
        showGrid(false), gridXSize(100), gridYSize(100),
        laneShowBorders(false), showLinkDecals(true), showRails(true),
        drawEdgeName(false), edgeNameSize(50),
        edgeNameColor(RGBColor((SUMOReal) 1, (SUMOReal) .5, (SUMOReal) 0)),
        drawInternalEdgeName(false), internalEdgeNameSize(40),
        internalEdgeNameColor(RGBColor((SUMOReal) .5, (SUMOReal) .25, (SUMOReal) 0)),
        hideConnectors(false),
        minVehicleSize(1), vehicleExaggeration(1), showBlinker(true),
        drawLaneChangePreference(false),
        drawVehicleName(false), vehicleNameSize(50),
        vehicleNameColor(RGBColor((SUMOReal) .8, (SUMOReal) .6, (SUMOReal) 0)),
        junctionMode(0), drawLinkTLIndex(false), drawLinkJunctionIndex(false),
        drawJunctionName(false), junctionNameSize(50),
        junctionNameColor(RGBColor((SUMOReal) 0, (SUMOReal) 1, (SUMOReal) .5)),
        showLane2Lane(false), addMode(0), minAddSize(1), addExaggeration(1),
        drawAddName(false), addNameSize(50),
        minPOISize(0), poiExaggeration(1), drawPOIName(false), poiNameSize(50),
        poiNameColor(RGBColor((SUMOReal) 1., (SUMOReal) 0, (SUMOReal) .5)),
        showSizeLegend(true) {
}
开发者ID:NeziheSozen,项目名称:sumo,代码行数:26,代码来源:GUIVisualizationSettings.cpp

示例10: BRDF

PerfectSpecular::PerfectSpecular()
:   BRDF(),
    m_k(0.0),
    m_c(RGBColor(0.0))
{}
开发者ID:apozTrof,项目名称:RayTracing,代码行数:5,代码来源:PerfectSpecular.cpp

示例11: RGBColor

RGBColor operator*(const RGBColor& color, float scalar) {
	return RGBColor(color.r * scalar, color.g * scalar, color.b * scalar);
}
开发者ID:Spide90,项目名称:Raytracer,代码行数:3,代码来源:color.cpp

示例12: drawWithColor

void Ship::draw()
{
    drawWithColor(RGBColor(0, 0, 1));
}
开发者ID:mattsan,项目名称:ToWriteMoreComprehensibleCode,代码行数:4,代码来源:Ship.cpp

示例13: RGBColor

// ------------
GUILaneWrapper::Colorer::Colorer() {
    mySchemes.push_back(GUIColorScheme("uniform", RGBColor(0,0,0), "", true));
    mySchemes.push_back(GUIColorScheme("by selection (lane-/streetwise)", RGBColor(0.7f, 0.7f, 0.7f), "unselected", true));
    mySchemes.back().addColor(RGBColor(0, .4f, .8f), 1, "selected");
    mySchemes.push_back(GUIColorScheme("by vclass", RGBColor(0,0,0), "all", true));
    mySchemes.back().addColor(RGBColor(0, .1f, .5f), 1, "public");
    // ... traffic states ...
    mySchemes.push_back(GUIColorScheme("by allowed speed (lanewise)", RGBColor(1,0,0)));
    mySchemes.back().addColor(RGBColor(0, 0, 1), (SUMOReal)(150.0/3.6));
    mySchemes.push_back(GUIColorScheme("by current occupancy (lanewise)", RGBColor(0,0,1)));
    mySchemes.back().addColor(RGBColor(1, 0, 0), (SUMOReal)0.95);
    mySchemes.push_back(GUIColorScheme("by first vehicle waiting time (lanewise)", RGBColor(0,1,0)));
    mySchemes.back().addColor(RGBColor(1,0,0), (SUMOReal)200);
    mySchemes.push_back(GUIColorScheme("by lane number (streetwise)", RGBColor(1,0,0)));
    mySchemes.back().addColor(RGBColor(0,0,1), (SUMOReal)5);
    // ... emissions ...
    mySchemes.push_back(GUIColorScheme("by CO2 emissions (HBEFA)", RGBColor(0,1,0)));
    mySchemes.back().addColor(RGBColor(1,0,0), (SUMOReal)(10./7.5/5.));
    mySchemes.push_back(GUIColorScheme("by CO emissions (HBEFA)", RGBColor(0,1,0)));
    mySchemes.back().addColor(RGBColor(1,0,0), (SUMOReal)(0.05/7.5/2.));
    mySchemes.push_back(GUIColorScheme("by PMx emissions (HBEFA)", RGBColor(0,1,0)));
    mySchemes.back().addColor(RGBColor(1,0,0), (SUMOReal)(.005/7.5/5.));
    mySchemes.push_back(GUIColorScheme("by NOx emissions (HBEFA)", RGBColor(0,1,0)));
    mySchemes.back().addColor(RGBColor(1,0,0), (SUMOReal)(.125/7.5/5.));
    mySchemes.push_back(GUIColorScheme("by HC emissions (HBEFA)", RGBColor(0,1,0)));
    mySchemes.back().addColor(RGBColor(1,0,0), (SUMOReal)(.02/7.5/4.));
    mySchemes.push_back(GUIColorScheme("by fuel consumption (HBEFA)", RGBColor(0,1,0)));
    mySchemes.back().addColor(RGBColor(1,0,0), (SUMOReal)(.005/7.5*100.));
    mySchemes.push_back(GUIColorScheme("by noise emissions (Harmonoise)", RGBColor(0,1,0)));
    mySchemes.back().addColor(RGBColor(1,0,0), (SUMOReal)100);
}
开发者ID:NeziheSozen,项目名称:sumo,代码行数:32,代码来源:GUILaneWrapper.cpp

示例14: glutGet

Model::Model() {
    this->screenWidth  = 0.7 * glutGet(GLUT_SCREEN_WIDTH);
    this->screenHeight = 0.7 * glutGet(GLUT_SCREEN_HEIGHT);

    // Crea il sole
    this->sun = new Sun();
    this->sun->circles.push_back(Sun::Circle(
                                     Vertex2d(this->screenWidth * 0.15f, this->screenHeight * 0.8f),
                                     55, 2, 1, RGBColor(1.0, 0.9, 0.0, 0.3)
                                 ));
    this->sun->circles.push_back(Sun::Circle(
                                     Vertex2d(this->screenWidth * 0.15f, this->screenHeight * 0.8f),
                                     45, 2, 0, RGBColor(1.0, 0.95, 0.0, 0.9)
                                 ));
    this->sun->circles.push_back(Sun::Circle(
                                     Vertex2d(this->screenWidth * 0.15f, this->screenHeight * 0.8f),
                                     40, 0, 0, RGBColor(1.0, 1.0, 0.0, 1.0)
                                 ));

    // Crea le nuvole
    for (int i=0; i<8; i++) {
        int circles = rand() % 3 + 3;
        this->clouds.push_back(Cloud(
                                   Vertex2d(0, this->screenHeight * (rand() % 30 + 60) / 100.0f),
                                   RGBColor(0.9, 0.9, 0.9, 1.0),
                                   1.0f * circles, 0.5f * circles * circles * circles, 0,
                                   (rand() % 10) * 3 / 10.0f + 3
                               ));
    }

    // Crea il pavimento
    this->floor = new Floor(this->screenWidth, 2 * this->screenHeight / 5);

    this->tree = new Tree(
        Vertex2d(this->screenWidth / 2.0f, this->screenHeight / 15.0f),
        0,
        this->screenHeight * 3 / 10.0, this->screenWidth / 80.0,
        5, this->floor, false
    );
    this->shrub1 = new Tree(
        Vertex2d(this->screenWidth / 2.0f, this->tree->position.y + this->tree->logHeight),
        M_PI / 8,
        this->tree->logHeight / 2.0, this->tree->logWidth / 2,
        3, this->floor, true
    );
    this->shrub2 = new Tree(
        Vertex2d(this->screenWidth / 2.0f, this->tree->position.y + this->tree->logHeight),
        -M_PI / 8,
        this->tree->logHeight / 2.0f, this->tree->logWidth / 2.0,
        3, this->floor, true
    );

    // Aggiunge la neve
    for (int i=0; i<this->snow.SNOW_FLAKES; i++) {
        this->snow.flakes.push_back(Snowflake());
        this->snow.flakes.back().position.y = rand() % screenHeight + screenHeight + 2;
        this->snow.flakes.back().weight = (rand() % 100) / 100.0f + 2.0f;
        this->snow.flakes.back().startX = rand() % screenWidth;
        this->snow.flakes.back().lastZ = rand() % (int)(this->floor->height / 2 - this->snow.flakes.back().weight) / 1.0f + this->snow.flakes.back().weight;
    }
}
开发者ID:wil93,项目名称:seasons,代码行数:61,代码来源:model.cpp

示例15: Bullet

Bullet Ship::fire()
{
    return Bullet(getPosition(), -10, RGBColor(0, 0, 1));
}
开发者ID:mattsan,项目名称:ToWriteMoreComprehensibleCode,代码行数:4,代码来源:Ship.cpp


注:本文中的RGBColor函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。