; WINDOWS SYSTEMGlobal windowsGlobal w_textureGlobal w_t_tamGlobal w_mxGlobal w_myGlobal w_pick_pivotGlobal w_distGlobal w_relacion#Global w_ancho#Global w_alto#Global w_margenGlobal w_tamGlobal w_cam_zoom#Global w_pointer_pivotFunction update_windows(tam,force_fix_vertex_position,zoom_ajust) ;Esta funcion Crea y actualiza la ventana mesh, ;pero la textura la manipula cada funcion independientemente de esta funcion. ;El plano esta sobre el 0,0,0 ;la camara se aleja del plano siempre ;el plano debe estar como el MAR w_dist = 5 w_tam = tam w_margen = 5 Local plano ;objeto temporal If windows = 0 Then If ground <> 0 Then EntityPickMode ground,0 DebugLog "PLANO WINDOWS creado!" PositionEntity cam,0,5,0 plano = CreatePlane() PointEntity cam,plano EntityColor plano,50,50,50 EntityPickMode plano,2 EntityAlpha plano,1 CameraZoom cam,1 PointEntity cam,plano windows = CreateMesh() EntityFX windows,1 surf = CreateSurface(windows) pick = CameraPick(cam,0,0) v0 = AddVertex (surf, PickedX(),PickedY(),PickedZ(), 0 ,0) DebugLog "V0 x: " + PickedX() DebugLog "V0 y: " + PickedY() DebugLog "V0 z: " + PickedZ() pick = CameraPick(cam,gancho,0) v1 = AddVertex (surf, PickedX(),PickedY(),PickedZ(), 1 ,0) DebugLog "V1 x: " + PickedX() DebugLog "V1 y: " + PickedY() DebugLog "V1 z: " + PickedZ() pick = CameraPick(cam,0,galto*w_relacion#) v2 = AddVertex (surf, PickedX(),PickedY(),PickedZ(), 0,1) DebugLog "V2 x: " + PickedX() DebugLog "V2 y: " + PickedY() DebugLog "V2 z: " + PickedZ() pick = CameraPick(cam,gancho,galto*w_relacion#) v3 = AddVertex (surf, PickedX(),PickedY(),PickedZ(), 1,1) DebugLog "V3 x: " + PickedX() DebugLog "V3 y: " + PickedY() DebugLog "V3 z: " + PickedZ() tri = AddTriangle (surf,v0,v1,v3) tri = AddTriangle (surf,v0,v3,v2) FreeEntity plano w_texture = CreateTexture(w_tam,w_tam,256) EntityOrder windows,-800 EntityBlend windows,1 EntityFX windows,1 w_pick_pivot = CreatePivot() End If ;this metohd must be improve for speed ;reposition the plane to fit with camera without care the zoom. If force_fix_vertex_position = 1 Then plano = CreatePlane() EntityPickMode plano,2 surf = GetSurface(windows,1) pick = CameraPick(cam,0,0) VertexCoords surf,1,PickedX(),PickedY(),PickedZ() pick = CameraPick(cam,gancho,0) VertexCoords surf,2,PickedX(),PickedY(),PickedZ() pick = CameraPick(cam,0,galto*relacion#) VertexCoords surf,3,PickedX(),PickedY(),PickedZ() pick = CameraPick(cam,gancho,galto*relacion#) VertexCoords surf,4,PickedX(),PickedY(),PickedZ() FreeEntity plano End If If zoom_ajust = 1 Then ScaleEntity windows, Float(1/cam_zoom),Float(1/cam_zoom),1/cam_zoom ;Define donde esta el pick del mouse sobre el plano del mundo w_mx = mx/(Float(Float(gancho)/Float(w_ancho))) w_my = my/(Float(Float(galto)/Float(w_alto))) plano = CreatePlane() EntityPickMode plano,2 pick = CameraPick(cam,mx,my) FreeEntity plano PositionEntity w_pick_pivot,PickedX(),PickedY(),PickedZ() End Function