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


C++ SetVector函数代码示例

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


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

示例1: SetVector

/*************
 * DESCRIPTION:   Generate an axis from a matrix
 * INPUT:         ox,oy,oz    returned orientation
 *                p           returned position
 * OUTPUT:        -
 *************/
void MATRIX::GenerateAxis(VECTOR *ox, VECTOR *oy, VECTOR *oz, VECTOR *p)
{
    SetVector(p,  m[1], m[ 2], m[ 3]);
    SetVector(ox, m[5], m[ 9], m[13]);
    SetVector(oy, m[6], m[10], m[14]);
    SetVector(oz, m[7], m[11], m[15]);
}
开发者ID:privatosan,项目名称:RayStorm,代码行数:13,代码来源:vecmath.cpp

示例2: SetVector

void hgemitter::SetDirectionFromAngle( int flag, VECTOR *res, VECTOR *ang )
{
	float spd;
	VECTOR v;

	spd = speed;
	if ( spd != 0.0f ) spd += ((float)(rand()&4095) * FRND_4096 ) * speedopt;

	if ( flag == HGMODEL_FLAG_2DSPRITE ) {
		SetVector( res, sin(ang->z) * spd, cos(ang->z) * spd, 0.0f, 0.0f );
		return;
	}

	SetVector( &v, 0.0f, 0.0f, spd, 0.0f );
	InitMatrix();
	switch( rotorder ) {
	case HGMODEL_ROTORDER_ZYX:
		RotZ( ang->z );
		RotY( ang->y );
		RotX( ang->x );
		break;
	case HGMODEL_ROTORDER_XYZ:
		RotX( ang->x );
		RotY( ang->y );
		RotZ( ang->z );
		break;
	case HGMODEL_ROTORDER_YXZ:
		RotY( ang->y );
		RotX( ang->x );
		RotZ( ang->z );
		break;
	}
	ApplyMatrix( res, &v );
}
开发者ID:sharkpp,项目名称:openhsp,代码行数:34,代码来源:hgemitter.cpp

示例3: VecAdd

/*************
 * DESCRIPTION:   sets the new object specs
 * INPUT:         disp     pointer to display structure
 *                pos      translate factor
 *                ox,oy,oz rotate factor
 *                size     scale factor
 * OUTPUT:        none
 *************/
void CAMERA::SetObject(DISPLAY *disp, VECTOR *pos, VECTOR *ox, VECTOR *oy, VECTOR *oz, VECTOR *size)
{
	MATRIX m;

	if(disp)
	{
		if(disp->view->viewmode == VIEW_CAMERA)
		{
			VecAdd(pos,&this->pos,&disp->view->pos);

			if(!track)
			{
				InvOrient(ox, oy, oz, &disp->view->axis_x, &disp->view->axis_y, &disp->view->axis_z);
				m.SetOMatrix(&orient_x,&orient_y,&orient_z);
				m.MultVectMat(&disp->view->axis_x);
				m.MultVectMat(&disp->view->axis_y);
				m.MultVectMat(&disp->view->axis_z);
			}
			else
			{
				UpdateTracking(&disp->view->pos);
				InvOrient(&orient_x, &orient_y, &orient_z, &disp->view->axis_x, &disp->view->axis_y, &disp->view->axis_z);
			}
		}
	}
	SetVector(&bboxmin, -this->size.z*.5f, -this->size.z*.5f, -this->size.z);
	SetVector(&bboxmax, this->size.z*.5f, this->size.z*1.3f, this->size.z*1.5f);
}
开发者ID:Kalamatee,项目名称:RayStorm,代码行数:36,代码来源:camera.cpp

示例4: SetVector

/*************
 * DESCRIPTION:   Init camera with defaults
 * INPUT:         none
 * OUTPUT:        none
 *************/
void CAMERA::ToDefaults()
{
	// camera-position
	SetVector(&pos, 0.f, 0.f, -10.f);
	// lookpoint
	SetVector(&lookp, 0.f, 0.f, 0.f);
	// view-up-vector
	SetVector(&vup, 0.f, 1.f, 0.f);
	// horizontal and vertical field of view
	hfov = 45.f;
	vfov = 45.f;
	// Screen x and y resolution
	xres = 128;
	yres = 128;
	left = top = 0;
	right = bottom = 127;
	// depth of field
	focaldist = 1.f;
	aperture = 0.f;
	flags = 0;
	// animation parameters
	time = 0;
	posactor = NULL;
	viewactor = NULL;
}
开发者ID:Kalamatee,项目名称:RayStorm,代码行数:30,代码来源:CAMERA.CPP

示例5: init

void init(void)
{
	// GL inits
	glClearColor(0.2,0.2,0.5,0);
	glEnable(GL_DEPTH_TEST);
	glDisable(GL_CULL_FACE);
	printError("GL inits");

	projectionMatrix = frustum(-0.1, 0.1, -0.1, 0.1, 0.2, 200.0);
	
	p = SetVector(10, 10, 10);
	l = SetVector(2, 10, 2);
	v = SetVector(0, 1, 0);
	

	// Load and compile shader
	program = loadShaders("terrain1.vert", "terrain1.frag");
	glUseProgram(program);
	printError("init shader");
	
	glUniformMatrix4fv(glGetUniformLocation(program, "projMatrix"), 1, GL_TRUE, projectionMatrix.m);
	glUniform1i(glGetUniformLocation(program, "tex"), 0); // Texture unit 0
	LoadTGATextureSimple("maskros512.tga", &tex1);
	
// Load terrain data
	
	LoadTGATextureData("fft-terrain.tga", &ttex);
	tm = GenerateTerrain(&ttex);
	printError("init terrain");
}
开发者ID:Nicsi918,项目名称:Labs,代码行数:30,代码来源:lab4-2.c

示例6: OrthoNormalizeMatrix

	// Orthonormalization of Matrix4D. Assumes rotation only, translation/projection ignored
	void OrthoNormalizeMatrix(GLfloat *R)
	{
		Point3D x, y, z;
		
		SetVector(R[0], R[1], R[2], &x);
		SetVector(R[4], R[5], R[6], &y);
//		SetVector(R[8], R[9], R[10], &z);
		// Kryssa fram ur varandra
		// Normera
		CrossProduct(&x, &y, &z);
		Normalize(&z);
		Normalize(&x);
		CrossProduct(&z, &x, &y);
		R[0] = x.x;
		R[1] = x.y;
		R[2] = x.z;
		R[4] = y.x;
		R[5] = y.y;
		R[6] = y.z;
		R[8] = z.x;
		R[9] = z.y;
		R[10] = z.z;
		
		R[3] = 0.0;
		R[7] = 0.0;
		R[11] = 0.0;
		R[12] = 0.0;
		R[13] = 0.0;
		R[14] = 0.0;
		R[15] = 1.0;
	}
开发者ID:jonatanolofsson,项目名称:tsbk07,代码行数:32,代码来源:VectorUtils2.c

示例7: SetVector

/*************
 * DESCRIPTION:   Constructor of box (sets the default values)
 * INPUT:         none
 * OUTPUT:        none
 *************/
BOX::BOX()
{
	SetVector(&lowbounds, -1.f, -1.f, -1.f);
	SetVector(&highbounds, 1.f, 1.f, 1.f);
	SetVector(&orient_x, 1.f, 0.f, 0.f);
	SetVector(&orient_y, 0.f, 1.f, 0.f);
	SetVector(&orient_z, 0.f, 0.f, 1.f);
}
开发者ID:Kalamatee,项目名称:RayStorm,代码行数:13,代码来源:box.cpp

示例8: SetVector

/*************
 * DESCRIPTION:   transfer camera data to RayStorm Interface
 * INPUT:         stack    matrix stack
 *                object   pointer to created rsi object
 * OUTPUT:        rsiERR_NONE if ok else error number
 *************/
rsiResult CAMERA::ToRSI(rsiCONTEXT *rc, MATRIX_STACK *stack, void **object)
{
	VECTOR up, look, orient_x, orient_y, orient_z, pos;
	MATRIX m, m1;
	int rsiflags;
	rsiResult err;

	stack->GenerateAxis(&orient_x, &orient_y, &orient_z, &pos);

	m.SetOMatrix(&orient_x, &orient_y, &orient_z);
	if(track)
	{
		track->GetObjectMatrix(&m1);
		m1.GenerateAxis(&orient_x, &orient_x, &orient_x, &look);
	}
	else
	{
		SetVector(&look, 0.f, 0.f, 1000.f);
		m.MultVectMat(&look);
		VecAdd(&look, &pos, &look);
	}

	SetVector(&up, 0.f, 1.f, 0.f);
	m.MultVectMat(&up);

	err = PPC_STUB(rsiSetCamera)(CTXT,
				rsiTCameraPos,    &pos,
				rsiTCameraViewUp, &up,
				rsiTCameraLook,   &look,
				rsiTDone);
	if(err)
		return err;

	if(flags & OBJECT_CAMERA_VFOV)
		vfov = hfov*global.yres/global.xres;

	if(flags & OBJECT_CAMERA_FOCUSTRACK)
	{
		VecSub(&look, &pos, &look);
		focaldist = VecNormalize(&look);
	}

	rsiflags = 0;

	if (flags & OBJECT_CAMERA_FASTDOF)
		rsiflags |= rsiFCameraFastDOF;

	return PPC_STUB(rsiSetCamera)(CTXT,
		rsiTCameraPos,       &pos,
		rsiTCameraHFov,      atan(hfov) * 2 * INV_PI_180,
		rsiTCameraVFov,      atan(vfov) * 2 * INV_PI_180,
		rsiTCameraFocalDist, focaldist,
		rsiTCameraAperture,  aperture,
		rsiTCameraFlags,     rsiflags,
		rsiTDone);
}
开发者ID:Kalamatee,项目名称:RayStorm,代码行数:62,代码来源:camera.cpp

示例9: SetVector

SURF_DATA::SURF_DATA()
{
	nobound = TRUE;
	SetVector(&lowbound, INFINITY, INFINITY, INFINITY);
	SetVector(&highbound, -INFINITY, -INFINITY, -INFINITY);
	facecount = 0;
	edgecount = 0;
	name = NULL;
	object_count = 0;
	objects = NULL;
}
开发者ID:Kalamatee,项目名称:RayStorm,代码行数:11,代码来源:lwob.cpp

示例10: lookAt

mat4 lookAt(GLfloat px, GLfloat py, GLfloat pz, 
			GLfloat lx, GLfloat ly, GLfloat lz,
			GLfloat vx, GLfloat vy, GLfloat vz)
{
	vec3 p, l, v;
	
	p = SetVector(px, py, pz);
	l = SetVector(lx, ly, lz);
	v = SetVector(vx, vy, vz);
	
	return lookAtv(p, l, v);
}
开发者ID:Grodaaa,项目名称:TSBK03,代码行数:12,代码来源:VectorUtils3.c

示例11: switch

/*************
 * DESCRIPTION:   Draw a brush
 * INPUT:         disp     display class
 *                stack    matrix stack
 * OUTPUT:        none
 *************/
void BRUSH_OBJECT::Draw(DISPLAY *disp,MATRIX_STACK *stack)
{
	VECTOR size, trans;
	MATRIX m;

	switch(disp->display)
	{
		case DISPLAY_BBOX:
		case DISPLAY_WIRE:
			switch(brush->wrap)
			{
				case BRUSH_WRAP_FLAT:
					// draw a bounding box around pos
					disp->DrawBox(stack,&bboxmin,&bboxmax);
					break;
				case BRUSH_WRAP_X:
					SetVector(&size,
						(bboxmax.y - bboxmin.y) * .5f,
						bboxmax.x - bboxmin.x,
						(bboxmax.z - bboxmin.z) * .5f);
					m.SetRotZMatrix(90.f);
					stack->Push(&m);
					SetVector(&trans,
						0.f,
						- size.y * .5f,
						0.f);
					m.SetTransMatrix(&trans);
					stack->Push(&m);
					disp->DrawCylinder(stack, &size, flags);
					stack->Pop(&m);
					stack->Pop(&m);
					break;
				case BRUSH_WRAP_Y:
					SetVector(&size,
						(bboxmax.x - bboxmin.x) * .5f,
						bboxmax.y - bboxmin.y,
						(bboxmax.z - bboxmin.z) * .5f);
					SetVector(&trans,
						0.f,
						- size.y * .5f,
						0.f);
					m.SetTransMatrix(&trans);
					stack->Push(&m);
					disp->DrawCylinder(stack, &size, flags);
					stack->Pop(&m);
					break;
				case BRUSH_WRAP_XY:
					disp->DrawSphere(stack, (bboxmax.x-bboxmin.x)*.5f);
					break;
			}
			break;
	}
}
开发者ID:Kalamatee,项目名称:RayStorm,代码行数:59,代码来源:brush.cpp

示例12: angles

/*
QuakeEd only writes a single float for angles (bad idea), so up and down are
just constant angles.
*/
void SetMovedir()
{
	if ( VectorCompareF( self->s.v.angles, 0, -1, 0 ) )
		SetVector( self->s.v.movedir, 0, 0, 1 );
	else if ( VectorCompareF( self->s.v.angles, 0, -2, 0 ) )
		SetVector( self->s.v.movedir, 0, 0, -1 );
	else
	{
		makevectors( self->s.v.angles );
		VectorCopy( g_globalvars.v_forward, self->s.v.movedir );
	}
	SetVector( self->s.v.angles, 0, 0, 0 );
}
开发者ID:angeld29,项目名称:qwprogs-qvm,代码行数:17,代码来源:subs.c

示例13: CreateSun

/*
 *	Creates a sun and appends it to planetsList.
 */
void CreateSun(GLfloat radius, enum planetShape shape)
{
	struct PlanetStruct planet;
	planet.center = SetVector(0, 0, 0);
	planet.startingPosition = planet.center;
	planet.radius = radius;
	planet.orbitalSpeed = 0;
	planet.orbitalAxis = SetVector(0,1,0);
	planet.rotationalSpeed = 0.0002;
	planet.rotationalAxis = SetVector(1,1,0);
	planet.type = shape;
	planet.textureScale = 1;

	CreatePlanet(planet, NO_SOUND);
}
开发者ID:Krowded,项目名称:Planet,代码行数:18,代码来源:PlanetManager.c

示例14: OpenGLDrawCylinder

void OpenGLDrawCylinder(VECTOR *size, ULONG flags)
{
	VECTOR bottom, norm;
	int i;

	if(!(flags & (OBJECT_OPENTOP | OBJECT_OPENBOTTOM)))
		glEnable(GL_CULL_FACE);

	if(!(flags & OBJECT_OPENBOTTOM))
	{
		glBegin(GL_TRIANGLE_FAN);
		glNormal3f(0.f, -1.f, 0.f);
		glVertex3f(0.f, 0.f, 0.f);

		for(i = 0; i <= 360; i += OGL_CYLINDER_DIVS)
			glVertex3f(sin(i*PI_180)*size->x, 0.f, cos(i*PI_180)*size->z);

		glEnd();
	}

	glBegin(GL_TRIANGLE_STRIP);
	for(i = 0; i <= 360; i += OGL_CYLINDER_DIVS)
	{
		SetVector(&norm, sin(i*PI_180), 0.f, cos(i*PI_180));

		SetVector(&bottom, norm.x*size->x, 0.f, norm.z*size->z);

		glNormal3fv((GLfloat*)&norm);
		glVertex3fv((GLfloat*)&bottom);
		glVertex3f(bottom.x, size->y, bottom.z);
	}
	glEnd();

	if(!(flags & OBJECT_OPENTOP))
	{
		glBegin(GL_TRIANGLE_FAN);
		glNormal3f(0.f, 1.f, 0.f);
		glVertex3f(0.f, size->y, 0.f);

		for(i = 360; i >= 0; i -= OGL_CYLINDER_DIVS)
			glVertex3f(sin(i*PI_180)*size->x, size->y, cos(i*PI_180)*size->z);

		glEnd();
	}

	if(!(flags & (OBJECT_OPENTOP | OBJECT_OPENBOTTOM)))
		glDisable(GL_CULL_FACE);
}
开发者ID:Kalamatee,项目名称:RayStorm,代码行数:48,代码来源:ogl_util.cpp

示例15: OpenGLDrawCone

void OpenGLDrawCone(VECTOR *size, ULONG flags)
{
	VECTOR bottom,bottom1, centertop;
	int i;
	VECTOR norm, e0,e1;

	if(!(flags & OBJECT_OPENBOTTOM))
	{
		glEnable(GL_CULL_FACE);
		glBegin(GL_TRIANGLE_FAN);
		glNormal3f(0.f, -1.f, 0.f);
		glVertex3f(0.f, 0.f, 0.f);

		for(i = 0; i <= 360; i += OGL_CONE_DIVS)
			glVertex3f(sin(i*PI_180)*size->x, 0.f, cos(i*PI_180)*size->z);

		glEnd();
	}

	glBegin(GL_TRIANGLE_FAN);
	glNormal3f(0.f, 1.f, 0.f);
	SetVector(&centertop, 0.f, size->y, 0.f);
	glVertex3fv((GLfloat*)&centertop);

	SetVector(&bottom, 0.f, 0.f, size->z);
	SetVector(&bottom1, sin((360-OGL_CONE_DIVS)*PI_180)*size->x, 0.f, cos((360-OGL_CONE_DIVS)*PI_180)*size->z);
	VecSub(&centertop, &bottom, &e0);
	VecSub(&centertop, &bottom1, &e1);
	VecNormCross(&e0, &e1, &norm);
	glNormal3fv((GLfloat*)&norm);
	glVertex3fv((GLfloat*)&bottom);

	for(i = 360-OGL_CONE_DIVS; i >= -OGL_CONE_DIVS; i -= OGL_CONE_DIVS)
	{
		bottom = bottom1;
		SetVector(&bottom1, sin(i*PI_180)*size->x, 0.f, cos(i*PI_180)*size->z);
		VecSub(&centertop, &bottom, &e0);
		VecSub(&centertop, &bottom1, &e1);
		VecNormCross(&e0, &e1, &norm);
		glNormal3fv((GLfloat*)&norm);
		glVertex3fv((GLfloat*)&bottom);
	}

	glEnd();

	if(!(flags & OBJECT_OPENBOTTOM))
		glDisable(GL_CULL_FACE);
}
开发者ID:Kalamatee,项目名称:RayStorm,代码行数:48,代码来源:ogl_util.cpp


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