/** Write code for code fragements and @a NonTerminal's to file

	Note: for LLgen style code generation, each @a NonTerminal is written to
	the output file corresponding to the input file in which it was declared.
*/
static void generateCode(void) {
	int i;
	Declaration *declaration;
	FileListItem *output;
	
	for (i = 0; i < listSize(declarations); i++) {
		declaration = (Declaration *) listIndex(declarations, i);
		switch (declaration->subtype) {
			case CODE:
				output = findOutput(declaration->uCode->fileName);
				outputCode(output->output, declaration->uCode, false);
				break;
			case DIRECTIVE:
				/* output = findOutput(declaration->uDirective->token[0]->fileName); */
				break;
			case NONTERMINAL:
				output = findOutput(declaration->uNonTerminal->token->fileName);
				/* Generate the declarations for all generated NonTerminal
				   functions right before the first one (for each file), so we
				   always declare them before use. */
				if (output->firstNonTerminal) {
					output->firstNonTerminal = false;
					generatePrototypes(output->output);
				}
				generateNonTerminalCode(output->output, declaration->uNonTerminal);
				break;
			default:
				PANIC();
		}
	}
}
void RPDeferredLightingNode::onObjectLoaded()
{
   __super::onObjectLoaded();

   // find input socket
   delete m_normalsInput;
   delete m_specularInput;
   delete m_depthInput;
   delete m_sceneColorInput;
   delete m_materialIndicesInput;
   delete m_materialsDescInput;

   delete m_finalLightColorTargetOutput;
   delete m_shadowDepthTextureOutput;
   delete m_screenSpaceShadowMapOutput;

   m_normalsInput = static_cast< RPTextureInput* >( findInput( "Normals" ) );
   m_specularInput = static_cast< RPTextureInput* >( findInput( "Specular" ) );
   m_depthInput = static_cast< RPTextureInput* >( findInput( "Depth" ) );
   m_sceneColorInput = static_cast< RPTextureInput* >( findInput( "SceneColor" ) );
   m_materialIndicesInput = static_cast< RPTextureInput* >( findInput( "MaterialsIndices" ) );
   m_materialsDescInput = static_cast< RPTextureInput* >( findInput( "MaterialsDescr" ) );

   m_finalLightColorTargetOutput = static_cast< RPTextureOutput* >( findOutput( "LitScene"  ) );
   m_shadowDepthTextureOutput = static_cast< RPTextureOutput* >( findOutput( "ShadowDepthBuffer" ) );
   m_screenSpaceShadowMapOutput = static_cast< RPTextureOutput* >( findOutput( "SS_ShadowMap" ) );
}
Beispiel #3
0
void GNSpatialEntity::onObjectLoaded()
{
   __super::onObjectLoaded();

   // find the existing inputs
   m_worldMtx = DynamicCast< GSMatrixOutput >( findOutput( "world" ) );
   m_worldViewMtx = DynamicCast< GSMatrixOutput >( findOutput( "worldView" ) );
}
void MNSurfaceProperties::onObjectLoaded()
{
   __super::onObjectLoaded();

   // find the existing inputs
   m_ambient = DynamicCast< MSVec4Output >( findOutput( "ambient" ) );
   m_diffuse = DynamicCast< MSVec4Output >( findOutput( "diffuse" ) );
   m_specular = DynamicCast< MSVec4Output >( findOutput( "specular" ) );
   m_specularPower = DynamicCast< MSFloatOutput >( findOutput( "specularPower" ) );
   m_emissive = DynamicCast< MSVec4Output >( findOutput( "emissive" ) );
}
Beispiel #5
0
void MNBool::onObjectLoaded()
{
    __super::onObjectLoaded();

    // find the existing inputs
    m_output = DynamicCast< MSBoolOutput >( findOutput( "Value" ) );
}
Beispiel #6
0
void MNVec4::onObjectLoaded()
{
   MaterialNode::onObjectLoaded();

   // find the existing inputs
   m_output = static_cast< MSVec4Output* >( findOutput( "Vec" ) );
}
Beispiel #7
0
MNVec4::MNVec4( const MNVec4& rhs )
   : MaterialNode( rhs )
   , m_vector( rhs.m_vector )
   , m_output( NULL )
{
   m_output = static_cast< MSVec4Output* >( findOutput( "Vec" ) );
}
Beispiel #8
0
void MNColor::onObjectLoaded()
{
   MaterialNode::onObjectLoaded();

   // find the existing inputs
   m_output = static_cast< MSColorOutput* >( findOutput( "Color" ) );
}
Beispiel #9
0
MNColor::MNColor( const MNColor& rhs )
   : MaterialNode( rhs )
   , m_color( rhs.m_color )
   , m_output( NULL )
{
   m_output = static_cast< MSColorOutput* >( findOutput( "Color" ) );
}
Beispiel #10
0
SAGetRandomAnnotation::SAGetRandomAnnotation( const SAGetRandomAnnotation& rhs )
   : StoryAction( rhs )
   , m_out( NULL )
   , m_spawnPoint( rhs.m_spawnPoint )
   , m_annotationName( rhs.m_annotationName )
{
   m_out = static_cast< SAAnnotationOutput* >( findOutput( "Out" ) );
}
Beispiel #11
0
void MNTexture::onObjectLoaded()
{
   MaterialNode::onObjectLoaded();

   // find the existing inputs
   m_uvInput = static_cast< MSVec2Input* >( findInput( "UV" ) );
   m_output = static_cast< MSColorOutput* >( findOutput( "Color" ) );

   if ( m_texture )
   {
      m_renderableTexture->setTexture( m_texture );
   }
}
Beispiel #12
0
MNTexture::MNTexture( const MNTexture& rhs )
   : MaterialNode( rhs )
   , m_texture( rhs.m_texture )
   , m_samplerSettings( rhs.m_samplerSettings )
   , m_output( NULL )
   , m_renderableTexture( new RenderableTexture() )
{
   m_uvInput = static_cast< MSVec2Input* >( findInput( "UV" ) );
   m_output = static_cast< MSColorOutput* >( findOutput( "Color" ) );

   if ( m_texture )
   {
      m_renderableTexture->setTexture( m_texture );
   }
}
Beispiel #13
0
void MNCamera::onObjectLoaded()
{
   __super::onObjectLoaded();

   // find the existing inputs
   m_nearZ = DynamicCast< MSFloatOutput >( findOutput( "nearZ" ) );
   m_farZ = DynamicCast< MSFloatOutput >( findOutput( "farZ" ) );
   m_viewportWidth = DynamicCast< MSFloatOutput >( findOutput( "width" ) );
   m_viewportHeight = DynamicCast< MSFloatOutput >( findOutput( "height" ) );
   m_invView = DynamicCast< MSMatrixOutput >( findOutput( "invView" ) );
   m_invProj = DynamicCast< MSMatrixOutput >( findOutput( "invProj" ) );
}
Beispiel #14
0
void SAGetRandomAnnotation::onObjectLoaded()
{
   m_out = static_cast< SAAnnotationOutput* >( findOutput( "Out" ) );
}