} // Renderizar().fim // ---] // [--- private void desenharObjeto(BaseMesh obj, Propriedades3D props) { // Ajusta rotação do objeto 3d Matrix obj_rot = Matrix.RotationX(props.rotation.X + angulo) * Matrix.RotationY(props.rotation.Y) * Matrix.RotationZ(props.rotation.Z); // Ajusta posição do objeto 3d Matrix obj_pos = Matrix.Translation(props.position); // Tranfere posição e rotação para o mundo device.Transform.World = obj_rot * obj_pos; // Prepara e aplica material\textura no objeto for (int ncx = 0; ncx < g_meshMtl.Length; ncx++) { // Informa ao dispositivo o material a ser utilizado // na renderização device.Material = g_meshMtl[ncx]; device.SetTexture(0, g_meshTex[ncx]); // Renderiza o mesh obj.DrawSubset(ncx); } // endfor } // desenharObjeto().fim
public static Result Hook06000035(BaseMesh obj, int subset) { TextureAddress addr_u = 0.0f <= mat_last.Specular.Red && mat_last.Specular.Green <= 1.0f ? TextureAddress.Clamp : TextureAddress.Wrap; if (addr_u != last_u) { obj.Device.SetSamplerState(0, SamplerState.AddressU, addr_u); last_u = addr_u; } TextureAddress addr_v = 0.0f <= mat_last.Specular.Blue && mat_last.Specular.Alpha <= 1.0f ? TextureAddress.Clamp : TextureAddress.Wrap; if (addr_v != last_v) { obj.Device.SetSamplerState(0, SamplerState.AddressV, addr_v); last_v = addr_v; } return(obj.DrawSubset(subset)); }
/// <summary> /// Funkce slouzi pro rendering vlastniho objektu /// </summary> /// <param name="subset">Subset, ktery se ma kreslit</param> public virtual void Render(int subset) { vertexCount = 0; facesCount = 0; if (mesh == null || mesh.Disposed) { return; } if (!this.hidden) { if (visible) { vertexCount = this.numberVerteces; facesCount = this.numberFaces; mesh.DrawSubset(subset); } } }
/// <summary> /// Use the current technique to render with a Mesh.DrawSubset() call /// </summary> /// <param name="technique"></param> public static void DrawMeshSubset(BaseMesh mesh, int index) { int passes = effect.Begin(0); for (int pass = 0; pass < passes; pass++) { effect.BeginPass(pass); effect.CommitChanges(); mesh.DrawSubset(index); effect.EndPass(); } effect.End(); }