本文整理汇总了C++中TransformComponent::setPos方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformComponent::setPos方法的具体用法?C++ TransformComponent::setPos怎么用?C++ TransformComponent::setPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransformComponent
的用法示例。
在下文中一共展示了TransformComponent::setPos方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addMap
Actor* addMap()
{
Actor* sphere = new Actor;
TransformComponent* trans = new TransformComponent();
trans->setPos(vec3(0, -0.01, 0));
Rotation rot;
rot.setEulerAngles(vec3(0, 0.785, 0));
trans->setRotation(rot);
sphere->addComponent(trans);
glDebug();
sphere->addComponent(new StaticMeshStaticPhysicsComponent(AssetManager::getBasePath() + "Data/Model/mappa4.obj"));
glDebug();
MeshGraphicComponent* mesh = new MeshGraphicComponent(AssetManager::getBasePath() + "Data/Model/mappa4.obj");
glDebug();
mesh->setTextureMatrix(mat2(scale(mat4(1), vec3(10))));
glDebug();
Material *mat = new Material();
glDebug();
mat->setDiffuse(AssetManager::getBasePath() + "Data/Texture/floor1_d.png");
mat->setNormal(AssetManager::getBasePath() + "Data/Texture/floor1_n.png");
mat->setSpecular(AssetManager::getBasePath() + "Data/Texture/floor1_s.png");
mat->setShininess(20);
glDebug();
mesh->addMaterial(mat);
glDebug();
sphere->addComponent(mesh);
glDebug();
return sphere;
}
示例2: TransformComponent
Actor* addAxis3()
{
Actor* actor = new Actor;
TransformComponent* trans = new TransformComponent();
trans->setPos(vec3(-5, 0, 5));
Rotation rot;
rot.setNormalDirection(vec3(1, 0, 0));
trans->setRotation(rot);
actor->addComponent(trans);
MeshGraphicComponent* mesh = new MeshGraphicComponent(AssetManager::getBasePath() + "Data/Model/axis.obj");
Material *mat = new Material();
mat->setDiffuse("#FF0000");
mesh->addMaterial(mat);
Material *mat1 = new Material();
mat1->setDiffuse("#00FF00");
mesh->addMaterial(mat1);
mesh->addMaterial(mat1);
Material *mat2 = new Material();
mat2->setDiffuse("#0000FF");
mesh->addMaterial(mat2);
actor->addComponent(mesh);
return actor;
}
示例3: addModel
Actor* addModel(string filename, vec3 pos = vec3(0), vec3 s = vec3(1))
{
Actor* sphere = new Actor;
TransformComponent* trans = new TransformComponent();
trans->setPos(pos);
trans->setScale(s);
sphere->addComponent(trans);
glDebug();
sphere->addComponent(new StaticMeshStaticPhysicsComponent(AssetManager::getBasePath() + filename));
glDebug();
MeshGraphicComponent* mesh = new MeshGraphicComponent(AssetManager::getBasePath() + filename);
glDebug();
mesh->setTextureMatrix(mat2(scale(mat4(1), vec3(10))));
glDebug();
Material *mat = new Material();
glDebug();
mat->setDiffuse(AssetManager::getBasePath() + "Data/Texture/floor1_d.png");
mat->setNormal(AssetManager::getBasePath() + "Data/Texture/floor1_n.png");
mat->setSpecular(AssetManager::getBasePath() + "Data/Texture/floor1_s.png");
mat->setShininess(20);
glDebug();
mesh->addMaterial(mat);
glDebug();
sphere->addComponent(mesh);
glDebug();
return sphere;
}
示例4: addSun
Actor* addSun(Scene *scene)
{
Actor* actor = new Actor;
TransformComponent* trans = new TransformComponent();
trans->setPos(vec3(0, 20, 0));
Rotation rot;
actor->addComponent(trans);
LightComponent* l = new DirectionalLightComponent();
l->setDirectional(1);
l->dir = normalize(vec3(0.5, 1, 0.2));
actor->addComponent(l);
scene->systemManager->getSystem(StringHash("GenericSystem").getHash())->addComponent(l);
scene->addActor(actor);
return actor;
}
示例5: addParticleSystem
Actor* addParticleSystem(Scene *scene, ParticleSystem* ps, vec3 pos)
{
Actor* actor = new Actor;
TransformComponent* trans = new TransformComponent();
trans->setPos(pos);
Rotation rot;
actor->addComponent(trans);
ActorComponent *c = ps;
ps->setup();
scene->systemManager->getSystem(StringHash("GenericSystem").getHash())->addComponent(c);
actor->addComponent(c);
scene->addActor(actor);
return actor;
}
示例6: addSphereLight
Actor* addSphereLight()
{
Actor* sphere = new Actor;
SphereGraphicComponent* comp = new SphereGraphicComponent();
TransformComponent* trans = new TransformComponent();
trans->setPos(vec3(0, 10, 0));
sphere->addComponent(trans);
sphere->addComponent(comp);
SpherePhysicsComponent *p = new SpherePhysicsComponent(1);
p->setMass(1);
sphere->addComponent(p);
LightComponent* l = new LightComponent();
sphere->addComponent(l);
return sphere;
}
示例7: addLucy
Actor* addLucy(Scene* scene)
{
string tex[] = {"#666666", "#666667", "#666668", "#666669"};
for(int i = 0; i < 5; i++) {
Actor* sphere = new Actor;
vec3 pos(i * 3, 0, -25);
TransformComponent* trans = new TransformComponent();
trans->setScale(vec3(0.2));
trans->setPos(pos);
sphere->addComponent(trans);
glDebug();
sphere->addComponent(new SpherePhysicsComponent(1));
glDebug();
MeshGraphicComponent* mesh = new MeshGraphicComponent(AssetManager::getBasePath() + "Data/Model/lucy_low.obj");
glDebug();
mesh->setTextureMatrix(mat2(scale(mat4(1), vec3(10))));
glDebug();
Material *mat = new Material();
glDebug();
if(i) {
mat->setDiffuse(tex[i - 1]);
mat->setShininess(i * i * i * i);
} else {
mat->setDiffuse(AssetManager::getBasePath() + "Data/Texture/floor1_d.png");
mat->setNormal(AssetManager::getBasePath() + "Data/Texture/floor1_n.png");
mat->setSpecular(AssetManager::getBasePath() + "Data/Texture/floor1_s.png");
mat->setShininess(20);
}
glDebug();
mesh->addMaterial(mat);
glDebug();
sphere->addComponent(mesh);
glDebug();
scene->addActor(sphere);
}
return 0;
}
示例8: addMainActor
Actor* addMainActor(Scene *scene)
{
Actor* actor = new Actor;
TransformComponent* trans = new TransformComponent();
actor->addComponent(trans);
CameraComponent* cam = new CameraComponent();
actor->addComponent(cam);
actor->addComponent(new MyCharacterDynamicPhysicsComponent());
PlayerAnimationManagerComponent *anim = new PlayerAnimationManagerComponent();
actor->addComponent(anim);
trans->setLocalPos(ComponentId::Render, vec3(0, -0.4, 0));
trans->setPos(vec3(0, 5, 0.5));
trans->setLocalPos(ComponentId::Light, vec3(0, 3, 0));
trans->setLocalScale(ComponentId::Render, vec3(0.017));
SkeletalMeshGraphicComponent * mesh = new SkeletalMeshGraphicComponent(AssetManager::getBasePath() + "Data/Model/mixamoWalkBlender.dae");
mesh->velocity = 1.4;
Material *mat = new Material();
mat->setDiffuse(AssetManager::getBasePath() + "Data/Texture/default.png");
mat->setShininess(200);
mesh->addMaterial(mat);
actor->addComponent(mesh);
scene->systemManager->getSystem(StringHash("GenericSystem").getHash())->addComponent(cam);
scene->systemManager->getSystem(StringHash("GenericSystem").getHash())->addComponent(mesh);
scene->addActor(actor);
return actor;
}