|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2009-2021 jMonkeyEngine |
| 2 | + * Copyright (c) 2009-2025 jMonkeyEngine |
3 | 3 | * All rights reserved.
|
4 | 4 | *
|
5 | 5 | * Redistribution and use in source and binary forms, with or without
|
|
40 | 40 | import java.io.IOException;
|
41 | 41 |
|
42 | 42 | /**
|
| 43 | + * A `CameraEvent` is a cinematic event that instantly sets the active camera |
| 44 | + * within a `Cinematic` sequence. |
43 | 45 | *
|
44 | 46 | * @author Rickard (neph1 @ github)
|
45 | 47 | */
|
46 | 48 | public class CameraEvent extends AbstractCinematicEvent {
|
47 | 49 |
|
| 50 | + /** |
| 51 | + * The name of the camera to activate. |
| 52 | + */ |
48 | 53 | private String cameraName;
|
| 54 | + /** |
| 55 | + * The `Cinematic` instance to which this event belongs and on which the |
| 56 | + * camera will be set. |
| 57 | + */ |
49 | 58 | private Cinematic cinematic;
|
50 | 59 |
|
51 |
| - public String getCameraName() { |
52 |
| - return cameraName; |
53 |
| - } |
54 |
| - |
55 |
| - public void setCameraName(String cameraName) { |
56 |
| - this.cameraName = cameraName; |
57 |
| - } |
58 |
| - |
| 60 | + /** |
| 61 | + * For serialization only. Do not use. |
| 62 | + */ |
59 | 63 | public CameraEvent() {
|
60 | 64 | }
|
61 | 65 |
|
62 |
| - public CameraEvent(Cinematic parentEvent, String cameraName) { |
63 |
| - this.cinematic = parentEvent; |
| 66 | + /** |
| 67 | + * Constructs a new `CameraEvent` with the specified cinematic and camera name. |
| 68 | + * |
| 69 | + * @param cinematic The `Cinematic` instance this event belongs to (cannot be null). |
| 70 | + * @param cameraName The name of the camera to be activated by this event (cannot be null or empty). |
| 71 | + */ |
| 72 | + public CameraEvent(Cinematic cinematic, String cameraName) { |
| 73 | + this.cinematic = cinematic; |
64 | 74 | this.cameraName = cameraName;
|
65 | 75 | }
|
66 | 76 |
|
@@ -102,33 +112,56 @@ public void setTime(float time) {
|
102 | 112 | play();
|
103 | 113 | }
|
104 | 114 |
|
| 115 | + /** |
| 116 | + * Returns the `Cinematic` instance associated with this event. |
| 117 | + * @return The `Cinematic` instance. |
| 118 | + */ |
105 | 119 | public Cinematic getCinematic() {
|
106 | 120 | return cinematic;
|
107 | 121 | }
|
108 | 122 |
|
| 123 | + /** |
| 124 | + * Sets the `Cinematic` instance for this event. |
| 125 | + * @param cinematic The `Cinematic` instance to set (cannot be null). |
| 126 | + */ |
109 | 127 | public void setCinematic(Cinematic cinematic) {
|
110 | 128 | this.cinematic = cinematic;
|
111 | 129 | }
|
112 | 130 |
|
113 | 131 | /**
|
114 |
| - * used internally for serialization |
| 132 | + * Returns the name of the camera that this event will activate. |
| 133 | + * @return The camera name. |
| 134 | + */ |
| 135 | + public String getCameraName() { |
| 136 | + return cameraName; |
| 137 | + } |
| 138 | + |
| 139 | + /** |
| 140 | + * Sets the name of the camera that this event will activate. |
| 141 | + * @param cameraName The new camera name (cannot be null or empty). |
| 142 | + */ |
| 143 | + public void setCameraName(String cameraName) { |
| 144 | + this.cameraName = cameraName; |
| 145 | + } |
| 146 | + |
| 147 | + /** |
| 148 | + * Used internally for serialization. |
115 | 149 | *
|
116 |
| - * @param ex the exporter (not null) |
117 |
| - * @throws IOException from the exporter |
| 150 | + * @param ex The exporter (not null). |
| 151 | + * @throws IOException If an I/O error occurs during serialization. |
118 | 152 | */
|
119 | 153 | @Override
|
120 | 154 | public void write(JmeExporter ex) throws IOException {
|
121 | 155 | super.write(ex);
|
122 | 156 | OutputCapsule oc = ex.getCapsule(this);
|
123 | 157 | oc.write(cameraName, "cameraName", null);
|
124 |
| - |
125 | 158 | }
|
126 | 159 |
|
127 | 160 | /**
|
128 |
| - * used internally for serialization |
| 161 | + * Used internally for deserialization. |
129 | 162 | *
|
130 |
| - * @param im the importer (not null) |
131 |
| - * @throws IOException from the importer |
| 163 | + * @param im The importer (not null). |
| 164 | + * @throws IOException If an I/O error occurs during deserialization. |
132 | 165 | */
|
133 | 166 | @Override
|
134 | 167 | public void read(JmeImporter im) throws IOException {
|
|
0 commit comments