mytree.h

来自「此文档是用vistual studio 2005 开发的用来描述3D-tree 」· C头文件 代码 · 共 80 行

H
80
字号
/*
* Copyleft (c) 2008 Lauming chen, SooChow University.
*
*
*
*/
#ifndef _3D_MyTree_
#define _3D_MyTree_

#include "Branch.h"
#include "Leaf.h"
#include "Enviroment.h"

class MyTree {
public :
	MyTree();
	MyTree( int maxBranchDepth, float maxBranchLength, float baseBranchRadius, float twist, float expand, int slices, float leafSize );
	~MyTree();
	void randomGenerate();
	void draw();
	void rebuild();
	void showGrowProcess();
	void drawBase();
	void drawBranches( int stacks, float radius, float length, float twist );
	void drawLeftBranch( float baseRadius, float topRadius, float length, int depth, int twist );
	void drawRightBranch( float baseRadius, float topRadius, float length, int depth, int twist );
	void setMaxBranchDepth( int depth );
	void setMaxBranchLength( float length );
	void setMaxBaseLength( float length );
	void setBaseBranchRadius( float radius );

	void setLeftBranchTwist( float twist );
	void setLeftBranchExpand( float expand );
	void setRightBranchTwist( float twist );
	void setRightBranchExpand( float expand );

	void setBranchSlices( int slices );
	void setLeafSize( float size );
	void setLeafVisible( bool visible );
	void setLeafShakeble( bool shakeble );

	void pauseGrow();
	void playGrow();
	int getMaxBranchDepth();

	float getLeftBranchTwist();
	float getLeftBranchExpand();
	float getRightBranchTwist();
	float getRightBranchExpand();

	int getBranchSlices();
	float getMaxBaseLength();
	float getMaxBranchLangth();
	float getBaseBranchRadius();
	float getLeafSize();
	bool isLeafVisible();
	bool isLeafShakeble();
	bool isGrowUp();
	bool isGrowing();
private :
	int maxBranchDepth;
	int currentBranchDepth;
	float maxBranchLength;
	float currentBranchLength;
	float maxBaseLength;
	float currentBaseLength;
	float baseBranchRadius;
	float currentBranchRadius;
	float leafSize;
	bool growUp;
	bool pause;
	Branch* leftBranch;
	Branch* rightBranch;
	Leaf* leaf;
	Enviroment enviroment;
	int count;
};

#endif  // _3D_MyTree_

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?