⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 branch.cpp

📁 此文档是用vistual studio 2005 开发的用来描述3D-tree 的生长过程
💻 CPP
字号:
#include "stdafx.h"
#include "Branch.h"
#include "ChGL.h"
#include <cmath>
#include <GL/glut.h>

Branch::Branch( int depth, float length, float twist, float expand, float radius, int slices, char* bmpPath ) {
	this->depth = depth;
	this->length = length;
	this->twist = twist;
	this->expand = expand;
	this->radius = radius;
	this->slices = slices;
	ChGL::loadTexture( bmpPath, &texture, false );
}

inline void Branch::draw( float baseRadius, float topRadius, float length ) {
	ChGL::drawCylinder( baseRadius, topRadius, length, slices );
}

Branch::~Branch() {
}

void Branch::setDepth( int depth ) {
	this->depth = depth;
}

void Branch::setSlices( int slices ) {
	this->slices = slices;
}


void Branch::setRadius( float radius ) {
	this->radius = radius;
}

void Branch::setLength( float length ) {
	this->length = length;
}

void Branch::setTwist( float twist ) {
	this->twist = twist;
}

void Branch::setExpand( float expand ) {
	this->expand = expand;
}

void Branch::setTexture( char *bmpPath ) {
	ChGL::loadTexture( bmpPath, &texture, false );
}

int Branch::getDepth() {
	return depth;
}

float Branch::getRadius() {
	return radius;
}

float Branch::getLength() {
	return length;
}

float Branch::getTwist() {
	return twist;
}

float Branch::getExpand() {
	return expand;
}

int Branch::getSlices() {
	return slices;
}

unsigned int Branch::getTexture() {
	return texture;
}

⌨️ 快捷键说明

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