您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ vec4函数代码示例

51自学网 2021-06-03 09:35:52
  C++
这篇教程C++ vec4函数代码示例写得很实用,希望能帮到您。

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

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

示例1: glGenVertexArrays

void Box::initTopBottomBack(){	GLuint VBO;	GLuint CBO;	GLuint IBO;	glGenVertexArrays (1, &vertexArrayObjectFBTB);	glBindVertexArray(vertexArrayObjectFBTB);	vec3 v0 = vec3(-width/2, width/2, width/2);	vec3 v1 = vec3(width/2, width/2, width/2);	vec3 v2 = vec3(-width/2, -width/2, width/2);	vec3 v3 = vec3(width/2, -width/2, width/2);		vec3 v4 = vec3(-width/2, width/2, -width/2);	vec3 v5 = vec3(width/2, width/2, -width/2);	vec3 v6 = vec3(-width/2, -width/2, -width/2);	vec3 v7 = vec3(width/2, -width/2, -width/2);	vector<pntVertexData> v;	vec2 t0 = vec2(0,1);	vec2 t1 = vec2(1,1);	vec2 t2 = vec2(0,0);	vec2 t3 = vec2(1,0);	vec2 t6 = vec2(0,1);	vec2 t7 = vec2(1,1);	vec2 t4 = vec2(0,0);	vec2 t5 = vec2(1,0);	v.push_back(pntVertexData(v0, normalize(vec3(-1,1,1)), t0));	v.push_back(pntVertexData(v1, normalize(vec3(1,1,1)), t1));	v.push_back(pntVertexData(v2, normalize(vec3(-1,-1,1)), t2));	v.push_back(pntVertexData(v3, normalize(vec3(1,-1,1)), t3));		v.push_back(pntVertexData(v4, normalize(vec3(-1,1,-1)), t4));	v.push_back(pntVertexData(v5, normalize(vec3(1,1,-1)), t5));	v.push_back(pntVertexData(v6, normalize(vec3(-1,-1,-1)), t6));	v.push_back(pntVertexData(v7, normalize(vec3(1,-1,-1)), t7));	/*	glGenBuffers(1, &VBO);	glBindBuffer(GL_ARRAY_BUFFER, VBO);	glBufferData(GL_ARRAY_BUFFER, v.size() * sizeof(vec3), &v[0], GL_STATIC_DRAW);	glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);	glEnableVertexAttribArray(0);	*/	vector<vec4> c;	vec4 c1 = vec4(1.0f, 0.0f, 0.0f, 1.0f);	vec4 c2 = vec4(0.0f, 1.0f, 0.0f, 1.0f);	vec4 c3 = vec4(0.0f, 0.0f, 1.0f, 1.0f);	vec4 c4 = vec4(1.0f, 1.0f, 0.0f, 1.0f);	vec4 c5 = vec4(1.0f, 0.0f, 1.0f, 1.0f);	c.push_back(c1);	c.push_back(c2);	c.push_back(c3);	c.push_back(c4);	c.push_back(c5);	c.push_back(c1);	c.push_back(c2);	c.push_back(c3);	/*	glGenBuffers(1, &CBO);	glBindBuffer(GL_ARRAY_BUFFER, CBO);	glBufferData(GL_ARRAY_BUFFER, c.size() * sizeof(vec4), &c[0], GL_STATIC_DRAW);	glVertexAttribPointer(2, 4, GL_FLOAT, GL_FALSE, 0, 0);	glEnableVertexAttribArray(2);	*/	vector<GLuint> indices;	// front	indices.push_back(0);	indices.push_back(2);	indices.push_back(1);	indices.push_back(1);	indices.push_back(2);	indices.push_back(3);	// back	indices.push_back(6);	indices.push_back(4);	indices.push_back(5);	indices.push_back(5);	indices.push_back(7);	indices.push_back(6);	// top	indices.push_back(1);	indices.push_back(5);	indices.push_back(0);	indices.push_back(0);	indices.push_back(5);	indices.push_back(4);//.........这里部分代码省略.........
开发者ID:Amber-Wolf,项目名称:FlightSimulator2013,代码行数:101,


示例2: vec4

vec3 Matrix44::transformVec3(vec3 v){    auto result = *this * vec4(v, 1.0f);    return vec3(result.x, result.y, result.z);}
开发者ID:tangziwen,项目名称:Cube-Engine,代码行数:5,


示例3: ivec4

// Variablesstatic const char var_dest[] = "ivec4 dest;/n";static const char var_pattern[] = "ivec4 pattern;/n";static const char var_pixel[] = "ivec4 pixel;/n";static const char var_src[] = "ivec4 src;/n";static const char var_patternst[] = "vec2 patternst;/n";// Operationsstatic const char op_src[] = "src = ivec4(texture2D(srctex,gl_TexCoord[0].st)*vec4(colorsizesrc)+.5);/n";static const char op_pixel[] = "pixel = ivec4(texture2D(srctex,gl_TexCoord[0].st)*vec4(colorsizedest)+.5);/n";static const char op_color[] = "pixel = fillcolor;/n";static const char op_dest[] = "dest = ivec4(texture2D(desttex,gl_TexCoord[1].st)*vec4(colorsizedest)+.5);/n";static const char op_pattern[] = "patternst = vec2(mod(gl_FragCoord.x,float(patternsize.x))/float(patternsize.x),/n/mod(gl_FragCoord.y, float(patternsize.y)) / float(patternsize.y));/n/pattern = ivec4(texture2D(patterntex,patternst)*vec4(colorsizedest)+.5);/n";static const char op_destout[] = "gl_FragColor = vec4(pixel)/vec4(colorsizedest);/n";static const char op_vertex[] = "vec4 xyzw = vec4(xy[0],xy[1],0,1);/n/mat4 proj = mat4(/n/vec4(2.0 / (view[1] - view[0]), 0, 0, 0),/n/vec4(0, 2.0 / (view[2] - view[3]), 0, 0),/n/vec4(0, 0, -2.0, 0),/n/vec4(-(view[1] + view[0]) / (view[1] - view[0]),/n/-(view[2] + view[3]) / (view[2] - view[3]), -1 , 1));/n/gl_Position    = proj * xyzw;/n";static const char op_vertcolorrgb[] = "gl_FrontColor = vec4(rgb,1.0);/n";static const char op_texcoord0[] = "gl_TexCoord[0] = vec4(srcst,0.0,1.0);/n";static const char op_texcoord1[] = "gl_TexCoord[1] = vec4(destst,0.0,1.0);/n";static const char op_texcoord3[] = "gl_TexCoord[3] = vec4(stencilst,0.0,1.0);/n";static const char op_ckeysrc[] = "if(src.rgb == ckeysrc) discard;/n";static const char op_ckeydest[] = "if(dest.rgb != ckeydest) discard;/n";
开发者ID:WilliamFeely,项目名称:dxgl,代码行数:30,


示例4: main

 void main() {     gl_Position = vec4(Position, 1.0f);// P*V*vec4(x, y, z, 1.0f); }
开发者ID:segfault11,项目名称:GerstnerWaves,代码行数:4,


示例5: position

 layerParam::layerParam() :      position(vec2(0.f)), scale(vec2(1.f)), hsb_bias(vec3(0.f)),     hsb_mod(vec3(1.f)), color_bias(vec4(0.f)), color_mod(vec4(1.f)),      blend(BLEND_REPLACE) { }
开发者ID:nystep,项目名称:Scream,代码行数:6,


示例6: glGenVertexArrays

void OpenglBufferData::loadBufferData() {	if (!theModelView)		return;	SimMesh *theMesh = theModelView->theMesh;	MeshColor *theColor = theModelView->theColor;	MeshTexture *theTexture = theModelView->theTexture;	MeshNormal *theNormals = theModelView->theNormals;	vertex *data = NULL;	glGenVertexArrays(1, &vao);	glBindVertexArray(vao);	glGenBuffers(1, &vbo);	glBindBuffer(GL_ARRAY_BUFFER, vbo);	if (!theTexture) {		data = new vertex[theMesh->numVertices()];		for (size_t i = 0; i < theMesh->numVertices(); i++) {			data[i].position = vec4(theMesh->indVertex(i)->p[0], theMesh->indVertex(i)->p[1], theMesh->indVertex(i)->p[2], 1.0f);			if (theModelView->theColor) {				GLfloat a = 1.0f;				if (i < theColor->a.size()) a = theColor->a[i] / 255.0f;				data[i].color = vec4(theColor->r[i] / 255.0f, theColor->g[i] / 255.0f, theColor->b[i] / 255.0f, a);			}			else				data[i].color = vec4(theModelView->color[0], theModelView->color[1], theModelView->color[2], 1.0f);		}		if (theNormals) {			for (size_t i = 0; i < theNormals->vNormals.size(); i++) {				data[i].normal = vec3(theNormals->vNormals[i][0], theNormals->vNormals[i][1], theNormals->vNormals[i][2]);			}		}		glBufferData(GL_ARRAY_BUFFER, theMesh->numVertices() * sizeof(vertex), data, GL_STATIC_DRAW);	}	else {		// if texture exists, we need to duplicate the vertex on each triangle		data = new vertex[theMesh->numFaces() * 3];		for (size_t i = 0; i < theMesh->numFaces(); i++) {			SimFace *f = theMesh->indFace(i);			for (int j = 0; j < 3; j++) {				SimVertex *v = f->ver[j];				data[i * 3 + j].position = vec4(theMesh->indVertex(v->idx)->p[0], theMesh->indVertex(v->idx)->p[1], theMesh->indVertex(v->idx)->p[2], 1.0);				if (theNormals) {					data[i * 3 + j].normal = vec3(theNormals->vNormals[v->idx][0], theNormals->vNormals[v->idx][1], theNormals->vNormals[v->idx][2]);					data[i * 3 + j].tangent = vec3(theModelView->tangents[i * 3 + j][0], theModelView->tangents[i * 3 + j][1], theModelView->tangents[i * 3 + j][2]);				}				data[i * 3 + j].texCoord = vec2(theTexture->getU(v, f), theTexture->getV(v, f));			}		}		glBufferData(GL_ARRAY_BUFFER, 3 * theMesh->numFaces() * sizeof(vertex), data, GL_STATIC_DRAW);	}	glEnableVertexAttribArray(0);	glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(vertex), BUFFER_OFFSET(0));	if (theTexture) {		glEnableVertexAttribArray(3);		glVertexAttribPointer(3, 2, GL_FLOAT, GL_FALSE, sizeof(vertex), BUFFER_OFFSET(2 * sizeof(vec4) + sizeof(vec3)));		if (theNormals) {			glEnableVertexAttribArray(4);			glVertexAttribPointer(4, 3, GL_FLOAT, GL_FALSE, sizeof(vertex), BUFFER_OFFSET(2 * sizeof(vec4) + sizeof(vec3) + sizeof(vec2)));		}	}	else {		glEnableVertexAttribArray(1);		glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, sizeof(vertex), BUFFER_OFFSET(sizeof(vec4)));	}	if (theNormals) {		glEnableVertexAttribArray(2);		glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, sizeof(vertex), BUFFER_OFFSET(2 * sizeof(vec4)));	}	unsigned int *face_indices = new unsigned int[3 * theMesh->numFaces()];	for (size_t i = 0; i < theMesh->numFaces(); i++) {		SimFace *f = theMesh->indFace(i);		for (int j = 0; j < 3; j++) {			if (!theTexture) 				face_indices[3 * i + j] = f->ver[j]->idx;			else 				face_indices[3 * i + j] = 3 * i + j;		}	}	glGenBuffers(1, &vbo_face_indices);	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbo_face_indices);	glBufferData(GL_ELEMENT_ARRAY_BUFFER, 3 * theMesh->numFaces() * sizeof(unsigned int), face_indices, GL_STATIC_DRAW);	glGenVertexArrays(1, &vao_wireFrame);	glBindVertexArray(vao_wireFrame);	glBindBuffer(GL_ARRAY_BUFFER, vbo);	glEnableVertexAttribArray(0);	glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(vertex), BUFFER_OFFSET(0));	unsigned int *edge_indices = new unsigned int[2 * theMesh->numEdges()];	if (theTexture) {		for (size_t i = 0; i < theMesh->numFaces(); i++) {			SimFace *f = theMesh->indFace(i);			for (int j = 0; j < 3; j++) {				SimEdge * e = theMesh->idEdge(f->ver[j]->idx, f->ver[(j + 1) % 3]->idx);				edge_indices[2 * e->idx + 0] = i * 3 + j;				edge_indices[2 * e->idx + 1] = i * 3 + (j + 1) % 3;			}		}	}	else {		for (size_t i = 0; i < theMesh->numEdges(); i++) {			SimEdge * e = theMesh->indEdge(i);			edge_indices[2 * i + 0] = e->v0->idx;//.........这里部分代码省略.........
开发者ID:zhangk430,项目名称:MeshViewer,代码行数:101,


示例7: vec4

void SurfaceExtraction::updateColors() {    const static vec4 defaultColor[11] = {vec4(1.0f),                                          vec4(0x1f, 0x77, 0xb4, 255) / vec4(255, 255, 255, 255),                                          vec4(0xff, 0x7f, 0x0e, 255) / vec4(255, 255, 255, 255),                                          vec4(0x2c, 0xa0, 0x2c, 255) / vec4(255, 255, 255, 255),                                          vec4(0xd6, 0x27, 0x28, 255) / vec4(255, 255, 255, 255),                                          vec4(0x94, 0x67, 0xbd, 255) / vec4(255, 255, 255, 255),                                          vec4(0x8c, 0x56, 0x4b, 255) / vec4(255, 255, 255, 255),                                          vec4(0xe3, 0x77, 0xc2, 255) / vec4(255, 255, 255, 255),                                          vec4(0x7f, 0x7f, 0x7f, 255) / vec4(255, 255, 255, 255),                                          vec4(0xbc, 0xbd, 0x22, 255) / vec4(255, 255, 255, 255),                                          vec4(0x17, 0xbe, 0xcf, 255) / vec4(255, 255, 255, 255)};    size_t count = 0;    for (const auto& data : volume_) {        count++;        if (colors_.size() < count) {            const static std::string color = "color";            const static std::string dispName = "Color for Volume ";            FloatVec4Property* colorProp =                new FloatVec4Property(color + toString(count - 1), dispName + toString(count),                                      defaultColor[(count - 1) % 11]);            colorProp->setCurrentStateAsDefault();            colorProp->setSemantics(PropertySemantics::Color);            colorProp->setSerializationMode(PropertySerializationMode::ALL);            colors_.addProperty(colorProp);        }        colors_[count - 1]->setVisible(true);    }    for (size_t i = count; i < colors_.size(); i++) {        colors_[i]->setVisible(false);    }}
开发者ID:sunwj,项目名称:inviwo,代码行数:34,


示例8: main

int main(){	Vector2<int> vec2(12,25);	Vector2<int> vec3(13,24);	Vector2<int> storage;	std::cout << "Vector2: /n/n";	storage = vec3 + vec2;		std::cout << "Add:" << "(" << storage.x << "," << storage.y << ")" << std::endl;	storage = vec3 - vec2;	std::cout << "Subtract:" << "(" << storage.x << "," << storage.y << ")" << std::endl;	storage = vec3 / vec2;	std::cout << "Divide:" << "(" << storage.x << "," << storage.y  << ")" << std::endl; 	storage = vec3 * vec2;	std::cout << "Multiply:" << "(" << storage.x << "," << storage.y << ")" << std::endl;	storage = vec3 % vec2;	std::cout << "Modulus:" << "(" << storage.x << "," << storage.y << "," << ")" << std::endl;	int sto = storage.Dot(vec2, vec3);	std::cout << "Dot product: " << sto << std::endl;	int mg = storage.Mag(vec2);	std::cout << "Magnitude: " << mg << std::endl;	Vector2<int> norm = storage.Normalise(vec2);	std::cout << "Normalize:" << "(" << norm.x << "," << norm.y << "," << ")/n/n" << std::endl;	Vector3<int> vec1(12, 12, 12);	Vector3<int> vec4(12, 12, 12);	Vector3<int> storage2;		std::cout << "Vector3: /n/n";	storage2 = vec1 + vec4;	std::cout << "Add:" << "(" << storage2.x << "," << storage2.y << "," << storage2.z << ")" << std::endl;	storage2 = vec1 - vec4;	std::cout << "Subtract:" << "(" << storage2.x << "," << storage2.y << "," << storage2.z << ")" << std::endl;	storage2 = vec1 / vec4;	std::cout << "Divide:" << "(" << storage2.x << "," << storage2.y << "," << storage2.z << ")" << std::endl; 	storage2 = vec1 * vec4;	std::cout << "Multiply:" << "(" << storage2.x << "," << storage2.y << "," << storage2.z << ")" << std::endl;	storage2 = vec1 % vec4;	std::cout << "Modulus:" << "(" << storage2.x << "," << storage2.y << "," << storage2.z << ")" << std::endl;	int Dot = storage2.Dot(vec1, vec4);	std::cout << "Dot Product is: " << Dot << std::endl;	Vector3<int> cross = storage2.Cross(vec1, vec4);	std::cout << "Cross Product is: " << cross.x << "," << cross.y << cross.z << std::endl;	int Mag = storage2.Mag(vec1);	std::cout << "Magnitude Product is: " << Mag  << std::endl;	Vector3<int> Norm = storage2.Normalise(vec1);	std::cout << "Normalised:" << "(" << Norm.x << "," << Norm.y << "," << Norm.z << ")/n" << std::endl;	std::cout << "Color: /n/n";	Color<int> color;	Color<int> boo1(12, 12, 12, 12);	Color<int> boo2(13, 13, 13, 13);	Color<int> test;	test = boo1 + boo2;	std::cout << "Add:" << "(" << test.r << "," << test.g << "," << test.b << "," << test.a << ")" << std::endl;	test = boo1 - boo2;	std::cout << "Subtract:" << "(" << test.r << "," << test.g << "," << test.b << "," << test.a << ")" << std::endl;	test = boo1 * boo2;	std::cout << "Multiply:" << "(" << test.r << "," << test.g << "," << test.b << "," << test.a << ")" << std::endl;//.........这里部分代码省略.........
开发者ID:AMiller90,项目名称:Homework,代码行数:101,


示例9: main

 void main() {     gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;     gl_TexCoord[0] = gl_MultiTexCoord0; //poop     cameraPosition = (gl_ModelViewMatrixInverse * vec4(0.,0.,0.,1.)).xyz; }); // END VERTEX SHADER STRINGIFY
开发者ID:Entropy,项目名称:ofxVolumetrics,代码行数:6,


示例10: switch

void SSProjectiles::SetSpecificProjectileProperties( Projectile* projectile, const glm::vec3& distance ){    // TODODP: TEMP    //auto GetEffect = [] ( ) -> gfx::ParticleSystem    //{    //	ScriptArg args[17];    //	g_Script.Run( "../../../script/Test.lua" );    //	g_Script.GetArray( "ParticleTest", args, 17 );    //	gfx::ParticleSystem ps	= g_SSParticle.GetDefaultParticleSystem( PARTICLE_TYPE_CONE );    //	ps.EmitterPosition		= glm::vec3( args[0].asDouble, args[1].asDouble, args[2].asDouble );    //	ps.TimeToLive			= args[3].asDouble;    //	ps.Colour				= glm::vec4( args[4].asDouble, args[5].asDouble, args[6].asDouble, args[7].asDouble );    //	ps.Direction			= glm::vec3( args[8].asDouble, args[9].asDouble, args[10].asDouble );    //	ps.ParticlesSpeed		= args[11].asDouble;    //	ps.Size					= glm::vec2( args[12].asDouble, args[13].asDouble );    //	ps.ParticlesTimeToLive	= args[14].asDouble;    //	ps.TransparencyPolynome	= glm::vec2( args[15].asDouble, args[16].asDouble );    //	return ps;    //};    switch ( projectile->Type )    {    case PROJECTILE_TYPE_BULLET:        projectile->Orientation = RotationAlignment( MODEL_PROJECTILE_UP, glm::normalize( projectile->Destination - projectile->Origin ) );        //projectile->Scale.z = 1; // TODODP: Move hardcoded length        projectile->Orientation = RotationAlignment(MODEL_BEAM_UP, glm::normalize(projectile->Destination - projectile->Origin));        {            if (projectile->Tracer)            {                gfx::ParticleSystem effect = g_SSParticle.GetDefaultParticleSystem(PARTICLE_TYPE_BULLET);                effect.ParticlesSpeed = projectile->Speed;                effect.TimeToLive = glm::length(distance) / projectile->Speed;                effect.ParticlesTimeToLive = glm::length(distance) / projectile->Speed;                effect.EmitterPosition = projectile->Origin + glm::vec3(0.0f, 0.5f, 0.0f);                effect.Direction = glm::normalize(projectile->Destination - projectile->Origin) * projectile->Scale.z;                effect.EmitterPosition = effect.EmitterPosition;                if (projectile->Weapon == WEAPON_TANK_CANNON)                    effect.Size = glm::vec2(0.25f, 0.25f);                else if (projectile->Weapon == WEAPON_MACHINE_GUN)                    effect.Size = glm::vec2(0.15f, 0.15f);                g_SSParticle.SpawnParticleSystem(PARTICLE_TYPE_BULLET, effect);                projectile->Light.Position = projectile->Position;                projectile->Light.Range = 4;                projectile->Light.Intensity = 15;                projectile->Light.Color = vec4(1.0f, 0.2f, 0.2f, 1.0f);            }            else            {                projectile->Light.Position = projectile->Position;                projectile->Light.Range = 7;                projectile->Light.Intensity = 2;                projectile->Light.Color = vec4(0.2f);            }        }        break;    case PROJECTILE_TYPE_GRENADE:        projectile->Velocity.y	= -((projectile->Position.y - projectile->Destination.y) / projectile->TimeLeft - GRAVITY_CONSTANT * projectile->TimeLeft / 2.0f);        {            gfx::ParticleSystem effect	= g_SSParticle.GetDefaultParticleSystem( PARTICLE_TYPE_SMOKE_TRAIL );            effect.EmitterPosition		= glm::vec3( FLT_MIN );            projectile->Effect			= g_SSParticle.SpawnParticleSystem( PARTICLE_TYPE_SMOKE_TRAIL, effect );        }        {            projectile->Light.Position		= projectile->Position;            projectile->Light.Color		= glm::vec4( 1.0f );            projectile->Light.Intensity	= 5.0f;            projectile->Light.Range		= 100.0f;        }        break;    case PROJECTILE_TYPE_BEAM:        projectile->TimeLeft	= 0.1f;        projectile->Scale.z		= projectile->Weapon == WEAPON_PIERCING_LASER ? 25.0f : glm::length( distance ); // TODODP: Move hardcoded length        projectile->Orientation = RotationAlignment( MODEL_BEAM_UP, glm::normalize( projectile->Destination - projectile->Origin ) );        projectile->Destination = projectile->Destination + glm::vec3( 0.0f, 0.5f, 0.0f );        {            gfx::ParticleSystem effect	= g_SSParticle.GetDefaultParticleSystem( PARTICLE_TYPE_LASER );            effect.EmitterPosition = projectile->Origin;// +glm::vec3(0.0f, 0.5f, 0.0f);            effect.Direction			= glm::normalize( projectile->Destination - projectile->Origin ) * projectile->Scale.z;            if (projectile->Weapon == WEAPON_CUTTER)            {                effect.Colour = vec4(0.1f, 0.1f, 0.9f, 1);                effect.Size = glm::vec2(0.1f, 0.1f);            }            g_SSParticle				.SpawnParticleSystem( PARTICLE_TYPE_LASER, effect );            effect.EmitterPosition		= effect.EmitterPosition + glm::normalize( projectile->Destination - projectile->Origin ) * effect.Size.x / 2.0f;            g_SSParticle				.SpawnParticleSystem( PARTICLE_TYPE_LASER, effect );            if(projectile->Weapon == WEAPON_PIERCING_LASER)            {//.........这里部分代码省略.........
开发者ID:Robograde,项目名称:Robograde,代码行数:101,


示例11: mem_zero

void GAMECLIENT::on_snapshot(){	new_tick = true;		// clear out the invalid pointers	mem_zero(&gameclient.snap, sizeof(gameclient.snap));	snap.local_cid = -1;	// secure snapshot	{		int num = snap_num_items(SNAP_CURRENT);		for(int index = 0; index < num; index++)		{			SNAP_ITEM item;			void *data = snap_get_item(SNAP_CURRENT, index, &item);			if(netobj_validate(item.type, data, item.datasize) != 0)			{				if(config.debug)					dbg_msg("game", "invalidated index=%d type=%d (%s) size=%d id=%d", index, item.type, netobj_get_name(item.type), item.datasize, item.id);				snap_invalidate_item(SNAP_CURRENT, index);			}		}	}			process_events();	if(config.dbg_stress)	{		if((client_tick()%100) == 0)		{			char message[64];			int msglen = rand()%(sizeof(message)-1);			for(int i = 0; i < msglen; i++)				message[i] = 'a'+(rand()%('z'-'a'));			message[msglen] = 0;							NETMSG_CL_SAY msg;			msg.team = rand()&1;			msg.message = message;			msg.pack(MSGFLAG_VITAL);			client_send_msg();		}	}	// go trough all the items in the snapshot and gather the info we want	{		snap.team_size[0] = snap.team_size[1] = 0;				// TeeComp.		for(int i=0; i<MAX_CLIENTS; i++)			stats[i].active = false;		int num = snap_num_items(SNAP_CURRENT);		for(int i = 0; i < num; i++)		{			SNAP_ITEM item;			const void *data = snap_get_item(SNAP_CURRENT, i, &item);			if(item.type == NETOBJTYPE_CLIENT_INFO)			{				const NETOBJ_CLIENT_INFO *info = (const NETOBJ_CLIENT_INFO *)data;				int cid = item.id;				ints_to_str(&info->name0, 6, clients[cid].name);				ints_to_str(&info->skin0, 6, clients[cid].skin_name);								clients[cid].use_custom_color = info->use_custom_color;				clients[cid].color_body = info->color_body;				clients[cid].color_feet = info->color_feet;								// prepare the info				if(clients[cid].skin_name[0] == 'x' || clients[cid].skin_name[1] == '_')					str_copy(clients[cid].skin_name, "default", 64);									clients[cid].skin_info.color_body = skins->get_color(clients[cid].color_body);				clients[cid].skin_info.color_feet = skins->get_color(clients[cid].color_feet);				clients[cid].skin_info.size = 64;								// find new skin				clients[cid].skin_id = gameclient.skins->find(clients[cid].skin_name);				if(clients[cid].skin_id < 0)				{					clients[cid].skin_id = gameclient.skins->find("default");					if(clients[cid].skin_id < 0)						clients[cid].skin_id = 0;				}								if(clients[cid].use_custom_color)					clients[cid].skin_info.texture = gameclient.skins->get(clients[cid].skin_id)->color_texture;				else				{					clients[cid].skin_info.texture = gameclient.skins->get(clients[cid].skin_id)->org_texture;					clients[cid].skin_info.color_body = vec4(1,1,1,1);					clients[cid].skin_info.color_feet = vec4(1,1,1,1);				}				clients[cid].update_render_info(cid);				gameclient.snap.num_players++;			}			else if(item.type == NETOBJTYPE_PLAYER_INFO)			{//.........这里部分代码省略.........
开发者ID:Amor,项目名称:Clientmod,代码行数:101,


示例12: BoundingSphere

 BoundingSphere(vec3 center, vec3 radius) {     this->center = vec4(center, 1.0f);     this->radius = vec_length(radius); }
开发者ID:ykdsea,项目名称:opengl-es-sdk-for-android,代码行数:5,


示例13: Processor

AxisAlignedCutPlane::AxisAlignedCutPlane()    : Processor()    , volume_("volume")    , imageInport_("imageInport_")    , outport_("outport")    , xSlide_("x", "X Slide")    , ySlide_("y", "Y Slide")    , zSlide_("z", "Z Slide")    , disableTF_("disableTF", "Disable transfer function", false,                 InvalidationLevel::InvalidResources)    , tf_("transferfunction", "Transfer function", TransferFunction(), &volume_)    , sliceShader_("geometryrendering.vert", "axisalignedcutplaneslice.frag", false)    , boundingBoxShader_("geometryrendering.vert", "axisalignedcutplaneboundingbox.frag")    , showBoundingBox_("boundingBox", "Show Bounding Box", true)    , boundingBoxColor_("boundingBoxColor", "Bounding Box Color", vec4(0.0f, 0.0f, 0.0f, 1.0f))	, renderPointSize_("renderPointSize", "Point Size", 1.0f, 0.001f, 15.0f, 0.001f)	, renderLineWidth_("renderLineWidth", "Line Width", 1.0f, 0.001f, 15.0f, 0.001f)    , nearestInterpolation_("nearestInterpolation", "Use nearest neighbor interpolation", false)    , camera_("camera", "Camera")    , trackball_(&camera_) {    addPort(volume_);    addPort(imageInport_);    addPort(outport_);    addProperty(xSlide_);    addProperty(ySlide_);    addProperty(zSlide_);    addProperty(disableTF_);    addProperty(tf_);    addProperty(showBoundingBox_);	addProperty(boundingBoxColor_);	addProperty(renderPointSize_);	addProperty(renderLineWidth_);    addProperty(camera_);    addProperty(trackball_);    imageInport_.setOptional(true);    tf_.get().clearPoints();    tf_.get().addPoint(vec2(0.0f, 1.0f), vec4(0.0f, 0.0f, 0.0f, 1.0f));    tf_.get().addPoint(vec2(1.0f, 1.0f), vec4(1.0f, 1.0f, 1.0f, 1.0f));    tf_.setCurrentStateAsDefault();    xSlide_.onChange([&]() {        if (volume_.hasData()) xSlide_.createDrawer(volume_.getData());    });    ySlide_.onChange([&]() {        if (volume_.hasData()) ySlide_.createDrawer(volume_.getData());    });    zSlide_.onChange([&]() {        if (volume_.hasData()) zSlide_.createDrawer(volume_.getData());    });    volume_.onChange([&]() {        if (!volume_.hasData()) return;        auto vol = volume_.getData();        xSlide_.onVolumeChange(vol);        ySlide_.onVolumeChange(vol);        zSlide_.onVolumeChange(vol);        if (!boundingBoxMesh_) {            createBoundingBox();        }        boundingBoxMesh_->setModelMatrix(vol->getModelMatrix());        boundingBoxMesh_->setWorldMatrix(vol->getWorldMatrix());    });    boundingBoxColor_.setSemantics(PropertySemantics::Color);    setAllPropertiesCurrentStateAsDefault();    createBoundingBox();}
开发者ID:david12345678901,项目名称:inviwo,代码行数:75,


示例14: Processor

MeshRenderProcessorGL::MeshRenderProcessorGL()    : Processor()    , inport_("geometry.inport")    , imageInport_("imageInport")    , outport_("image.outport")    , camera_("camera", "Camera")    , centerViewOnGeometry_("centerView", "Center view on geometry")    , setNearFarPlane_("setNearFarPlane", "Calculate Near and Far Plane")    , resetViewParams_("resetView", "Reset Camera")    , trackball_(&camera_)    , overrideColorBuffer_("overrideColorBuffer", "Override Color Buffer", false , INVALID_RESOURCES)    , overrideColor_("overrideColor", "Override Color", vec4(0.75f, 0.75f, 0.75f, 1.0f), vec4(0.0f), vec4(1.0f))    , geomProperties_("geometry", "Geometry Rendering Properties")    , cullFace_("cullFace", "Cull Face")    , polygonMode_("polygonMode", "Polygon Mode")    , renderPointSize_("renderPointSize", "Point Size", 1.0f, 0.001f, 15.0f, 0.001f)    , renderLineWidth_("renderLineWidth", "Line Width", 1.0f, 0.001f, 15.0f, 0.001f)    , lightingProperty_("lighting", "Lighting", &camera_)    , layers_("layers", "Layers")    , colorLayer_("colorLayer", "Color", true, INVALID_RESOURCES)    , texCoordLayer_("texCoordLayer", "Texture Coordinates", false, INVALID_RESOURCES)    , normalsLayer_("normalsLayer", "Normals (World Space)", false, INVALID_RESOURCES)    , viewNormalsLayer_("viewNormalsLayer", "Normals (View space)", false, INVALID_RESOURCES)    , shader_("geometryrendering.vert", "geometryrendering.frag", false) {    addPort(inport_);    addPort(imageInport_);    addPort(outport_);    addProperty(camera_);    centerViewOnGeometry_.onChange(this, &MeshRenderProcessorGL::centerViewOnGeometry);    addProperty(centerViewOnGeometry_);    setNearFarPlane_.onChange(this, &MeshRenderProcessorGL::setNearFarPlane);    addProperty(setNearFarPlane_);    resetViewParams_.onChange([this]() { camera_.resetCamera(); });    addProperty(resetViewParams_);    outport_.addResizeEventListener(&camera_);    inport_.onChange(this, &MeshRenderProcessorGL::updateDrawers);    cullFace_.addOption("culldisable", "Disable", GL_NONE);    cullFace_.addOption("cullfront", "Front", GL_FRONT);    cullFace_.addOption("cullback", "Back", GL_BACK);    cullFace_.addOption("cullfrontback", "Front & Back", GL_FRONT_AND_BACK);    cullFace_.set(GL_NONE);    polygonMode_.addOption("polypoint", "Points", GL_POINT);    polygonMode_.addOption("polyline", "Lines", GL_LINE);    polygonMode_.addOption("polyfill", "Fill", GL_FILL);    polygonMode_.set(GL_FILL);    polygonMode_.onChange(this, &MeshRenderProcessorGL::changeRenderMode);    geomProperties_.addProperty(cullFace_);    geomProperties_.addProperty(polygonMode_);    geomProperties_.addProperty(renderPointSize_);    geomProperties_.addProperty(renderLineWidth_);    geomProperties_.addProperty(overrideColorBuffer_);    geomProperties_.addProperty(overrideColor_);    overrideColor_.setSemantics(PropertySemantics::Color);    overrideColor_.setVisible(false);    overrideColorBuffer_.onChange([&](){overrideColor_.setVisible(overrideColorBuffer_.get()); });    float lineWidthRange[2];    float increment;    glGetFloatv(GL_LINE_WIDTH_RANGE, lineWidthRange);    glGetFloatv(GL_LINE_WIDTH_GRANULARITY, &increment);    renderLineWidth_.setMinValue(lineWidthRange[0]);    renderLineWidth_.setMaxValue(lineWidthRange[1]);    renderLineWidth_.setIncrement(increment);    renderLineWidth_.setVisible(false);    renderPointSize_.setVisible(false);    addProperty(geomProperties_);    addProperty(lightingProperty_);    addProperty(trackball_);    addProperty(layers_);    layers_.addProperty(colorLayer_);    layers_.addProperty(texCoordLayer_);    layers_.addProperty(normalsLayer_);    layers_.addProperty(viewNormalsLayer_);    setAllPropertiesCurrentStateAsDefault();}
开发者ID:sarbi127,项目名称:inviwo,代码行数:83,


示例15: main

void main() {    vec4 color = texture2D(backgroundSampler, v_texCoord);    gl_FragColor = vec4(backgroundColor.rgb, color.a);}
开发者ID:Kitware,项目名称:cinema,代码行数:4,


示例16: main

		void main(void)/		{/			gl_Position = vec4(point.x / scene.x - 1.0, 1.0 - point.y / scene.y, 0.0, 1.0);/			v_tex_coord = tex_coord;/			v_color = color;/		}";
开发者ID:Zoxc,项目名称:scaled,代码行数:6,


示例17: Init_Menu_Win

void Init_Menu_Win(){	ItemDef    *item;		Menu_Win = new MenuDef( "win" );	Engine->UI->PushMenu( Menu_Win );	Menu_Win->OnOpen = OnOpen;	item = new ItemDef( ITYPE_DEFAULT, ITEMFLAG_IMAGE, "background" );	Menu_Win->PushItem( item );	{		item->rect = vec4( 0,0,640,480 );		item->mat = NULL;		item->color = vec4( 0,0,0,0.4 );	}		item = new ItemDef( ITYPE_DEFAULT, ITEMFLAG_TEXT, "as" );	Menu_Win->PushItem( item );	{		item->rect = vec4( 320,170,0,0 );		item->textColor = vec4( 0.0,0.8,0,1.0 );		item->textAlign = vec2(1,0);		item->fontSize = 2.6f;		item->font = 0;		item->string = "YOU WIN";	}	item = new ItemDef( ITYPE_DEFAULT, ITEMFLAG_TEXT, "as" );	Menu_Win->PushItem( item );	{		item->rect = vec4( 320,190,0,0 );		item->textColor = vec4( 0.96,0.96,0.96,1 );		item->textAlign = vec2(1,0);		item->fontSize = 1.3f;		item->font = 0;		//item->string = info;//"WANT TO FART AGAIN?";		score = item;	}	item = new ItemDef( ITYPE_BUTTON, (ITEMFLAG_IMAGE|ITEMFLAG_TEXT), "button-yes" );	Menu_Win->PushItem( item );	{		item->rect = vec4( 225,230,90,40 );		item->mat = NULL;				item->color = vec4(0.1,0.1,0.1,0.4);		item->textColor = vec4( 0.92,0.92,0.92,1.0 );		item->textOffset = vec2( 45,25 );		item->fontSize = 1.3f;		item->textAlign = vec2(1,0);		item->font = 0;		item->string = "NEXT LEVEL";		item->OnFocus = ButtonFocus;		item->OnAction = ButtonYesAction;		item->visible = true;	}		item = new ItemDef( ITYPE_BUTTON, (ITEMFLAG_IMAGE|ITEMFLAG_TEXT), "button-no" );	Menu_Win->PushItem( item );	{		item->rect = vec4( 325,230,90,40 );		item->mat = NULL;				item->color = vec4(0.1,0.1,0.1,0.4);		item->textColor = vec4( 0.92,0.92,0.92,1.0 );		item->textOffset = vec2( 45,25 );		item->fontSize = 1.3f;		item->textAlign = vec2(1,0);		item->font = 0;		item->string = "BACK TO MENU";		item->OnFocus = ButtonFocus;		item->OnAction = ButtonNoAction;		item->visible = true;	}}
开发者ID:BraXi,项目名称:FartyBear,代码行数:85,


示例18: main

void main(void){	gl_Position = charMat * vec4(pos.xy, 0.0, 1.0);	charDataOut = charDataIn;	texCoords = pos.zw;}
开发者ID:calceusHD,项目名称:cqtTest,代码行数:6,


示例19: GetPosition

void Trans_Mesh::Draw(const Base_Camera* camera, float dt){	Graphics::SetTopology(PRIM_TRIANGLELIST);	Graphics::DepthStates::NoDepthTest.Bind();	Graphics::RasterizerStates::CullNone.Bind();	Graphics::BlendStates::No_Blend.Bind();	VB[0].BindAsVertexBuffer();	IB.BindAsIndexBuffer();	// first axis	Batch* cone_batch = Batches[0];	Batch* rod_batch = Batches[1];	struct tempstruct{		mat4 vp;		vec4 color;	};	tempstruct t;	mat4 bvtrans, bvaxis, rodscale, rodtrans;	const float offaxis =10.0f;	rodscale.setupScale(offaxis/3.0f, .1f, .1f);	const float distaway = 120.0f;	LastCamPosition = camera->Position;	vec3 transpost =  GetPosition()-LastCamPosition;	transpost.normalize();	//FIRST AXIS.. RED AND X	bvtrans.setupTranslation((transpost*distaway) + LastCamPosition+vec3(offaxis, 0.0f, 0.0f));	bvaxis.setupTranslation(vec3(-1.0f, 0, 0));	t.vp = bvaxis*bvtrans*camera->VP;// we have to move the BV that was pregenerated into the correct position and scale it 	t.vp.Transpose();	t.color = vec4(XAxis_Color, 1);//red  ==x	CBuffer0.Update(&t);	cone_batch->GetVS()->Bind();	cone_batch->GetVS()->SetConstantBuffer(CBuffer0, 0);	cone_batch->GetPS()->Bind();	Graphics::DrawIndexed(cone_batch->StartIndex, cone_batch->NumIndices);	//now draw the rod	bvtrans.setupTranslation((transpost*distaway) + LastCamPosition);	rodtrans.setupTranslation(vec3(1.3f, 0, 0));	t.vp = rodtrans*rodscale*bvtrans*camera->VP;// we have to move the BV that was pregenerated into the correct position and scale it 	t.vp.Transpose();	CBuffer0.Update(&t);	cone_batch->GetVS()->SetConstantBuffer(CBuffer0, 0);	Graphics::DrawIndexed(rod_batch->StartIndex, rod_batch->NumIndices);	//SECOND AXIS. .. BLUE AND Z	mat4 rot;	rot.setupRotateY(-Pi/2.0f);	bvaxis.setupTranslation( 0.0f,  0.0f, -1.0f);	bvtrans.setupTranslation((transpost*distaway) + LastCamPosition+ vec3(0.0f, 0.0f, offaxis));	t.vp = bvaxis*rot*bvtrans*camera->VP;	t.vp.Transpose();	t.color = vec4(ZAxis_Color, 1);	CBuffer0.Update(&t);	cone_batch->GetVS()->SetConstantBuffer(CBuffer0, 0);	Graphics::DrawIndexed(cone_batch->StartIndex, cone_batch->NumIndices);	//now draw the rod	bvtrans.setupTranslation((transpost*distaway) + LastCamPosition+ vec3(1.0f, 0, offaxis/2.0f));	t.vp = rodscale*rot*bvtrans*camera->VP;// we have to move the BV that was pregenerated into the correct position and scale it 	t.vp.Transpose();	CBuffer0.Update(&t);	cone_batch->GetVS()->SetConstantBuffer(CBuffer0, 0);	Graphics::DrawIndexed(rod_batch->StartIndex, rod_batch->NumIndices);	//THIRD AXIS . . . . GREEN AND Y	rot.setupRotateZ(Pi/2.0f);	bvtrans.setupTranslation((transpost*distaway) + LastCamPosition + vec3(0.0f, offaxis, 0.0f));	bvaxis.setupTranslation(0.0f, -1.0f, 0.0f);	t.vp = bvaxis*rot*bvtrans*camera->VP;	t.vp.Transpose();	t.color = vec4(YAxis_Color, 1);	CBuffer0.Update(&t);	cone_batch->GetVS()->SetConstantBuffer(CBuffer0, 0);	Graphics::DrawIndexed(cone_batch->StartIndex, cone_batch->NumIndices);	//now draw the rod	bvtrans.setupTranslation((transpost*distaway) + LastCamPosition+ vec3(1.0f, offaxis/2.0f, 0.0f));	rodtrans.setupTranslation(vec3(0,  1.3f, 0));	t.vp = rodtrans*rodscale*rot*bvtrans*camera->VP;// we have to move the BV that was pregenerated into the correct position and scale it 	t.vp.Transpose();	CBuffer0.Update(&t);	cone_batch->GetVS()->SetConstantBuffer(CBuffer0, 0);	Graphics::DrawIndexed(rod_batch->StartIndex, rod_batch->NumIndices);}
开发者ID:LazyNarwhal,项目名称:Destination_Toolkit,代码行数:99,


示例20: brw_clip_tri

/* Use mesa's clipping algorithms, translated to GEN4 assembly. */void brw_clip_tri( struct brw_clip_compile *c ){   struct brw_compile *p = &c->func;   struct brw_indirect vtx = brw_indirect(0, 0);   struct brw_indirect vtxPrev = brw_indirect(1, 0);   struct brw_indirect vtxOut = brw_indirect(2, 0);   struct brw_indirect plane_ptr = brw_indirect(3, 0);   struct brw_indirect inlist_ptr = brw_indirect(4, 0);   struct brw_indirect outlist_ptr = brw_indirect(5, 0);   struct brw_indirect freelist_ptr = brw_indirect(6, 0);   struct brw_instruction *plane_loop;   struct brw_instruction *plane_active;   struct brw_instruction *vertex_loop;   struct brw_instruction *next_test;   struct brw_instruction *prev_test;      brw_MOV(p, get_addr_reg(vtxPrev),     brw_address(c->reg.vertex[2]) );   brw_MOV(p, get_addr_reg(plane_ptr),   brw_clip_plane0_address(c));   brw_MOV(p, get_addr_reg(inlist_ptr),  brw_address(c->reg.inlist));   brw_MOV(p, get_addr_reg(outlist_ptr), brw_address(c->reg.outlist));   brw_MOV(p, get_addr_reg(freelist_ptr), brw_address(c->reg.vertex[3]) );   plane_loop = brw_DO(p, BRW_EXECUTE_1);   {      /* if (planemask & 1)       */      brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);      brw_AND(p, vec1(brw_null_reg()), c->reg.planemask, brw_imm_ud(1));            plane_active = brw_IF(p, BRW_EXECUTE_1);      {	 /* vtxOut = freelist_ptr++ 	  */	 brw_MOV(p, get_addr_reg(vtxOut),       get_addr_reg(freelist_ptr) );	 brw_ADD(p, get_addr_reg(freelist_ptr), get_addr_reg(freelist_ptr), brw_imm_uw(c->nr_regs * REG_SIZE));	 if (c->key.nr_userclip)	    brw_MOV(p, c->reg.plane_equation, deref_4f(plane_ptr, 0));	 else	    brw_MOV(p, c->reg.plane_equation, deref_4b(plane_ptr, 0));	    	 brw_MOV(p, c->reg.loopcount, c->reg.nr_verts);	 brw_MOV(p, c->reg.nr_verts, brw_imm_ud(0));	 vertex_loop = brw_DO(p, BRW_EXECUTE_1);	 {	    /* vtx = *input_ptr;	     */	    brw_MOV(p, get_addr_reg(vtx), deref_1uw(inlist_ptr, 0));	    /* IS_NEGATIVE(prev) */	    brw_set_conditionalmod(p, BRW_CONDITIONAL_L);	    brw_DP4(p, vec4(c->reg.dpPrev), deref_4f(vtxPrev, c->offset[VERT_RESULT_HPOS]), c->reg.plane_equation);	    prev_test = brw_IF(p, BRW_EXECUTE_1);	    {	       /* IS_POSITIVE(next)		*/	       brw_set_conditionalmod(p, BRW_CONDITIONAL_GE);	       brw_DP4(p, vec4(c->reg.dp), deref_4f(vtx, c->offset[VERT_RESULT_HPOS]), c->reg.plane_equation);	       next_test = brw_IF(p, BRW_EXECUTE_1);	       {		  /* Coming back in.		   */		  brw_ADD(p, c->reg.t, c->reg.dpPrev, negate(c->reg.dp));		  brw_math_invert(p, c->reg.t, c->reg.t);		  brw_MUL(p, c->reg.t, c->reg.t, c->reg.dpPrev);		  /* If (vtxOut == 0) vtxOut = vtxPrev		   */		  brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_EQ, get_addr_reg(vtxOut), brw_imm_uw(0) );		  brw_MOV(p, get_addr_reg(vtxOut), get_addr_reg(vtxPrev) );		  brw_set_predicate_control(p, BRW_PREDICATE_NONE);		  brw_clip_interp_vertex(c, vtxOut, vtxPrev, vtx, c->reg.t, GL_FALSE);		  /* *outlist_ptr++ = vtxOut;		   * nr_verts++; 		   * vtxOut = 0;		   */		  brw_MOV(p, deref_1uw(outlist_ptr, 0), get_addr_reg(vtxOut));		  brw_ADD(p, get_addr_reg(outlist_ptr), get_addr_reg(outlist_ptr), brw_imm_uw(sizeof(short)));		  brw_ADD(p, c->reg.nr_verts, c->reg.nr_verts, brw_imm_ud(1));		  brw_MOV(p, get_addr_reg(vtxOut), brw_imm_uw(0) );	       }	       brw_ENDIF(p, next_test);	       	    }	    prev_test = brw_ELSE(p, prev_test);	    {	       /* *outlist_ptr++ = vtxPrev;		* nr_verts++;		*/	       brw_MOV(p, deref_1uw(outlist_ptr, 0), get_addr_reg(vtxPrev));	       brw_ADD(p, get_addr_reg(outlist_ptr), get_addr_reg(outlist_ptr), brw_imm_uw(sizeof(short)));	       brw_ADD(p, c->reg.nr_verts, c->reg.nr_verts, brw_imm_ud(1));//.........这里部分代码省略.........
开发者ID:MttDs,项目名称:new-rexeno-tindpe,代码行数:101,


示例21: main

void main() {    float newZoom = min(cameraZoom,1.0);    // vec4 tex4 = texture2D(Texture4, TexCoord0.xy);    // vec4 tex5 = texture2D(Texture5, TexCoord0.xy);    // vec4 tex6 = texture2D(Texture6, TexCoord0.xy);    vec4 tex7 = texture2D(Texture7, TexCoord0.xy);    vec3 worldPosition = tex7.xyz;    // vec2 tcMod = (vec2(TexCoord0.x,1.0-TexCoord0.y)*2.0-1.0 );    // tcMod.x *= bufferDim.x/(newZoom);    // tcMod.y *= bufferDim.y/(newZoom);    // tcMod.y -= cameraPos.z;    // vec3 worldPosition = vec3(0.0,0.0,0.0);    // worldPosition.x = tcMod.y + tcMod.x/2.0;    // worldPosition.y = tcMod.y - tcMod.x/2.0;    // worldPosition.x += cameraPos.x;    // worldPosition.y += cameraPos.y;    // worldPosition.z = 0.0;    // float tilt = tiltAmount;    // float itilt = 1.0-tiltAmount;    // float baseHeight = 0.0;    // vec3 worldPosition = vec3(0.0,0.0,0.0);    // vec2 ssCoord = vec2(0.0);    // ssCoord = vec2(TexCoord0.x,1.0-TexCoord0.y)*2.0-1.0;    // ssCoord.x *= bufferDim.x/(newZoom);    // ssCoord.y *= bufferDim.y/(newZoom);    // ssCoord.y -= cameraPos.z*tilt*2.0;    // ssCoord.y += baseHeight*tilt*2.0;    // worldPosition.x = (ssCoord.y*0.5/itilt + ssCoord.x*0.5);    // worldPosition.y = (ssCoord.y*0.5/itilt - ssCoord.x*0.5);    // worldPosition.z = baseHeight;    // worldPosition.x += cameraPos.x;    // worldPosition.y += cameraPos.y;    vec2 newPos = worldPosition.xy/waveSpacing;    // float wm = mix(    //     abs(    //         sin(    //             (curTime)/500.0 + (TexCoord0.x + TexCoord0.y) * 12.0    //         )    //     ),    //     0.25,    //     1.0    // )*2.0;    float waveh = (waveHeight(newPos) )*0.5+0.5;    vec3 waven = (normalize( waveNormal(newPos) )+1.0)/2.0;    gl_FragData[0] = vec4(waven,waveh);}
开发者ID:CodeMason,项目名称:voxelquestiso,代码行数:77,


示例22: glDeleteLists

void PointListRenderer::generateDisplayList(const std::vector<vec3>& pointList) {    if (glIsList(displayList_))        glDeleteLists(displayList_, 1);    displayList_ = glGenLists(1);    glNewList(displayList_, GL_COMPILE);    glPushAttrib(GL_ALL_ATTRIB_BITS);    if (coordinateSystem_.get() != "world") {        glMatrixMode(GL_PROJECTION);        glPushMatrix();        glLoadIdentity();        glMatrixMode(GL_MODELVIEW);        glPushMatrix();        glLoadIdentity();        if (coordinateSystem_.get() == "viewport") {            glTranslatef(-1.f, -1.f, 0.f);            glScalef(2.f/viewport_.x, 2.f/viewport_.y, 1.f);        }    }    if (!depthTest_.get())        glDisable(GL_DEPTH_TEST);    // enable lighting for illuminated spheres    if (renderingPrimitiveProp_.get() == "illuminated-spheres") {        glEnable(GL_LIGHTING);        glEnable(GL_LIGHT0);        glLightfv(GL_LIGHT0, GL_AMBIENT, vec4(0.3f, 0.3f, 0.3f, 1.f).elem);        glLightfv(GL_LIGHT0, GL_DIFFUSE, vec4(0.6f, 0.6f, 0.6f, 1.f).elem);        glLightfv(GL_LIGHT0, GL_SPECULAR, vec4(0.6f, 0.6f, 0.6f, 1.f).elem);        glLightf(GL_LIGHT0, GL_SPOT_EXPONENT, 128.f);        tgt::Material material(color_.get(), color_.get(), color_.get(), 75.f);        material.activate();        glMatrixMode(GL_MODELVIEW);        glPushMatrix();        glLoadIdentity();        glLightfv(GL_LIGHT0, GL_POSITION, vec4(1.f, 1.f, 10.f, 1.f).elem);        glPopMatrix();    }    // render: point primitives    if (renderingPrimitiveProp_.get() == "points") {        glColor4fv(color_.get().elem);        glPointSize(pointSize_.get());        if (pointSmooth_.get())            glEnable(GL_POINT_SMOOTH);        glBegin(GL_POINTS);        for (size_t i=0; i<pointList.size(); ++i) {            tgt::vertex(pointList[i]);        }        glEnd();    }    // render: line strip    if (renderingPrimitiveProp_.get() == "line-strip") {        glColor4fv(color_.get().elem);        glLineWidth(pointSize_.get());        if (pointSmooth_.get())            glEnable(GL_LINE_SMOOTH);        glBegin(GL_LINE_STRIP);        for (size_t i=0; i<pointList.size(); ++i) {            tgt::vertex(pointList[i]);        }        glEnd();    }    // render: spheres    else if (renderingPrimitiveProp_.get() == "spheres" || renderingPrimitiveProp_.get() == "illuminated-spheres") {        GLUquadricObj* quadric = gluNewQuadric();        glColor4fv(color_.get().elem);        for (size_t i=0; i<pointList.size(); ++i) {            glPushMatrix();            tgt::translate(pointList[i]);            gluSphere(quadric, sphereDiameter_.get(), sphereSlicesStacks_.get(), sphereSlicesStacks_.get());            glPopMatrix();        }        gluDeleteQuadric(quadric);    }    if (coordinateSystem_.get() != "world") {        glMatrixMode(GL_PROJECTION);        glPopMatrix();        glMatrixMode(GL_MODELVIEW);        glPopMatrix();    }    glPopAttrib();    glEndList();}
开发者ID:alvatar,项目名称:smartmatter,代码行数:95,


示例23: main

void main()	{	vec4 baseval = texture2D( u_Texture0, v_TexCoords );	vec3 offsetNorm;	offsetNorm.rg = (baseval.rg-0.5)*2.0;	offsetNorm.b = abs(sqrt( abs(1.0-(offsetNorm.r*offsetNorm.r+offsetNorm.g*offsetNorm.g) )));	offsetNorm *= 2.0;	vec4 samp;	vec3 tc;	int i;	int j;	int k;	float fl;	float fi;	float fj;	float fk;	float dis;	float fit;	float fjt;	float rad;	const int iMax = 8;	const int jMax = 5;	const float fiMax = float(iMax);	const float fjMax = float(jMax);	const float pi = 3.14159;			float totHits = 0.0;	float totRays = 0.0;	float hitPower;	float phi;	float theta;	int counter = 1;		for (int j = 2; j < jMax; j++) {		fjt = pow( 2.0, float(j) );		hitPower = (fjMax-fjt)/fjMax;				for (int i = 0; i < iMax; i++) {			fit = float(i)*pi/fiMax;			theta = fit/2.0;//1.5*pi;////2.0*pi - fit/2.0;			phi = 2.0*fit;			rad = fjt*fit/pi;			fi = rad*cos(phi+fjt)*sin(theta);			fj = rad*sin(phi+fjt)*sin(theta);			fk = rad*cos(theta);			tc.x = (fi + offsetNorm.x)/u_Resolution.x;			tc.y = ( (fj - offsetNorm.y) + (fk + offsetNorm.z)  )/u_Resolution.y;			tc.z = clamp(baseval.b + (fk + offsetNorm.z)/255.0,0.0,u_MaxLayers);			dis = clamp(sqrt(fi*fi+fj*fj+fk*fk)/fjt,0.0,1.0);			samp = texture2D( u_Texture0, v_TexCoords + tc.xy );			if (samp.b < tc.z) {				totHits += hitPower;			}			totRays += hitPower;		}		counter++;	}	float resVal = (totHits/totRays);	resVal = clamp(resVal,0.0,1.0);	resVal = pow(resVal,6.0);		gl_FragColor = vec4(baseval.rgb,resVal);	//gl_FragColor = vec4(resVal,resVal,resVal,1.0);//.........这里部分代码省略.........
开发者ID:BrendanBuono,项目名称:voxelquestiso,代码行数:101,


示例24: int

void Widget::drawSoftBorderQuad(Renderer *renderer, const SamplerStateID linearClamp, const BlendStateID blendSrcAlpha, const DepthStateID depthState, const float x0, const float y0, const float x1, const float y1, const float borderWidth, const float colScale, const float transScale){	if (corner == TEXTURE_NONE){		ubyte pixels[32][32][4];		for (int y = 0; y < 32; y++){			for (int x = 0; x < 32; x++){				int r = 255 - int(powf(sqrtf(float(x * x + y * y)) * (255.0f / 31.0f), 1.0f));				if (r < 0) r = 0;				pixels[y][x][0] = r;				pixels[y][x][1] = r;				pixels[y][x][2] = r;				pixels[y][x][3] = r;			}		}		Image img;		img.loadFromMemory(pixels, FORMAT_RGBA8, 32, 32, 1, 1, false);		corner = renderer->addTexture(img, false, linearClamp);	}	float x0bw = x0 + borderWidth;	float y0bw = y0 + borderWidth;	float x1bw = x1 - borderWidth;	float y1bw = y1 - borderWidth;	TexVertex border[] = {		TexVertex(vec2(x0,   y0bw), vec2(1, 0)),		TexVertex(vec2(x0,   y0  ), vec2(1, 1)),		TexVertex(vec2(x0bw, y0bw), vec2(0, 0)),		TexVertex(vec2(x0bw, y0  ), vec2(0, 1)),		TexVertex(vec2(x1bw, y0bw), vec2(0, 0)),		TexVertex(vec2(x1bw, y0  ), vec2(0, 1)),		TexVertex(vec2(x1bw, y0  ), vec2(0, 1)),		TexVertex(vec2(x1,   y0  ), vec2(1, 1)),		TexVertex(vec2(x1bw, y0bw), vec2(0, 0)),		TexVertex(vec2(x1,   y0bw), vec2(1, 0)),		TexVertex(vec2(x1bw, y1bw), vec2(0, 0)),		TexVertex(vec2(x1,   y1bw), vec2(1, 0)),		TexVertex(vec2(x1,   y1bw), vec2(1, 0)),		TexVertex(vec2(x1,   y1  ), vec2(1, 1)),		TexVertex(vec2(x1bw, y1bw), vec2(0, 0)),		TexVertex(vec2(x1bw, y1  ), vec2(0, 1)),		TexVertex(vec2(x0bw, y1bw), vec2(0, 0)),		TexVertex(vec2(x0bw, y1  ), vec2(0, 1)),		TexVertex(vec2(x0bw, y1  ), vec2(0, 1)),		TexVertex(vec2(x0,   y1  ), vec2(1, 1)),		TexVertex(vec2(x0bw, y1bw), vec2(0, 0)),		TexVertex(vec2(x0,   y1bw), vec2(1, 0)),		TexVertex(vec2(x0bw, y0bw), vec2(0, 0)),		TexVertex(vec2(x0,   y0bw), vec2(1, 0)),	};	vec4 col = color * vec4(colScale, colScale, colScale, transScale);	renderer->drawTextured(PRIM_TRIANGLE_STRIP, border, elementsOf(border), corner, linearClamp, blendSrcAlpha, depthState, &col);	// Center	vec2 center[] = { vec2(x0bw, y0bw), vec2(x1bw, y0bw), vec2(x0bw, y1bw), vec2(x1bw, y1bw) };	renderer->drawPlain(PRIM_TRIANGLE_STRIP, center, 4, blendSrcAlpha, depthState, &col);}
开发者ID:DanielNeander,项目名称:my-3d-engine,代码行数:62,


示例25: vec4

void RDirNode::updateFilesVBO(quadbuf& buffer, float dt) const{    if(in_frustum) {        for(std::list<RFile*>::const_iterator it = files.begin(); it!=files.end(); it++) {            RFile* f = *it;            if(f->isHidden()) continue;            vec3 col   = f->getColour();            float alpha = f->getAlpha();            buffer.add(f->graphic->textureid, f->getAbsolutePos() - f->dims*0.5f, f->dims, vec4(col.x, col.y, col.z, alpha));        }    }    for(std::list<RDirNode*>::const_iterator it = children.begin(); it != children.end(); it++) {        RDirNode* node = (*it);        node->updateFilesVBO(buffer,dt);    }}
开发者ID:stewartpark,项目名称:Gource,代码行数:21,


示例26: vec2

void CItems::RenderLaser(const struct CNetObj_Laser *pCurrent){	vec2 Pos = vec2(pCurrent->m_X, pCurrent->m_Y);	vec2 From = vec2(pCurrent->m_FromX, pCurrent->m_FromY);	vec2 Dir = normalize(Pos-From);	float Ticks = (Client()->GameTick() - pCurrent->m_StartTick) + Client()->IntraGameTick(); // H-Client (Vanilla #1157)	float Ms = (Ticks/50.0f) * 1000.0f;	float a = Ms / m_pClient->m_Tuning.m_LaserBounceDelay;	a = clamp(a, 0.0f, 1.0f);	float Ia = 1-a;	vec2 Out, Border;	Graphics()->BlendNormal();	Graphics()->TextureSet(-1);	Graphics()->QuadsBegin();	//vec4 inner_color(0.15f,0.35f,0.75f,1.0f);	//vec4 outer_color(0.65f,0.85f,1.0f,1.0f);    vec3 Rgb = HslToRgb(vec3(g_Config.m_hcLaserColorHue/255.0f, g_Config.m_hcLaserColorSat/255.0f, g_Config.m_hcLaserColorLht/255.0f)); //H-Client	// do outline	vec4 OuterColor(0.075f, 0.075f, 0.25f, 1.0f);	if (g_Config.m_hcLaserCustomColor)        OuterColor = vec4(Rgb.r+0.25f, Rgb.g+0.25f, Rgb.b-0.75f, g_Config.m_hcLaserColorAlpha/255.0f);	Graphics()->SetColor(OuterColor.r, OuterColor.g, OuterColor.b, 1.0f);	Out = vec2(Dir.y, -Dir.x) * (7.0f*Ia);	IGraphics::CFreeformItem Freeform(			From.x-Out.x, From.y-Out.y,			From.x+Out.x, From.y+Out.y,			Pos.x-Out.x, Pos.y-Out.y,			Pos.x+Out.x, Pos.y+Out.y);	Graphics()->QuadsDrawFreeform(&Freeform, 1);	// do inner	vec4 InnerColor(0.5f, 0.5f, 1.0f, 1.0f);	if (g_Config.m_hcLaserCustomColor)        InnerColor = vec4(Rgb.r, Rgb.g, Rgb.b, g_Config.m_hcLaserColorAlpha/255.0f);	Out = vec2(Dir.y, -Dir.x) * (5.0f*Ia);	Graphics()->SetColor(InnerColor.r, InnerColor.g, InnerColor.b, 1.0f); // center	Freeform = IGraphics::CFreeformItem(			From.x-Out.x, From.y-Out.y,			From.x+Out.x, From.y+Out.y,			Pos.x-Out.x, Pos.y-Out.y,			Pos.x+Out.x, Pos.y+Out.y);	Graphics()->QuadsDrawFreeform(&Freeform, 1);	Graphics()->QuadsEnd();    //H-Client    CServerInfo Info;    Client()->GetServerInfo(&Info);	if(g_Config.m_hcLaserCustomColor && !str_find_nocase(Info.m_aGameType, "race") && length(Pos-From) != 0 && Pos != From)	{	    vec2 cPos = From;        for (int i=0; i<length(From-Pos); i++)        {            m_pClient->m_pEffects->LaserTrail(cPos, Dir, InnerColor);            cPos += Dir;        }	}	//	// render head	{		Graphics()->BlendNormal();		Graphics()->TextureSet(g_pData->m_aImages[IMAGE_PARTICLES].m_Id);		Graphics()->QuadsBegin();		int Sprites[] = {SPRITE_PART_SPLAT01, SPRITE_PART_SPLAT02, SPRITE_PART_SPLAT03};		RenderTools()->SelectSprite(Sprites[Client()->GameTick()%3]);		Graphics()->QuadsSetRotation(Client()->GameTick());		Graphics()->SetColor(OuterColor.r, OuterColor.g, OuterColor.b, 1.0f);		IGraphics::CQuadItem QuadItem(Pos.x, Pos.y, 24, 24);		Graphics()->QuadsDraw(&QuadItem, 1);		Graphics()->SetColor(InnerColor.r, InnerColor.g, InnerColor.b, 1.0f);		QuadItem = IGraphics::CQuadItem(Pos.x, Pos.y, 20, 20);		Graphics()->QuadsDraw(&QuadItem, 1);		Graphics()->QuadsEnd();	}	Graphics()->BlendNormal();}
开发者ID:digideskio,项目名称:HClient,代码行数:87,


示例27: main

void main(void){																/n/	gl_FragColor=vec4((texture2D(tex,gl_TexCoord[0].st).xyz),1.0);				/n/}																				/n/
开发者ID:yluo1,项目名称:Liquidus,代码行数:3,


示例28: vec3

Our_Model::Our_Model(){	vertex_positions.push_back(vec4(-1, -1, 0, 1));	vertex_positions.push_back(vec4(1, -1, 0, 1));	vertex_positions.push_back(vec4(0, 0, 1, 1));	vertex_positions.push_back(vec4(1, -1, 0, 1));	vertex_positions.push_back(vec4(-0.77, 0.77, 0, 1));	vertex_positions.push_back(vec4(0, 0, 1, 1));	vertex_positions.push_back(vec4(-0.77, 0.77, 0, 1));	vertex_positions.push_back(vec4(-1, -1, 0, 1));	vertex_positions.push_back(vec4(0, 0, 1, 1));	vertex_positions.push_back(vec4(-0.77, 0.77, 0,1));	vertex_positions.push_back(vec4(1, -1, 0,1));	vertex_positions.push_back(vec4(-1, -1, 0,1));		normalsToVerticesGeneralForm.push_back(vec3(-1, -1, -0.2));	normalsToVerticesGeneralForm.push_back(vec3(1, -1, -0.2));	normalsToVerticesGeneralForm.push_back(vec3(0, 0, 0.8));	normalsToVerticesGeneralForm.push_back(vec3(1, -1, -0.2));	normalsToVerticesGeneralForm.push_back(vec3(-0.77, 0.77, -0.2));	normalsToVerticesGeneralForm.push_back(vec3(0, 0, 0.8));	normalsToVerticesGeneralForm.push_back(vec3(-0.77, 0.77, -0.2));	normalsToVerticesGeneralForm.push_back(vec3(-1, -1, -0.2));	normalsToVerticesGeneralForm.push_back(vec3(0, 0, 0.8));	normalsToVerticesGeneralForm.push_back(vec3(-0.77, 0.77, -0.2));	normalsToVerticesGeneralForm.push_back(vec3(1, -1, -0.2));	normalsToVerticesGeneralForm.push_back(vec3(-1, -1, -0.2));	//normalsToVerticesGeneralForm.push_back(vec3());	colors[0] = vec3(256, 0, 0);	colors[1] = vec3(0, 256, 0);	colors[2] = vec3(0, 0, 256);	colors[3] = vec3(256, 256, 256);	GLfloat minX=-1, minY=-1, minZ=0, maxX=1, maxY=0.77, maxZ=1;	cube[0] = vec4(minX, minY, minZ, 1.0);	cube[1] = vec4(minX, minY, maxZ, 1.0);	cube[2] = vec4(minX, maxY, minZ, 1.0);	cube[3] = vec4(minX, maxY, maxZ, 1.0);	cube[4] = vec4(maxX, minY, minZ, 1.0);	cube[5] = vec4(maxX, minY, maxZ, 1.0);	cube[6] = vec4(maxX, maxY, minZ, 1.0);	cube[7] = vec4(maxX, maxY, maxZ, 1.0);	computeNormalsPerFace();		massCenter = vec4(0, 0, 0.4, 1);}
开发者ID:dekel2003,项目名称:Graphics,代码行数:59,



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


C++ vec4f函数代码示例
C++ vec3f函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。