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


C++ vec2::X方法代码示例

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


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

示例1: DrawPoint

void DrawPoint ( vec2 coord, float width, colour col )
{
	SetShader("Primitive");
	DisableTexturing();
	if (col.alpha() < 1.0f)
	{
		EnableBlending();
	}
	else
	{
		DisableBlending();
	}
	SetColour(col);
	Matrices::SetViewMatrix(matrix2x3::Identity());
	Matrices::SetModelMatrix(matrix2x3::Identity());
	float quad[8] = { coord.X(), coord.Y(),
		coord.X(), coord.Y() - 2,
		coord.X() + 2, coord.Y() - 2,
		coord.X() + 2, coord.Y() };
	glVertexPointer ( 2, GL_FLOAT, 0, quad );
	glDrawArrays ( GL_QUADS, 0, 4 );
	/* ¡WARNING! IMMEDIATE MODE! ENTER AT YOUR OWN RISK */
//	glBegin(GL_POINTS);
//		glVertex2f(coord.X(), coord.Y());
//	glEnd();
}
开发者ID:prophile,项目名称:xsera,代码行数:26,代码来源:Graphics.cpp

示例2: SetCamera

void SetCamera ( vec2 corner1, vec2 corner2, float rotation )
{
	matrix2x3 projection ( matrix2x3::Ortho(corner1.X(), corner2.X(), corner1.Y(), corner2.Y()) );
	if (fabs(rotation) > 0.00004f)
		projection *= matrix2x3::Rotation(rotation);
	Matrices::SetProjectionMatrix(projection);
	cameraCorner1 = corner1;
	cameraCorner2 = corner2;
}
开发者ID:prophile,项目名称:xsera,代码行数:9,代码来源:Graphics.cpp

示例3: IsCulled

bool IsCulled ( vec2 position, float radius )
{
	if ((position.X() + radius) < cameraCorner1.X())
		return true;
	if ((position.X() - radius) > cameraCorner2.X())
		return true;
	if ((position.Y() + radius) < cameraCorner1.Y())
		return true;
	if ((position.Y() - radius) > cameraCorner2.Y())
		return true;
	return false;
}
开发者ID:prophile,项目名称:xsera,代码行数:12,代码来源:Graphics.cpp

示例4: SetListener

void SetListener(vec2 pos, vec2 vel)
{
	ALfloat fpos[] = {pos.X(), pos.Y(), 0.0f};
	ALfloat fvel[] = {vel.X(), vel.Y(), 0.0f};
	alListenerfv(AL_POSITION, fpos);
	alListenerfv(AL_VELOCITY, fvel);
	if (vel.ModulusSquared() > 0.2f)
	{
		forientation[0] = fvel[0];
		forientation[1] = fvel[1];
	}
	alListenerfv(AL_ORIENTATION, forientation);
}
开发者ID:adam000,项目名称:Apollo,代码行数:13,代码来源:Sound.cpp

示例5: PlaySoundPositional

void PlaySoundPositional(const std::string& name, vec2 pos, vec2 vel, float gain)
{
	ALfloat fpos[] = {pos.X(), pos.Y(), 0.0f};
	ALfloat fvel[] = {vel.X(), vel.Y(), 0.0f};
	ALuint buf    = GetSound(name);
	ALuint source = GetFreeSource();
	alSourcei(source, AL_BUFFER, buf);
	alSourcei(source, AL_SOURCE_RELATIVE, AL_FALSE);
	alSourcefv(source, AL_POSITION, fpos);
	alSourcefv(source, AL_VELOCITY, fvel);
	alSourcef(source, AL_REFERENCE_DISTANCE, 50.0);
	alSourcef(source, AL_GAIN, gain);
	alSourcePlay(source);
}
开发者ID:prophile,项目名称:xsera,代码行数:14,代码来源:Sound.cpp

示例6:

vec2 matrix2x3::operator* ( const vec2& srcv2 ) const
{
	float ix, iy, ox, oy;
	ix = srcv2.X();
	iy = srcv2.Y();
	ox = (ix * _m11) + (iy * _m12) + _tX;
	oy = (ix * _m21) + (iy * _m22) + _tY;
	return vec2(ox, oy);
}
开发者ID:adam000,项目名称:Apollo,代码行数:9,代码来源:Matrix2x3.cpp

示例7: DrawTriangle

void DrawTriangle ( const vec2 point1, const vec2 point2, const vec2 point3, colour col )
{
	SetShader("Primitive");
	DisableTexturing();
	if (col.alpha() < 1.0f)
	{
		EnableBlending();
	}
	else
	{
		DisableBlending();
	}
	SetColour(col);
	Matrices::SetViewMatrix(matrix2x3::Identity());
	Matrices::SetModelMatrix(matrix2x3::Identity());
	float real_triangle[6] = { point1.X(), point1.Y(),
								point2.X(), point2.Y(),
								point3.X(), point3.Y() };
	glVertexPointer(2, GL_FLOAT, 0, real_triangle);
	glDrawArrays(GL_POLYGON, 0, 3);
} 
开发者ID:prophile,项目名称:xsera,代码行数:21,代码来源:Graphics.cpp

示例8: DrawLine

void DrawLine ( vec2 coordinate1, vec2 coordinate2, float width, colour col )
{
	SetShader("Primitive");
	DisableTexturing();
	if (col.alpha() < 1.0f)
	{
		EnableBlending();
	}
	else
	{
		DisableBlending();
	}
	glLineWidth(width);
	Matrices::SetViewMatrix(matrix2x3::Identity());
	Matrices::SetModelMatrix(matrix2x3::Identity());
	SetColour(col);
	float vertices[4] = { coordinate1.X(), coordinate1.Y(),
						coordinate2.X(), coordinate2.Y() };
	glVertexPointer ( 2, GL_FLOAT, 0, vertices );
	glDrawArrays ( GL_LINES, 0, 2 );
}
开发者ID:prophile,项目名称:xsera,代码行数:21,代码来源:Graphics.cpp

示例9: PlaySoundPositional

void PlaySoundPositional(const std::string& name, vec2 pos, vec2 vel, float gain)
{
	ALfloat fpos[] = {pos.X(), pos.Y(), 0.0f};
	ALfloat fvel[] = {vel.X(), vel.Y(), 0.0f};
	ALuint buf    = GetSound(name);
	ALuint source = GetFreeSource();
	alSourcei(source, AL_BUFFER, buf);
	alSourcei(source, AL_SOURCE_RELATIVE, AL_FALSE);
	alSourcefv(source, AL_POSITION, fpos);
	alSourcefv(source, AL_VELOCITY, fvel);
	alSourcef(source, AL_REFERENCE_DISTANCE, 50.0);
	alSourcef(source, AL_GAIN, gain);
	alSourcePlay(source);
#ifndef NDEBUG
    if (alGetError())
        LOG("Sound", LOG_ERROR, "OpenAL error");
    const ALchar* err = alureGetErrorString();
    if (strcmp(err, "No error"))
    {
        LOG("Sound", LOG_ERROR, "ALURE error: %s", err);
        exit(1);
    }
#endif
}
开发者ID:adam000,项目名称:Apollo,代码行数:24,代码来源:Sound.cpp

示例10: display

// Draw
void display ( void )
{
	int j=0;
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
	glLineWidth( GLfloat(lineWidth) );

	if (!useErrors)
	{
		// Bind and setup the shader
		draw->Enable();
		draw["xRange"] = vec2( 330.0f, 843.0f );
		draw["yRange"] = vec2( -0.13f, 2.05f );
		draw["useXYZ"]    = vec3( displayX ? 1.0f : 0.0f, 
								  displayY ? 1.0f : 0.0f, 
								  displayZ ? 1.0f : 0.0f );
			// For each curve, check if it's selected to be display, if so, draw it
			for (uint i=0; i<drawableCurves.Size(); i++)
			{
				// Check if this curve was selected to be drawn
				if ( curveSelection[i]->GetValue() )
				{
					draw["xColor"] = colorArr[j++];
					draw["yColor"] = colorArr[j++];
					draw["zColor"] = colorArr[j++];
					drawableCurves[i]->DrawArrays( GL_LINE_STRIP, 0, 471 );
				}
			}
		draw->Disable();

		// After drawing the curve, draw the axes
		drawAxes->Enable();
			axes->DrawArrays( GL_LINES, 0, 38 );
		drawAxes->Disable();
	}
	else
	{
		// Bind and setup the shader
		draw->Enable();
		draw["xRange"] = vec2( 330.0f, 843.0f );
		draw["yRange"] = vec2( -0.25f, 0.25f );
		draw["useXYZ"]    = vec3( displayX ? 1.0f : 0.0f, 
								  displayY ? 1.0f : 0.0f, 
								  displayZ ? 1.0f : 0.0f );
			// For each curve, check if it's selected to be display, if so, draw it
			for (uint i=0; i<errorCurves.Size(); i++)
			{
				// Check if this curve was selected to be drawn
				if ( curveSelection[i]->GetValue() )
				{
					draw["xColor"] = colorArr[j++];
					draw["yColor"] = colorArr[j++];
					draw["zColor"] = colorArr[j++];
					errorCurves[i]->DrawArrays( GL_LINE_STRIP, 0, 471 );
				}
			}
		draw->Disable();
	}

	// Draw the labels
	for (int i=0; i<10; i++)
		IGLUDraw::DrawColorText( IGLU_FONT_VARIABLE, 
		                         int(textOffsetFactor.X()*labels[i].x), 
								 int(textOffsetFactor.Y()*labels[i].y), 
								 color::Gray80, labels[i].name, textOffsetFactor.X() );
}
开发者ID:JournalOfComputerGraphicsTechniques,项目名称:TEST-0002-02-01-Wyman-Sloan-Shirley,代码行数:66,代码来源:main.cpp


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