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


C++ Color4::r方法代码示例

本文整理汇总了C++中Color4::r方法的典型用法代码示例。如果您正苦于以下问题:C++ Color4::r方法的具体用法?C++ Color4::r怎么用?C++ Color4::r使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Color4的用法示例。


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

示例1: SetDiffuseColor

GLvoid Material::SetDiffuseColor(GLenum face, const Color4& c)
{
    switch (face)
    {
    case GL_FRONT:
        _front_diffuse.r() = c.r();
        _front_diffuse.g() = c.g();
        _front_diffuse.b() = c.b();
        _front_diffuse.a() = c.a();
    break;

    case GL_BACK:
        _back_diffuse.r() = c.r();
        _back_diffuse.g() = c.g();
        _back_diffuse.b() = c.b();
        _back_diffuse.a() = c.a();
    break;

    case GL_FRONT_AND_BACK:
        _front_diffuse.r() = c.r();
        _front_diffuse.g() = c.g();
        _front_diffuse.b() = c.b();
        _front_diffuse.a() = c.a();

        _back_diffuse.r() = c.r();
        _back_diffuse.g() = c.g();
        _back_diffuse.b() = c.b();
        _back_diffuse.a() = c.a();
    break;
    }
}
开发者ID:istee,项目名称:cor3d,代码行数:31,代码来源:Materials.cpp

示例2: SetSpecularColor

GLvoid Material::SetSpecularColor(GLenum face, const Color4& c)
{
    switch (face)
    {
    case GL_FRONT:
        _front_specular.r() = c.r();
        _front_specular.g() = c.g();
        _front_specular.b() = c.b();
        _front_specular.a() = c.a();
    break;

    case GL_BACK:
        _back_specular.r() = c.r();
        _back_specular.g() = c.g();
        _back_specular.b() = c.b();
        _back_specular.a() = c.a();
    break;

    case GL_FRONT_AND_BACK:
        _front_specular.r() = c.r();
        _front_specular.g() = c.g();
        _front_specular.b() = c.b();
        _front_specular.a() = c.a();

        _back_specular.r() = c.r();
        _back_specular.g() = c.g();
        _back_specular.b() = c.b();
        _back_specular.a() = c.a();
    break;
    }
}
开发者ID:istee,项目名称:cor3d,代码行数:31,代码来源:Materials.cpp

示例3: renderRectangle

// ----------------------------------------------------------------
//	Name:			renderRectangle
//	Description:	根据参数TRectanglef提供的参数绘制矩形
//	Return Value:	void
// ----------------------------------------------------------------
void Helper::renderRectangle( const TRectanglef& rect, 
							 Color4 color, bool isEmpty )
{
	float left = rect.m_Left;
	float right = rect.m_Right;
	float bottom = rect.m_Bottom;
	float top = rect.m_Top;

	glPushMatrix();
	{	
		glColor4f( color.r(), color.g(), color.b(), color.a() );
		glLineWidth(2.0);
		if( isEmpty ) 
		{
			glBegin(GL_LINE_STRIP);
			glVertex3f(left, bottom, 0.0);
			glVertex3f(right, bottom, 0.0);
			glVertex3f(right, top, 0.0);
			glVertex3f(left, top, 0.0);
			glVertex3f(left, bottom, 0.0);
			glEnd();
		}
		else
		{
			glBegin(GL_QUADS);
			glVertex3f(left, bottom, 0.0);
			glVertex3f(right, bottom, 0.0);
			glVertex3f(right, top, 0.0);
			glVertex3f(left, top, 0.0);
			glEnd();
		}
		glLineWidth(1.0);
	} glPopMatrix();
}
开发者ID:andreaswatch,项目名称:dizuo,代码行数:39,代码来源:Helper.cpp

示例4: renderBox

// ----------------------------------------------------------------
//	Name:			renderBox
//	Description:	根据参数Box提供的参数绘制box线框
//	Return Value:	void
// ----------------------------------------------------------------
void Helper::renderBox(const Box3f& box, Color4 color)
{
	glPushMatrix();
	{
		glColor4f( color.r(), color.g(), color.b(), color.a() );
		ColorCube::renderColorCube( box );
	} glPopMatrix();
}
开发者ID:andreaswatch,项目名称:dizuo,代码行数:13,代码来源:Helper.cpp

示例5: clamp

 Color4ub toColor4ub(const Color4& _color)
 {
   using gex::color::clamp;
   return Color4ub(
       clamp(int(255*_color.r()),0,255),
       clamp(int(255*_color.g()),0,255),
       clamp(int(255*_color.b()),0,255),
       clamp(int(255*_color.a()),0,255));
 }
开发者ID:WilstonOreo,项目名称:Tomo,代码行数:9,代码来源:colorizer.hpp

示例6: renderElipse

// ----------------------------------------------------------------
//	Name:			renderElipse
//	Description:	根据参数TRectanglef提供的参数绘制椭圆
//	Return Value:	void
// ----------------------------------------------------------------
void Helper::renderElipse( const TRectanglef& rect, 
						  Color4 color, bool isEmpty )
{
	float xpos = rect.GetCenter().x();
	float ypos = rect.GetCenter().y();

	float xradius = rect.GetSize().x() / 2;
	float yradius = rect.GetSize().y() / 2;

	const float DEG2RAD = 3.14159/180;

	glPushMatrix();
	{
		glColor4f( color.r(), color.g(), color.b(), color.a() );
		glLineWidth(5.0);
		if( isEmpty )
		{
			glBegin(GL_LINE_LOOP);   
			for (int i=0; i<360; i++)   
			{   
				//convert   degrees   into   radians   
				float degInRad = i*DEG2RAD;   
				glVertex2f( xpos + cos(degInRad) * xradius, ypos + sin(degInRad) * yradius );   
			}   
			glEnd();   
		}
		else
		{
			glBegin(GL_TRIANGLE_FAN);
			glVertex2f(xpos, ypos);
			//draw the vertex on the contour of the circle
			for(int i = 0; i < 360; i++)
			{	
				float degInRad = i*DEG2RAD;   
				glVertex2f( xpos + cos(degInRad) * xradius, ypos + sin(degInRad) * yradius );
			}
			glVertex2f( 1.0 * xradius + xpos, 0.0 *yradius + ypos );
			glEnd();
		}
		glLineWidth(1.0);
	}glPopMatrix();
}
开发者ID:andreaswatch,项目名称:dizuo,代码行数:47,代码来源:Helper.cpp

示例7: stringf

static std::string Color_str(const Color4& c)
{
  return stringf("<rgba: %.2f %.2f %.2f %.2f>",
                 c.r(), c.g(), c.b(), c.a());
}
开发者ID:benoitryder,项目名称:simulotter,代码行数:5,代码来源:utils.cpp

示例8: SetAmbientColor

GLvoid Material::SetAmbientColor(GLenum face, const Color4& c)
{
    SetAmbientColor(face, c.r(), c.g(), c.b(), c.a());
}
开发者ID:istee,项目名称:cor3d,代码行数:4,代码来源:Materials.cpp


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