branch.cpp
来自「此文档是用vistual studio 2005 开发的用来描述3D-tree 」· C++ 代码 · 共 80 行
CPP
80 行
#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 + =
减小字号Ctrl + -
显示快捷键?