Hello everyone, i'm Zino and i have a problem.
I got this script from [DenR] (Thanks for that )
But here's the problem : It scrolls like a billboard, but it can only show one picture?
Can someone please edit the script so i can make 2 pictures scroll over the billboard?
Thanks already
Client-side:
local myShader
local startTickCount
addEventHandler( "onClientResourceStart", resourceRoot,
function()
myShader, tec = dxCreateShader ( "uv_scripted.fx" )
local myTexture = dxCreateTexture ( "images/env3.png" )
dxSetShaderValue ( myShader, "CUSTOMTEX0", myTexture );
if not myShader then
outputChatBox( "Could not create shader. Please use debugscript 3" )
else
engineApplyShaderToWorldTexture ( myShader, "bobo_2" )
startTickCount = getTickCount()
addEventHandler( "onClientRender", root, updateUVs )
end
end
)
function updateUVs()
if not isElement( myShader ) then return end
local secondsElapsed = ( getTickCount() - startTickCount ) / 1000
local timeLooped = ( secondsElapsed / 2 ) % 6
local section = math.floor ( timeLooped )
local time = timeLooped % 1 + 3
local bScrollLeft = section == 0 or section == 3 or section == 4 or section == 6
local bWobbleRotate = section == 1 or section == 3 or section == 5 or section == 6
local bGoneAllZoomy = section == 2 or section == 4 or section == 5 or section == 6
local u,v = 0, 0
local angle = 0
local scale = 1
if bScrollLeft then
u = time
end
if bWobbleRotate then
end
if bGoneAllZoomy then
end
dxSetShaderValue ( myShader, "gUVPosition", u,v );
dxSetShaderValue ( myShader, "gUVRotAngle", angle );
dxSetShaderValue ( myShader, "gUVScale", scale, scale );
end
uv.scripted.fx:
[lua]/
// Example shader - uv_scripted.fx
//
#include "include/tex_matrix.fx"
///////////////////////////////////////////////////////////////////////////////
// Global variables
///////////////////////////////////////////////////////////////////////////////
texture gOrigTexure0 : TEXTURE0;
texture gCustomTex0 : CUSTOMTEX0;
float2 gUVPrePosition = float2( 0, 0 );
float2 gUVScale = float( 1 ); // UV scale
float2 gUVScaleCenter = float2( 0.5, 0.5 );
float gUVRotAngle = float( 0 ); // UV Rotation
float2 gUVRotCenter = float2( 0.5, 0.5 );
float2 gUVPosition = float2( 0, 0 ); // UV position
///////////////////////////////////////////////////////////////////////////////
// Functions
///////////////////////////////////////////////////////////////////////////////
//-------------------------------------------
// Returns UV transform using external settings
//-------------------------------------------
float3x3 getTextureTransform()
{
return makeTextureTransform( gUVPrePosition, gUVScale, gUVScaleCenter, gUVRotAngle, gUVRotCenter, gUVPosition );
}
///////////////////////////////////////////////////////////////////////////////
// Techniques
///////////////////////////////////////////////////////////////////////////////
technique hello
{
pass P0
{
// Set the texture
Texture[0] = gCustomTex0; // Use custom texture
// Set the UV thingy
TextureTransform[0] = getTextureTransform();
// Enable UV thingy
TextureTransformFlags[0] = Count2;
}
}
tex-matrix.fx:
//
// tex_matrix.fx
//
//-------------------------------------------
// Returns a translation matrix
//-------------------------------------------
float3x3 makeTranslationMatrix ( float2 pos )
{
return float3x3(
1, 0, 0,
0, 1, 0,
pos.x, pos.y, 1
);
}
//-------------------------------------------
// Returns a rotation matrix
//-------------------------------------------
float3x3 makeRotationMatrix ( float angle )
{
float s = sin(angle);
float c = cos(angle);
return float3x3(
c, s, 0,
-s, c, 0,
0, 0, 1
);
}
//-------------------------------------------
// Returns a scale matrix
//-------------------------------------------
float3x3 makeScaleMatrix ( float2 scale )
{
return float3x3(
scale.x, 0, 0,
0, scale.y, 0,
0, 0, 1
);
}
//-------------------------------------------
// Returns a combined matrix of doom
//-------------------------------------------
float3x3 makeTextureTransform ( float2 prePosition, float2 scale, float2 scaleCenter, float rotAngle, float2 rotCenter, float2 postPosition )
{
float3x3 matPrePosition = makeTranslationMatrix( prePosition );
float3x3 matToScaleCen = makeTranslationMatrix( -scaleCenter );
float3x3 matScale = makeScaleMatrix( scale );
float3x3 matFromScaleCen = makeTranslationMatrix( scaleCenter );
float3x3 matToRotCen = makeTranslationMatrix( -rotCenter );
float3x3 matRot = makeRotationMatrix( rotAngle );
float3x3 matFromRotCen = makeTranslationMatrix( rotCenter );
float3x3 matPostPosition = makeTranslationMatrix( postPosition );
float3x3 result =
mul(
mul(
mul(
mul(
mul(
mul(
mul(
matPrePosition
,matToScaleCen)
,matScale)
,matFromScaleCen)
,matToRotCen)
,matRot)
,matFromRotCen)
,matPostPosition)
;
return result;
}