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

📄 land.cpp

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

Land::Land( float size, char* bmpPath ) {
	this->size = size;
	visible = true;
	ChGL::loadTexture( bmpPath, &texture, false );
}

void Land::draw() {
	if ( visible == true ) {
		glPushMatrix();
			// enableFog();
			glEnable( GL_CULL_FACE );
			glBindTexture( GL_TEXTURE_2D, texture );
			glBegin( GL_QUADS );
				glNormal3f( 0.0f, 1.0f, 0.0f );

				glTexCoord2f( 0.0f, 0.0f );
				glVertex3f( -size, 0.0f, -size );
				glTexCoord2f( 0.0f, 8.0f );
				glVertex3f( -size, 0.0f, size );
				glTexCoord2f( 8.0f, 8.0f );
				glVertex3f( size, 0.0f, size );
				glTexCoord2f( 8.0f, 0.0f );
				glVertex3f( size, 0.0f, -size );
			glEnd();
			glDisable( GL_CULL_FACE );
			// disableFog();
		glPopMatrix();
	}
}

void Land::setSize( float size ) {
	this->size = size;
}

void Land::setVisible( bool visible ) {
	this->visible = visible;
}

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

float Land::getSize() {
	return size;
}

bool Land::getVisible() {
	return visible;
}

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

Land::~Land() {
}

⌨️ 快捷键说明

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