Added SetVertsFromSplines to AMV. Moved const to the left side. Documentation for all new functions.

This commit is contained in:
Kyzentun
2015-01-06 20:14:59 -07:00
parent 703b423dd4
commit d3bbf9cbd3
11 changed files with 454 additions and 248 deletions
+13 -1
View File
@@ -4,10 +4,22 @@ The StepMania 5 Changelog covers all post-sm-ssc changes. For a list of changes
from StepMania 4 alpha 5 to sm-ssc v1.2.5, see Changelog_sm-ssc.txt.
________________________________________________________________________________
2015/01/06
----------
* [ActorMultiVertex] GetSpline and SetVertsFromSplines functions added.
[kyzentun]
* [NoteColumnRenderer] Functions for fetching the spline handlers for the
column added. [kyzentun]
* [NCSplineHandler] New class for setting various parameters of a spline used
by a NoteColumnRenderer and containing the spline. [kyzentun]
* [CubicSplineN] New class that provides spline functionality. [kyzentun]
2014/12/26
----------
* [NoteField] Columns turned into actors that can be fetched with
GetColumnActors. [kyzentun]
get_column_actors. [kyzentun]
Tiny boost in fps when there is a large number of notes on screen.
* [NoteColumnRenderer] New class for controlling one column. [kyzentun]
2014/12/20
----------
+56 -8
View File
@@ -496,6 +496,7 @@
<Function name='GetDestFirstToDraw'/>
<Function name='GetDestNumToDraw'/>
<Function name='GetNumVertices'/>
<Function name='GetSpline'/>
<Function name='GetTexture'/>
<Function name='LoadTexture'/>
<Function name='SetDrawState'/>
@@ -506,6 +507,7 @@
<Function name='SetTextureMode'/>
<Function name='SetVertex'/>
<Function name='SetVertices'/>
<Function name='SetVertsFromSplines'/>
</Class>
<Class base='Actor' name='ActorProxy'>
<Function name='GetTarget'/>
@@ -678,6 +680,31 @@
<Function name='SHA1File'/>
<Function name='SHA1String'/>
</Class>
<Class name='CubicSplineN'>
<Function name='solve'/>
<Function name='evaluate'/>
<Function name='evaluate_derivative'/>
<Function name='evaluate_second_derivative'/>
<Function name='evaluate_third_derivative'/>
<Function name='set_point'/>
<Function name='set_coefficients'/>
<Function name='get_coefficients'/>
<Function name='set_spatial_extent'/>
<Function name='get_spatial_extent'/>
<Function name='get_max_t'/>
<Function name='set_size'/>
<Function name='get_size'/>
<Function name='set_dimension'/>
<Function name='get_dimension'/>
<Function name='empty'/>
<Function name='set_loop'/>
<Function name='get_loop'/>
<Function name='set_polygonal'/>
<Function name='get_polygonal'/>
<Function name='set_dirty'/>
<Function name='get_dirty'/>
<Function name='destroy'/>
</Class>
<Class base='Sprite' name='DifficultyIcon'>
<Function name='SetFromDifficulty'/>
<Function name='SetFromSteps'/>
@@ -967,16 +994,32 @@
<Function name='SelectCourse'/>
<Function name='SelectSong'/>
</Class>
<Class name='NCSplineHandler'>
<Function name='get_spline'/>
<Function name='get_beats_per_t'/>
<Function name='set_beats_per_t'/>
<Function name='get_receptor_t'/>
<Function name='set_receptor_t'/>
<Function name='get_spline_mode'/>
<Function name='set_spline_mode'/>
<Function name='get_subtract_song_beat'/>
<Function name='set_subtract_song_beat'/>
</Class>
<Class base='Actor' name='NoteColumnRenderer'>
<Function name='get_pos_handler'/>
<Function name='get_rot_handler'/>
<Function name='get_zoom_handler'/>
</Class>
<Class base='ActorFrame' name='NoteField'>
<Function name='DidHoldNote'/>
<Function name='DidTapNote'/>
<Function name='did_hold_note'/>
<Function name='did_tap_note'/>
<Function name='get_column_actors'/>
<Function name='SetPressed'/>
<Function name='SetDidHoldNoteCallback'/>
<Function name='SetDidTapNoteCallback'/>
<Function name='SetSetPressedCallback'/>
<Function name='SetStepCallback'/>
<Function name='Step'/>
<Function name='set_pressed'/>
<Function name='set_did_hold_note_callback'/>
<Function name='set_did_tap_note_callback'/>
<Function name='set_set_pressed_callback'/>
<Function name='set_step_callback'/>
<Function name='step'/>
</Class>
<Class name='NoteSkinManager'>
<Function name='DoesNoteSkinExist'/>
@@ -2215,6 +2258,11 @@
<EnumValue name='&apos;MusicWheelUsesSections_Always&apos;' value='1'/>
<EnumValue name='&apos;MusicWheelUsesSections_ABCOnly&apos;' value='2'/>
</Enum>
<Enum name='NoteColumnSplineMode'>
<EnumValue name='&apos;NoteColumnSplineMode_Disabled&apos;' value='0'/>
<EnumValue name='&apos;NoteColumnSplineMode_Offset&apos;' value='1'/>
<EnumValue name='&apos;NoteColumnSplineMode_Position&apos;' value='2'/>
</Enum>
<Enum name='NotePart'>
<EnumValue name='&apos;NotePart_TapNote&apos;' value='0'/>
<EnumValue name='&apos;NotePart_TapMine&apos;' value='1'/>
+176 -13
View File
@@ -112,6 +112,9 @@ save yourself some time, copy this for undocumented things:
<Function name='ConnectToServer' return='bool' arguments='string sAddress'>
Tries to connect to the server at <code>sAddress</code>.
</Function>
<Function name='create_spline' return='CubicSplineN' arguments=''>
Creates a CubicSplineN for you to use. Make sure you destroy the CubicSplineN when you're done with it, or you will have a memory leak.
</Function>
<Function name='CustomDifficultyToColor' theme='_fallback' return='color' arguments='string cd'>
[02 Colors.lua]
</Function>
@@ -1521,6 +1524,22 @@ save yourself some time, copy this for undocumented things:
Sets multiple vertices at once. The elements of <code>vertices</code> should themselves be tables, of the form provided to <Link class='ActorMultiVertex' function='SetVertex'>SetVertex</Link>. If <code>vertices</code> is the first argument it will start from vertex 1. If an integer is provided before <code>vertices</code> it will start from that vertex. It will add vertices as necessary.
Example: self:SetVertices( { { { x1, y1, z1 } , { r1,g1,b1,a1 } , { tcx1,tcy1 } }; { { x2, y2, z2 } , { r2,g2,b2,a2 } , { tcx2,tcy2 } } } )
</Function>
<Function name='SetVertsFromSplines' return='' arguments=''>
Sets all the drawn verts of the ActorMultiVertex by evaluating the splines.<br />
("all the drawn verts" means all the verts between FirstToDraw and NumToDraw, the verts that are set to draw in the current tween state.)<br />
The parts of the ActorMultiVertex are evenly spaced along the spline in terms of t value.<br />
The exact behavior depends on the draw mode.<br />
DrawMode_Quads uses all 4 splines, one for each corner.<br />
DrawMode_QuadStrip and DrawMode_Strip use 2 splines, one for each edge of the strip.<br />
DrawMode_Fan uses one spline, for the edge verts of the fan. The first vert is not touched because it is the center.<br />
DrawMode_Triangles uses 3 splines, one for each corner.<br />
DrawMode_SymmetricQuadStrip uses 3 splines, one on each edge and one in the center.<br />
DrawMode_LineStrip uses 1 spline.<br />
</Function>
<Function name='GetSpline' return='CubicSplineN' arguments='int i'>
Returns the requested spline. Spline indices range from 1 to 4.<br />
ActorMultiVertex splines are not inside the tween state, and will not change the verts until you call SetVertsFromSplines.
</Function>
<Function name='SetNumVertices' return='void' arguments='int num'>
Sets the number of vertices.
</Function>
@@ -2062,6 +2081,92 @@ save yourself some time, copy this for undocumented things:
Returns the SHA-1 hash for <code>s</code>.
</Function>
</Class>
<Class name='CubicSplineN'>
<Description>
All functions in this class have camel case equivalents, use whichever naming style you prefer.<br />
This spline implementation is a cubic spline.<br />
A spline is a line calculated from a small set of points with mathematical smooting applied.<br />
Splines can have any number of dimensions, but splines owned by actors (the ones inside NCSplineHandler and ActorMultiVertex) always have 3 dimensions.<br />
</Description>
<Function name='solve' return='' arguments=''>
Solves the spline, setting the coefficients.
</Function>
<Function name='evaluate' return='{float}' arguments='float t'>
Evaluates the spline at the given t value, returning a table of the results for each dimension of the spline.<br />
t can range from 0 to the value returned by get_max_t().<br />
A normal spline will return its starting point for any t value less than 0 and its end point for any t value greater than the max.<br />
A looped spline adjust the t value to be within the its range by adding or subtracting the max t as needed. (so if the max t is 4 and you evaluate at 5, it will return the same as if you evaluated at 1.)
</Function>
<Function name='evaluate_derivative' return='{float}' arguments='float t'>
Evaluates the derivative at t.
</Function>
<Function name='evaluate_second_derivative' return='{float}' arguments='float t'>
Evaluates the second derivative at t.
</Function>
<Function name='evaluate_third_derivative' return='{float}' arguments='float t'>
Evaluates the third derivative at t.<br />
Second and third derivative functions exist because they're possible, not because they're expected to be useful. The fourth derivative would be 0 because the equation for evaluating the spline is "a + (b*t) + (c*t^2) + (d*t^3)".
</Function>
<Function name='set_point' return='' arguments='int i, {float} p'>
Sets point i of the spline to the position specified by the table p.
</Function>
<Function name='set_coefficients' return= '' arguments='int i, {float} b, {float} c, {float} d'>
Sets the coefficients of the spline at point i.<br />
Each table must contain a value for each dimension of the spline.<br />
Solving the spline normally should cover all normal usage, this is for people that want a spline with an abnormal behavior, so if you set the coefficients directly, expect to end up with an unsmooth shape.
</Function>
<Function name='get_coefficients' return='{{float}, {float}, {float}}' arguments='int i'>
Returns a table containing the tables of coefficients for the point i.
</Function>
<Function name='set_spatial_extent' return='' arguments='int d, float e'>
Sets the spatial extent of dimension d of the spline to e.<br />
The spatial extent exists to handle numbers that exist in a finite looped space, instead of the flat infinite space.<br />
To put it more concretely, spatial extent exists to allow a spline to control rotation with wrapping behavior at 0.0 and 2pi, instead of suddenly jerking from 2pi to 0.0.
</Function>
<Function name='get_spatial_extent' return='float' arguments='int d'>
Returns the spatial extent of dimension d of the spline.
</Function>
<Function name='get_max_t' return='float' arguments=''>
Returns the max t value the spline extends to. For a normal spline, this will be size()-1. For a looped spline, this will be size().
</Function>
<Function name='set_size' return='' arguments='int s'>
Sets the number of points in the spline. You must set the number of points before trying to set the position of any point.
</Function>
<Function name='get_size' return='int s' arguments=''>
Returns the number of points in the spline.
</Function>
<Function name='set_dimension' return='' arguments='int d'>
Sets the number of dimensions the spline has.<br />
Splines that are owned by actors (the ones inside ActorMultiVertex and NCSplineHandler) cannot have their number of dimensions changed because the actors require them to have 3 dimensions.
</Function>
<Function name='get_dimension' return='int' arguments=''>
Returns the number of dimensions the spline has.
</Function>
<Function name='empty' return='bool' arguments=''>
Returns true of the spline has zero points, or false if it has more than zero points.
</Function>
<Function name='set_loop' return='' arguments='bool'>
Sets whether the spline is looped. A looped spline is one where the end point is connected to the start point.
</Function>
<Function name='get_loop' return='bool' arguments=''>
Returns whether the spline is looped.
</Function>
<Function name='set_polygonal' return='' arguments='bool'>
Sets whether the spline is polygonal. If the spline is polygonal, then it will have straight lines between the points instead of curves.
</Function>
<Function name='get_polygonal' return='bool' arguments=''>
Returns whether the spline is polygonal.
</Function>
<Function name='set_dirty' return='' arguments='bool'>
Sets whether the spline is dirty. A dirty spline is one that has been changed in some way that affects its shape. When solve() is called, the spline will only be solved if it is dirty. The dirty flag is automatically set by everything, so you should never have to call this function.
</Function>
<Function name='get_dirty' return='bool' arguments=''>
Returns whether the spline is currently dirty.
</Function>
<Function name='destroy' return='' arguments=''>
Destroys the spline, freeing the memory allocated for it. This can only be called on splines created with create_spline().
</Function>
</Class>
<Class name='DifficultyIcon'>
<Function name='SetFromDifficulty' return='void' arguments='Difficulty dc'>
Sets the DifficultyIcon's state from the difficulty passed in.
@@ -2950,44 +3055,102 @@ save yourself some time, copy this for undocumented things:
Returns a table of noteskin names for the current gametype.
</Function>
</Class>
<Class name='NCSplineHandler'>
<Description>
All functions in this class have camel case equivalents, use whichever naming style you prefer.<br />
The spline handler holds info on how the spline is used by the engine.<br />
Each get/set pair of functions in this class is for a different aspect of the spline's behavior.
</Description>
<Function name='get_spline' return='CubicSplineN' arguments=''>
Returns the spline for this handler.
</Function>
<Function name='get_beats_per_t' return='float' arguments=''>
Returns the beats per t value of the spline. If the beats_per_t is 4, then a note must be on screen for 4 beats to traverse from one point on the spline to the next.
</Function>
<Function name='set_beats_per_t' return='' arguments='float per'>
Sets the beats per t value for the spline.
</Function>
<Function name='get_receptor_t' return='float' arguments=''>
Returns the t value that receptors are evaluated at.
</Function>
<Function name='set_receptor_t' return='' arguments='float t'>
the t value that receptors are evaluated at.
</Function>
<Function name='get_spline_mode' return='NoteColumnSplineMode' arguments=''>
Returns the mode the spline is set to.<br />
"NoteColumnSplineMode_Disabled" means the spline will not affect the notes or receptors at all.<br />
"NoteColumnSplineMode_Offset" means the spline will added to the effects from the mods.<br />
"NoteColumnSplineMode_Position" means only the spline affect the notes and mods will be ignored. (but only mods that affect the same aspect of the note as the spline will be disabled. So a rotation spline won't disable Mini or Tiny, but a zoom spline will, and a zoom spline won't disable Dizzy, Twirl, or Roll, but a rotation spline will.)
</Function>
<Function name='set_spline_mode' return='' arguments='NoteColumnSplineMode mode'>
Sets the current spline mode for this handler.
</Function>
<Function name='get_subtract_song_beat' return='bool' arguments=''>
Returns whether the current song beat is subtracted from a note's beat when calculating the t value to use on the spline.
</Function>
<Function name='set_subtract_song_beat' return='' arguments='bool s'>
Sets whether the current song beat is subtracted from a note's beat when calculating the t value to use on the spline.
</Function>
</Class>
<Class base='Actor' name='NoteColumnRenderer'>
<Description>
All functions in this class have camel case equivalents, use whichever naming style you prefer.<br />
Position, rotation, and zoom each have separate spline handlers to allow them to have separate independent behavior.<br />
It is important to note that the spline handlers are inside the tween state, so whenever you start a new tween on the actor, you need to refetch the spline handlers.<br />
</Description>
<Function name='get_pos_handler' return='NCSplineHandler' arguments=''>
Returns the handler for the position spline.
</Function>
<Function name='get_rot_handler' return='NCSplineHandler' arguments=''>
Returns the handler for the rotation spline.<br />
The rotation applied by the rotation spline is in radians.<br />
For convenience, the spatial extent of the rotation spline defaults to 2pi.
</Function>
<Function name='get_zoom_handler' return='NCSplineHandler' arguments=''>
Returns the handler for the zoom spline.
</Function>
</Class>
<Class name='NoteField'>
<Function name='DidHoldNote' return='' arguments='int column, TapNoteScore tns, bool bright'>
<Description>
All functions in this class have camel case equivalents, use whichever naming style you prefer.<br />
</Description>
<Function name='did_hold_note' return='' arguments='int column, TapNoteScore tns, bool bright'>
Makes the NoteField act as if a hold note was hit in the column, with the given score and bright setting. <br />
The callback for DidHoldNote will not be called.
The callback for did_hold_note will not be called.
</Function>
<Function name='DidTapNote' return='' arguments='int column, TapNoteScore tns, bool bright'>
<Function name='did_tap_note' return='' arguments='int column, TapNoteScore tns, bool bright'>
Makes the NoteField act as if a tap note was hit in the column, with the given score and bright setting. <br />
The callback for DidTapNote will not be called.
The callback for did_tap_note will not be called.
</Function>
<Function name='get_column_actors' return='{actor}' arguments=''>
Returns a table of the actors for the columns.
<Function name='get_column_actors' return='{NoteColumnRenderer}' arguments=''>
Returns a table of the actors for the columns. This means that each column is an actor, so you can move it around or animate it like an actor. See the NoteColumnRenderer class for a list of special functions for the column's actor.
</Function>
<Function name='SetDidHoldNoteCallback' return= '' arguments='function callback'>
<Function name='set_did_hold_note_callback' return= '' arguments='function callback'>
Same as SetDidTapNoteCallback, but for hold notes. Uses HoldNoteScore instead of TapNoteScore.
</Function>
<Function name='SetDidTapNoteCallback' return= '' arguments='function callback'>
<Function name='set_did_tap_note_callback' return= '' arguments='function callback'>
Sets the function that the NoteField will call whenever a tap note is hit.<br />
The callback function is passed the column, the TapNoteScore, and whether the explosion will be bright.<br />
The callback function can return changed values for the NoteField to use instead of the ones that were passed.<br />
Pass nil instead of a function to clear the callback.
</Function>
<Function name='SetPressed' return='' arguments='int column'>
<Function name='set_pressed' return='' arguments='int column'>
Makes the NoteField act as if a press occurred in the column. <br />
The callback for SetPressed will not be called.
The callback for set_pressed will not be called.
</Function>
<Function name='SetSetPressedCallback' return= '' arguments='function callback'>
<Function name='set_set_pressed_callback' return= '' arguments='function callback'>
Sets the function that the NoteField will call whenever a press occurs.<br />
The callback function is passed the column for the press.<br />
The callback function can return changed values for the NoteField to use instead of the ones that were passed.<br />
Pass nil instead of a function to clear the callback.
</Function>
<Function name='SetStepCallback' return= '' arguments='function callback'>
<Function name='set_step_callback' return= '' arguments='function callback'>
Sets the function that the NoteField will call whenever a step occurs.<br />
The callback function is passed the column and the TapNoteScore for the step.<br />
The callback function can return changed values for the NoteField to use instead of the ones that were passed.<br />
Pass nil instead of a function to clear the callback.
</Function>
<Function name='Step' return='' arguments='int column, TapNoteScore tns'>
<Function name='step' return='' arguments='int column, TapNoteScore tns'>
Makes the NoteField act as if a step occurred in the column with the given score.
The callback for Step will not be called.
</Function>
+1
View File
@@ -33,6 +33,7 @@ function alias_one(class, main_name, alt_name)
lua.ReportScriptError("Alias name of function must be a string.")
return
end
if class[alt_name] then return end
class[alt_name]= class[main_name]
end
+81 -112
View File
@@ -63,9 +63,12 @@ ActorMultiVertex::ActorMultiVertex()
_EffectMode = EffectMode_Normal;
_TextureMode = TextureMode_Modulate;
_using_spline= false;
_spline.redimension(3);
_spline.m_owned_by_actor= true;
_splines.resize(num_vert_splines);
for(size_t i= 0; i < num_vert_splines; ++i)
{
_splines[i].redimension(3);
_splines[i].m_owned_by_actor= true;
}
}
ActorMultiVertex::~ActorMultiVertex()
@@ -77,13 +80,12 @@ ActorMultiVertex::ActorMultiVertex( const ActorMultiVertex &cpy ):
Actor( cpy )
{
#define CPY(a) a = cpy.a
CPY( _spline );
CPY( _using_spline );
CPY( AMV_Tweens );
CPY( AMV_current );
CPY( AMV_start );
CPY( _EffectMode );
CPY( _TextureMode );
CPY( _splines );
#undef CPY
if( cpy._Texture != NULL )
@@ -200,71 +202,6 @@ void ActorMultiVertex::SetVertexCoords( int index, float TexCoordX, float TexCoo
AMV_DestTweenState().vertices[index].t = RageVector2( TexCoordX, TexCoordY );
}
bool ActorMultiVertex::GetUseSpline()
{
return _using_spline;
}
void ActorMultiVertex::SetUseSpline(bool use)
{
_using_spline= use;
}
void ActorMultiVertex::SplineSetPoint(size_t i, float x , float y , float z)
{
vector<float> v(3);
v[0]= x; v[1]= y; v[2]= z;
_spline.set_point(i, v);
}
void ActorMultiVertex::SplineResize(size_t s)
{
_spline.resize(s);
}
size_t ActorMultiVertex::SplineSize()
{
return _spline.size();
}
void ActorMultiVertex::SplineSolve()
{
if(_spline.empty())
{
return;
}
_spline.solve();
float num_parts= 0.0f;
size_t num_verts= GetNumVertices();
switch(GetDestDrawMode())
{
case DrawMode_Quads:
break;
case DrawMode_QuadStrip:
break;
case DrawMode_Fan:
break;
case DrawMode_Strip:
break;
case DrawMode_Triangles:
break;
case DrawMode_LineStrip:
{
float conversion= static_cast<float>(_spline.size()-1) / static_cast<float>(num_verts-1);
for(size_t i= 0; i < num_verts; ++i)
{
float t= i * conversion;
vector<float> p;
_spline.evaluate(t, p);
SetVertexPos(i, p[0], p[1], p[2]);
}
}
break;
case DrawMode_SymmetricQuadStrip:
break;
}
}
void ActorMultiVertex::DrawPrimitives()
{
Actor::SetGlobalRenderStates(); // set Actor-specified render states
@@ -380,6 +317,61 @@ bool ActorMultiVertex::EarlyAbortDraw() const
return false;
}
void ActorMultiVertex::SetVertsFromSplinesInternal(size_t num_splines, size_t offset)
{
vector<RageSpriteVertex>& verts= AMV_DestTweenState().vertices;
size_t first= AMV_DestTweenState().FirstToDraw + offset;
size_t num_verts= AMV_DestTweenState().GetSafeNumToDraw(AMV_DestTweenState()._DrawMode, AMV_DestTweenState().NumToDraw);
float tper[num_splines]= {0.0f};
float num_parts= static_cast<float>(num_verts - offset) /
static_cast<float>(num_splines);
for(size_t i= 0; i < num_splines; ++i)
{
tper[i]= _splines[i].get_max_t() / num_parts;
}
for(size_t v= 0; v < num_verts; ++v)
{
vector<float> pos;
const int spi= v%num_splines;
_splines[spi].evaluate(static_cast<float>(v) * tper[spi], pos);
verts[v+first].p.x= pos[0];
verts[v+first].p.y= pos[1];
verts[v+first].p.z= pos[2];
}
}
void ActorMultiVertex::SetVertsFromSplines()
{
if(AMV_DestTweenState().vertices.empty()) { return; }
switch(AMV_DestTweenState()._DrawMode)
{
case DrawMode_Quads:
SetVertsFromSplinesInternal(4, 0);
break;
case DrawMode_QuadStrip:
case DrawMode_Strip:
SetVertsFromSplinesInternal(2, 0);
break;
case DrawMode_Fan:
// Skip the first vert because it is the center of the fan. -Kyz
SetVertsFromSplinesInternal(1, 1);
break;
case DrawMode_Triangles:
case DrawMode_SymmetricQuadStrip:
SetVertsFromSplinesInternal(3, 0);
break;
case DrawMode_LineStrip:
SetVertsFromSplinesInternal(1, 0);
break;
}
}
CubicSplineN* ActorMultiVertex::GetSpline(size_t i)
{
ASSERT(i < num_vert_splines);
return &(_splines[i]);
}
void ActorMultiVertex::SetCurrentTweenStart()
{
AMV_start= AMV_current;
@@ -709,6 +701,23 @@ public:
COMMON_RETURN_SELF;
}
static int GetSpline(T* p, lua_State* L)
{
size_t i= static_cast<size_t>(IArg(1)-1);
if(i >= ActorMultiVertex::num_vert_splines)
{
luaL_error(L, "Spline index must be greater than 0 and less than or equal to %zu.", ActorMultiVertex::num_vert_splines);
}
p->GetSpline(i)->PushSelf(L);
return 1;
}
static int SetVertsFromSplines(T* p, lua_State* L)
{
p->SetVertsFromSplines();
COMMON_RETURN_SELF;
}
static int SetTexture( T* p, lua_State *L )
{
RageTexture *Texture = Luna<RageTexture>::check(L, 1);
@@ -729,42 +738,6 @@ public:
}
return 1;
}
DEFINE_METHOD(GetUseSpline, GetUseSpline());
static int SplineSize(T* p, lua_State* L)
{
lua_pushnumber(L, p->SplineSize());
return 1;
}
static int SetUseSpline(T* p, lua_State* L)
{
p->SetUseSpline(lua_toboolean(L, 1));
COMMON_RETURN_SELF;
}
static int SplineSetPoint(T* p, lua_State* L)
{
size_t i= IArg(1)-1;
if(i >= p->SplineSize())
{
luaL_error(L, "Spline point index greater than the number of points.");
}
p->SplineSetPoint(i, FArg(2), FArg(3), FArg(4));
COMMON_RETURN_SELF;
}
static int SplineResize(T* p, lua_State* L)
{
int s= IArg(1);
if(s < 0)
{
luaL_error(L, "Negative spline size not allowed.");
}
p->SplineResize(static_cast<size_t>(s));
COMMON_RETURN_SELF;
}
static int SplineSolve(T* p, lua_State* L)
{
p->SplineSolve();
COMMON_RETURN_SELF;
}
LunaActorMultiVertex()
{
@@ -786,12 +759,8 @@ public:
ADD_METHOD( GetCurrFirstToDraw );
ADD_METHOD( GetCurrNumToDraw );
ADD_METHOD(GetUseSpline);
ADD_METHOD(SetUseSpline);
ADD_METHOD(SplineSize);
ADD_METHOD(SplineResize);
ADD_METHOD(SplineSetPoint);
ADD_METHOD(SplineSolve);
ADD_METHOD( GetSpline );
ADD_METHOD( SetVertsFromSplines );
// Copy from RageTexture
ADD_METHOD( SetTexture );
+11 -10
View File
@@ -28,6 +28,7 @@ class RageTexture;
class ActorMultiVertex: public Actor
{
public:
static const size_t num_vert_splines= 4;
ActorMultiVertex();
ActorMultiVertex( const ActorMultiVertex &cpy );
virtual ~ActorMultiVertex();
@@ -37,7 +38,9 @@ public:
struct AMV_TweenState
{
AMV_TweenState(): _DrawMode(DrawMode_Invalid), FirstToDraw(0), NumToDraw(-1), line_width(1.0f) {}
AMV_TweenState(): _DrawMode(DrawMode_Invalid), FirstToDraw(0),
NumToDraw(-1), line_width(1.0f)
{}
static void MakeWeightedAverage(AMV_TweenState& average_out, const AMV_TweenState& ts1, const AMV_TweenState& ts2, float percent_between);
bool operator==(const AMV_TweenState& other) const;
bool operator!=(const AMV_TweenState& other) const { return !operator==(other); }
@@ -104,21 +107,15 @@ public:
void SetVertexColor( int index , RageColor c );
void SetVertexCoords( int index , float TexCoordX , float TexCoordY );
bool GetUseSpline();
void SetUseSpline(bool use);
void SplineSetPoint(size_t i, float x , float y , float z);
void SplineResize(size_t s);
size_t SplineSize();
void SplineSolve();
inline void SetVertsFromSplinesInternal(size_t num_splines, size_t start_vert);
void SetVertsFromSplines();
CubicSplineN* GetSpline(size_t i);
virtual void PushSelf( lua_State *L );
private:
RageTexture* _Texture;
CubicSplineN _spline;
bool _using_spline;
vector<RageSpriteVertex> _Vertices;
vector<AMV_TweenState> AMV_Tweens;
AMV_TweenState AMV_current;
@@ -129,6 +126,10 @@ private:
EffectMode _EffectMode;
TextureMode _TextureMode;
// Four splines for controlling vert positions, because quads drawmode
// requires four. -Kyz
vector<CubicSplineN> _splines;
};
/**
+21 -21
View File
@@ -35,7 +35,7 @@ private:
list<Entry> looped_diagonals;
};
size_t const solution_cache_limit= 16;
const size_t solution_cache_limit= 16;
bool SplineSolutionCache::find_in_cache(list<Entry>& cache, vector<float>& outd, vector<float>& outm)
{
@@ -111,7 +111,7 @@ void SplineSolutionCache::solve_diagonals_straight(vector<float>& diagonals, vec
for(size_t i= 1; i < last-1; ++i)
{
// Operation: Add row[i] / -[ri][ci] to row[i+1] to zero [ri+1][ci].
float const diag_recip= 1.0f / diagonals[i];
const float diag_recip= 1.0f / diagonals[i];
diagonals[i+1]-= diag_recip;
multiples.push_back(diag_recip);
}
@@ -173,7 +173,7 @@ void SplineSolutionCache::solve_diagonals_looped(vector<float>& diagonals, vecto
for(size_t i= 0; i < last-2; ++i)
{
// Operation: Add row[i] / -[ri][ci] to row[i+1] to zero [ri+1][ci].
float const diag_recip= 1.0f / diagonals[i];
const float diag_recip= 1.0f / diagonals[i];
diagonals[i+1]-= diag_recip;
right_column[i+1]-= right_column[i] * diag_recip;
multiples.push_back(diag_recip);
@@ -181,7 +181,7 @@ void SplineSolutionCache::solve_diagonals_looped(vector<float>& diagonals, vecto
// Last step of stage one needs special handling for right_column.
// Operation: Add row[l-2] / [rl-2][cl-2] to row[l-1] to zero [rl-1][cl-2].
{
float const diag_recip= 1.0f / diagonals[last-2];
const float diag_recip= 1.0f / diagonals[last-2];
diagonals[last-1]-= right_column[last-2] * diag_recip;
multiples.push_back(diag_recip);
}
@@ -189,19 +189,19 @@ void SplineSolutionCache::solve_diagonals_looped(vector<float>& diagonals, vecto
for(size_t i= last-2; i > 0; --i)
{
// Operation: Add row[i] / -[ri][ci] to row[i-1] to zero [ri-1][ci].
float const diag_recip= 1.0f / diagonals[i];
const float diag_recip= 1.0f / diagonals[i];
right_column[i-1]-= right_column[i] * diag_recip;
multiples.push_back(diag_recip);
}
// Last step of stage two.
{
// Operation: Add row[0] / [r0][c0] to row[l-1] to zero [rl-1][c0].
float const diag_recip= 1.0f / diagonals[0];
const float diag_recip= 1.0f / diagonals[0];
right_column[0]-= right_column[1] * diag_recip;
multiples.push_back(diag_recip);
}
// Stage three.
size_t const end= last-1;
const size_t end= last-1;
for(size_t i= 0; i < end; ++i)
{
// Operation: Add row[e] * (right_column[i] / [re][ce]) to row[i] to
@@ -223,13 +223,13 @@ SplineSolutionCache solution_cache;
float loop_space_difference(float a, float b, float spatial_extent);
float loop_space_difference(float a, float b, float spatial_extent)
{
float const norm_diff= a - b;
const float norm_diff= a - b;
if(spatial_extent == 0.0f) { return norm_diff; }
float const plus_diff= a - (b + spatial_extent);
float const minus_diff= a - (b - spatial_extent);
float const abs_norm_diff= abs(norm_diff);
float const abs_plus_diff= abs(plus_diff);
float const abs_minus_diff= abs(minus_diff);
const float plus_diff= a - (b + spatial_extent);
const float minus_diff= a - (b - spatial_extent);
const float abs_norm_diff= abs(norm_diff);
const float abs_plus_diff= abs(plus_diff);
const float abs_minus_diff= abs(minus_diff);
if(abs_norm_diff < abs_plus_diff)
{
if(abs_norm_diff < abs_minus_diff)
@@ -287,7 +287,7 @@ void CubicSpline::solve_looped()
results[last-1]-= results[0] * multiples[next_mult];
++next_mult;
// Stage three.
size_t const end= last-1;
const size_t end= last-1;
for(size_t i= 0; i < end; ++i)
{
// Operation: Add row[e] * -multiples[nm] to row[i].
@@ -532,7 +532,7 @@ bool CubicSpline::empty() const
}
void CubicSplineN::weighted_average(CubicSplineN& out,
CubicSplineN const& from, CubicSplineN const& to, float between)
const CubicSplineN& from, CubicSplineN const& to, float between)
{
ASSERT_M(out.dimension() == from.dimension() &&
to.dimension() == from.dimension(),
@@ -552,8 +552,8 @@ void CubicSplineN::weighted_average(CubicSplineN& out,
// Behavior for splines of different sizes: Use a size between the two.
// Points that exist in both will be averaged.
// Points that only exist in one will come only from that one.
size_t const from_size= from.size();
size_t const to_size= to.size();
const size_t from_size= from.size();
const size_t to_size= to.size();
size_t out_size= to_size;
size_t limit= to_size;
if(from_size < to_size)
@@ -666,7 +666,7 @@ CSN_EVAL_SOMETHING(evaluate_third_derivative);
#undef CSN_EVAL_SOMETHING
void CubicSplineN::set_point(size_t i, vector<float> const& v)
void CubicSplineN::set_point(size_t i, const vector<float>& v)
{
ASSERT_M(v.size() == m_splines.size(), "CubicSplineN::set_point requires the passed point to be the same dimension as the spline.");
for(size_t n= 0; n < m_splines.size(); ++n)
@@ -676,8 +676,8 @@ void CubicSplineN::set_point(size_t i, vector<float> const& v)
m_dirty= true;
}
void CubicSplineN::set_coefficients(size_t i, vector<float> const& b,
vector<float> const& c, vector<float> const& d)
void CubicSplineN::set_coefficients(size_t i, const vector<float>& b,
const vector<float>& c, const vector<float>& d)
{
ASSERT_M(b.size() == c.size() && c.size() == d.size() &&
d.size() == m_splines.size(), "CubicSplineN: coefficient vectors must be "
@@ -904,7 +904,7 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
}
static int get_max_t(T* p, lua_State* L)
{
lua_pushnumber(L, p->size() - 1 + p->get_loop());
lua_pushnumber(L, p->get_max_t());
return 1;
}
static int set_size(T* p, lua_State* L)
+9 -5
View File
@@ -42,16 +42,16 @@ struct CubicSplineN
CubicSplineN()
:m_owned_by_actor(false), m_loop(false), m_polygonal(false), m_dirty(true)
{}
static void weighted_average(CubicSplineN& out, CubicSplineN const& from,
CubicSplineN const& to, float between);
static void weighted_average(CubicSplineN& out, const CubicSplineN& from,
const CubicSplineN& to, float between);
void solve();
void evaluate(float t, vector<float>& v) const;
void evaluate_derivative(float t, vector<float>& v) const;
void evaluate_second_derivative(float t, vector<float>& v) const;
void evaluate_third_derivative(float t, vector<float>& v) const;
void set_point(size_t i, vector<float> const& v);
void set_coefficients(size_t i, vector<float> const& b,
vector<float> const& c, vector<float> const& d);
void set_point(size_t i, const vector<float>& v);
void set_coefficients(size_t i, const vector<float>& b,
const vector<float>& c, const vector<float>& d);
void get_coefficients(size_t i, vector<float>& b,
vector<float>& c, vector<float>& d);
void set_spatial_extent(size_t i, float extent);
@@ -61,6 +61,10 @@ struct CubicSplineN
void redimension(size_t d);
size_t dimension() const;
bool empty() const;
float get_max_t() const {
if(m_loop) { return static_cast<float>(size()); }
else { return static_cast<float>(size()-1); }
}
typedef vector<CubicSpline> spline_cont_t;
void set_loop(bool l);
bool get_loop() const;
+38 -31
View File
@@ -326,7 +326,7 @@ void NCSplineHandler::EvalForReceptor(float song_beat, vector<float>& ret) const
}
void NCSplineHandler::MakeWeightedAverage(NCSplineHandler& out,
NCSplineHandler const& from, NCSplineHandler const& to, float between)
const NCSplineHandler& from, const NCSplineHandler& to, float between)
{
#define BOOLS_FROM_CLOSEST(closest) \
out.m_spline_mode= closest.m_spline_mode; \
@@ -344,7 +344,7 @@ void NCSplineHandler::MakeWeightedAverage(NCSplineHandler& out,
between);
}
void NoteColumnRenderArgs::spae_pos_for_beat(PlayerState const* state,
void NoteColumnRenderArgs::spae_pos_for_beat(const PlayerState* state,
float beat, float y_offset, float y_reverse_offset,
vector<float>& sp_pos, vector<float>& ae_pos) const
{
@@ -367,7 +367,7 @@ void NoteColumnRenderArgs::spae_pos_for_beat(PlayerState const* state,
break;
}
}
void NoteColumnRenderArgs::spae_zoom_for_beat(PlayerState const* state, float beat,
void NoteColumnRenderArgs::spae_zoom_for_beat(const PlayerState* state, float beat,
vector<float>& sp_zoom, vector<float>& ae_zoom) const
{
switch(zoom_handler->m_spline_mode)
@@ -387,9 +387,9 @@ void NoteColumnRenderArgs::spae_zoom_for_beat(PlayerState const* state, float be
}
}
void NoteColumnRenderArgs::SetPRZForActor(Actor* actor,
vector<float> const& sp_pos, vector<float> const& ae_pos,
vector<float> const& sp_rot, vector<float> const& ae_rot,
vector<float> const& sp_zoom, vector<float> const& ae_zoom) const
const vector<float>& sp_pos, const vector<float>& ae_pos,
const vector<float>& sp_rot, const vector<float>& ae_rot,
const vector<float>& sp_zoom, const vector<float>& ae_zoom) const
{
actor->SetX(sp_pos[0] + ae_pos[0]);
actor->SetY(sp_pos[1] + ae_pos[1]);
@@ -468,16 +468,16 @@ bool NoteDisplay::IsOnScreen( float fBeat, int iCol, int iDrawDistanceAfterTarge
return true;
}
bool NoteDisplay::DrawHoldsInRange(NoteFieldRenderArgs const& field_args,
NoteColumnRenderArgs const& column_args,
vector<NoteData::TrackMap::const_iterator> const& tap_set)
bool NoteDisplay::DrawHoldsInRange(const NoteFieldRenderArgs& field_args,
const NoteColumnRenderArgs& column_args,
const vector<NoteData::TrackMap::const_iterator>& tap_set)
{
bool any_upcoming = false;
for(vector<NoteData::TrackMap::const_iterator>::const_iterator tapit=
tap_set.begin(); tapit != tap_set.end(); ++tapit)
{
TapNote const& tn= (*tapit)->second;
HoldNoteResult const& result= tn.HoldResult;
const TapNote& tn= (*tapit)->second;
const HoldNoteResult& result= tn.HoldResult;
int start_row= (*tapit)->first;
int end_row = start_row + tn.iDuration;
@@ -536,9 +536,9 @@ bool NoteDisplay::DrawHoldsInRange(NoteFieldRenderArgs const& field_args,
return any_upcoming;
}
bool NoteDisplay::DrawTapsInRange(NoteFieldRenderArgs const& field_args,
NoteColumnRenderArgs const& column_args,
vector<NoteData::TrackMap::const_iterator> const& tap_set)
bool NoteDisplay::DrawTapsInRange(const NoteFieldRenderArgs& field_args,
const NoteColumnRenderArgs& column_args,
const vector<NoteData::TrackMap::const_iterator>& tap_set)
{
bool any_upcoming= false;
// draw notes from furthest to closest
@@ -546,7 +546,7 @@ bool NoteDisplay::DrawTapsInRange(NoteFieldRenderArgs const& field_args,
tap_set.begin(); tapit != tap_set.end(); ++tapit)
{
int tap_row= (*tapit)->first;
TapNote const& tn= (*tapit)->second;
const TapNote& tn= (*tapit)->second;
// TRICKY: If boomerang is on, then all notes in the range
// [first_row,last_row] aren't necessarily visible.
@@ -736,8 +736,8 @@ struct StripBuffer
};
void NoteDisplay::DrawHoldPart(vector<Sprite*> &vpSpr,
NoteFieldRenderArgs const& field_args,
NoteColumnRenderArgs const& column_args, int fYStep,
const NoteFieldRenderArgs& field_args,
const NoteColumnRenderArgs& column_args, int fYStep,
float fPercentFadeToFail, float fColorScale, bool bGlow,
float fOverlappedTime, float fYTop, float fYBottom, float fYStartPos,
float fYEndPos, bool bWrapping, bool bAnchorToTop,
@@ -793,8 +793,8 @@ void NoteDisplay::DrawHoldPart(vector<Sprite*> &vpSpr,
const float fTexCoordCenter = (fTexCoordLeft+fTexCoordRight)/2;
// pos_z_vec will be used later to orient the hold. Read below. -Kyz
static RageVector3 const pos_z_vec(0.0f, 0.0f, 1.0f);
static RageVector3 const pos_y_vec(0.0f, 1.0f, 0.0f);
static const RageVector3 pos_z_vec(0.0f, 0.0f, 1.0f);
static const RageVector3 pos_y_vec(0.0f, 1.0f, 0.0f);
StripBuffer queue;
for( float fY = fYStartPos; !bLast; fY += fYStep )
@@ -946,9 +946,9 @@ void NoteDisplay::DrawHoldPart(vector<Sprite*> &vpSpr,
render_left.y*= half_width;
render_left.z*= half_width;
RageVector3 const left_vert(center_vert.x + render_left.x,
const RageVector3 left_vert(center_vert.x + render_left.x,
center_vert.y + render_left.y, center_vert.z + render_left.z);
RageVector3 const right_vert(center_vert.x - render_left.x,
const RageVector3 right_vert(center_vert.x - render_left.x,
center_vert.y - render_left.y, center_vert.z - render_left.z);
const float fDistFromTop = fY - fYTop;
@@ -990,8 +990,8 @@ void NoteDisplay::DrawHoldPart(vector<Sprite*> &vpSpr,
}
void NoteDisplay::DrawHoldBody(const TapNote& tn,
NoteFieldRenderArgs const& field_args,
NoteColumnRenderArgs const& column_args, float fBeat,
const NoteFieldRenderArgs& field_args,
const NoteColumnRenderArgs& column_args, float fBeat,
bool bIsBeingHeld, float fYHead, float fYTail, bool bIsAddition,
float fPercentFadeToFail, float fColorScale, bool bGlow,
float top_beat, float bottom_beat)
@@ -1087,8 +1087,8 @@ void NoteDisplay::DrawHoldBody(const TapNote& tn,
}
void NoteDisplay::DrawHold(const TapNote& tn,
NoteFieldRenderArgs const& field_args,
NoteColumnRenderArgs const& column_args, int iRow, bool bIsBeingHeld,
const NoteFieldRenderArgs& field_args,
const NoteColumnRenderArgs& column_args, int iRow, bool bIsBeingHeld,
const HoldNoteResult &Result, bool bIsAddition, float fPercentFadeToFail)
{
int iEndRow = iRow + tn.iDuration;
@@ -1173,7 +1173,7 @@ void NoteDisplay::DrawHold(const TapNote& tn,
}
void NoteDisplay::DrawActor(const TapNote& tn, Actor* pActor, NotePart part,
NoteFieldRenderArgs const& field_args, NoteColumnRenderArgs const& column_args, float fYOffset, float fBeat,
const NoteFieldRenderArgs& field_args, const NoteColumnRenderArgs& column_args, float fYOffset, float fBeat,
bool bIsAddition, float fPercentFadeToFail, float fColorScale,
bool is_being_held)
{
@@ -1266,8 +1266,8 @@ void NoteDisplay::DrawActor(const TapNote& tn, Actor* pActor, NotePart part,
}
void NoteDisplay::DrawTap(const TapNote& tn,
NoteFieldRenderArgs const& field_args,
NoteColumnRenderArgs const& column_args, float fBeat,
const NoteFieldRenderArgs& field_args,
const NoteColumnRenderArgs& column_args, float fBeat,
bool bOnSameRowAsHoldStart, bool bOnSameRowAsRollStart,
bool bIsAddition, float fPercentFadeToFail)
{
@@ -1351,7 +1351,7 @@ void NoteDisplay::DrawTap(const TapNote& tn,
void NoteColumnRenderer::UpdateReceptorGhostStuff(Actor* receptor) const
{
PlayerState const* player_state= m_field_render_args->player_state;
const PlayerState* player_state= m_field_render_args->player_state;
float song_beat= player_state->GetDisplayedPosition().m_fSongBeatVisible;
// sp_* will be filled with the settings from the splines.
// ae_* will be filled with the settings from ArrowEffects.
@@ -1436,7 +1436,7 @@ void NoteColumnRenderer::DrawPrimitives()
m_field_render_args->first_row, m_field_render_args->last_row+1, begin, end);
for(; begin != end; ++begin)
{
TapNote const& tn= begin->second;
const TapNote& tn= begin->second;
switch(tn.type)
{
case TapNoteType_Empty:
@@ -1525,8 +1525,15 @@ void NoteColumnRenderer::FinishTweening()
Actor::FinishTweening();
}
NoteColumnRenderer::NCR_TweenState::NCR_TweenState()
{
m_rot_handler.m_spline.set_spatial_extent(0, PI*2.0f);
m_rot_handler.m_spline.set_spatial_extent(1, PI*2.0f);
m_rot_handler.m_spline.set_spatial_extent(2, PI*2.0f);
}
void NoteColumnRenderer::NCR_TweenState::MakeWeightedAverage(
NCR_TweenState& out, NCR_TweenState const& from, NCR_TweenState const& to,
NCR_TweenState& out, const NCR_TweenState& from, const NCR_TweenState& to,
float between)
{
#define WEIGHT_FOR_ME(me) \
+32 -31
View File
@@ -100,11 +100,11 @@ enum NoteColumnSplineMode
// NoteDisplay during rendering.
struct NoteFieldRenderArgs
{
PlayerState const* player_state; // to look up PlayerOptions
const PlayerState* player_state; // to look up PlayerOptions
float reverse_offset_pixels;
ReceptorArrowRow* receptor_row;
GhostArrowRow* ghost_row;
NoteData const* note_data;
const NoteData* note_data;
float first_beat;
float last_beat;
int first_row;
@@ -137,7 +137,7 @@ struct NCSplineHandler
void EvalDerivForBeat(float song_beat, float note_beat, vector<float>& ret) const;
void EvalForReceptor(float song_beat, vector<float>& ret) const;
static void MakeWeightedAverage(NCSplineHandler& out,
NCSplineHandler const& from, NCSplineHandler const& to, float between);
const NCSplineHandler& from, const NCSplineHandler& to, float between);
CubicSplineN m_spline;
NoteColumnSplineMode m_spline_mode;
@@ -150,18 +150,18 @@ struct NCSplineHandler
struct NoteColumnRenderArgs
{
void spae_pos_for_beat(PlayerState const* state,
void spae_pos_for_beat(const PlayerState* state,
float beat, float y_offset, float y_reverse_offset,
vector<float>& sp_pos, vector<float>& ae_pos) const;
void spae_zoom_for_beat(PlayerState const* state, float beat,
void spae_zoom_for_beat(const PlayerState* state, float beat,
vector<float>& sp_zoom, vector<float>& ae_zoom) const;
void SetPRZForActor(Actor* actor,
vector<float> const& sp_pos, vector<float> const& ae_pos,
vector<float> const& sp_rot, vector<float> const& ae_rot,
vector<float> const& sp_zoom, vector<float> const& ae_zoom) const;
NCSplineHandler const* pos_handler;
NCSplineHandler const* rot_handler;
NCSplineHandler const* zoom_handler;
const vector<float>& sp_pos, const vector<float>& ae_pos,
const vector<float>& sp_rot, const vector<float>& ae_rot,
const vector<float>& sp_zoom, const vector<float>& ae_zoom) const;
const NCSplineHandler* pos_handler;
const NCSplineHandler* rot_handler;
const NCSplineHandler* zoom_handler;
float song_beat;
int column;
};
@@ -179,12 +179,12 @@ public:
bool IsOnScreen( float fBeat, int iCol, int iDrawDistanceAfterTargetsPixels, int iDrawDistanceBeforeTargetsPixels ) const;
bool DrawHoldsInRange(NoteFieldRenderArgs const& field_args,
NoteColumnRenderArgs const& column_args,
vector<NoteData::TrackMap::const_iterator> const& tap_set);
bool DrawTapsInRange(NoteFieldRenderArgs const& field_args,
NoteColumnRenderArgs const& column_args,
vector<NoteData::TrackMap::const_iterator> const& tap_set);
bool DrawHoldsInRange(const NoteFieldRenderArgs& field_args,
const NoteColumnRenderArgs& column_args,
const vector<NoteData::TrackMap::const_iterator>& tap_set);
bool DrawTapsInRange(const NoteFieldRenderArgs& field_args,
const NoteColumnRenderArgs& column_args,
const vector<NoteData::TrackMap::const_iterator>& tap_set);
/**
* @brief Draw the TapNote onto the NoteField.
* @param tn the TapNote in question.
@@ -198,12 +198,12 @@ public:
* @param fDrawDistanceAfterTargetsPixels how much to draw after the receptors.
* @param fDrawDistanceBeforeTargetsPixels how much ot draw before the receptors.
* @param fFadeInPercentOfDrawFar when to start fading in. */
void DrawTap(const TapNote& tn, NoteFieldRenderArgs const& field_args,
NoteColumnRenderArgs const& column_args, float fBeat,
void DrawTap(const TapNote& tn, const NoteFieldRenderArgs& field_args,
const NoteColumnRenderArgs& column_args, float fBeat,
bool bOnSameRowAsHoldStart,
bool bOnSameRowAsRollBeat, bool bIsAddition, float fPercentFadeToFail);
void DrawHold(const TapNote& tn, NoteFieldRenderArgs const& field_args,
NoteColumnRenderArgs const& column_args, int iRow, bool bIsBeingHeld,
void DrawHold(const TapNote& tn, const NoteFieldRenderArgs& field_args,
const NoteColumnRenderArgs& column_args, int iRow, bool bIsBeingHeld,
const HoldNoteResult &Result,
bool bIsAddition, float fPercentFadeToFail);
@@ -217,18 +217,18 @@ private:
Sprite *GetHoldSprite( NoteColorSprite ncs[NUM_HoldType][NUM_ActiveType], NotePart part, float fNoteBeat, bool bIsRoll, bool bIsBeingHeld );
void DrawActor(const TapNote& tn, Actor* pActor, NotePart part,
NoteFieldRenderArgs const& field_args,
NoteColumnRenderArgs const& column_args, float fYOffset, float fBeat,
const NoteFieldRenderArgs& field_args,
const NoteColumnRenderArgs& column_args, float fYOffset, float fBeat,
bool bIsAddition, float fPercentFadeToFail, float fColorScale,
bool is_being_held);
void DrawHoldBody(const TapNote& tn, NoteFieldRenderArgs const& field_args,
NoteColumnRenderArgs const& column_args, float fBeat, bool bIsBeingHeld,
void DrawHoldBody(const TapNote& tn, const NoteFieldRenderArgs& field_args,
const NoteColumnRenderArgs& column_args, float fBeat, bool bIsBeingHeld,
float fYHead, float fYTail,
bool bIsAddition, float fPercentFadeToFail, float fColorScale,
bool bGlow, float top_beat, float bottom_beat);
void DrawHoldPart(vector<Sprite*> &vpSpr,
NoteFieldRenderArgs const& field_args,
NoteColumnRenderArgs const& column_args, int fYStep,
const NoteFieldRenderArgs& field_args,
const NoteColumnRenderArgs& column_args, int fYStep,
float fPercentFadeToFail, float fColorScale, bool bGlow,
float fOverlappedTime, float fYTop, float fYBottom, float fYStartPos,
float fYEndPos, bool bWrapping, bool bAnchorToTop,
@@ -275,13 +275,14 @@ struct NoteColumnRenderer : public Actor
struct NCR_TweenState
{
NCR_TweenState();
NCSplineHandler m_pos_handler;
NCSplineHandler m_rot_handler;
NCSplineHandler m_zoom_handler;
static void MakeWeightedAverage(NCR_TweenState& out,
NCR_TweenState const& from, NCR_TweenState const& to, float between);
bool operator==(NCR_TweenState const& other) const;
bool operator!=(NCR_TweenState const& other) const { return !operator==(other); }
const NCR_TweenState& from, const NCR_TweenState& to, float between);
bool operator==(const NCR_TweenState& other) const;
bool operator!=(const NCR_TweenState& other) const { return !operator==(other); }
};
NCR_TweenState& NCR_DestTweenState()
@@ -291,7 +292,7 @@ struct NoteColumnRenderer : public Actor
else
{ return NCR_Tweens.back(); }
}
NCR_TweenState const& NCR_DestTweenState() const { return const_cast<NoteColumnRenderer*>(this)->NCR_DestTweenState(); }
const NCR_TweenState& NCR_DestTweenState() const { return const_cast<NoteColumnRenderer*>(this)->NCR_DestTweenState(); }
virtual void SetCurrentTweenStart();
virtual void EraseHeadTween();
+16 -16
View File
@@ -1397,10 +1397,10 @@ public:
} \
return 0; \
}
SET_CALLBACK_GENERIC(SetStepCallback, m_StepCallback);
SET_CALLBACK_GENERIC(SetSetPressedCallback, m_SetPressedCallback);
SET_CALLBACK_GENERIC(SetDidTapNoteCallback, m_DidTapNoteCallback);
SET_CALLBACK_GENERIC(SetDidHoldNoteCallback, m_DidHoldNoteCallback);
SET_CALLBACK_GENERIC(set_step_callback, m_StepCallback);
SET_CALLBACK_GENERIC(set_set_pressed_callback, m_SetPressedCallback);
SET_CALLBACK_GENERIC(set_did_tap_note_callback, m_DidTapNoteCallback);
SET_CALLBACK_GENERIC(set_did_hold_note_callback, m_DidHoldNoteCallback);
#undef SET_CALLBACK_GENERIC
static int check_column(lua_State* L, int index)
@@ -1416,7 +1416,7 @@ public:
return col;
}
static int Step(T* p, lua_State* L)
static int step(T* p, lua_State* L)
{
int col= check_column(L, 1);
TapNoteScore tns= Enum::Check<TapNoteScore>(L, 2);
@@ -1424,14 +1424,14 @@ public:
return 0;
}
static int SetPressed(T* p, lua_State* L)
static int set_pressed(T* p, lua_State* L)
{
int col= check_column(L, 1);
p->SetPressed(col, true);
return 0;
}
static int DidTapNote(T* p, lua_State* L)
static int did_tap_note(T* p, lua_State* L)
{
int col= check_column(L, 1);
TapNoteScore tns= Enum::Check<TapNoteScore>(L, 2);
@@ -1440,7 +1440,7 @@ public:
return 0;
}
static int DidHoldNote(T* p, lua_State* L)
static int did_hold_note(T* p, lua_State* L)
{
int col= check_column(L, 1);
HoldNoteScore hns= Enum::Check<HoldNoteScore>(L, 2);
@@ -1462,14 +1462,14 @@ public:
LunaNoteField()
{
ADD_METHOD(SetStepCallback);
ADD_METHOD(SetSetPressedCallback);
ADD_METHOD(SetDidTapNoteCallback);
ADD_METHOD(SetDidHoldNoteCallback);
ADD_METHOD(Step);
ADD_METHOD(SetPressed);
ADD_METHOD(DidTapNote);
ADD_METHOD(DidHoldNote);
ADD_METHOD(set_step_callback);
ADD_METHOD(set_set_pressed_callback);
ADD_METHOD(set_did_tap_note_callback);
ADD_METHOD(set_did_hold_note_callback);
ADD_METHOD(step);
ADD_METHOD(set_pressed);
ADD_METHOD(did_tap_note);
ADD_METHOD(did_hold_note);
ADD_METHOD(get_column_actors);
}
};