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


C++ Object3D类代码示例

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


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

示例1: Object3D

void Renderer::ImportObjFileCallback(string param)
{
	Object3D* obj = new Object3D(param);
	obj->glTranslate(ofGetWindowWidth()*0.5, ofGetWindowHeight()*0.5, 0);

	this->sceneStructure->AddElement(obj);
}
开发者ID:LordCatzorz,项目名称:IFT-3100-TP,代码行数:7,代码来源:Renderer.cpp

示例2: groupObjectComponents

		/**
		 * Method is used to group object components.
		 * @param	object is source object.
		 * @param	vertices is other object vertices.
		 * @pram	indices is other object indices.
		 * @param	faceStatus1 is face status.
		 * @param	faceStatus2 is face status.
		 */
		void GeoModifier::groupObjectComponents(Object3D& object, VertexSet& vertices, IntSet& indices, int faceStatus1, int faceStatus2)
		{
			//for each face..
			for(int i = 0; i < object.getNumFaces(); ++i)
			{
				Face& face = *(object.getFace(i));

				if(face.getStatus()==faceStatus1 || face.getStatus()==faceStatus2)
				{
					VertexPointerSet faceVerts;
					faceVerts.add(face.v1);
					faceVerts.add(face.v2);
					faceVerts.add(face.v3);

					for(int j=0;j<faceVerts.length();j++)
					{
						if(vertices.contains(faceVerts[j]))
							indices.push_back(vertices.indexOf(faceVerts[j]));
						else
						{
							indices.push_back(vertices.length());
							vertices.AddVertex(*faceVerts[j]);
						}
					}
				}
			}
		}
开发者ID:veldrinlab,项目名称:ayumiEngine,代码行数:35,代码来源:GeoModifier.cpp

示例3: addSineCosine

void addSineCosine()
{
    mat4 Model = translate(mat4(1.0f), vec3(0.0f, -10.0f, 0.0f));

    vec2 x[] =
    {
        vec2(-20.0f, -20.0f), vec2(-20.0f, 20.0f), vec2(20.0f, 20.0f),
        vec2(-20.0f, -20.0f), vec2(20.0f, 20.0f), vec2(20.0f, -20.0f)
    };
    Mesh *mesh = new Mesh();
    FunctionGraph graph(new SineCosine());
    graph.generateGraph(x, 7, -1000.0f, mesh);
    graph.generateGraph(x+3, 7, -1000.0f, mesh);

    mesh->setOrientation(GL_CCW);
    mesh->applyIndexing();
    mesh->makeUpUVData();

    const Material mat(vec4(1.0f, 0.2f, 0.2f, 1.0f), vec4(0.1f, 0.1f, 0.1f, 1.0f), vec4(0.7f, 0.7f, 0.7f, 1.0f), 128.0f);

    Object3D *obj = new Object3D(mesh, mat);
    obj->setModelMatrix(Model);
    junk.push_back(obj);
    Engine::addToDisplayList(junk.back());

    //Engine::addToDisplayList(new NormalDrawer(*mesh, Model));
}
开发者ID:Aloalo,项目名称:RenderingEngine,代码行数:27,代码来源:Tester.cpp

示例4: UpdateObjectValues

void GraphicsCore::UpdateObjectValues(Object3D object)
{
	vec3 up(0.0f, 1.0f, 0.0f);
	
    mat4 Projection = glm::perspective(fov, float(windowWidth) / (float)windowHeight, 0.1f, 200.f); 	
    mat4 Model = glm::translate(object.GetWorldPos());
	mat4 viewMatrix = mCam.GetRotationMatrix() * glm::lookAt(mEye, mTarget, up);
    mat4 ModelView =  viewMatrix * Model;   	
    mat4 MVP = Projection * ModelView;

	mat3 normalMatrix = glm::transpose(glm::inverse(mat3(ModelView)));
	
	uint shaderProgHandle = object.GetShaderID();

	uint location = glGetUniformLocation(shaderProgHandle, "NormalMatrix");	//gets the UniformLocation from shader.vertex
	if( location >= 0 ){ glUniformMatrix3fv(location, 1, GL_FALSE, &normalMatrix[0][0]); }

		location = glGetUniformLocation(shaderProgHandle, "ProjectionMatrix");	//gets the UniformLocation from shader.vertex
	if( location >= 0 ){ glUniformMatrix4fv(location, 1, GL_FALSE, &Projection[0][0]); }

	location = glGetUniformLocation(shaderProgHandle, "ViewMatrix");	//gets the UniformLocation from shader.vertex
	if( location >= 0 ){ glUniformMatrix4fv(location, 1, GL_FALSE, &viewMatrix[0][0]); }

	location = glGetUniformLocation(shaderProgHandle, "ModelViewMatrix");	//gets the UniformLocation from shader.vertex
	if( location >= 0 ){ glUniformMatrix4fv(location, 1, GL_FALSE, &ModelView[0][0]); }

	location = glGetUniformLocation(shaderProgHandle, "MVP");	//gets the UniformLocation from shader.vertex
	if( location >= 0 ){ glUniformMatrix4fv(location, 1, GL_FALSE, &MVP[0][0]); }

}
开发者ID:TeamGLPacman,项目名称:Pacman,代码行数:30,代码来源:GraphicsCore.cpp

示例5: resetTransformation

void DualQuaternionTransformationTest::resetTransformation() {
    Object3D o;
    o.setTransformation(DualQuaternion::rotation(Deg(17.0f), Vector3::xAxis()));
    CORRADE_VERIFY(o.transformationMatrix() != Matrix4());
    o.resetTransformation();
    CORRADE_COMPARE(o.transformationMatrix(), Matrix4());
}
开发者ID:matheboy,项目名称:magnum,代码行数:7,代码来源:DualQuaternionTransformationTest.cpp

示例6: transformation

void SceneTest::transformation() {
    Scene3D scene;

    Object3D* scenePointer = &scene;
    scenePointer->setTransformation(Matrix4::translation({1.0f, 1.0f, 1.0f}));
    CORRADE_COMPARE(scene.transformation(), Matrix4());
}
开发者ID:Ali-Wassouf,项目名称:magnum,代码行数:7,代码来源:SceneTest.cpp

示例7:

void RigidMatrixTransformation3DTest::resetTransformation() {
    Object3D o;
    o.setTransformation(Matrix4::rotationX(Deg(17.0f)));
    CORRADE_VERIFY(o.transformationMatrix() != Matrix4());
    o.resetTransformation();
    CORRADE_COMPARE(o.transformationMatrix(), Matrix4());
}
开发者ID:NextGenIntelligence,项目名称:magnum,代码行数:7,代码来源:RigidMatrixTransformation3DTest.cpp

示例8: visit

 virtual void visit(Object3D &theNode)
 {
     if(theNode.enabled() || !visit_only_enabled())
     {
         m_transform_stack.push(m_transform_stack.top() * theNode.transform());
         for (Object3DPtr &child : theNode.children()){child->accept(*this);}
         m_transform_stack.pop();
     }
 }
开发者ID:,项目名称:,代码行数:9,代码来源:

示例9: normal

Vector3 CSGUnionIntersection::normal() {

    Vector3 local = iheap.intersection()->normal();

    Object3D* oc = static_cast<Object3D*>( iheap.object() );
    oc->transformNormalOut(local);

    return local;

}
开发者ID:iquadrat,项目名称:raytracer,代码行数:10,代码来源:csg.cpp

示例10: parent

void SceneTest::parent() {
    Scene3D scene;

    /* Scene parent cannot be changed */
    Object3D* scenePointer = &scene;
    Object3D object;
    scenePointer->setParent(&object);
    CORRADE_VERIFY(scene.parent() == nullptr);
    CORRADE_VERIFY(scene.children().isEmpty());
    CORRADE_VERIFY(object.children().isEmpty());
}
开发者ID:Ali-Wassouf,项目名称:magnum,代码行数:11,代码来源:SceneTest.cpp

示例11: init

void Accelerator::init(const vector<Object3D*>& geometry, const vector<const Plane*>& scene_planes)
{
  for(unsigned int i = 0; i < geometry.size(); ++i)
  {
    Object3D* obj = geometry[i];
    unsigned int no_of_prims = primitives.size();
    primitives.resize(no_of_prims + obj->get_no_of_primitives());
    for(unsigned int j = 0; j < obj->get_no_of_primitives(); ++j)
      primitives[j + no_of_prims] = new AccObj(obj, j);
  }
  planes = scene_planes;
}
开发者ID:nical,项目名称:DTU-school-projetcs,代码行数:12,代码来源:Accelerator.cpp

示例12: QObject

Object3D::Object3D(const Object3D& obj)
    : QObject(obj.parent()), m_center(obj.center()),
      m_translation(obj.translation()), m_rotations(obj.rotations()),
      m_interactiveQuartenion(obj.interactiveQuartenion()),
      m_slices(obj.slices()), m_stacks(obj.stacks()),
      m_texture(obj.texture()), m_inputType(obj.inputType())

{
}
开发者ID:ethiago,项目名称:triquadgl,代码行数:9,代码来源:Object3D.cpp

示例13: DrawObject3DAmbient

void DrawObject3DAmbient ( std::string name, vec2 centre, float scale, float angle, float bank )
{
	Object3D* obj = GetObject3D(name);
	EnableTexturing();
	DisableBlending();
	obj->BindTextures();
	//glUniform3f(UniformLocation("Ambient"), ambient.red(), ambient.green(), ambient.blue());
	SetShader("3DBase");
	glUniform1f(UniformLocation("specularScale"), obj->SpecularScale());
	glUniform1f(UniformLocation("shininess"), obj->Shininess());
	Matrices::SetViewMatrix(matrix2x3::Translate(centre));
	obj->Draw(scale, angle, bank);
}
开发者ID:prophile,项目名称:xsera,代码行数:13,代码来源:Graphics.cpp

示例14: assert

Intersection* CSGIntersect::intersectLocalLimitedTime(const Ray &shoot, DBL tmax) const {

    assert(isclosed);
    stat.eval();
    CSGIntersectIntersection* i = 0;

    // fill Array with initial values
    for(unsigned int j=0; j<objects->listsize; j++) {

        Object3D* current = static_cast<Object3D*>(objects->list[j]);
        
        double t;
        if ( (t=current->intersectBounding(shoot,tmax))!=INTERSECTION_TIME_EPSILON ) {

            if (t > INTERSECTION_TIME_EPSILON) {
                // boundingbox hit
                if (i == 0)  i = new CSGIntersectIntersection(this,shoot,tmax);
                i->put(0,t,current);
                continue;
            }

        } else {

            // there is no boundingbox or we are inside
            Intersection* ci = current->intersectLimitedTime(shoot,tmax);

            if (ci) {
                if (i == 0)  i = new CSGIntersectIntersection(this,shoot,tmax);
                i->put(ci,ci->currentTime(),current);
                continue;
            }

        }

        // no intersection with that object, test if we are inside
        Vector3 testpoint = Vector3::add( shoot.getOrigin(), shoot.getDirection() );
        if (static_cast<const Object3D*>(current)->isInsideAtBounded(testpoint)==false) {delete(i); return 0;}
        
    }

    if (i) {
        // build up structure 
        if (i->init() == false) {delete(i); return 0;}
        stat.success();
    }
    
    return i;

}
开发者ID:iquadrat,项目名称:raytracer,代码行数:49,代码来源:csg.cpp

示例15: UpdateLightValues

//temporary function
void GraphicsCore::UpdateLightValues(Object3D object)
{
	//lightinfos
	vec3 ambient = vec3(0.4, 0.4, 0.4);

	//material
	vec3 ambientRefl = vec3(1.0f, 1.0f, 1.0f);	
	vec3 diffuseRefl = vec3(0.9f, 0.9f, 0.9f);	
	vec3 specularRefl = vec3(0.4f, 0.4f, 0.4f);
	float shininess = 2.0;

	uint shaderProgHandle = object.GetShaderID();
	
	uint location = glGetUniformLocation(shaderProgHandle, "Light.La");	//gets the UniformLocation from shader.vertex
	glUniform3fv(location, 1, &ambient[0]);

	//-------------------
	location = glGetUniformLocation(shaderProgHandle, "Material.Ka");	//gets the UniformLocation from shader.vertex
	glUniform3fv(location, 1, &ambientRefl[0]);

	location = glGetUniformLocation(shaderProgHandle, "Material.Kd");	//gets the UniformLocation from shader.vertex
	glUniform3fv(location, 1, &diffuseRefl[0]);

	location = glGetUniformLocation(shaderProgHandle, "Material.Ks");	//gets the UniformLocation from shader.vertex
	glUniform3fv(location, 1, &specularRefl[0]);

	location = glGetUniformLocation(shaderProgHandle, "Material.Shininess");	//gets the UniformLocation from shader.vertex
	glUniform1fv(location, 1, &shininess);
	
}
开发者ID:TeamGLPacman,项目名称:Pacman,代码行数:31,代码来源:GraphicsCore.cpp


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