Beispiel #1
0
void create_object(void)
{
    set_name("sail");
    add_id("gaff sail");
    add_id("_pirate_quest_gaff_sail_");
    set_short("A gaff sail");
    set_long("A sail with four corners and four edges.\n");
    set_weight(4);
    set_value(75);

    add_lore("Schooners are usually rigged with gaff sails, and most " +
             "square rigged vessels have a gaff sail on their aft mast " +
             "called the spanker. Above the gaff is often rigged a " +
             "triangular sail called a gaff topsail.\n",5);
    add_lore("A gaff sail is a fore-and-aft sail with four corners and " +
             "four edges. The lowest edge is called the foot and is " +
             "attached to a horizontal spar called a boom. The vertical " +
             "edge that is attached to the mast is called the luff. The " +
             "upper edge is called the head and is attached to a spar " +
             "called a gaff. The remaining edge is the leech. The corner " +
             "between the luff and the head is called the throat, between " +
             "the head and the leech is the peak, between the leech and " +
             "the foot is the clew, and the remaining corner is called " +
             "the tack.\n",10);
    set_material("canvas"); //Angelwings
}
Beispiel #2
0
void CCharShape::DrawNodes (TCharNode *node) {
    TCharNode *child;
    glPushMatrix();
	GLfloat trans[16];
	for ( int i = 0; i < 16; i++ ) {
		trans[i] = ((const double*)node->trans)[i];
	}
	glMultMatrixf (trans);

	if (node->node_name == highlight_node) highlighted = true;
	TCharMaterial *mat; 
	if (highlighted && useHighlighting) {
		mat = &Highlight;
	} else {
		if (node->mat != NULL && useMaterials) mat = node->mat; 
		else mat = &TuxDefMat;
	}

	if (node->visible == true) {
		set_material (mat->diffuse, mat->specular, mat->exp);
		DrawCharSphere (node->divisions);
	}
 
// -------------- recursive loop -------------------------------------
	child = node->child;
	while (child != NULL) {
		DrawNodes (child);
		if (child->node_name == highlight_node) highlighted = false;
		child = child->next;
	} 
// -------------------------------------------------------------------
    glPopMatrix();
} 
void CCharShape::DrawNodes (const TCharNode *node) {
	glPushMatrix();
	glMultMatrix(node->trans);

	if (node->node_name == highlight_node) highlighted = true;
	const TCharMaterial *mat;
	if (highlighted && useHighlighting) {
		mat = &Highlight;
	} else {
		if (node->mat != NULL && useMaterials) mat = node->mat;
		else mat = &TuxDefMat;
	}

	if (node->visible == true) {
		set_material (mat->diffuse, mat->specular, mat->exp);

		DrawCharSphere (node->divisions);
	}
// -------------- recursive loop -------------------------------------
	TCharNode *child = node->child;
	while (child != NULL) {
		DrawNodes (child);
		if (child->node_name == highlight_node) highlighted = false;
		child = child->next;
	}
// -------------------------------------------------------------------
	glPopMatrix();
}
Beispiel #4
0
  void open_igs(std::string const& file, gpucast::gl::material const& m)
  {
    gpucast::igs_loader loader;
    gpucast::surface_converter converter;

    bool initialized_bbox = false;

    auto nurbs_objects = loader.load(file);

    for (auto nurbs_object : nurbs_objects)
    {
      auto bezier_object = std::make_shared<gpucast::beziersurfaceobject>();
      converter.convert(nurbs_object, bezier_object);

      if (!initialized_bbox) {
        _bbox.min = bezier_object->bbox().min;
        _bbox.max = bezier_object->bbox().max;
      }
      else {
        _bbox.merge(bezier_object->bbox().min);
        _bbox.merge(bezier_object->bbox().max);
      }

      bezier_object->init();

      auto drawable = std::make_shared<gpucast::gl::bezierobject>(*bezier_object);
      drawable->set_material(m);
      drawable->rendermode(gpucast::gl::bezierobject::tesselation);
      drawable->trimming(gpucast::beziersurfaceobject::contour_kd_partition);
      drawable->tesselation_max_pixel_error(1.0);

      _objects.push_back(drawable);
    }
  }
Beispiel #5
0
void draw_object_ex(IDirect3DDevice9 *device, object *obj, BOOL trans){
	unsigned int mesh;
	if(!device) return;
	if(!obj) return;

	if(obj->update){
		vertex *dest;
		generate_normals(obj);
		IDirect3DVertexBuffer9_Lock(obj->vertexbuffer, 0, 0, (BYTE**)&dest, 0 );
		memcpy(dest,obj->vertices,sizeof(vertex)*obj->vertex_count);
		IDirect3DVertexBuffer9_Unlock(obj->vertexbuffer);
		obj->update = FALSE;
	}

	IDirect3DDevice9_SetTransform( device, D3DTS_WORLD, (D3DMATRIX*)&obj->mat );
	IDirect3DDevice9_SetStreamSource(device, 0, obj->vertexbuffer, 0, sizeof(vertex));
	IDirect3DDevice9_SetFVF(device, OBJECT_VERTEX_TYPE);

	for(mesh=0;mesh<obj->submesh_count;mesh++){
		if(obj->submeshes[mesh].mat){
			if(obj->submeshes[mesh].mat->additive==trans){
				set_material(device,obj->submeshes[mesh].mat);
				IDirect3DDevice9_SetIndices(device,obj->submeshes[mesh].indexbuffer);
				IDirect3DDevice9_DrawIndexedPrimitive(device, D3DPT_TRIANGLELIST, 0,0,obj->vertex_count, 0,obj->submeshes[mesh].triangle_count);
			}
		}else{
			if(!trans){
				IDirect3DDevice9_SetIndices(device,obj->submeshes[mesh].indexbuffer);
				IDirect3DDevice9_DrawIndexedPrimitive(device, D3DPT_TRIANGLELIST, 0,0,obj->vertex_count, 0,obj->submeshes[mesh].triangle_count);
			}
		}
	}
}
Beispiel #6
0
/* Traverses the DAG structure and draws the nodes
 */
void
traverse_dag(const SceneNode *node, ppogl::Material *mat)
{
    PP_CHECK_POINTER( node );
    gl::PushMatrix();

    gl::MultMatrix(node->trans);

    if ( node->mat != NULL ) {
        mat = node->mat;
    } 

    if ( node->isSphere == true ) {
        set_material( mat->diffuse, mat->specular, mat->getSpecularExponent() );

	    gl::CallList(get_sphere_display_list(node->sphere.divisions));
    } 

    SceneNode *child = node->child;
    while (child != NULL) {
        traverse_dag( child, mat );
        child = child->next;
    } 

    gl::PopMatrix();
} 
Beispiel #7
0
void create() {
 ::create();
   set_name("purple sweater");
   set_short("a %^BOLD%^%^MAGENTA%^purple%^RESET%^ cotton sweater");
   set_long("This sweater is made from some of the thickest cotton available in all of the lands of Merentha.  It is warm enough for the coldest of temperatures.");
   set_size("dwarf");
set_material("cloth");
   set_id(({ "sweater", "purple sweater"}));
Beispiel #8
0
void create() {
 ::create();
   set_name("purple pants");
   set_short("a pair of %^BOLD%^%^MAGENTA%^purple%^RESET%^ pants");
   set_long("Made of a thick and rugged material, these trousers look as if they will protect from cold as well as wetness.");
   set_size("dwarf");
set_material("cloth");
   set_id(({ "pants", "purple pants"}));
Beispiel #9
0
void create() {
 ::create();
   set_name("yellow sash");
   set_short("a %^BOLD%^%^YELLOW%^yellow%^RESET%^ sash of the Mountain Dwarf Guard");
   set_long("This small yellow sash has the crest of the Mountain Dwarf Guard printed in gold.  It symbolizes a cleric for the safety of the Mountain Dwarves of Diran.");
   set_size("dwarf");
set_material("cloth");
   set_id(({ "sash", "yellow sash"}));
Beispiel #10
0
void create() {
 ::create();
   set_name("grey sash");
   set_short("a grey sash of the Mountain Dwarf Guard");
   set_long("This small grey sash has the crest of the Mountain Dwarf Guard printed in gold.  It symbolizes a priest for the safety of the Mountain Dwarves of Diran.");
   set_size("dwarf");
set_material("cloth");
   set_id(({ "sash", "grey sash"}));
Beispiel #11
0
void create() {
 ::create();
   set_name("necklace");
   set_short("a %^BOLD%^%^WHITE%^diamond%^RESET%^ necklace");
   set_long("This string of diamonds has very little string showing.  There are diamonds the entire way around it.");
   set_size(0);
set_material("metal");
   set_id(({ "necklace", "diamond necklace"}));
Beispiel #12
0
void create() {
    ::create();
    set_name("shirt");
    set_short("a grey cotton shirt");
    set_long("This shirt is made of grey cotton.  It has charred edges and a few smoke-stains.");
    set_size("dwarf");
    set_material("cloth");
    set_id(({ "shirt", "grey shirt", "cotton shirt", "grey cotton shirt"}));
void draw_array() {

	int location;

	set_material();

	// Teapot
	location = glGetUniformLocation(sprogram,"mode");
	glUniform1i(location,1);
	location = glGetUniformLocation(sprogram,"shadowmap");
	glUniform1i(location,7);
	location = glGetUniformLocation(sprogram,"envMap");
	glUniform1i(location,TEXTURE3 - 1);
	location = glGetUniformLocation(sprogram,"mytexture");
	glUniform1i(location,TEXTURE1 - 1);
	location = glGetUniformLocation(sprogram,"mynormalmap");
	glUniform1i(location,NORMAL1 - 1);
	glPushMatrix();
	glTranslatef(0, -1.1, 0);
	glRotated( 80.0, 0.0, 1.0, 0.0 );
	glRotated( 20.0, 1.0, 0.0, 0.0 );
	glClearColor(0,0,0,0.0);
	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
	glDrawArrays(GL_QUADS, 0, numFaces*4);
	glPopMatrix();

	// Ground Plane
	location = glGetUniformLocation(sprogram,"mode");
	glUniform1i(location,2);
	location = glGetUniformLocation(sprogram,"mytexture");
	glUniform1i(location,TEXTURE2 - 1);
	double x=8.0;
	double y = -1.0;
	double z = 8.0;
	glBegin(GL_POLYGON);
		glNormal3f(0, 1, 0);
		glTexCoord2f(1.0f, 0.0f); 		glVertex3f(-x, y, z);
		glTexCoord2f(1.0f, 1.0f); 		glVertex3f(-x, y, -z);
		glTexCoord2f(0.0f, 1.0f); 		glVertex3f(x, y, -z);
		glTexCoord2f(0.0f, 0.0f); 		glVertex3f(x, y, z);
	glEnd();
	
	// Sky
	location = glGetUniformLocation(sprogram,"mode");
	glUniform1i(location,3);
	location = glGetUniformLocation(sprogram,"mytexture");
	glUniform1i(location,TEXTURE3 - 1);
	GLUquadric* qptr=gluNewQuadric();
	gluQuadricTexture(qptr,1);
	gluQuadricOrientation(qptr,GLU_INSIDE);
	glTranslatef(0, -0.7, 0);
	glRotatef(0,0.0,1.0,0.0);
	glRotatef(90,1.0,0.0,0.0);
	gluSphere(qptr,8.0,64,64);
	glPopMatrix();
}
Beispiel #14
0
void create_object(void)
{
    set_name("bowl");
    add_id("wooden bowl");
    set_short("a wooden bowl");
    set_long("A small bowl made out of oak wood. It is very well made.\n");
    set_value(35);
    set_weight(1);
    set_material("wood");
}
Beispiel #15
0
void create_object(void)
{
  set_name("sextant");
  add_id("_pirate_quest_sextant_");
  set_short("A sextant");
  set_long("A sextant, an absolutely vital instrument for pirates who want " +
           "to be able to navigate as they sail the seas, plundering and " +
           "pillaging.\n");
  set_weight(1);
  set_value(60);
  set_material("brass"); //Angelwings
}
Beispiel #16
0
void create_object(void)
{
  set_name("stone troll");
  add_id("troll");
  add_id("statue");
  set_short("A stone troll");
  set_weight(35);
  set_value(250);
  set_material("stone");

  set_alarm(300.0,0.0,"crumble");
} 
Beispiel #17
0
void create_object(void)
{
    set_name("basket");
    add_id("whicker basket");
    set_short("a basket");
    set_long("A whicker basket of the kind people bring when they go " +
             "shopping.\n");
    set_material("wood");
    set_value(12);
    set_weight(1);
    set_max_weight(4);
    set_property("average");
}
Beispiel #18
0
void set_stat_index(int index)
{
    i = index;
    set_short(short_desc[i]);
    set_long(long_desc[i]);
    set_name(name[i]);
    add_id(alias[i]);
    set_value(value[i]);
    set_weight(weight[i]);
    set_material(material[i]);
    set_new_ac(ac[i]);
    set_type(type[i]);
}
Beispiel #19
0
void create_object(void)
{
    set_name("shirt");
    add_id("torn shirt");
    set_short("a torn shirt");
    set_long("A torn shirt that badly needs to be fixed.\n");
    set_type("armour");
    set_weight(1);
    set_value(4);
    set_new_ac(2);
    set_material("cloth");
    set_property("poor");
}
Beispiel #20
0
void create_object(void)
{
    set_name("gloves");
    add_id("leather gloves");
    set_short("a pair of leather gloves");
    set_long("A pair of small leather gloves.\n");
    set_type("glove");
    set_weight(1);
    set_value(15);
    set_new_ac(4);
    set_material("leather");
    set_property("average");
}
Beispiel #21
0
void render_surface(SURFACE *surface) {
  int i,j;
  // dibujo los parches de bezier
  glPushMatrix();
  glScalef(1.0,1.0,1.0);
  set_material(plane->material);
  for (i=0;i<8;i++) {
    for (j=0;j<8;j++) {
      GLfloat parche[4][4][3];
      bspline2bezier(surface,i,j,parche);
      glMap2f(GL_MAP2_VERTEX_3,
	      0.0,1.0,3,4,
	      0.0,1.0,12,4,
	      &parche[0][0][0]);
      glEnable(GL_MAP2_VERTEX_3);
      glEnable(GL_AUTO_NORMAL);
      glEnable(GL_NORMALIZE);
      glMapGrid2f(resolucion,0.0,1.0,
		  resolucion,0.0,1.0);
      // si estoy seleccionando entonces dibujo modo wireframe
      if (selected != -1 || wire_mode)
	glEvalMesh2(GL_LINE,0,resolucion,0,resolucion);
      else
	glEvalMesh2(GL_FILL,0,resolucion,0,resolucion);
    }
  }
  glPopMatrix();

  // pintar normal para ver que tal 
  POINT3D mipunto, minormal;
  calculateNormalNotRotated(surface,ball->position.u,ball->position.v,&mipunto,&minormal);
  glBegin(GL_LINES); 
  set_material(plane->material); 
  glVertex3f(mipunto.x,mipunto.y,mipunto.z); 
  glVertex3f(mipunto.x+5*minormal.x,mipunto.y+5*minormal.y,mipunto.z+5*minormal.z);  
  glEnd(); 

}
Beispiel #22
0
void create_object(void)
{
    set_name("shortsword");
    add_id("sword");
    add_id("darkling shortsword");
    set_short("a darkling shortsword");
    set_long("A well made short sword with a small steel plate engraved " +
             "with a mark of a black dragon on it's pommel.\n");
    set_value(10);
    set_weight(2);
    set_type("shortblade");
    set_class(12);
    set_material("steel");
    set_property("average");
}
Beispiel #23
0
    box::box(float x, float y, float z, float length, float height, float depth, std::shared_ptr<graphics::material> material) : box()
    {
        position.set_x(x);
        position.set_y(y);
        position.set_z(z);
        size.set_x(length);
        size.set_y(height);
        size.set_z(depth);
        update_mesh();

        if (material)
        {
            set_material(material);
        }
    }
Beispiel #24
0
void create_object(void)
{
    set_short("A strangely shaped mandolin");
    set_long("A black mandolin with a strange shape and a pointy head. It " +
             "seems to be solid, not hollow like mandolins usually are, " +
             "and when you strum it it makes a strange, distorted sound.\n");
    set_name("mandolin");
    add_id("strangely shaped mandolin");
    add_id("black mandolin");
    set_class(8);
    set_weight(2);
    set_value(30);
    set_material("wood");
    set_type("blunt");
    set_property("poor");
}
Beispiel #25
0
void create_object(void)
{
    set_name("scalemail");
    add_id("darkling scalemail");
    set_short("a darkling scalemail");
    set_long("A strange looking scalemail made of large, black scales. You " +
             "can't imagine what beast these scales came from, but the " +
             "armour looks quite comfortable and balanced. On its chest is " +
             "a small steel plate engraved with a mark of a black dragon.\n");
    set_type("armour");
    set_weight(3);
    set_value(111);
    set_new_ac(20);
    set_material("dragonscale");
    set_property("average");
}
Beispiel #26
0
void create_object(void)
{
    set_name("sword");
    add_id("longsword");
    add_id("darkling longsword");
    set_short("a darkling longsword");
    set_long("A long sword made of black steel. The steel is smooth and " +
             "hard, and looks very sharp. On the pommel is a small steel " +
             "plate engraved with a mark of a black dragon.\n");
    set_value(20);
    set_weight(2);
    set_type("longblade");
    set_class(16);
    set_material("steel");
    set_property("average");
}
Beispiel #27
0
void create_object(void)
{
  set_name("fishingpole");
  add_id("fishing pole");
  add_id("pole");
  set_short("A fishing pole");
  set_long("A nice, long, wooden fishing pole. You bet you could catch some "+
           "fine fish with this pole wielded!\n");
  set_value(5);
  set_weight(1);
  set_type("blunt");
  set_class(5);
  set_material("wood");
  set_property("poor");
  set_wield_func(TO);
  set_hit_func(TO);
}
Beispiel #28
0
void render_ball(BALL *ball, SURFACE *surface) {

  glPushMatrix();
  

  POINT3D point, normal;
  calculateNormalNotRotated(surface,ball->position.u,ball->position.v,&point,&normal);
  glTranslatef(point.x + normal.x * ball->radius, 
	       point.y + normal.y * ball->radius, 
	       point.z + normal.z * ball->radius);
  
  set_material(ball->material);
  
  glutSolidSphere(ball->radius, 20, 20);
  glPopMatrix();

}
Beispiel #29
0
void render_course()
{
    int nx, ny;
    
    get_course_divisions(&nx, &ny);
    set_gl_options( COURSE );
    
    setup_course_tex_gen();
    
    glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
    set_material( white, black, 1.0 );
    
    update_course_quadtree( eye_pt, getparam_course_detail_level() );
    
    render_course_quadtree( );
    
    draw_track_marks();
}
Beispiel #30
0
void render_plane(PLANE *plane) {
  int i = 0;
  int j = 0;
  
  set_material(plane->material);
  
  for (i = 0; i != SUBDIVISION_STEPS; i++) {
    for (j = 0; j != SUBDIVISION_STEPS; j++) {
      glBegin(GL_QUADS);
      glNormal3f(0.0f, 1.0f, 0.0f );
      glVertex3f(plane->inter_points[i][j].x, 0.0, plane->inter_points[i][j].z);
      glVertex3f(plane->inter_points[i+1][j].x, 0.0, plane->inter_points[i+1][j].z);
      glVertex3f(plane->inter_points[i+1][j+1].x, 0.0, plane->inter_points[i+1][j+1].z);
      glVertex3f(plane->inter_points[i][j+1].x, 0.0, plane->inter_points[i][j+1].z);
      glEnd();
    }
  }
}