本文整理汇总了C++中TestScene类的典型用法代码示例。如果您正苦于以下问题:C++ TestScene类的具体用法?C++ TestScene怎么用?C++ TestScene使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestScene类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: WinMain
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
#endif
{
// Initialize the environment.
DMAPP_INIT();
// Configuration
DMAPP.GetConfig()->SetFullScreen(false);
DMAPP.GetConfig()->SetShowMouse();
// Initialize the app
DMAPP.Initialize();
// Create a scene and show it.
TestScene* s = new TestScene();
s->Initialize();
DMSCENE.AddScene("test", s);
DMSCENE.SetCurrentScene("test");
// Start game.
DMAPP.Start();
// Shutdown after gaming.
DMAPP.Shutdown();
// You should clear scene before all cleaned.
DMSCENE.ClearScenes();
return 0;
}
开发者ID:XadillaX,项目名称:DMGameEngine,代码行数:30,代码来源:main.cpp
示例2: main
int main(int argc, char **argv) {
TestScene *scene = new TestScene(argc, argv, std::min(1, argc - 1));
options.parse(argc, argv);
size_t count = 0;
carve::input::Input inputs;
std::vector<carve::poly::Polyhedron *> polys;
std::vector<carve::line::PolylineSet *> lines;
std::vector<carve::point::PointSet *> points;
// Test polyhedron
carve::poly::Polyhedron *test1 = makeCube(-1,-1,-1,1,1,1);
carve::poly::Polyhedron *test2 = makeCube(0,0,0,2,2,2);
polys.push_back(test1);
polys.push_back(test2);
carve::csg::CSG testt;
carve::poly::Polyhedron *test3 = testt.compute(test1, test2, carve::csg::CSG::INTERSECTION);
polys.push_back(test3);
scene->draw_list_base = genSceneDisplayList(polys, lines, points, &count, scene->is_wireframe);
scene->draw_flags.assign(count, true);
scene->run();
delete scene;
return 0;
}
开发者ID:pigoblock,项目名称:TFYP,代码行数:32,代码来源:view.cpp
示例3: main
int main(int argc, char **argv) {
carve::poly::Polyhedron *input = readPLY(argv[1]);
double offset = strtod(argv[2], NULL);
TestScene *scene = new TestScene(argc, argv, 3);
glNewList(scene->draw_list_base, GL_COMPILE);
doOffset(input, offset);
glEndList();
glNewList(scene->draw_list_base + 1, GL_COMPILE);
drawPolyhedron(input, .6, .6, .6, 1.0, false);
glEndList();
glNewList(scene->draw_list_base + 2, GL_COMPILE);
drawPolyhedronWireframe(input);
glEndList();
scene->draw_flags[0] = true;
scene->draw_flags[1] = true;
scene->draw_flags[2] = true;
scene->run();
delete scene;
return 0;
}
开发者ID:dbc,项目名称:pyPolyCSG,代码行数:28,代码来源:offset.cpp
示例4: scene
cocos2d::CCScene* CocoStudioAnimationTest::scene()
{
TestScene* scene = TestScene::create();
CocoStudioAnimationTest* layer = CocoStudioAnimationTest::create();
scene->addChild(layer);
return scene;
}
开发者ID:LiYuandong,项目名称:Cocos2dxTestProject,代码行数:7,代码来源:CocoStudioAnimationTest.cpp
示例5: scene
cocos2d::CCScene* PixelSpriteTest::scene()
{
TestScene* scene = TestScene::create();
PixelSpriteTest* layer = PixelSpriteTest::create();
scene->addChild(layer);
return scene;
}
开发者ID:LiYuandong,项目名称:Cocos2dxTestProject,代码行数:7,代码来源:PixelSpriteTest.cpp
示例6: TestScene
TestScene *TestScene::create(const Size3D &size)
{
TestScene *scene = new TestScene();
if(scene->initWithSize(size)){
return scene;
}
delete scene;
return NULL;
}
开发者ID:rocket99,项目名称:PEEngine,代码行数:9,代码来源:TestScene.cpp
示例7: switch
void ExtensionsMainLayer::menuCallback(CCObject* pSender)
{
CCMenuItemFont* pItem = (CCMenuItemFont*)pSender;
int nIndex = pItem->getZOrder() - kItemTagBasic;
switch (nIndex)
{
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE) // MARMALADE CHANGE: Not yet avaiable on Marmalade
case TEST_NOTIFICATIONCENTER:
{
runNotificationCenterTest();
}
break;
#endif
case TEST_CCCONTROLBUTTON:
{
CCControlSceneManager* pManager = CCControlSceneManager::sharedControlSceneManager();
CCScene* pScene = pManager->currentControlScene();
CCDirector::sharedDirector()->replaceScene(pScene);
}
break;
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE) // MARMALADE CHANGE: Not yet avaiable on Marmalade
case TEST_COCOSBUILDER:
{
TestScene* pScene = new CocosBuilderTestScene();
if (pScene)
{
pScene->runThisTest();
pScene->release();
}
}
break;
#endif
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE) // MARMALADE CHANGE: Not yet avaiable on Marmalade
case TEST_HTTPCLIENT:
{
runHttpClientTest();
}
break;
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
case TEST_EDITBOX:
{
runEditBoxTest();
}
break;
#endif
case TEST_TABLEVIEW:
{
runTableViewTest();
}
break;
default:
break;
}
}
开发者ID:PavolSatala,项目名称:cocos2d-x,代码行数:56,代码来源:ExtensionsTest.cpp
示例8: TestScene
TestScene* TestScene::Create()
{
TestScene* ts = new TestScene();
ts->AutoRelease();
if (!ts->Init())
{
return NULL;
}
return ts;
}
开发者ID:tcye,项目名称:D3DEngine,代码行数:10,代码来源:TestScene.cpp
示例9: new
TestScene* TestScene::createWithPhysics()
{
TestScene *ret = new (std::nothrow) TestScene();
if (ret && ret->initWithPhysics())
{
ret->autorelease();
return ret;
}
else
{
CC_SAFE_DELETE(ret);
return nullptr;
}
}
开发者ID:Totolin,项目名称:cultus-cocos2d,代码行数:14,代码来源:TestScene.cpp
示例10: menuCallback
void TestController::menuCallback(Object * pSender)
{
Director::sharedDirector()->purgeCachedData();
// get the userdata, it's the index of the menu item clicked
MenuItem* pMenuItem = (MenuItem *)(pSender);
int idx = pMenuItem->getZOrder() - 10000;
// create the test scene and run it
TestScene* pScene = g_aTestNames[idx].callback();
if (pScene)
{
pScene->runThisTest();
pScene->release();
}
}
开发者ID:bassarisse,项目名称:LostInCaves,代码行数:18,代码来源:controller.cpp
示例11: switch
void ExtensionsMainLayer::menuCallback(CCObject* pSender)
{
CCMenuItemFont* pItem = (CCMenuItemFont*)pSender;
int nIndex = pItem->getZOrder() - kItemTagBasic;
switch (nIndex)
{
case TEST_NOTIFICATIONCENTER:
{
runNotificationCenterTest();
}
break;
case TEST_CCCONTROLBUTTON:
{
CCControlSceneManager* pManager = CCControlSceneManager::sharedControlSceneManager();
CCScene* pScene = pManager->currentControlScene();
CCDirector::sharedDirector()->replaceScene(pScene);
}
break;
case TEST_TEXTUREWATCHER:
{
static bool s_bOpened = false;
s_bOpened = !s_bOpened;
CCTextureWatcher::sharedTextureWatcher()->setDisplayWatcher(s_bOpened);
}
break;
case TEST_COCOSBUILDER:
{
TestScene* pScene = new CocosBuilderTestScene();
if (pScene)
{
pScene->runThisTest();
pScene->release();
}
}
break;
default:
break;
}
}
开发者ID:haiweizhang,项目名称:MyCocos2d-xV2.0,代码行数:40,代码来源:ExtensionsTest.cpp
示例12: create
Scene* TestScene::create()
{
TestScene* scene = TestScene::createWithPhysics();
scene->getPhysicsWorld()->setGravity(Vect(0.0f, -700.0f));
scene->getPhysicsWorld()->setDebugDrawMask(PhysicsWorld::DEBUGDRAW_ALL);
scene->scheduleUpdate();
Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
PhysicsBody* edgeBody = PhysicsBody::createEdgeBox(visibleSize, PhysicsMaterial(0.1f, 0.0f, 0.5f), 3);
Node* edgeNode = Node::create();
edgeNode->setPosition(Point(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y));
edgeNode->setPhysicsBody(edgeBody);
scene->addChild(edgeNode);
Player* sprite = Player::create();
sprite->setPosition(Point(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y));
/*Sprite* sprite = Sprite::create("testSprite.png");
sprite->setPosition(Point(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y));
MyBodyParser::getInstance()->parseJsonFile("test.json");
auto spriteBody = MyBodyParser::getInstance()->bodyFormJson(sprite, "Test", PhysicsMaterial(1, 1, 0));
if (spriteBody != nullptr)
{
spriteBody->setDynamic(true);
sprite->setPhysicsBody(spriteBody);
}*/
scene->addChild(sprite);
return scene;
}
开发者ID:Totolin,项目名称:cultus-cocos2d,代码行数:44,代码来源:TestScene.cpp
示例13: main
int main(int argc, char **argv) {
TestScene *scene = new TestScene(argc, argv, 2);
GLuint tex_1 = initTexture(128, 128, carve_texture);
GLuint tex_2 = initTexture(128, 128, brick_texture);
GLuint tex_3 = initTexture(128, 128, leaf_texture);
g_scale = 10.0;
carve::interpolate::FaceVertexAttr<tex_t> fv_tex;
carve::interpolate::FaceAttr<GLuint> f_tex_num;
carve::mesh::MeshSet<3> *base = NULL;
bool b = true;
for (int x = -10; x <= +10; x += 5) {
for (int y = -10; y <= +10; y += 5) {
for (int z = -10; z <= +10; z += 5) {
double rot = x * .17 + y * .06 + z * .09;
carve::mesh::MeshSet<3> *r = texturedCube(fv_tex, f_tex_num, b ? tex_2 : tex_3,
carve::math::Matrix::TRANS(x/2.5, y/2.5, z/2.5) *
carve::math::Matrix::ROT(rot, 1,2,3));
b = !b;
if (base) {
carve::mesh::MeshSet<3> *temp = base;
carve::csg::CSG csg;
fv_tex.installHooks(csg);
f_tex_num.installHooks(csg);
base = csg.compute(temp, r, carve::csg::CSG::UNION);
delete temp;
delete r;
} else {
base = r;
}
}
}
}
carve::mesh::MeshSet<3> *r1 = texturedCube(fv_tex, f_tex_num, tex_1,
carve::math::Matrix::TRANS(0,0,4) *
carve::math::Matrix::SCALE(4,4,4));
carve::mesh::MeshSet<3> *r2 = texturedCube(fv_tex, f_tex_num, tex_1,
carve::math::Matrix::TRANS(0,0,5) *
carve::math::Matrix::SCALE(2, 2, 2));
carve::csg::CSG csg;
fv_tex.installHooks(csg);
f_tex_num.installHooks(csg);
carve::mesh::MeshSet<3> *r3 = csg.compute(base, r1, carve::csg::CSG::INTERSECTION, NULL, carve::csg::CSG::CLASSIFY_EDGE);
carve::mesh::MeshSet<3> *r4 = csg.compute(r3, r2, carve::csg::CSG::UNION, NULL, carve::csg::CSG::CLASSIFY_EDGE);
glNewList(scene->draw_list_base, GL_COMPILE);
drawTexturedPolyhedron(r4, fv_tex, f_tex_num);
glEndList();
glNewList(scene->draw_list_base+1, GL_COMPILE);
drawWireframePolyhedron(r3);
glEndList();
scene->draw_flags[0] = true;
scene->draw_flags[1] = true;
scene->run();
destroyTexture(tex_1);
destroyTexture(tex_2);
destroyTexture(tex_3);
delete scene;
return 0;
}
开发者ID:ManojRollo,项目名称:carve,代码行数:74,代码来源:texture_example.cpp
示例14: main
int main(int argc, char **argv) {
carve::mesh::MeshSet<3> *a = makeCube(carve::math::Matrix::ROT(1.0, 1.0, 1.0, 1.0));
std::vector<carve::mesh::MeshSet<3>::vertex_t> shape;
for (int i = 0; i < POINTS; ++i) {
double r = 2.0 + .4 * sin(i * 3 * M_TWOPI / POINTS) + .8 * sin(i * 5 * M_TWOPI / POINTS);
shape.push_back(carve::mesh::MeshSet<3>::vertex_t(carve::geom::VECTOR(r * cos(i * M_TWOPI / POINTS), r * sin(i * M_TWOPI / POINTS), 0.0)));
}
std::vector<carve::mesh::MeshSet<3>::vertex_t *> face_verts;
for (int i = 0; i < POINTS; ++i) {
face_verts.push_back(&shape[i]);
}
std::vector<carve::mesh::MeshSet<3>::face_t *> faces;
faces.push_back(new carve::mesh::MeshSet<3>::face_t(face_verts.begin(), face_verts.end()));
carve::mesh::MeshSet<3> *b = new carve::mesh::MeshSet<3>(faces);
std::list<std::pair<carve::csg::FaceClass, carve::mesh::MeshSet<3> *> > b_sliced;
carve::csg::CSG csg;
csg.hooks.registerHook(new carve::csg::CarveTriangulator, carve::csg::CSG::Hooks::PROCESS_OUTPUT_FACE_BIT);
csg.sliceAndClassify(a, b, b_sliced);
TestScene *scene = new TestScene(argc, argv, 6);
glNewList(scene->draw_list_base + 0, GL_COMPILE);
drawMeshSet(a, .4, .6, .8, 1.0);
glEndList();
glNewList(scene->draw_list_base + 1, GL_COMPILE);
drawMeshSet(b, .8, .6, .4, 1.0);
glEndList();
glNewList(scene->draw_list_base + 2, GL_COMPILE);
{
int n = 0;
for (std::list<std::pair<carve::csg::FaceClass, carve::mesh::MeshSet<3> *> >::iterator i = b_sliced.begin(); i != b_sliced.end(); ++i) {
float r, g, b;
switch ((*i).first) {
case carve::csg::FACE_IN: r = 0.0; g = 0.0; b = 1.0; break;
case carve::csg::FACE_OUT: r = 1.0; g = 0.0; b = 0.0; break;
case carve::csg::FACE_ON_ORIENT_OUT: r = 1.0; g = 1.0; b = 0.0; break;
case carve::csg::FACE_ON_ORIENT_IN: r = 0.0; g = 1.0; b = 1.0; break;
}
drawMeshSet((*i).second, r, g, b, 1.0);
++n;
}
}
glEndList();
glNewList(scene->draw_list_base + 3, GL_COMPILE);
{
int n = 0;
for (std::list<std::pair<carve::csg::FaceClass, carve::mesh::MeshSet<3> *> >::iterator i = b_sliced.begin(); i != b_sliced.end(); ++i) {
float r, g, b;
switch ((*i).first) {
case carve::csg::FACE_IN: r = 0.3; g = 0.3; b = 0.7; break;
case carve::csg::FACE_OUT: r = 0.7; g = 0.3; b = 0.3; break;
case carve::csg::FACE_ON_ORIENT_OUT: r = 0.7; g = 0.7; b = 0.3; break;
case carve::csg::FACE_ON_ORIENT_IN: r = 0.3; g = 0.7; b = 0.7; break;
}
drawMeshSetWireframe((*i).second, -1, false, false);
++n;
}
}
glEndList();
scene->run();
delete scene;
return 0;
}
开发者ID:ManojRollo,项目名称:carve,代码行数:76,代码来源:test_slice_classify.cpp
示例15: warning
#include <vector>
#ifdef _MSC_VER
#pragma warning(push, 0)
#include <catch.hpp>
#pragma warning(pop)
#else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wall"
#include <catch.hpp>
#pragma GCC diagnostic pop
#endif
TEST_CASE("DetourPipelineTest/Pipeline", "Tests about the pipeline behavior")
{
TestScene ts;
dtCrowd* crowd = ts.createSquareScene(20, 0.5);
REQUIRE(crowd != 0);
dtPipelineBehavior* pipeline = dtPipelineBehavior::allocate();
float posAgt1[] = {0, 0.2f, 0};
float destAgt1[] = {15, 0, 0};
dtCrowdAgent ag;
// Adding the agents to the crowd
REQUIRE(crowd->addAgent(ag, posAgt1));
ts.defaultInitializeAgent(*crowd, ag.id);
开发者ID:LEgregius,项目名称:recastdetour,代码行数:30,代码来源:DetourPipelineTest.cpp
示例16: WinMain
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
XEngine *engine = XEngine::GetInstance();
if( engine->Init(hInstance) == FALSE )
{
return -1;
}
Rect rec(Position(-10000.0, 10000.0), Position(10000.0, -10000.0));
TestScene *scene = new TestScene;
scene->SetTime(0);
//Scene *scene = new Scene;
scene->Init(rec);
scene->camera->MoveForwardBy(-40);
scene->camera->MoveUpBy(18);
scene->camera->Pitch(-XM_PI / 10);
Material material;
material.ambient = XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
material.diffuse = XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
material.specular = XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
material.power = 9.0f;
//material.texture = SRVBatch::GetInstance()->LoadSRV("media/", "cup.jpg");
Particle *fire = new Particle;
fire->Init("media/","fire.png");
fire->SetPosition(0, 0, 10);
//scene->AddRenderableThing(*fire);
SkyBox *sky = new SkyBox;
//sky->Init("textures/", "skymap.dds");
sky->Init("textures/", "Above_The_Sea.dds");
//sky->Init("textures/", "desert_skymap.dds");
scene->AddSky(sky);
Terrain *terrain = new Terrain;
//terrain->Init("terrain/testHight.bmp", "terrain/", "dirt01.dds");
terrain->Init("terrain/heightmap01.bmp", "terrain/", "grass.jpg");
scene->AddTerrain(terrain);
Wall *wall = new Wall;
wall->Init(30, 30, 0.3);
wall->Pitch(XM_PI / 2);
wall->SetPosition(0, -3, 0);
//scene->AddRenderableThing(*wall);
//¿É¼ûÐÔ²âÊÔ
Wall *wall0 = new Wall;
wall0->Init(30, 30, 0.3);
wall0->Pitch(XM_PI / 2);
wall0->SetPosition(1000, -3, 0);
//scene->AddRenderableThing(*wall0);
Obj *obj = new Obj;
obj->CreateBox(1, 3, 2, material);
obj->SetPosition(5, 1, 12);
obj->Yaw(XM_PI / 3);
obj->Roll(XM_PI / 3);
obj->SetScale(1.3);
//scene->AddRenderableThing(*obj);
Cube *cube = new Cube;
cube->Init(2);
cube->Pitch(XM_PI / 3);
cube->Roll(XM_PI / 3);
cube->SetMaterial(material);
//scene->AddRenderableThing(*cube);
Ball *ball = new Ball;
ball->Init(1);
ball->SetPosition(0, 0, 6);
Obj *objInWall = new Obj;
objInWall->CreateBox(1, 1, 1, material);
objInWall->SetPosition(0, 1, 0);
ball->AddChild(objInWall);
//scene->AddRenderableThing(*ball);
Ship *ship = new Ship;
//ship->Init();
//ship->SetPosition(-10, 0, 0);
//scene->AddRenderableThing(*ship);
Model *test = new Model;
test->LoadModel("media/", "chair.obj");
test->SetScale(1.7);
test->SetPosition(-15, 0, 0);
test->Pitch(-1.2);
test->Yaw(-1.5);
//scene->AddRenderableThing(*test);
//SmileBoy *smileBoy= new SmileBoy;
//smileBoy->Init();
//smileBoy->SetHandleInput(FALSE);
//.........这里部分代码省略.........
开发者ID:whztt07,项目名称:XEngine,代码行数:101,代码来源:main.cpp
示例17: switch
void ExtensionsMainLayer::menuCallback(CCObject* pSender)
{
CCMenuItemFont* pItem = (CCMenuItemFont*)pSender;
int nIndex = pItem->getZOrder() - kItemTagBasic;
switch (nIndex)
{
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE) // MARMALADE CHANGE: Not yet avaiable on Marmalade
case TEST_NOTIFICATIONCENTER:
{
runNotificationCenterTest();
}
break;
#endif
case TEST_CCCONTROLBUTTON:
{
CCControlSceneManager* pManager = CCControlSceneManager::sharedControlSceneManager();
CCScene* pScene = pManager->currentControlScene();
CCDirector::sharedDirector()->replaceScene(pScene);
}
break;
case TEST_COCOSBUILDER:
{
TestScene* pScene = new CocosBuilderTestScene();
if (pScene)
{
pScene->runThisTest();
pScene->release();
}
}
break;
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE && CC_TARGET_PLATFORM != CC_PLATFORM_NACL && CC_TARGET_PLATFORM != CC_PLATFORM_EMSCRIPTEN && CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
case TEST_HTTPCLIENT:
{
runHttpClientTest();
}
break;
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
case TEST_WEBSOCKET:
{
runWebSocketTest();
}
break;
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
case TEST_EDITBOX:
{
runEditBoxTest();
}
break;
#endif
case TEST_TABLEVIEW:
{
runTableViewTest();
}
break;
case TEST_COMPONENTS:
{
runComponentsTestLayerTest();
}
break;
case TEST_ARMATURE:
{
ArmatureTestScene *pScene = new ArmatureTestScene();
if (pScene)
{
pScene->runThisTest();
pScene->release();
}
}
break;
case TEST_SCENEEDITOR:
{
SceneEditorTestScene *pScene = new SceneEditorTestScene();
if (NULL != pScene)
{
pScene->runThisTest();
pScene->release();
}
}
break;
case TEST_COCOSGUI:
{
CocoStudioGUITestScene* pScene = new CocoStudioGUITestScene();
pScene->runThisTest();
pScene->release();
}
break;
case TEST_ACTIONTIMELINE:
{
TimelineTestScene* pScene = new TimelineTestScene();
pScene->runThisTest();
pScene->release();
}
default:
break;
}
}
开发者ID:bunny1985,项目名称:DigitAdventures,代码行数:99,代码来源:ExtensionsTest.cpp
示例18: CreateTestScene
TestScene CreateTestScene(egl::graphics::LightManager& light_manager) {
using egl::SceneNode;
namespace ef = egl::factories;
static constexpr float kPi = 3.14159265;
static constexpr float k2Pi = 3.14159265 * 2;
static constexpr float kPi2 = 3.14159265 / 2;
static constexpr float kPi3 = 3.14159265 / 3;
auto scene_root = ef::MakeCubeNode(nullptr);
scene_root->SetOffset(0.f, 0.f, 0.f);
auto rotating_bawse = ef::MakeCubeNode(scene_root.get());
rotating_bawse->SetOffset(0.0, 0.0, -15.0);
std::vector<glm::vec3> offsets = {
{ 2.f, 0.f, 0.f },
{ -2.f, 0.f, 0.f },
{ 0.f, 2.f, 0.f },
{ 0.f, -2.f, 0.f },
{ 0.f, 0.f, 2.f },
{ 0.f, 0.f, -4.f },
};
std::vector<glm::vec3> orientation_offsets = {
{ 0.f, kPi2, 0.f },
{ 0.f, -kPi2, 0.f },
{ kPi2, 0.f, 0.f },
{ -kPi2, 0.f, 0.f },
{ 0.f, 0.f, 0.f },
{ 0.f, kPi, 0.f },
};
std::vector<std::unique_ptr<SceneNode>> children;
for (size_t i = 0; i < offsets.size(); i++) {
auto child = ef::MakeCubeNode(rotating_bawse.get());
auto o = offsets[i];
child->SetOffset(o[0], o[1], o[2]);
auto oo = orientation_offsets[i];
child->RotateBodyAxes(oo[0], oo[1], oo[2]);
children.push_back(std::move(child));
}
for (auto& child : children) {
child->AddMutator([](SceneNode* obj, float dT) {
obj->RotateBodyAxes(0, 0, kPi * dT);
});
}
constexpr float kWo = 25.f;
std::vector<glm::vec3> wall_offsets {
{ kWo, 0.f, 0.f },
{ -kWo, 0.f, 0.f },
{ 0.f, kWo, 0.f },
{ 0.f, -kWo, 0.f },
{ 0.f, 0.f, kWo },
{ 0.f, 0.f, -kWo },
};
std::vector<glm::vec3> wall_orientation_offsets = {
{ 0.f, kPi2, 0.f },
{ 0.f, -kPi2, 0.f },
{ kPi2, 0.f, 0.f },
{ -kPi2, 0.f, 0.f },
{ 0.f, 0.f, 0.f },
{ 0.f, kPi, 0.f },
};
std::vector<std::unique_ptr<SceneNode>> walls;
for (size_t i = 0; i < 6; i++) {
auto o = wall_offsets[i];
auto oo = wall_orientation_offsets[i];
auto p_wall = ef::MakeCubeNode(rotating_bawse.get());
p_wall->SetOffset(o[0], o[1], o[2]);
p_wall->RotateBodyAxes(oo[0], oo[1], oo[2]);
//p_wall->Scale(2 * kWo, 2 * kWo, 0.1f);
p_wall->Scale(kWo, kWo, 1.f);
walls.push_back(std::move(p_wall));
}
auto rogue_entity = ef::MakeCubeNode(rotating_bawse.get());
constexpr float e_x = 0.25, e_y = 0.25, e_z = 0.25;
rogue_entity->SetOffset(0.f, 0.f, 6.f);
rogue_entity->Scale(2 * e_x, 2 * e_y, 2 * e_z);
rogue_entity->SetExtents(e_x, e_y, e_z);
rogue_entity->AddMutator([t = 0.f](SceneNode* obj, float dT) mutable {
t = std::fmod((t + dT), k2Pi);
obj->SetOffset(0.f, 0.f, 5.f + 2 * std::sin(t));
obj->RotateBodyAxes(dT * kPi, dT * kPi, 0.f);
});
//auto rogue_light_node = ef::MakeLightNode(rogue_entity.get(), light_manager);
//rogue_light_node->ClearMutators();
//rogue_light_node->AddMutator([theta = 3 * 1.57f](egl::SceneNode* sp, float dT) mutable {
// theta = std::fmod(theta + 10 * dT, 2 * 3.14159265);
// sp->SetOffset(0.f, 1.5 * std::cos(theta), 1.5 * sin(theta));
//});
children.push_back(std::move(rogue_entity));
//.........这里部分代码省略.........
开发者ID:KeyserSosse,项目名称:EGL,代码行数:101,代码来源:TestScene.cpp
示例19: main
int main(int argc, char **argv) {
carve::mesh::MeshSet<3> *a = makeCube(carve::math::Matrix::ROT(1.0, 1.0, 1.0, 1.0));
std::vector<carve::geom3d::Vector> shape;
carve::input::PolyhedronData data;
for (int i = 0; i < POINTS; ++i) {
double r = 2.0 + .4 * sin(i * 3 * M_TWOPI / POINTS) + .8 * sin(i * 5 * M_TWOPI / POINTS);
data.addVertex(carve::geom::VECTOR(r * cos(i * M_TWOPI / POINTS), r * sin(i * M_TWOPI / POINTS), 0.0));
}
std::vector<int> face_verts;
for (int i = 0; i < POINTS; ++i) {
face_verts.push_back(i);
}
data.addFace(face_verts.begin(), face_verts.end());
carve::mesh::MeshSet<3> *b = new carve::mesh::MeshSet<3>(data.points, data.getFaceCount(), data.faceIndices);
std::list<carve::mesh::MeshSet<3> *> a_sliced, b_sliced;
carve::csg::CSG csg;
csg.hooks.registerHook(new carve::csg::CarveTriangulator, carve::csg::CSG::Hooks::PROCESS_OUTPUT_FACE_BIT);
csg.slice(a, b, a_sliced, b_sliced);
TestScene *scene = new TestScene(argc, argv, 6);
glNewList(scene->draw_list_base + 0, GL_COMPILE);
drawMeshSet(a, .4, .6, .8, 1.0);
glEndList();
glNewList(scene->draw_list_base + 1, GL_COMPILE);
drawMeshSet(b, .8, .6, .4, 1.0);
glEndList();
glNewList(scene->draw_list_base + 2, GL_COMPILE);
{
int n = 0;
for (std::list<carve::mesh::MeshSet<3> *>::iterator i = a_sliced.begin(); i != a_sliced.end(); ++i) {
float r = n & 1 ? .3 : .7;
float g = n & 2 ? .3 : .7;
float b = n & 4 ? .3 : .7;
drawMeshSet(*i, r, g, b, 1.0);
++n;
}
}
glEndList();
glNewList(scene->draw_list_base + 3, GL_COMPILE);
{
int n = 0;
for (std::list<carve::mesh::MeshSet<3> *>::iterator i = a_sliced.begin(); i != a_sliced.end(); ++i) {
drawMeshSetWireframe(*i, -1, false, false);
++n;
}
}
glEndList();
glNewList(scene->draw_list_base + 4, GL_COMPILE);
{
int n = 0;
for (std::list<carve::mesh::MeshSet<3> *>::iterator i = b_sliced.begin(); i != b_sliced.end(); ++i) {
float r = n & 1 ? .3 : .7;
float g = n & 2 ? .3 : .7;
float b = n & 4 ? .3 : .7;
drawMeshSet(*i, r, g, b, 1.0);
++n;
}
}
glEndList();
glNewList(scene->draw_list_base + 5, GL_COMPILE);
{
int n = 0;
for (std::list<carve::mesh::MeshSet<3> *>::iterator i = b_sliced.begin(); i != b_sliced.end(); ++i) {
drawMeshSetWireframe(*i, -1, false, false);
++n;
}
}
glEndList();
scene->run();
delete scene;
return 0;
}
开发者ID:DarkOfTheMoon,项目名称:Carve,代码行数:87,代码来源:test_slice.cpp
示例20: main
int main(int argc, char **argv) {
carve::mesh::MeshSet<3> *a = makeTorus(30, 30, 2.0, 0.8, carve::math::Matrix::ROT(0.5, 1.0, 1.0, 1.0));
carve::input::PolyhedronData data;
for (int i = 0; i < DIM; i++) {
double x = -3.0 + 6.0 * i / double(DIM - 1);
for (int j = 0; j < DIM; j++) {
double y = -3.0 + 6.0 * j / double(DIM - 1);
double z = -1.0 + 2.0 * cos(sqrt(x * x + y * y) * 2.0) / sqrt(1.0 + x * x + y * y);
size_t n = data.addVertex(carve::geom::VECTOR(x, y, z));
if (i && j) {
data.addFace(n - DIM - 1, n - 1, n - DIM);
data.addFace(n - 1, n, n - DIM);
}
}
}
for (int i = 0; i < DIM; i++) {
double x = -3.0 + 6.0 * i / double(DIM - 1);
for (int j = 0; j < DIM; j++) {
double y = -3.0 + 6.0 * j / double(DIM - 1);
double z = 1.0 + 2.0 * cos(sqrt(x * x + y * y) * 2.0) / sqrt(1.0 + x * x + y * y);
size_t n = data.addVertex(carve::geom::VECTOR(x, y, z));
if (i && j) {
data.addFace(n - DIM - 1, n - 1, n - DIM);
data.addFace(n - 1, n, n - DIM);
}
}
}
carve::mesh::MeshSet<3> *b = data.createMesh(carve::input::opts());
CARVE_ASSERT(b->meshes.size() == 2);
Between between_collector(a, b);
carve::mesh::MeshSet<3> *c = carve::csg::CSG().compute(a, b, between_collector, NULL, carve::csg::CSG::CLASSIFY_EDGE);
TestScene *scene = new TestScene(argc, argv, 3);
glNewList(scene->draw_list_base + 0, GL_COMPILE);
drawMeshSet(a, .4, .6, .8, 1.0);
glEndList();
glNewList(scene->draw_list_base + 1, GL_COMPILE);
drawMeshSet(b, .8, .6, .4, 1.0);
glEndList();
glNewList(scene->draw_list_base + 2, GL_COMPILE);
drawMeshSet(c, .2, .2, .8, 1.0);
drawMeshSetWireframe(c, -1, false, false);
glEndList();
scene->run();
delete scene;
delete a;
delete b;
delete c;
return 0;
}
开发者ID:barche,项目名称:carve,代码行数:63,代码来源:custom_collector.cpp
注:本文中的TestScene类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论