本文整理汇总了C++中setMesh函数的典型用法代码示例。如果您正苦于以下问题:C++ setMesh函数的具体用法?C++ setMesh怎么用?C++ setMesh使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setMesh函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: D3DPERF_BeginEvent
HRESULT SkillObject::frameRender ( IDirect3DDevice9* pd3dDevice, double dTime, float fElapsedTime )
{
HRESULT f = 0;
D3DPERF_BeginEvent( 0, L"SkillObject Render" );
HRESULT hr = S_OK;
ArnMatrix mWorld;
ArnMatrixIdentity( &mWorld );
UINT iPass, cPasses;
if ( SUCCEEDED(g_bombShader->setMainTechnique()) )
{
ArnMatrix arnvm, arnpm;
memcpy(arnvm.m, GetG().m_camera.GetViewMatrix()->m, sizeof(float)*16);
memcpy(arnpm.m, GetG().m_camera.GetProjMatrix()->m, sizeof(float)*16);
V( g_bombShader->setWorldViewProj( dTime, fElapsedTime, &getLocalXform(), &arnvm, &arnpm) );
V( g_bombShader->begin( &cPasses, 0 ) );
for( iPass = 0; iPass < cPasses; iPass++ )
{
V( g_bombShader->beginPass( iPass ) );
// TODO Mesh pointing should be done here? not OnResetDevice?
if ( getMesh() == 0 )
{
setMesh( g_bst[ m_bst ] );
}
f = getMesh()->DrawSubset( 0 );
V( g_bombShader->endPass() );
}
V( g_bombShader->end() );
}
else
{
// TODO Mesh pointing should be done here? not OnResetDevice?
if ( getMesh() == 0 )
{
setMesh( g_bst[ m_bst ] );
}
pd3dDevice->SetTransform(D3DTS_WORLD, (const D3DXMATRIX*)getLocalXform().m);
f = getMesh()->DrawSubset( 0 );
}
D3DPERF_EndEvent();
return f;
}
开发者ID:gasbank,项目名称:poolg,代码行数:49,代码来源:SkillObject.cpp
示例2: SpaceGameActor
Bullet::Bullet( const std::string& id, const vec2f& pos, float rotation, short teamNumber, int screenWidth, int screenHeight, bool isServerSide )
: SpaceGameActor( id + "_" + toString( sm_nextBulletID++ ), teamNumber, screenWidth, screenHeight )
, BULLET_SPEED( 500.0f )
{
m_actorType = BULLET_ACTOR_TYPE;
setPosition( pos );
m_lifespan = 2.0f;
m_drag = 0.0f;
m_radius = 4.0f;
SGA_State currentState;
currentState.pos = pos;
currentState.rot = rotation;
m_stateTimeline.SetDrag( m_drag );
const float radians = MathFuncs<float>::degreesToRadians( rotation );
const float sinRotation = std::sin( radians );
const float cosRotation = std::cos( radians );
vec2f dir = vec2f( sinRotation, cosRotation );
currentState.vel = dir * BULLET_SPEED;
if( !isServerSide )
setMesh( MeshFactory::generateLine( vec2f(), vec2f( 0.0f, 4.0f ), "SimpleColorMaterial", getTeamColor( teamNumber ) ) );
setRotation( mat3f::createMatrixFromQuaternion( quatf::makeQuaternionFromAxisAngle( MathFuncs<float>::degreesToRadians( rotation ), vec3f( 0.0f, 0.0f, 1.0f ) ) ) );
m_stateTimeline.Set( 0, currentState );
m_actorTypesCanCollideWith = SPACE_SHIP_ACTOR_TYPE;
}
开发者ID:hulcyp,项目名称:GuildhallProjects,代码行数:29,代码来源:Bullet.cpp
示例3: XMFLOAT4
void StandardRenderer::render(ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext, GameObject* gameObject)
{
// simplest possible renderer
// get world matrix
XMMATRIX worldMatrix = gameObject->transformMatrix;
// only supports one parent at moment
if (gameObject->parent)
{
// for some reason it breaks if you remove this line...
// it could be something to do with the warning C4316
XMMATRIX parentTransform = gameObject->parent->transformMatrix;
worldMatrix *= parentTransform;
}
GameContext * gameContext = gameObject->gameContext;
XMMATRIX viewMatrix = gameContext->renderingContext->primaryCamera->viewMatrix;
XMMATRIX projectionMatrix = gameContext->renderingContext->projectionMatrix;
XMMATRIX matWorldViewProjection = worldMatrix * viewMatrix * projectionMatrix;
// update constant buffers
gameObject->shaderPair->updateBuffersPerObject(pd3dImmediateContext, worldMatrix, matWorldViewProjection, XMFLOAT4(1, 1, 1, 1));
setMesh(pd3dImmediateContext, gameObject->sharedMesh);
renderMesh(pd3dImmediateContext, gameObject->sharedMesh);
}
开发者ID:alcornwill,项目名称:directx_demo,代码行数:30,代码来源:StandardRenderer.cpp
示例4: makeSponge
InstancedSponge::InstancedSponge(unsigned recursion, QList<string>& attributes) {
bufferCount = 1;
makeSponge(recursion, {0, 0, 0}, 1.0f);
setMesh(MeshLoader::load(attributes, "cube.obj"));
calculateBufferSize();
setCastShadows(false);
}
开发者ID:lubosz,项目名称:liblub,代码行数:7,代码来源:InstancedSponge.cpp
示例5: free
void InfoWidgetMsh::loadParticles(Particles *particles){
int k;
if(mSpec!=NULL)
free(mSpec);
mSpec=NULL;
nbMeshes=0;
if(particles!=NULL){
nbMeshes=particles->nbMeshes;
mSpec=(MeshSpec*)calloc(nbMeshes,sizeof(MeshSpec));
memcpy(mSpec,particles->mSpec,nbMeshes*sizeof(MeshSpec));
while(meshBx->count())
meshBx->removeItem(meshBx->count()-1);
for(k=0;k<nbMeshes;k++)
meshBx->addItem(mSpec[k].name);
meshBx->setCurrentIndex(0);
wireBx->setChecked(mSpec[0].showWires);
cullBackFaceBx->setChecked(mSpec[0].cullBackFace);
setMesh(0);
setChecked(true);
setEnabled(true);
}
else {
while(meshBx->count())
meshBx->removeItem(meshBx->count()-1);
setChecked(false);
setEnabled(false);
}
}
开发者ID:nfaralli,项目名称:BPV,代码行数:28,代码来源:infowidgetmsh.cpp
示例6: setTexture
bool Cc3dSprite::init(){
this->setAnchorPoint(ccp(0,0));
//call parent init
Cc3dNode::init();
//texture
CCTexture2D*texture=CCTextureCache::sharedTextureCache()->addImage((c3dDefaultTexPicFolderPath+"defaultTexPic.png").c_str());
setTexture(texture);
//material
Cc3dMaterial*material=Cc3dMaterial::create();
setMaterial(material);
//mesh
Cc3dMesh*mesh=Cc3dMesh::create();//empty mesh
setMesh(mesh);
//program
Cc3dProgram*program=c3dGetProgram_c3dTexOnly();
setProgram(program);
//uniformPassor
Cc3dUniformPassor*uniformPassor=Cc3dUniformPassor::create();
setUniformPassor(uniformPassor);
//lightSource
Cc3dLightSource*lightSource=Cc3dLightSource::create();
setLightSource(lightSource);
//indexVBO
Cc3dIndexVBO3d*indexVBO=Cc3dIndexVBO3d::create();
setIndexVBO(indexVBO);
//enable array attribute
Cc3dIndexVBO3d::enableAttribArrays();
return true;
}
开发者ID:meiry,项目名称:3DToolKit-for-cocos2dx,代码行数:29,代码来源:c3dSprite.cpp
示例7: updateTrigger
void TriggerObject::Update(double dt, bool* myKey)
{
updateTrigger(dt, myKey); //Actual update
//Sprite animation
switch (type)
{
case FIRE:
{
setState(FIRE);
if (animationList[FIRE]->ended == true)
{
animationList[FIRE]->Reset();
if(this->getActive() == true)
{
my_sfx_man->play_fire();
}
}
if (mesh != animationList[FIRE])
{
setMesh(animationList[FIRE]);
}
animationList[FIRE]->Update(dt);
break;
}
}
}
开发者ID:barryHub20,项目名称:SP3,代码行数:29,代码来源:TriggerObject.cpp
示例8: init
void Collider::_copyFrom(const ComponentBase *model)
{
auto m = (Collider*)model;
if (m->getColliderType() == Physics::ColliderType::Mesh)
{
init(m->getColliderType(), m->getMesh());
}
else
{
init(m->getColliderType(), "");
}
#ifdef EDITOR_ENABLED
editorUpdate();
if (editorStruct)
{
editorStruct->copyDatas(m);
}
Link *link = entity.getLinkPtr();
auto p = scaleFromMat4(link->getGlobalTransform());
//scale(p / getSize());
#else
setMaterial(m->getMaterial()->getName());
setAsTrigger(m->isATrigger());
setFilterGroup(m->getFilterGroup());
setCenter(m->getCenter());
setHeight(m->getHeight());
setRadius(m->getRadius());
setSize(m->getSize());
setMesh(m->getMesh());
if (m->isConvex())
setAsConvex();
else if (m->isConcave())
setAsConcave();
#endif
}
开发者ID:Another-Game-Engine,项目名称:AGE,代码行数:35,代码来源:Collider.cpp
示例9: init
void CC3PODMeshNode::initAtIndex( GLint aPODIndex, CC3PODResource* aPODRez )
{
init();
setPodIndex( aPODIndex );
SPODNode* pmn = (SPODNode*)getNodePODStructAtIndex( aPODIndex, aPODRez );
//LogRez(@"Creating %@ at index %i from: %@", [self class], aPODIndex, NSStringFromSPODNode(psn));
setName( pmn->pszName );
setPodContentIndex( pmn->nIdx );
setPodParentIndex( pmn->nIdxParent );
if ( pmn->pfAnimPosition )
setLocation( *(CC3Vector*)pmn->pfAnimPosition );
if ( pmn->pfAnimRotation )
setQuaternion( *(CC3Quaternion*)pmn->pfAnimRotation );
if ( pmn->pfAnimScale )
setScale( *(CC3Vector*)pmn->pfAnimScale );
if ( CC3PODNodeAnimation::sPODNodeDoesContainAnimation((PODStructPtr)pmn) )
setAnimation( CC3PODNodeAnimation::animationFromSPODNode( (PODStructPtr)pmn, aPODRez->getAnimationFrameCount() ) );
else if (aPODRez->shouldFreezeInanimateNodes())
setAnimation( CC3FrozenNodeAnimation::animationFromNodeState( this ) );
// If this node has a mesh, build it
if (getPodContentIndex() >= 0) {
setMesh( aPODRez->getMeshAtIndex( getPodContentIndex() ) );
}
// If this node has a material, build it
setPodMaterialIndex( pmn->nIdxMaterial );
if (getPodMaterialIndex() >= 0)
setMaterial( (CC3PODMaterial*)aPODRez->getMaterialAtIndex( getPodMaterialIndex() ) );
}
开发者ID:HerdiandKun,项目名称:cocos3d-x,代码行数:33,代码来源:CC3PODMeshNode.cpp
示例10: cc3v
void CC3Billboard::populateAsBoundingRectangle()
{
CC3Vector* vertices; // Array of simple vertex location data
// Start with default initial values
GLfloat xMin = 0.0f;
GLfloat xMax = 1.0f;
GLfloat yMin = 0.0f;
GLfloat yMax = 1.0f;
int vCount = 4;
CC3VertexLocations* locArray = CC3VertexLocations::vertexArray();
locArray->setDrawingMode( GL_TRIANGLE_STRIP ); // Location array will do the drawing as a strip
locArray->setVertexStride( 0 ); // Tightly packed locations only
locArray->setElementOffset( 0 ); // Only locations
locArray->setAllocatedVertexCapacity( vCount );
vertices = (CC3Vector*)locArray->getVertices();
// Populate vertex locations in the X-Y plane
vertices[0] = cc3v(xMax, yMax, 0.0f);
vertices[1] = cc3v(xMin, yMax, 0.0f);
vertices[2] = cc3v(xMax, yMin, 0.0f);
vertices[3] = cc3v(xMin, yMin, 0.0f);
// Create mesh with vertex location array
CC3Mesh* aMesh = CC3Mesh::mesh();
aMesh->setVertexLocations( locArray );
setMesh( aMesh );
updateBoundingMesh();
}
开发者ID:HerdiandKun,项目名称:cocos3d-x,代码行数:31,代码来源:CC3Billboard.cpp
示例11: vec3f
//----------------------------------------------------------------------
void Spaceship::createMesh( const Color4f& color )
{
std::vector< Mesh::Vertex > vertices;
std::vector< unsigned int > indices;
vertices.push_back( Mesh::Vertex( vec3f( 0.0f, 20.0f ),
vec3f( 0.0f, 0.0f, 1.0f ),
color,
vec2f() ) );
vertices.push_back( Mesh::Vertex( vec3f( 15.0f, -20.0f ),
vec3f( 0.0f, 0.0f, 1.0f ),
color,
vec2f() ) );
vertices.push_back( Mesh::Vertex( vec3f( 0.0f, -10.0f ),
vec3f( 0.0f, 0.0f, 1.0f ),
color,
vec2f() ) );
vertices.push_back( Mesh::Vertex( vec3f( -15.0f, -20.0f ),
vec3f( 0.0f, 0.0f, 1.0f ),
color,
vec2f() ) );
indices.push_back( 0 );
indices.push_back( 1 );
indices.push_back( 2 );
indices.push_back( 3 );
setMesh( new Mesh( vertices, indices, "SimpleColorMaterial", GL_LINE_LOOP ) );
}
开发者ID:hulcyp,项目名称:GuildhallProjects,代码行数:30,代码来源:Spaceship.cpp
示例12: name
SubMesh::SubMesh(const char* newName, const Mesh& mesh, int primitiveType, Material* material)
: name(newName)
{
setMesh(mesh);
this->primitiveType = primitiveType;
this->material = material;
}
开发者ID:MrGlamur,项目名称:libgdx-cpp,代码行数:7,代码来源:SubMesh.cpp
示例13: setMesh
/** If a mesh does not yet exist, create it as a CC3Mesh with interleaved vertices. */
CC3Mesh* CC3MeshNode::ensureMesh()
{
if ( !_mesh )
setMesh( makeMesh() );
return _mesh;
}
开发者ID:ClAndHHL,项目名称:cocos3d-x,代码行数:8,代码来源:CC3MeshNode.cpp
示例14: switch
void EntityGridObject::toggleObject(GridMap * currMap)
{
if (!m_bToggled)
{
m_bToggled = true;
}
else
{
m_bToggled = false;
}
auto graphicsComponent = this->getComponent<GraphicsComponent>();
Mesh * newMesh;
switch (this->m_eObjectType)
{
case OBJECT_BOX:
break;
case OBJECT_KEY:
break;
case OBJECT_SWITCH:
delete graphicsComponent->getMesh();
graphicsComponent->setMesh(MeshBuilder::GenerateQuad("Activated", Color(0.f, 0.f, 0.f), 16.f));
graphicsComponent->getMesh()->textureArray[0] = LoadTGA("Images//Tiles//tile_switch_activate.tga");
graphicsComponent->getMesh()->alpha = 1.f;
break;
case OBJECT_DOOR:
SoundManager::playSound("Sounds//lever.wav", false);
SoundManager::playSound("Sounds//opendoor.wav", false);
currMap->getGridMap()[this->m_iIndexY][this->m_iIndexX]->setremoveDoor(true);
currMap->getGridMap()[this->m_iIndexY][this->m_iIndexX]->replaceTile(Grid::TILE_FLOOR,BACKGROUND_TILE);
currMap->getGridMap()[this->m_iIndexY][this->m_iIndexX]->deleteEntity();
break;
}
}
开发者ID:DarkPromise,项目名称:StudioProject4,代码行数:35,代码来源:EntityGridObject.cpp
示例15: OnEvent
virtual bool OnEvent(const SEvent& event)
{
if (event.EventType == EET_KEY_INPUT_EVENT &&
event.KeyInput.PressedDown){
switch(event.KeyInput.Key)
{
case 'O':
device_->getGUIEnvironment()->addFileOpenDialog(
L"Please select a model file to open");
break;
case 27: // ESCAPE
case 'Q': // fall through
device_->closeDevice();
break;
default:
std::cout << event.KeyInput.Key << std::endl;
}
}
else if (event.EventType == EET_GUI_EVENT){
if(event.GUIEvent.EventType==gui::EGET_FILE_SELECTED){
// load the model file, selected in the file open dialog
gui::IGUIFileOpenDialog* dialog =
(gui::IGUIFileOpenDialog*)event.GUIEvent.Caller;
scene::IAnimatedMesh *m=loadMesh(dialog->getFileName());
if(m){
setMesh(m);
}
}
}
return false;
}
开发者ID:fkoner,项目名称:irrmmd,代码行数:34,代码来源:main.cpp
示例16: ModellingBase
DC1dModelling::DC1dModelling(size_t nlayers, const RVector & am, const RVector & bm, const RVector & an, const RVector & bn,
bool verbose)
: ModellingBase(verbose), nlayers_(nlayers), am_(am), an_(an), bm_(bm), bn_(bn){
init_();
setMesh(createMesh1DBlock(nlayers));
k_ = (2.0 * PI) / (1.0 / am_ - 1.0 / an_ - 1.0 / bm_ + 1.0 / bn_);
meanrhoa_ = 100.0; //*** hack
}
开发者ID:KristoferHellman,项目名称:gimli,代码行数:8,代码来源:dc1dmodelling.cpp
示例17: setMesh
void CC3TouchBox::setBox( const CC3Box& aBox )
{
if ( aBox.isNull() ) {
setMesh( NULL );
} else {
populateBox( aBox );
}
}
开发者ID:HerdiandKun,项目名称:cocos3d-x,代码行数:8,代码来源:CC3UtilityMeshNodes.cpp
示例18: EGE_ERROR
bool ege::Element::loadMesh(const std::string& _meshFileName) {
ememory::SharedPtr<ege::resource::Mesh> tmpMesh = ege::resource::Mesh::create(_meshFileName);
if(tmpMesh == nullptr) {
EGE_ERROR("can not load the resources : " << _meshFileName);
return false;
}
return setMesh(tmpMesh);
}
开发者ID:atria-soft,项目名称:ege,代码行数:8,代码来源:Element.cpp
示例19: setLocation
void JSRestoredVisibleData::updateFrom(const IPresencePropertiesRead& orig) {
setLocation(orig.location());
setOrientation(orig.orientation());
setBounds(orig.bounds());
setMesh(orig.mesh());
setPhysics(orig.physics());
}
开发者ID:SinSiXX,项目名称:sirikata,代码行数:8,代码来源:JSVisibleData.cpp
示例20: setMesh
/** Changes this item to be a new type for a certain amount of time.
* \param type New type of this item.
* \param mesh Mesh to use to display this item.
*/
void Item::switchTo(ItemType type, scene::IMesh *mesh, scene::IMesh *lowmesh)
{
// triggers and easter eggs should not be switched
if (m_type == ITEM_TRIGGER || m_type == ITEM_EASTER_EGG) return;
m_original_type = m_type;
setMesh(mesh, lowmesh);
setType(type);
} // switchTo
开发者ID:toymak3r,项目名称:Beyond-The-Mirror---Weird-Rancing-Game,代码行数:13,代码来源:item.cpp
注:本文中的setMesh函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论