I value the rights of the living to be treated with respect over the rights of dead bodies to be treated with respect, so rape is worse than necrophilia in my opinion, and taking a big bite out of someone who's alive is worse than cannibalism of a dead body. Unless of course someone kills someone else so they can do things with their body in either scenario, as then, y'know... murder.
With full knowledge and consent by the dead beforehand, I don't see any ethical reason not to eat dead people's bodies when it's a matter of survival, although I'm not sure if I could actually bring myself to do so.
Legalizing pre-consented acts of cannibalism and necrophilia does seem to be a bad idea, though, because it would create perverse incentivizes for people to forge consent for the use of other's bodies, and potentially even kill them or allow things to come to pass for them to die. Technically organ transplant already has these perverse incentives, but at least in that case, it's theoretically doing some good.
...I don't think profit off of organ transplants should be allowed, but that's a whole other ethical issue, so I'll leave that alone for now.
Let's go off on the vampire tangent instead!
I'm not sure if vampirism is necrophilia or not, but... either way, I have no ethical problems with people sleeping with vampires if both parties are consenting and aware of risks-- if any? I am admittedly not a vampirologist.
Come to think of it, I'd also say non-consensual vampirism is a form of cannibalism, and significantly worse than not getting a person's consent while they're alive to eat their corpse before eating their corpse?