Ejemplo n.º 1
0
void LayerFCD::InitializeData()
{
  if ( m_layerSource )
  {
    GetProperty()->SetLookupTable(m_layerSource->GetProperty()->GetLUTTable());
    m_imageDataRef = m_layerSource->GetImageData();
    SetWorldOrigin( m_layerSource->GetWorldOrigin() );
    SetWorldVoxelSize( m_layerSource->GetWorldVoxelSize() );
    SetWorldSize( m_layerSource->GetWorldSize() );

    m_imageData = vtkSmartPointer<vtkImageData>::New();
    // m_imageData->DeepCopy( m_layerSource->GetRASVolume() );

    m_imageData->SetNumberOfScalarComponents( 1 );
    m_imageData->SetScalarTypeToUnsignedChar();
    m_imageData->SetOrigin( GetWorldOrigin() );
    m_imageData->SetSpacing( GetWorldVoxelSize() );
    m_imageData->SetDimensions( 
      ( int )( m_dWorldSize[0] / m_dWorldVoxelSize[0] + 0.5 ),
      ( int )( m_dWorldSize[1] / m_dWorldVoxelSize[1] + 0.5 ),
      ( int )( m_dWorldSize[2] / m_dWorldVoxelSize[2] + 0.5 ) );
    m_imageData->AllocateScalars();
    void* ptr = m_imageData->GetScalarPointer();
    int* nDim = m_imageData->GetDimensions();
    // cout << nDim[0] << ", " << nDim[1] << ", " << nDim[2] << endl;
    memset( ptr, 0, m_imageData->GetScalarSize() * 
            nDim[0] * nDim[1] * nDim[2] );
    InitializeActors();
  }
}
Ejemplo n.º 2
0
/*
=================
sdWalker::Event_GroundPound
=================
*/
void sdWalker::Event_GroundPound( float force, float damageScale, float shockWaveRange ) {
	GroundPound( force, damageScale, shockWaveRange );

	bool leftleg = false;
	jointHandle_t jh = GetAnimator()->GetJointHandle( spawnArgs.GetString( leftleg ? "joint_foot_left" : "joint_foot_right" ) );

	idVec3 traceOrig;
	GetWorldOrigin( jh, traceOrig );

	idVec3 traceEnd = traceOrig;
	traceOrig.z += 100.0f;
	traceEnd.z -= 10.0f;

	trace_t		traceObject;
	gameLocal.clip.TracePoint( CLIP_DEBUG_PARMS traceObject, traceOrig, traceEnd, MASK_SOLID | CONTENTS_WATER | MASK_OPAQUE, this );
	traceEnd = traceObject.endpos;

	if ( traceObject.fraction < 1.f ) {
		int cont = gameLocal.clip.Contents( CLIP_DEBUG_PARMS traceEnd, NULL, mat3_identity, CONTENTS_WATER, this );
		if ( !cont ) {

			const char* surfaceTypeName = NULL;
			if ( traceObject.c.surfaceType ) {
				surfaceTypeName = traceObject.c.surfaceType->GetName();
			}

			idVec3 colorWhite(1.f,1.f,1.f);
			idVec3 xaxis(-1.f, 0.f, 0.f);
			PlayEffect( "fx_ground_pound", colorWhite, surfaceTypeName, traceEnd, xaxis.ToMat3() );
		}
	}
}
Ejemplo n.º 3
0
void Layer::GetBounds( double* bounds )
{
  double* origin = GetWorldOrigin();
  double* size = GetWorldSize();
  for ( int i = 0; i < 3; i++ )
  {
    bounds[i*2] = origin[i];
    bounds[i*2+1] = origin[i] + size[i];
  }
}