parent
ede3d4a99c
commit
1ff5034713
@ -1,5 +1,5 @@
|
|||||||
```csharp
|
```csharp
|
||||||
public static class Geometry {
|
public static class Geometry {
|
||||||
public static bool PointInCone(
|
public static bool PointInCone(
|
||||||
float visionRangeSq, float fovCos, Vector2 eyePos, Vector2 direction, Vector2 test) {
|
float visionRangeSq, float fovCos, Vector2 eyePos, Vector2 direction, Vector2 test) {
|
||||||
Vector2 delta = Vector2.Subtract(test, eyePos);
|
Vector2 delta = Vector2.Subtract(test, eyePos);
|
||||||
@ -9,5 +9,13 @@
|
|||||||
float dot = Vector2.Dot(Vector2.Normalize(direction), Vector2.Normalize(delta));
|
float dot = Vector2.Dot(Vector2.Normalize(direction), Vector2.Normalize(delta));
|
||||||
return dot > fovCos;
|
return dot > fovCos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
// Make a 1x1 white texture:
|
||||||
|
Texture2D whiteTexture = new Texture2D(GraphicsDevice, 1, 1);
|
||||||
|
whiteTexture.SetData(new Color[] { Color.White });
|
||||||
|
// When done with it:
|
||||||
|
whiteTexture.Dispose();
|
||||||
```
|
```
|
Loading…
Reference in New Issue
Block a user