Пример #1
0
void CModelSurface::OnRenderInstances( const CHull &bounds ){
	if( !_triangles.size() ) return;
	
	if( !_instances.size() ) return;
	
//	glPolygonMode( GL_FRONT_AND_BACK,GL_LINE );
//	glLineWidth( 2 );
	
	App.Graphics()->SetVertexBuffer( VertexBuffer() );
	App.Graphics()->SetIndexBuffer( IndexBuffer() );
	
	const int MAXINSTS=48;
	CParam *bb_mm=CParam::ForName( "bb_ModelMatrices" );
	
	if( bounds.Empty() ){
		RenderInstances( 0,_instances.size() );
	}else{
		int n=0;
		for( int i=0;i<_instances.size();++i ){
			if( bounds.Intersects( _instances[i] * Bounds() ) ){
				++n;
			}else if( n ){
				RenderInstances( i-n,n );
				n=0;
			}
		}
		if( n ){
			RenderInstances( _instances.size()-n,n );
		}
	}

//	glPolygonMode( GL_FRONT_AND_BACK,GL_FILL );
}
Пример #2
0
 void Render(){
     RenderInstances();
 };