本文整理汇总了C++中CCVector3::set方法的典型用法代码示例。如果您正苦于以下问题:C++ CCVector3::set方法的具体用法?C++ CCVector3::set怎么用?C++ CCVector3::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCVector3
的用法示例。
在下文中一共展示了CCVector3::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CCBasicLineCollisionCheck
CCSceneCollideable* CCBasicLineCollisionCheck(const CCVector3 &start,
const CCVector3 &end,
const float width,
CCSceneCollideable *source)
{
static CCVector3 hitLocation;
CCSceneCollideable *hitObject = CCBasicLineCollisionCheck( gEngine->collisionManager.collideables.list,
gEngine->collisionManager.collideables.length,
source,
start, end,
&hitLocation,
true,
collision_static,
true );
if( hitObject == NULL )
{
static CCVector3 minStart, minEnd, maxStart, maxEnd;
minStart.set( start.x - width, start.y, start.z - width );
minEnd.set( end.x - width, start.y, end.z - width );
maxStart.set( start.x + width, start.y, start.z + width );
maxEnd.set( end.x - width, start.y, end.z - width );
hitObject = CCBasicLineCollisionCheck( gEngine->collisionManager.collideables.list,
gEngine->collisionManager.collideables.length,
NULL,
minStart, maxEnd,
&hitLocation,
true,
collision_static,
true );
if( hitObject == NULL )
{
hitObject = CCBasicLineCollisionCheck( gEngine->collisionManager.collideables.list,
gEngine->collisionManager.collideables.length,
NULL,
maxStart, minEnd,
&hitLocation,
true,
collision_static,
true );
}
}
return hitObject;
}
示例2: view
void CCPathFinderNetwork::view()
{
if( nodes.length > 0 && connectingNodes == false )
{
gEngine->textureManager->setTextureIndex( 1 );
const CCColour nodeColour = CCColour( 1.0f, 0.0f, 0.0f, 1.0f );
const CCColour pathColour = CCColour( 1.0f, 1.0f, 1.0f, 1.0f );
CCSetColour( nodeColour );
for( int i=0; i<nodes.length; ++i )
{
const PathNode *node = nodes.list[i];
GLPushMatrix();
GLTranslatef( node->point.x, node->point.y, node->point.z );
CCRenderCube( true );
GLPopMatrix();
}
static CCVector3 start, end;
{
GLVertexPointer( 3, GL_FLOAT, sizeof( PathNode ), &nodes.list[0]->point, nodes.length );
#ifndef DXRENDERER
GLDrawArrays( GL_POINTS, 0, nodes.length );
#endif
for( int i=0; i<nodes.length; ++i )
{
const PathNode *node = nodes.list[i];
const CCList<PathNode::PathConnection> &connections = node->connections;
for( int j=0; j<connections.length; ++j )
{
const PathNode::PathConnection *connection = connections.list[j];
start.set( node->point.x, 2.0f, node->point.z );
end.set( connection->node->point.x, 2.0f, connection->node->point.z );
CCRenderLine( start, end );
}
}
}
if( pathingFrom != NULL )
{
CCRenderer::CCSetDepthRead( false );
CCSetColour( pathColour );
const PathNode *currentNode = pathingFrom;
for( int i=0; i<path.endDirection; ++i )
{
const int connectionIndex = path.directions[i];
const CCList<PathNode::PathConnection> &connections = currentNode->connections;
if( connectionIndex < connections.length )
{
const PathNode::PathConnection *connection = connections.list[connectionIndex];
const PathNode *toNode = connection->node;
ASSERT( toNode != NULL );
start.set( currentNode->point.x, 5.0f, currentNode->point.z );
end.set( toNode->point.x, 5.0f, toNode->point.z );
CCRenderLine( start, end );
currentNode = toNode;
}
}
CCRenderer::CCSetDepthRead( true );
}
}
}