2010-07-12 3 views
2

Pourriez-vous me montrer un article sur un algorithme Rendering? Je cherche quelque chose de similaire à celui utilisé dans la série de jeux Commandos (par Pyro Studios). La ligne de vue cône/triangle doit être rendue (dans une vue de haut en bas) avec des ombres appropriées causées par des obstructions. MerciAlgorithme de ligne de vue de type Commandos

+4

Pouvez-vous décrire la fonction, ou devrions-nous acheter le jeu pour répondre? –

+0

Avez-vous déjà trouvé un moyen de le faire? Je pense à faire un jeu de style Commandos et cette fonctionnalité doit être incluse. – rfcoder89

Répondre

1

En pseudo-code:

function get_visible_objects(observer) 

    /* get the list of objects inside the cone of vision */ 
    in_cone = get_the_objects_inside(observer.cone) 

    /* sort the objects by proximity to the observer */ 
    sorted = in_cone.sort_by_distance_to(observer) 

    /* visible is the result. start with all the objects in the cone */ 
    visible = sorted.copy 

    /* parse the objects in the cone, from nearest to the observer to farthest away, 
    and remove any objects occluded */ 
    for each object in sorted do 
    /* remove any other object that is occluded by object */ 
    to_remove = [] 
    for each other in visible do 
     if object.occludes(other) then 
     to_remove.add(other) 
     end 
    end 
    visible = visible - to_remove 
    end 

    return visible 
end 
+0

Merci pour votre réponse, mais je cherchais principalement un algorithme pour rendre la région LOS. – BlueSilver