Newer
Older
cg / include / poly.h
@glproj03 glproj03 on 1 Feb 2006 1 KB added material
#ifndef _POLY_H
#define _POLY_H

#include "vec.h"
#include "spoly.h"
#include "thing.h"
#include "color.h"
#include "material.h"
#include <vector>
#include <string>

using namespace std;

class Poly : SPoly {
	private:
		std::vector<Vec*> initpoints;
		int size;
		Vec* position;
		Vec* rotation;
		Vec* center;
		Vec* normal;
		Material* material;
		float delta;
		bool drawNormals;
		float scaleFactor;

	public:
		Poly();
		Poly(std::vector<Vec*> & _points);
		Poly(std::vector<Vec*> & _points, Color _color);
		Poly(std::vector<Vec*> & _points, Material _material);
		~Poly();
		void setCenter(Vec c);
		void setCenter(Vec* c);
		Vec getInitRotation(Vec& v);
		Vec calcCenter();
		void setPosition(Vec newcenter);
		void setPosition(Vec* newcenter);
		void setRotation(Vec rot);
		void setRotation(Vec* rot);
		void rotate(Vec rot);
		void draw();
		int numPoints();
		void vardump(std::string whitespace);
		void addPoint(Vec* p);

		void setColor(Color c);
		void setColor(Color* c);
		void setMaterial(Material m);
		void setMaterial(Material* m);
		Material* getMaterial();

		void setDelta(float d);
		void showNormals();
		void hideNormals();
		void calcNormal();
		Poly* clone();
		void translate(Vec d);
		void scale(float f);
};
#endif