本文整理汇总了C++中CColor::GetBlue方法的典型用法代码示例。如果您正苦于以下问题:C++ CColor::GetBlue方法的具体用法?C++ CColor::GetBlue怎么用?C++ CColor::GetBlue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CColor
的用法示例。
在下文中一共展示了CColor::GetBlue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderPixelBuffer
// The raytracing process
void CRenderingCore::RenderPixelBuffer()
{
/**************************************************************
STRATEGY:
1. Run nested loop for the entire screen.
**************************************************************/
m_pcamCurrent->Describe();
// 1.
for (int y = 0; y < m_iPixelY; y++)
{
for (int x = 0; x < m_iPixelX; x++)
{
CColor colToUse;
/****************************************************************
NESTED LOOP LOGIC:
Calculate the X fraction
Get the pixel ray for this screen coordinate fromt the
camera
Get the color for this ray.
Plot the pixel with this color.
****************************************************************/
colToUse = Sample ((float)x, (float)y, 1);
m_ppPixelBuffer[0][x][y] = ((float) (int)(colToUse.GetRed() * 1000.0f)) / 1000.0f;
m_ppPixelBuffer[1][x][y] = ((float) (int)(colToUse.GetGreen() * 1000.0f)) / 1000.0f;
m_ppPixelBuffer[2][x][y] = ((float) (int)(colToUse.GetBlue() * 1000.0f)) / 1000.0f;
}
}
}
示例2: SetColor
void CQTOpenGLUserFunctions::SetColor(const CColor& c_color) {
const GLfloat pfColor[] = {
c_color.GetRed() / 255.0f,
c_color.GetGreen() / 255.0f,
c_color.GetBlue() / 255.0f
};
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, DEFAULT_SPECULAR);
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, DEFAULT_SHININESS);
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, DEFAULT_EMISSION);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, pfColor);
}
示例3: Register
buzzvm_state CBuzzController::Register(const std::string& str_key,
const CColor& c_color) {
buzzvm_pushs(m_tBuzzVM, buzzvm_string_register(m_tBuzzVM, str_key.c_str(), 1));
buzzvm_pusht(m_tBuzzVM);
buzzobj_t tColorTable = buzzvm_stack_at(m_tBuzzVM, 1);
buzzvm_gstore(m_tBuzzVM);
TablePut(tColorTable, "red", c_color.GetRed());
TablePut(tColorTable, "green", c_color.GetGreen());
TablePut(tColorTable, "blue", c_color.GetBlue());
return m_tBuzzVM->state;
}
示例4: TablePut
buzzvm_state CBuzzController::TablePut(buzzobj_t t_table,
SInt32 n_idx,
const CColor& c_color) {
buzzvm_push(m_tBuzzVM, t_table);
buzzvm_pushi(m_tBuzzVM, n_idx);
buzzvm_pusht(m_tBuzzVM);
buzzobj_t tColorTable = buzzvm_stack_at(m_tBuzzVM, 1);
buzzvm_tput(m_tBuzzVM);
TablePut(tColorTable, "red", c_color.GetRed());
TablePut(tColorTable, "green", c_color.GetGreen());
TablePut(tColorTable, "blue", c_color.GetBlue());
return m_tBuzzVM->state;
}
示例5: DrawPoint
void CQTOpenGLUserFunctions::DrawPoint(const CVector3& c_position,
const CColor& c_color,
const Real f_point_diameter) {
glDisable(GL_LIGHTING);
glColor3ub(c_color.GetRed(),
c_color.GetGreen(),
c_color.GetBlue());
glPointSize(f_point_diameter);
glBegin(GL_POINTS);
glVertex3f(c_position.GetX(), c_position.GetY(), c_position.GetZ());
glEnd();
glPointSize(1.0);
glEnable(GL_LIGHTING);
}
示例6: DrawText
void CQTOpenGLUserFunctions::DrawText(const std::string& str_text,
const CVector3& c_center_offset,
const CColor& c_color) {
glDisable(GL_LIGHTING);
glDisable(GL_CULL_FACE);
glColor3ub(c_color.GetRed(),
c_color.GetGreen(),
c_color.GetBlue());
GetOpenGLWidget().renderText(c_center_offset.GetX(),
c_center_offset.GetY(),
c_center_offset.GetZ(),
str_text.c_str());
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
}
示例7: DrawTriangle
void CQTOpenGLUserFunctions::DrawTriangle(const CVector3& c_center_offset,
const CColor& c_color,
const bool b_fill,
const CQuaternion& c_orientation,
Real f_base,
Real f_height) {
glDisable(GL_LIGHTING);
glDisable(GL_CULL_FACE);
glColor3ub(c_color.GetRed(),
c_color.GetGreen(),
c_color.GetBlue());
if(b_fill) {
glBegin(GL_POLYGON);
}
else {
glBegin(GL_LINE_LOOP);
}
CVector3 cNormalDirection(0.0f, 0.0f, 1.0f);
cNormalDirection.Rotate(c_orientation);
glNormal3f(cNormalDirection.GetX(),
cNormalDirection.GetY(),
cNormalDirection.GetZ());
CVector3 cVertex(f_height * 0.5f, 0.0f, 0.0f);
cVertex.Rotate(c_orientation);
glVertex3f(cVertex.GetX() + c_center_offset.GetX(),
cVertex.GetY() + c_center_offset.GetY(),
cVertex.GetZ() + c_center_offset.GetZ());
cVertex.Set(-f_height * 0.5f, f_base * 0.5f, 0.0f);
cVertex.Rotate(c_orientation);
glVertex3f(cVertex.GetX() + c_center_offset.GetX(),
cVertex.GetY() + c_center_offset.GetY(),
cVertex.GetZ() + c_center_offset.GetZ());
cVertex.Set(-f_height * 0.5f, -f_base * 0.5f, 0.0f);
cVertex.Rotate(c_orientation);
glVertex3f(cVertex.GetX() + c_center_offset.GetX(),
cVertex.GetY() + c_center_offset.GetY(),
cVertex.GetZ() + c_center_offset.GetZ());
glEnd();
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
}
示例8: DrawCircle
void CQTOpenGLUserFunctions::DrawCircle(Real f_radius,
const CVector3& c_center_offset,
const CColor& c_color,
const bool b_fill,
const CQuaternion& c_orientation,
GLuint un_vertices) {
glDisable(GL_LIGHTING);
glDisable(GL_CULL_FACE);
glColor3ub(c_color.GetRed(),
c_color.GetGreen(),
c_color.GetBlue());
CVector3 cVertex(f_radius, 0.0f, 0.0f);
CRadians cAngle(CRadians::TWO_PI / un_vertices);
if(b_fill) {
glBegin(GL_POLYGON);
}
else {
glBegin(GL_LINE_LOOP);
}
CVector3 cNormalDirection(0.0f, 0.0f, 1.0f);
cNormalDirection.Rotate(c_orientation);
glNormal3f(cNormalDirection.GetX(),
cNormalDirection.GetY(),
cNormalDirection.GetZ());
/* Compute the quaternion defining the rotation of the vertices used to draw the circle. */
CQuaternion cVertexRotation;
CVector3 cVertexRotationAxis(0.0f, 0.0f, 1.0f);
cVertexRotationAxis.Rotate(c_orientation);
cVertexRotation.FromAngleAxis(cAngle, cVertexRotationAxis);
cVertex.Rotate(c_orientation);
for(GLuint i = 0; i <= un_vertices; i++) {
glVertex3f(cVertex.GetX() + c_center_offset.GetX(),
cVertex.GetY() + c_center_offset.GetY(),
cVertex.GetZ() + c_center_offset.GetZ());
cVertex.Rotate(cVertexRotation);
}
glEnd();
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
}
示例9: FillTextureWithColor
bool CTexture::FillTextureWithColor (unsigned int width, unsigned int height, const CColor& color)
{
if (m_Texture==NULL)
{
LOGGER->AddNewLog(ELL_ERROR,"CTexture::FillTextureWithColor-> m_Texture no ha sido creado aun ");
return false;
}
HRESULT hr;
D3DLOCKED_RECT lock;
hr=m_Texture->LockRect(0, &lock, NULL, D3DLOCK_DISCARD);
if(hr==D3D_OK)
{
uint8 *pTxtBuffer; // Bitmap buffer, texture buffer
pTxtBuffer = (uint8*)lock.pBits;
uint32 j = 0;
for( uint32 cont = 0; cont< width * height; cont++)
{
//BLUE
pTxtBuffer[cont*4 + 0] = (uint8)(color.GetBlue()*255);
//GREEN
pTxtBuffer[cont*4 + 1] = (uint8)(color.GetGreen()*255);
//RED
pTxtBuffer[cont*4 + 2] = (uint8)(color.GetRed()*255);
//ALPHA
pTxtBuffer[cont*4 + 3] = (uint8)(color.GetAlpha()*255);
}
hr=m_Texture->UnlockRect(0);
}
else
{
LOGGER->AddNewLog(ELL_ERROR,"CTexture::FillTextureWithColor->Error en la llamada lockRect");
return false;
}
m_Width = width;
m_Height = height;
return true;
}
示例10: DrawSegment
void CQTOpenGLUserFunctions::DrawSegment(const CVector3& c_end_point,
const CVector3& c_start_point,
const CColor& c_segment_color,
const Real& f_line_width,
bool b_draw_end_point,
bool b_draw_start_point,
const CColor& c_end_point_color,
const CColor& c_start_point_color) {
/* Draw the segment */
glDisable(GL_LIGHTING);
glColor3ub(c_segment_color.GetRed(),
c_segment_color.GetGreen(),
c_segment_color.GetBlue());
glEnable (GL_LINE_SMOOTH);
glLineWidth(f_line_width);
glBegin(GL_LINES);
glVertex3f(c_start_point.GetX(),
c_start_point.GetY(),
c_start_point.GetZ() );
glVertex3f(c_end_point.GetX(),
c_end_point.GetY(),
c_end_point.GetZ() );
glEnd();
/* Draw the end and start points if necessary */
if(b_draw_end_point) {
DrawPoint(c_end_point, c_end_point_color, 5.0);
}
if(b_draw_start_point) {
DrawPoint(c_start_point, c_start_point_color, 5.0);
}
glPointSize(1.0);
glEnable(GL_LIGHTING);
}
示例11: SaveAsImage
virtual void SaveAsImage(const std::string& str_path) {
fipImage cImage(FIT_BITMAP, m_unPixelsPerMeter * m_cHalfArenaSize.GetX()*2, m_unPixelsPerMeter * m_cHalfArenaSize.GetY()*2, 24);
Real fFactor = 1.0f / static_cast<Real>(m_unPixelsPerMeter);
CVector2 cFloorPos;
CColor cARGoSPixel;
RGBQUAD tFIPPixel;
for(UInt32 y = 0; y < cImage.getHeight(); ++y) {
for(UInt32 x = 0; x < cImage.getWidth(); ++x) {
cFloorPos.Set(x * fFactor, y * fFactor);
cFloorPos -= m_cHalfArenaSize;
cARGoSPixel = m_cLoopFunctions.GetFloorColor(cFloorPos);
tFIPPixel.rgbRed = cARGoSPixel.GetRed();
tFIPPixel.rgbGreen = cARGoSPixel.GetGreen();
tFIPPixel.rgbBlue = cARGoSPixel.GetBlue();
cImage.setPixelColor(x, y, &tFIPPixel);
}
}
if(!cImage.save(str_path.c_str())) {
THROW_ARGOSEXCEPTION("Cannot save image \"" << str_path << "\" for floor entity.");
}
}
示例12: DrawText
void CQTOpenGLUserFunctions::DrawText(const CVector3& c_position,
const std::string& str_text,
const CColor& c_color) {
/* Save attributes */
glPushAttrib(GL_ENABLE_BIT);
/* Disable lighting to make text color unaffected by light */
glDisable(GL_LIGHTING);
/* Disable culling to make text visibile from any angle */
glDisable(GL_CULL_FACE);
/* Set color */
glColor3ub(c_color.GetRed(),
c_color.GetGreen(),
c_color.GetBlue());
GetMainWindow().
GetOpenGLWidget().
renderText(c_position.GetX(),
c_position.GetY(),
c_position.GetZ(),
str_text.c_str());
/* Restore saved attributes */
glPopAttrib();
}
示例13: center
void DX9SpriteBatch::Draw(
ITextureBase *Texture2D, CRectangle &PositionInTexture,
Vector2I &Origin, Vector2F &Position,
float Rotation, Vector2F &Scale, CColor &Color,
float ZOrder, eSpriteEffects SpriteEffect )
{
CDX9Texture *tex = dynamic_cast<CDX9Texture *>(Texture2D);
RECT src;
src.left = PositionInTexture.Left();
src.right = PositionInTexture.Right();
src.top = PositionInTexture.Top();
src.bottom = PositionInTexture.Bottom();
D3DXVECTOR2 center(static_cast<float>(Origin.x), static_cast<float>(Origin.y));
D3DXVECTOR2 pos(Position.x - Origin.x, Position.y - Origin.y);
D3DXMATRIX transform;
DXCheck(D3DXMatrixTransformation2D(&transform, NULL, NULL, &D3DXVECTOR2(Scale.x, Scale.y), ¢er, Rotation, &pos));
if (SUCCEEDED(DXCheck(m_D3DSprite->SetTransform(&transform))))
{
DXCheck(m_D3DSprite->Draw( tex->GetDxTexture(), &src, NULL, NULL,
D3DCOLOR_RGBA(Color.GetRed(), Color.GetGreen(), Color.GetBlue(), Color.GetAlpha()) ));
}
}
示例14: DrawPolygon
void CQTOpenGLUserFunctions::DrawPolygon(const std::vector<CVector3>& vec_points,
const CColor& c_color) {
if (vec_points.size() > 2)
{
glDisable(GL_LIGHTING);
glDisable(GL_CULL_FACE);
glColor3ub(c_color.GetRed(),
c_color.GetGreen(),
c_color.GetBlue());
glBegin(GL_POLYGON);
for (UInt32 i = 0; i < vec_points.size(); ++i)
{
glVertex3f(vec_points[i].GetX(),
vec_points[i].GetY(),
vec_points[i].GetZ());
}
glEnd();
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
}
}
示例15: DrawCylinder
void CQTOpenGLUserFunctions::DrawCylinder(Real f_radius,
Real f_height,
const CVector3& c_center_offset,
const CColor& c_color,
const CQuaternion& c_orientation,
GLuint un_vertices) {
/* Draw top circle*/
CVector3 cCirclePos(0.0f, 0.0f, f_height * 0.5f);
cCirclePos.Rotate(c_orientation);
cCirclePos += c_center_offset;
DrawCircle(f_radius,
cCirclePos,
c_color,
true,
c_orientation,
un_vertices);
/* Draw bottom circle*/
cCirclePos.Set(0.0f, 0.0f, -f_height * 0.5f);
cCirclePos.Rotate(c_orientation);
cCirclePos += c_center_offset;
DrawCircle(f_radius,
cCirclePos,
c_color,
true,
c_orientation,
un_vertices);
/* Side surface */
CVector3 cVertex1(f_radius, 0.0f, f_height * 0.5f);
CVector3 cVertex2(f_radius, 0.0f, -f_height * 0.5f);
CRadians cAngle(CRadians::TWO_PI / un_vertices);
/* Compute the quaternion defining the rotation of the vertices used to draw the side surface. */
CQuaternion cVertexRotation;
CVector3 cVertexRotationAxis(0.0f, 0.0f, 1.0f);
cVertexRotationAxis.Rotate(c_orientation);
cVertexRotation.FromAngleAxis(cAngle, cVertexRotationAxis);
glDisable(GL_LIGHTING);
glColor3ub(c_color.GetRed(),
c_color.GetGreen(),
c_color.GetBlue());
glBegin(GL_QUAD_STRIP);
/* Compute the normal direction of the starting edge. */
CVector3 cNormalDirection(cVertex1.GetX(), cVertex1.GetY(), 0.0f);
cNormalDirection.Rotate(c_orientation);
glNormal3f(cNormalDirection.GetX(),
cNormalDirection.GetY(),
cNormalDirection.GetZ());
/* Rotate the endpoints of the first edge.*/
cVertex1.Rotate(c_orientation);
cVertex2.Rotate(c_orientation);
for(GLuint i = 0; i <= un_vertices; i++) {
glVertex3f(cVertex1.GetX() + c_center_offset.GetX(),
c_center_offset.GetY() + cVertex1.GetY(),
c_center_offset.GetZ() + cVertex1.GetZ() );
glVertex3f(cVertex2.GetX() + c_center_offset.GetX(),
c_center_offset.GetY() + cVertex2.GetY(),
c_center_offset.GetZ() + cVertex2.GetZ() );
/* Rotate the vertices and the normal direction, set the new normal. */
cVertex1.Rotate(cVertexRotation);
cVertex2.Rotate(cVertexRotation);
cNormalDirection.Rotate(cVertexRotation);
glNormal3f(cNormalDirection.GetX(),
cNormalDirection.GetY(),
cNormalDirection.GetZ());
}
glEnd();
glEnable(GL_LIGHTING);
}