//----------------------------------------------------------------------------
StringTree* ParticleController::SaveStrings ()
{
    // TO DO.  Finish implementation.
    StringTree* pkTree = new StringTree(1,0,1,0);
    pkTree->SetString(0,MakeString(&ms_kRTTI,GetName()));
    pkTree->SetChild(0,Controller::SaveStrings());
    return pkTree;
}
//----------------------------------------------------------------------------
StringTree* ConvexRegionManager::SaveStrings ()
{
    // TO DO.  Finish implementation.
    StringTree* pkTree = new StringTree(1,0,1,0);
    pkTree->SetString(0,MakeString(&ms_kRTTI,GetName()));
    pkTree->SetChild(0,BspNode::SaveStrings());
    return pkTree;
}
Exemple #3
0
//----------------------------------------------------------------------------
StringTree* Image::SaveStrings ()
{
    StringTree* pkTree = new StringTree(4,0,1,0);

    // strings
    pkTree->SetString(0,MakeString(&ms_kRTTI,GetName()));

    switch ( m_eType )
    {
    case IT_RGBA4444:
        pkTree->SetString(1,MakeString("type = RGBA4444"));
        break;
    case IT_RGB888:
        pkTree->SetString(1,MakeString("type = RGB888"));
        break;
    case IT_RGBA5551:
        pkTree->SetString(1,MakeString("type = RGBA5551"));
        break;
    case IT_RGBA8888:
        pkTree->SetString(1,MakeString("type = RGBA8888"));
        break;
    default:  // IT_QUANTITY
        break;
    }

    pkTree->SetString(2,MakeString("width =",m_iWidth));
    pkTree->SetString(3,MakeString("height =",m_iHeight));

    // children
    pkTree->SetChild(0,Object::SaveStrings());

    return pkTree;
}
//----------------------------------------------------------------------------
StringTree* BezierCylinder2::SaveStrings ()
{
    StringTree* pkTree = new StringTree(1,0,1,0);

    // strings
    pkTree->SetString(0,MakeString(&ms_kRTTI,GetName()));

    // children
    pkTree->SetChild(0,BezierCylinder::SaveStrings());

    return pkTree;
}
//----------------------------------------------------------------------------
StringTree* BezierCylinder::SaveStrings ()
{
    StringTree* pkTree = new StringTree(2,0,1,0);

    // strings
    pkTree->SetString(0,MakeString(&ms_kRTTI,GetName()));
    pkTree->SetString(1,MakeString("cyln level =",m_iCylinderLevel));

    // children
    pkTree->SetChild(0,BezierPatch::SaveStrings());

    return pkTree;
}
//----------------------------------------------------------------------------
StringTree* DirectionalLight::SaveStrings ()
{
    StringTree* pkTree = new StringTree(2,0,1,0);

    // strings
    pkTree->SetString(0,MakeString(&ms_kRTTI,GetName()));
    pkTree->SetString(1,MakeString("direction =",m_kDirection));

    // children
    pkTree->SetChild(0,Light::SaveStrings());

    return pkTree;
}
//----------------------------------------------------------------------------
StringTree* DitherState::SaveStrings ()
{
    StringTree* pkTree = new StringTree(2,0,1,0);

    // strings
    pkTree->SetString(0,MakeString(&ms_kRTTI,GetName()));
    pkTree->SetString(1,MakeString("enabled =",m_bEnabled));

    // children
    pkTree->SetChild(0,RenderState::SaveStrings());

    return pkTree;
}
Exemple #8
0
//----------------------------------------------------------------------------
StringTree* LightNode::SaveStrings ()
{
    int iCQuantity = ( m_spkLight ? 2 : 1 );
    StringTree* pkTree = new StringTree(1,0,iCQuantity,0);

    // strings
    pkTree->SetString(0,MakeString(&ms_kRTTI,GetName()));

    // children
    pkTree->SetChild(0,Spatial::SaveStrings());

    if ( m_spkLight )
        pkTree->SetChild(1,m_spkLight->SaveStrings());

    return pkTree;
}
Exemple #9
0
int main(void)
{
	StringTree * binaryTree = new StringTree();
	insertBinaryTreeInput("..\\input\\insert.txt", binaryTree);
	A4BinaryTreeIterator<string, BinaryTreeNode> btItr = binaryTree->geta4Iterator();
	generateBinarySearchTreeReportOutput("..\\reports\\01-bst-initial-forward.txt",
		"BINARY SEARCH TREE - INITIAL INPUT - FORWARD", btItr, false, true, false);
	generateBinarySearchTreeReportOutput("..\\reports\\02-bst-initial-backward.txt",
		"BINARY SEARCH TREE - INITIAL INPUT - BACKWARD", btItr, false, false, false);

	removeBinaryTreeEntries(binaryTree);

	generateBinarySearchTreeReportOutput("..\\reports\\03-bst-deletion-forward.txt",
		"BINARY SEARCH TREE - AFTER REMOVAL - FORWARD", btItr, false, true, false);
	generateBinarySearchTreeReportOutput("..\\reports\\04-bst-deletion-backward.txt",
		"BINARY SEARCH TREE - AFTER REMOVAL - BACKWARD", btItr, false, false, false);

	generateBinarySearchTreeReportOutput("..\\reports\\05-bst-hierarchy-diagram.txt",
		"BINARY SEARCH TREE - HIERARCHICAL VIEW", btItr, true, false, true);

	delete binaryTree;

	StringAvlTree * avlTree = new StringAvlTree();
	insertBinaryTreeInput("..\\input\\insert.txt", (StringTree *)avlTree);
	A4AvlTreeIterator<string> avlItr = avlTree->geta4Iterator();
	generateBinarySearchTreeReportOutput("..\\reports\\06-avl-initial-forward.txt",
		"AVL BINARY TREE - INITIAL INPUT - FORWARD", avlItr, true, true, false, true);
	generateBinarySearchTreeReportOutput("..\\reports\\07-avl-initial-backward.txt",
		"AVL BINARY TREE - INITIAL INPUT - BACKWARD", avlItr, true, false, false, true);

	removeBinaryTreeEntries((StringTree *)avlTree);

	generateBinarySearchTreeReportOutput("..\\reports\\08-avl-deletion-forward.txt",
		"AVL BINARY TREE - AFTER REMOVAL - FORWARD", avlItr, true, true, false, true);
	generateBinarySearchTreeReportOutput("..\\reports\\09-avl-deletion-backward.txt",
		"AVL BINARY TREE - AFTER REMOVAL - BACKWARD", avlItr, true, false, false, true);

	generateBinarySearchTreeReportOutput("..\\reports\\10-avl-hierarchy-diagram.txt",
		"AVL BINARY TREE - HIERARCHICAL VIEW", avlItr, true, false, true, false);

	
	delete avlTree;

	return 0;
}
//----------------------------------------------------------------------------
StringTree* MaterialState::SaveStrings ()
{
    StringTree* pkTree = new StringTree(7,0,1,0);

    // strings
    pkTree->SetString(0,MakeString(&ms_kRTTI,GetName()));
    pkTree->SetString(1,MakeString("emissive =",m_kEmissive));
    pkTree->SetString(2,MakeString("ambient =",m_kAmbient));
    pkTree->SetString(3,MakeString("diffuse =",m_kDiffuse));
    pkTree->SetString(4,MakeString("specular =",m_kSpecular));
    pkTree->SetString(5,MakeString("shininess =",m_fShininess));
    pkTree->SetString(6,MakeString("alpha =",m_fAlpha));

    // children
    pkTree->SetChild(0,RenderState::SaveStrings());

    return pkTree;
}
Exemple #11
0
//----------------------------------------------------------------------------
StringTree* Object::SaveStrings ()
{
    int iCQuantity = ( m_spkControl ? 1 : 0 );
    StringTree* pkTree = new StringTree(4,0,iCQuantity,0);

    // strings
    pkTree->SetString(0,MakeString(&ms_kRTTI,GetName()));
    pkTree->SetString(1,MakeString("this =",this));
    pkTree->SetString(2,MakeString("ID   =",m_uiID));
    pkTree->SetString(3,MakeString("refs =",m_uiReferences));

    // children
    if ( m_spkControl )
    {
        Controller* pkControl = WmlSmartPointerCast(Controller,m_spkControl);
        iCQuantity = 0;
        while ( pkControl )
        {
            iCQuantity++;
            pkControl = pkControl->GetNext();
        }

        StringTree* pkCTree = new StringTree(1,0,iCQuantity,0);
        pkTree->SetChild(0,pkCTree);
        pkCTree->SetString(0,MakeString("controllers"));
        int iSlot = 0;
        pkControl = WmlSmartPointerCast(Controller,m_spkControl);
        while ( pkControl )
        {
            pkCTree->SetChild(iSlot++,pkControl->SaveStrings());
            pkControl = pkControl->GetNext();
        }
    }

    return pkTree;
}
int main() {
	StringTree st;
	string s1 = { 'a', 'b', '\0' };
	string s2 = { 'D', 'b', 's', 'a', '\0' };
	string s3 = { 'z', 'B', 'a', 'B', 'a', 'B', '\0' };
	string s4 = { 'c', 'b', '\0' };
	string s5 = { '4', 'b', '\0' };
	st.insert(s1);
	st.insert(s2);
	st.insert(s3);
	st.insert(s4);
	st.insert(s1);
	st.insert(s5);
	printf("%s\n", st.exists(s1) ? "t" : "f");
	printf("%c - %i\n", s1[0], st.count(s1[0]));
	printf("%c - %i\n", s2[0], st.count(s2[0]));
	printf("%c - %i\n", s3[0], st.count(s3[0]));
	printf("%c - %i\n", s4[0], st.count(s4[0]));
	printf("%c - %i\n", s5[0], st.count(s5[0]));
	return 0;
};
//----------------------------------------------------------------------------
StringTree* VertexColorState::SaveStrings ()
{
    StringTree* pkTree = new StringTree(3,0,1,0);

    // strings
    pkTree->SetString(0,MakeString(&ms_kRTTI,GetName()));

    switch ( m_eSource )
    {
    case SM_IGNORE:
        pkTree->SetString(1,MakeString("source = IGNORE"));
        break;
    case SM_EMISSIVE:
        pkTree->SetString(1,MakeString("source = EMISSIVE"));
        break;
    case SM_DIFFUSE:
        pkTree->SetString(1,MakeString("source = DIFFUSE"));
        break;
    default:  // SM_QUANTITY
        break;
    };

    switch ( m_eLighting )
    {
    case LM_EMISSIVE:
        pkTree->SetString(2,MakeString("lighting = EMISSIVE"));
        break;
    case LM_DIFFUSE:
        pkTree->SetString(2,MakeString("lighting = DIFFUSE"));
        break;
    default:  // LM_QUANTITY
        break;
    }

    // children
    pkTree->SetChild(0,RenderState::SaveStrings());

    return pkTree;
}
Exemple #14
0
//----------------------------------------------------------------------------
StringTree* Polyline::SaveStrings ()
{
    StringTree* pkTree = new StringTree(4,0,1,0);

    // strings
    pkTree->SetString(0,MakeString(&ms_kRTTI,GetName()));
    pkTree->SetString(1,MakeString("closed =",m_bClosed));
    pkTree->SetString(2,MakeString("active quantity =",m_iActiveQuantity));
    pkTree->SetString(3,MakeString("contiguous =",m_bContiguous));

    // children
    pkTree->SetChild(0,Geometry::SaveStrings());

    return pkTree;
}
Exemple #15
0
//----------------------------------------------------------------------------
StringTree* Controller::SaveStrings ()
{
    StringTree* pkTree = new StringTree(5,0,1,0);

    // strings
    pkTree->SetString(0,MakeString(&ms_kRTTI,GetName()));
    pkTree->SetString(1,MakeString("min time =",m_fMinTime));
    pkTree->SetString(2,MakeString("max time =",m_fMaxTime));
    pkTree->SetString(3,MakeString("phase =",m_fPhase));
    pkTree->SetString(4,MakeString("frequency =",m_fFrequency));

    // children
    pkTree->SetChild(0,Object::SaveStrings());

    // Object will iterate over controllers to save strings

    return pkTree;
}
Exemple #16
0
//----------------------------------------------------------------------------
StringTree* Texture::SaveStrings ()
{
    StringTree* pkTree = new StringTree(26,0,2,0);

    // strings
    pkTree->SetString(0,MakeString(&ms_kRTTI,GetName()));

    switch ( m_eCorrection )
    {
    case CM_AFFINE:
        pkTree->SetString(1,MakeString("correction = AFFINE"));
        break;
    case CM_PERSPECTIVE:
        pkTree->SetString(1,MakeString("correction = PERSPECTIVE"));
        break;
    default:  // CM_QUANTITY
        break;
    };

    switch ( m_eApply )
    {
    case AM_REPLACE:
        pkTree->SetString(2,MakeString("apply = REPLACE"));
        break;
    case AM_DECAL:
        pkTree->SetString(2,MakeString("apply = DECAL"));
        break;
    case AM_MODULATE:
        pkTree->SetString(2,MakeString("apply = MODULATE"));
        break;
    case AM_BLEND:
        pkTree->SetString(2,MakeString("apply = BLEND"));
        break;
    case AM_ADD:
        pkTree->SetString(2,MakeString("apply = ADD"));
        break;
    case AM_COMBINE:
        pkTree->SetString(2,MakeString("apply = COMBINE"));
        break;
    default:  // AM_QUANTITY
        break;
    };

    switch ( m_eCombineFuncRGB )
    {
    case ACF_REPLACE:
        pkTree->SetString(3,MakeString("CombFuncRGB = REPLACE"));
        break;
    case ACF_MODULATE:
        pkTree->SetString(3,MakeString("CombFuncRGB = MODULATE"));
        break;
    case ACF_ADD:
        pkTree->SetString(3,MakeString("CombFuncRGB = ADD"));
        break;
    case ACF_ADD_SIGNED:
        pkTree->SetString(3,MakeString("CombFuncRGB = ADD_SIGNED"));
        break;
    case ACF_SUBTRACT:
        pkTree->SetString(3,MakeString("CombFuncRGB = SUBTRACT"));
        break;
    case ACF_INTERPOLATE:
        pkTree->SetString(3,MakeString("CombFuncRGB = INTERPOLATE"));
        break;
    case ACF_DOT3_RGB:
        pkTree->SetString(3,MakeString("CombFuncRGB = DOT3_RGB"));
        break;
    case ACF_DOT3_RGBA:
        pkTree->SetString(3,MakeString("CombFuncRGB = DOT3_RGBA"));
        break;
    default:  // ACF_QUANTITY
        break;
    }

    switch ( m_eCombineFuncAlpha )
    {
    case ACF_REPLACE:
        pkTree->SetString(4,MakeString("CombineFuncAlpha = REPLACE"));
        break;
    case ACF_MODULATE:
        pkTree->SetString(4,MakeString("CombineFuncAlpha = MODULATE"));
        break;
    case ACF_ADD:
        pkTree->SetString(4,MakeString("CombineFuncAlpha = ADD"));
        break;
    case ACF_ADD_SIGNED:
        pkTree->SetString(4,MakeString("CombineFuncAlpha = ADD_SIGNED"));
        break;
    case ACF_SUBTRACT:
        pkTree->SetString(4,MakeString("CombineFuncAlpha = SUBTRACT"));
        break;
    case ACF_INTERPOLATE:
        pkTree->SetString(4,MakeString("CombineFuncAlpha = INTERPOLATE"));
        break;
    case ACF_DOT3_RGB:
        pkTree->SetString(4,MakeString("CombineFuncAlpha = DOT3_RGB"));
        break;
    case ACF_DOT3_RGBA:
        pkTree->SetString(4,MakeString("CombineFuncAlpha = DOT3_RGBA"));
        break;
    default:  // ACF_QUANTITY
        break;
    }

    switch ( m_eCombineSrc0RGB )
    {
    case ACS_TEXTURE:
        pkTree->SetString(5,MakeString("CombineSrc0RGB = TEXTURE"));
        break;
    case ACS_PRIMARY_COLOR:
        pkTree->SetString(5,MakeString("CombineSrc0RGB = PRIMARY_COLOR"));
        break;
    case ACS_CONSTANT:
        pkTree->SetString(5,MakeString("CombineSrc0RGB = CONSTANT"));
        break;
    case ACS_PREVIOUS:
        pkTree->SetString(5,MakeString("CombineSrc0RGB = PREVIOUS"));
        break;
    default:  // ACS_QUANTITY
        break;
    }

    switch ( m_eCombineSrc1RGB )
    {
    case ACS_TEXTURE:
        pkTree->SetString(6,MakeString("CombineSrc1RGB = TEXTURE"));
        break;
    case ACS_PRIMARY_COLOR:
        pkTree->SetString(6,MakeString("CombineSrc1RGB = PRIMARY_COLOR"));
        break;
    case ACS_CONSTANT:
        pkTree->SetString(6,MakeString("CombineSrc1RGB = CONSTANT"));
        break;
    case ACS_PREVIOUS:
        pkTree->SetString(6,MakeString("CombineSrc1RGB = PREVIOUS"));
        break;
    default:  // ACS_QUANTITY
        break;
    }

    switch ( m_eCombineSrc2RGB )
    {
    case ACS_TEXTURE:
        pkTree->SetString(7,MakeString("CombineSrc1RGB = TEXTURE"));
        break;
    case ACS_PRIMARY_COLOR:
        pkTree->SetString(7,MakeString("CombineSrc1RGB = PRIMARY_COLOR"));
        break;
    case ACS_CONSTANT:
        pkTree->SetString(7,MakeString("CombineSrc1RGB = CONSTANT"));
        break;
    case ACS_PREVIOUS:
        pkTree->SetString(7,MakeString("CombineSrc1RGB = PREVIOUS"));
        break;
    default:  // ACS_QUANTITY
        break;
    }

    switch ( m_eCombineSrc0Alpha )
    {
    case ACS_TEXTURE:
        pkTree->SetString(8,MakeString("CombineSrc0Alpha = TEXTURE"));
        break;
    case ACS_PRIMARY_COLOR:
        pkTree->SetString(8,MakeString("CombineSrc0Alpha = PRIMARY_COLOR"));
        break;
    case ACS_CONSTANT:
        pkTree->SetString(8,MakeString("CombineSrc0Alpha = CONSTANT"));
        break;
    case ACS_PREVIOUS:
        pkTree->SetString(8,MakeString("CombineSrc0Alpha = PREVIOUS"));
        break;
    default:  // ACS_QUANTITY
        break;
    }

    switch ( m_eCombineSrc1Alpha )
    {
    case ACS_TEXTURE:
        pkTree->SetString(9,MakeString("CombineSrc1Alpha = TEXTURE"));
        break;
    case ACS_PRIMARY_COLOR:
        pkTree->SetString(9,MakeString("CombineSrc1Alpha = PRIMARY_COLOR"));
        break;
    case ACS_CONSTANT:
        pkTree->SetString(9,MakeString("CombineSrc1Alpha = CONSTANT"));
        break;
    case ACS_PREVIOUS:
        pkTree->SetString(9,MakeString("CombineSrc1Alpha = PREVIOUS"));
        break;
    default:  // ACS_QUANTITY
        break;
    }

    switch ( m_eCombineSrc2Alpha )
    {
    case ACS_TEXTURE:
        pkTree->SetString(10,MakeString("CombineSrc2Alpha = TEXTURE"));
        break;
    case ACS_PRIMARY_COLOR:
        pkTree->SetString(10,MakeString("CombineSrc2Alpha = PRIMARY_COLOR"));
        break;
    case ACS_CONSTANT:
        pkTree->SetString(10,MakeString("CombineSrc2Alpha = CONSTANT"));
        break;
    case ACS_PREVIOUS:
        pkTree->SetString(10,MakeString("CombineSrc2Alpha = PREVIOUS"));
        break;
    default:  // ACS_QUANTITY
        break;
    }

    switch ( m_eCombineOp0RGB )
    {
    case ACO_SRC_COLOR:
        pkTree->SetString(11,MakeString("CombineOp0RGB = SRC_COLOR"));
        break;
    case ACO_ONE_MINUS_SRC_COLOR:
        pkTree->SetString(11,
            MakeString("CombineOp0RGB = ONE_MINUS_SRC_COLOR"));
        break;
    case ACO_SRC_ALPHA:
        pkTree->SetString(11,MakeString("CombineOp0RGB = SRC_ALPHA"));
        break;
    case ACO_ONE_MINUS_SRC_ALPHA:
        pkTree->SetString(11,
            MakeString("CombineOp0RGB = ONE_MINUS_SRC_ALPHA"));
        break;
    default:  // ACO_QUANTITY
        break;
    }

    switch ( m_eCombineOp1RGB )
    {
    case ACO_SRC_COLOR:
        pkTree->SetString(12,MakeString("CombineOp1RGB = SRC_COLOR"));
        break;
    case ACO_ONE_MINUS_SRC_COLOR:
        pkTree->SetString(12,
            MakeString("CombineOp1RGB = ONE_MINUS_SRC_COLOR"));
        break;
    case ACO_SRC_ALPHA:
        pkTree->SetString(12,MakeString("CombineOp1RGB = SRC_ALPHA"));
        break;
    case ACO_ONE_MINUS_SRC_ALPHA:
        pkTree->SetString(12,
            MakeString("CombineOp1RGB = ONE_MINUS_SRC_ALPHA"));
        break;
    default:  // ACO_QUANTITY
        break;
    }

    switch ( m_eCombineOp2RGB )
    {
    case ACO_SRC_COLOR:
        pkTree->SetString(13,MakeString("CombineOp2RGB = SRC_COLOR"));
        break;
    case ACO_ONE_MINUS_SRC_COLOR:
        pkTree->SetString(13,
            MakeString("CombineOp2RGB = ONE_MINUS_SRC_COLOR"));
        break;
    case ACO_SRC_ALPHA:
        pkTree->SetString(13,MakeString("CombineOp2RGB = SRC_ALPHA"));
        break;
    case ACO_ONE_MINUS_SRC_ALPHA:
        pkTree->SetString(13,
            MakeString("CombineOp2RGB = ONE_MINUS_SRC_ALPHA"));
        break;
    default:  // ACO_QUANTITY
        break;
    }

    switch ( m_eCombineOp0Alpha )
    {
    case ACO_SRC_COLOR:
        pkTree->SetString(14,MakeString("CombineOp0Alpha = SRC_COLOR"));
        break;
    case ACO_ONE_MINUS_SRC_COLOR:
        pkTree->SetString(14,
            MakeString("CombineOp0Alpha = ONE_MINUS_SRC_COLOR"));
        break;
    case ACO_SRC_ALPHA:
        pkTree->SetString(14,MakeString("CombineOp0Alpha = SRC_ALPHA"));
        break;
    case ACO_ONE_MINUS_SRC_ALPHA:
        pkTree->SetString(14,
            MakeString("CombineOp0Alpha = ONE_MINUS_SRC_ALPHA"));
        break;
    default:  // ACO_QUANTITY
        break;
    }

    switch ( m_eCombineOp1Alpha )
    {
    case ACO_SRC_COLOR:
        pkTree->SetString(15,MakeString("CombineOp1Alpha = SRC_COLOR"));
        break;
    case ACO_ONE_MINUS_SRC_COLOR:
        pkTree->SetString(15,
            MakeString("CombineOp1Alpha = ONE_MINUS_SRC_COLOR"));
        break;
    case ACO_SRC_ALPHA:
        pkTree->SetString(15,MakeString("CombineOp1Alpha = SRC_ALPHA"));
        break;
    case ACO_ONE_MINUS_SRC_ALPHA:
        pkTree->SetString(15,
            MakeString("CombineOp1Alpha = ONE_MINUS_SRC_ALPHA"));
        break;
    default:  // ACO_QUANTITY
        break;
    }

    switch ( m_eCombineOp2Alpha )
    {
    case ACO_SRC_COLOR:
        pkTree->SetString(16,MakeString("CombineOp2Alpha = SRC_COLOR"));
        break;
    case ACO_ONE_MINUS_SRC_COLOR:
        pkTree->SetString(16,
            MakeString("CombineOp2Alpha = ONE_MINUS_SRC_COLOR"));
        break;
    case ACO_SRC_ALPHA:
        pkTree->SetString(16,MakeString("CombineOp2Alpha = SRC_ALPHA"));
        break;
    case ACO_ONE_MINUS_SRC_ALPHA:
        pkTree->SetString(16,
            MakeString("CombineOp2Alpha = ONE_MINUS_SRC_ALPHA"));
        break;
    default:  // ACO_QUANTITY
        break;
    }

    switch ( m_eCombineScaleRGB )
    {
    case ACSC_ONE:
        pkTree->SetString(17,MakeString("CombineScaleRGB = ONE"));
        break;
    case ACSC_TWO:
        pkTree->SetString(17,MakeString("CombineScaleRGB = TWO"));
        break;
    case ACSC_FOUR:
        pkTree->SetString(17,MakeString("CombineScaleRGB = FOUR"));
        break;
    default:  // ACSC_QUANTITY
        break;
    }

    switch ( m_eCombineScaleAlpha )
    {
    case ACSC_ONE:
        pkTree->SetString(18,MakeString("CombineScaleAlpha = ONE"));
        break;
    case ACSC_TWO:
        pkTree->SetString(18,MakeString("CombineScaleAlpha = TWO"));
        break;
    case ACSC_FOUR:
        pkTree->SetString(18,MakeString("CombineScaleAlpha = FOUR"));
        break;
    default:  // ACSC_QUANTITY
        break;
    }

    switch ( m_eWrap )
    {
    case WM_CLAMP_S_CLAMP_T:
        pkTree->SetString(19,MakeString("uv mode = CLAMP_S_CLAMP_T"));
        break;
    case WM_CLAMP_S_WRAP_T:
        pkTree->SetString(19,MakeString("uv mode = CLAMP_S_WRAP_T"));
        break;
    case WM_WRAP_S_CLAMP_T:
        pkTree->SetString(19,MakeString("uv mode = WRAP_S_CLAMP_T"));
        break;
    case WM_WRAP_S_WRAP_T:
        pkTree->SetString(19,MakeString("uv mode = WRAP_S_WRAP_T"));
        break;
    case WM_CLAMP_BORDER_S_CLAMP_BORDER_T:
        pkTree->SetString(19,
            MakeString("uv mode = CLAMP_BORDER_S_CLAMP_BORDER_T"));
        break;
    default:  // WM_QUANTITY
        break;
    };

    switch ( m_eFilter )
    {
    case FM_NEAREST:
        pkTree->SetString(20,MakeString("filter = NEAREST"));
        break;
    case FM_LINEAR:
        pkTree->SetString(20,MakeString("filter = LINEAR"));
        break;
    default:  // FM_QUANTITY
        break;
    };

    switch ( m_eMipmap )
    {
    case MM_NONE:
        pkTree->SetString(21,MakeString("mipmap = NONE"));
        break;
    case MM_NEAREST:
        pkTree->SetString(21,MakeString("mipmap = NEAREST"));
        break;
    case MM_LINEAR:
        pkTree->SetString(21,MakeString("mipmap = LINEAR"));
        break;
    case MM_NEAREST_NEAREST:
        pkTree->SetString(21,MakeString("mipmap = NEAREST_NEAREST"));
        break;
    case MM_NEAREST_LINEAR:
        pkTree->SetString(21,MakeString("mipmap = NEAREST_LINEAR"));
        break;
    case MM_LINEAR_NEAREST:
        pkTree->SetString(21,MakeString("mipmap = LINEAR_NEAREST"));
        break;
    case MM_LINEAR_LINEAR:
        pkTree->SetString(21,MakeString("mipmap = LINEAR_LINEAR"));
        break;
    default:  // MM_QUANTITY
        break;
    }

    switch ( m_eEnvmap )
    {
    case EM_NONE:
        pkTree->SetString(22,MakeString("envmap = NONE"));
        break;
    case EM_IGNORE:
        pkTree->SetString(22,MakeString("envmap = IGNORE"));
        break;
    case EM_SPHERE:
        pkTree->SetString(22,MakeString("envmap = SPHERE"));
        break;
    default:  // EM_QUANTITY
        break;
    }

    pkTree->SetString(23,MakeString("blend color =",m_kBlendColor));
    pkTree->SetString(24,MakeString("priority =",m_fPriority));
    pkTree->SetString(25,MakeString("border color =",m_kBorderColor));

    // children
    pkTree->SetChild(0,Object::SaveStrings());
    pkTree->SetChild(1,m_spkImage->SaveStrings());

    return pkTree;
}
Exemple #17
0
//----------------------------------------------------------------------------
StringTree* AlphaState::SaveStrings ()
{
    StringTree* pkTree = new StringTree(6,0,1,0);

    // strings
    pkTree->SetString(0,MakeString(&ms_kRTTI,GetName()));
    pkTree->SetString(1,MakeString("blend =",m_bBlendEnabled));

    switch ( m_eSrcBlend )
    {
    case SBF_ZERO:
        pkTree->SetString(2,MakeString("src blend = ZERO"));
        break;
    case SBF_ONE:
        pkTree->SetString(2,MakeString("src blend = ONE"));
        break;
    case SBF_DST_COLOR:
        pkTree->SetString(2,MakeString("src blend = DST_COLOR"));
        break;
    case SBF_ONE_MINUS_DST_COLOR:
        pkTree->SetString(2,MakeString("src blend = ONE_MINUS_DST_COLOR"));
        break;
    case SBF_SRC_ALPHA:
        pkTree->SetString(2,MakeString("src blend = SRC_ALPHA"));
        break;
    case SBF_ONE_MINUS_SRC_ALPHA:
        pkTree->SetString(2,MakeString("src blend = ONE_MINUS_SRC_ALPHA"));
        break;
    case SBF_DST_ALPHA:
        pkTree->SetString(2,MakeString("src blend = DST_ALPHA"));
        break;
    case SBF_ONE_MINUS_DST_ALPHA:
        pkTree->SetString(2,MakeString("src blend = ONE_MINUS_DST_ALPHA"));
        break;
    case SBF_SRC_ALPHA_SATURATE:
        pkTree->SetString(2,MakeString("src blend = SRC_ALPHA_SATURATE"));
        break;
    default:  // SBF_QUANTITY
        break;
    }

    switch ( m_eDstBlend )
    {
    case DBF_ZERO:
        pkTree->SetString(3,MakeString("dst blend = ZERO"));
        break;
    case DBF_ONE:
        pkTree->SetString(3,MakeString("dst blend = ONE"));
        break;
    case DBF_SRC_COLOR:
        pkTree->SetString(3,MakeString("dst blend = DST_COLOR"));
        break;
    case DBF_ONE_MINUS_SRC_COLOR:
        pkTree->SetString(3,MakeString("dst blend = ONE_MINUS_DST_COLOR"));
        break;
    case DBF_SRC_ALPHA:
        pkTree->SetString(3,MakeString("dst blend = SRC_ALPHA"));
        break;
    case DBF_ONE_MINUS_SRC_ALPHA:
        pkTree->SetString(3,MakeString("dst blend = ONE_MINUS_SRC_ALPHA"));
        break;
    case DBF_DST_ALPHA:
        pkTree->SetString(3,MakeString("dst blend = DST_ALPHA"));
        break;
    case DBF_ONE_MINUS_DST_ALPHA:
        pkTree->SetString(3,MakeString("dst blend = ONE_MINUS_DST_ALPHA"));
        break;
    default:  // DBF_QUANTITY
        break;
    }

    pkTree->SetString(1,MakeString("test =",m_bTestEnabled));

    switch ( m_eTest )
    {
    case TF_NEVER:
        pkTree->SetString(4,MakeString("test func = NEVER"));
        break;
    case TF_LESS:
        pkTree->SetString(4,MakeString("test func = LESS"));
        break;
    case TF_EQUAL:
        pkTree->SetString(4,MakeString("test func = EQUAL"));
        break;
    case TF_LEQUAL:
        pkTree->SetString(4,MakeString("test func = LEQUAL"));
        break;
    case TF_GREATER:
        pkTree->SetString(4,MakeString("test func = GREATER"));
        break;
    case TF_NOTEQUAL:
        pkTree->SetString(4,MakeString("test func = NOTEQUAL"));
        break;
    case TF_GEQUAL:
        pkTree->SetString(4,MakeString("test func = GEQUAL"));
        break;
    case TF_ALWAYS:
        pkTree->SetString(4,MakeString("test func = ALWAYS"));
        break;
    default:  // TF_QUANTITY
        break;
    }

    pkTree->SetString(5,MakeString("test ref =",m_fReference));

    // children
    pkTree->SetChild(0,RenderState::SaveStrings());

    return pkTree;
}
void ProjLoad_fillProjectVarsInSourceFiles(StringTree&sourceTree, const String&templateSrcRoot, const String&projectSrcRoot, const String&subFolder,
        const String&projectName, const String&authorName, const String&projectNameAsIdentifier,
        const String&executableName, const String& productName)
{
    ArrayList<String> members = sourceTree.getMembers();

    String templateSrcCurrentFolder = templateSrcRoot;
    String projectSrcCurrentFolder = projectSrcRoot;
    if(!subFolder.equals(""))
    {
        templateSrcCurrentFolder += (String)"/" + subFolder;
        projectSrcCurrentFolder += (String)"/" + subFolder;
    }

    for(int i=0; i<members.size(); i++)
    {
        String filename = members.get(i);
        String filepath = templateSrcCurrentFolder + '/' + filename;

        String fileContents;
        bool loadedFile = FileTools::loadFileIntoString(filepath, fileContents);

        if(!loadedFile)
        {
            showSimpleMessageBox("Error loading ProjectData", (String)"Error loading file " + filepath);
        }
        else
        {
            ProjLoad_fillProjectVarsInString(fileContents, projectName, authorName, projectNameAsIdentifier, executableName, productName);

            String newFilename = filename;
            ProjLoad_fillProjectVarsInString(newFilename, projectName, authorName, projectNameAsIdentifier, executableName, productName);

            String saveFile = newFilename;

            //rename file if necessary
            bool couldRename = false;
            int matchChecks = 0;
            do
            {
                couldRename = sourceTree.renameMember(filename, saveFile);
                if(!couldRename)
                {
                    matchChecks++;
                    saveFile = newFilename + " (" + matchChecks + ')';
                }
            }
            while (!couldRename);

            bool success = FileTools::writeStringToFile(projectSrcCurrentFolder + '/' + saveFile, fileContents);
            if(!success)
            {

                showSimpleMessageBox("Error creating new project", (String)"Error creating file " + projectSrcCurrentFolder + '/' + saveFile);
            }
        }
    }

    ArrayList<String> branchNames = sourceTree.getBranchNames();

    for(int i=0; i<branchNames.size(); i++)
    {
        String branchname = branchNames.get(i);
        String branchpath = templateSrcCurrentFolder + '/' + branchname;

        String newBranchname = branchname;
        ProjLoad_fillProjectVarsInString(newBranchname, projectName, authorName, projectNameAsIdentifier, executableName, productName);

        String saveFolder = newBranchname;

        //rename file if necessary
        bool couldRename = false;
        int matchChecks = 0;
        do
        {
            couldRename = sourceTree.renameBranch(branchname, saveFolder);
            if(!couldRename)
            {
                matchChecks++;
                saveFolder = newBranchname + " (" + matchChecks + ')';
            }
        }
        while (!couldRename);

        bool success = FileTools::createDirectory(projectSrcCurrentFolder + '/' + saveFolder);
        if(success)
        {
            StringTree*tree = sourceTree.getBranch(saveFolder);
            ProjLoad_fillProjectVarsInSourceFiles(*tree, templateSrcRoot, projectSrcRoot, subFolder + '/' + saveFolder,
                                                  projectName, authorName, projectNameAsIdentifier, executableName, productName);
        }
        else
        {
            showSimpleMessageBox("Error creating new project", (String)"Error creating folder " + projectSrcCurrentFolder + '/' + saveFolder);
        }
    }
}
void ProjLoad_fillProjectVarsInResourceFiles(StringTree&resourceTree, const String&templateResRoot, const String&projectResRoot, const String&subFolder,
        const String&projectName, const String&authorName, const String&projectNameAsIdentifier,
        const String&executableName, const String& productName)
{
    ArrayList<String> members = resourceTree.getMembers();

    String templateResCurrentFolder = templateResRoot + '/' + subFolder;
    String projectResCurrentFolder = projectResRoot + '/' + subFolder;

    for(int i=0; i<members.size(); i++)
    {
        String filename = members.get(i);
        String filepath = templateResCurrentFolder + '/' + filename;

        String newFilename = filename;
        ProjLoad_fillProjectVarsInString(newFilename, projectName, authorName, projectNameAsIdentifier, executableName, productName);

        String saveFile = newFilename;

        //rename file if necessary
        bool couldRename = false;
        int matchChecks = 0;
        do
        {
            couldRename = resourceTree.renameMember(filename, saveFile);
            if(!couldRename)
            {
                matchChecks++;
                saveFile = newFilename + " (" + matchChecks + ')';
            }
        }
        while (!couldRename);

        bool success = FileTools::copyFile(filepath, projectResCurrentFolder + '/' + saveFile);
        if(!success)
        {

            showSimpleMessageBox("Error creating new project", (String)"Error copying file " + filepath + " to destination " + projectResCurrentFolder + '/' + saveFile);
        }
    }

    ArrayList<String> branchNames = resourceTree.getBranchNames();

    for(int i=0; i<branchNames.size(); i++)
    {
        String branchname = branchNames.get(i);
        String branchpath = templateResCurrentFolder + '/' + branchname;

        String newBranchname = branchname;
        ProjLoad_fillProjectVarsInString(newBranchname, projectName, authorName, projectNameAsIdentifier, executableName, productName);

        String saveFolder = newBranchname;

        //rename file if necessary
        bool couldRename = false;
        int matchChecks = 0;
        do
        {
            couldRename = resourceTree.renameBranch(branchname, saveFolder);
            if(!couldRename)
            {
                matchChecks++;
                saveFolder = newBranchname + " (" + matchChecks + ')';
            }
        }
        while (!couldRename);

        bool success = FileTools::createDirectory(projectResCurrentFolder + '/' + saveFolder);
        if(success)
        {
            StringTree*tree = resourceTree.getBranch(saveFolder);
            ProjLoad_fillProjectVarsInResourceFiles(*tree, templateResRoot, projectResRoot, subFolder + '/' + saveFolder,
                                                    projectName, authorName, projectNameAsIdentifier, executableName, productName);
        }
        else
        {
            showSimpleMessageBox("Error creating new project", (String)"Error creating folder " + projectResCurrentFolder + '/' + saveFolder);
        }
    }
}