void r1_dx9_class::use_texture(r1_texture_handle material_ref, sw32 desired_width, w32 frame) { pf_dx9_use_texture.start(); if (!tmanager->valid_handle(material_ref)) { //i4_warning("Tried to use a texture before tmanager::load_textures. Case 2."); pf_dx9_use_texture.stop(); disable_texture(); return; } if (!texture_mode) { d3d_device->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); //d3d_device->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_DISABLE); d3d_device->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); d3d_device->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); } texture_mode = i4_T; sw32 width=0,height=0; r1_miplevel_t * mip = tmanager->get_texture(material_ref, frame, desired_width, width, height); // don't select the texture again if it's the same one we used last time if (mip) { i4_bool is_alpha = mip->entry->is_alphatexture(); i4_bool is_holy = mip->entry->is_transparent(); if (is_alpha || is_holy) { enable_holy(); } else { disable_holy(); } if (mip != last_node) { states_have_changed = i4_T; flush_vert_buffer(); last_node = mip; i4_float blahfloat_a, blahfloat_b; ((r1_dx9_texture_class *)tmanager)->select_texture(mip->vram_handle, blahfloat_a, blahfloat_b); //d3d_device->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_DISABLE ); //i4_dx9_check(d3d_device->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE)); //i4_dx9_check(d3d_device->SetRenderState(D3DRS_DITHERENABLE,FALSE)); } } pf_dx9_use_texture.stop(); }
void sfml2_renderer::draw(const rect& box, const color& fill) { set_primitive_type(sf::Triangles); disable_texture(); auto color = col(fill); add_vertex(box.top_left(), color); add_vertex(box.bottom_right(), color); add_vertex(box.top_right(), color); add_vertex(box.top_left(), color); add_vertex(box.bottom_right(), color); add_vertex(box.bottom_left(), color); }