Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
deprecated-irrlicht-mac
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
deprecated-irrlicht-mac
Commits
f56e7fb5
Commit
f56e7fb5
authored
Feb 11, 2015
by
engineer_apple
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
6011b4c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
20 deletions
+78
-20
source/Irrlicht/CSoftwareDriver2.cpp
source/Irrlicht/CSoftwareDriver2.cpp
+78
-20
No files found.
source/Irrlicht/CSoftwareDriver2.cpp
View file @
f56e7fb5
...
@@ -22,7 +22,7 @@ namespace irr
...
@@ -22,7 +22,7 @@ namespace irr
{
{
namespace
video
namespace
video
{
{
#if 0
namespace glsl
namespace glsl
{
{
...
@@ -103,11 +103,14 @@ inline vec4 refract (const vec4 &I, const vec4 &N, float eta) {
...
@@ -103,11 +103,14 @@ inline vec4 refract (const vec4 &I, const vec4 &N, float eta) {
}
}
inline
float
length
(
const
vec3
&
v
)
{
return
sqrtf
(
v
.
x
*
v
.
x
+
v
.
y
*
v
.
y
+
v
.
z
*
v
.
z
);
}
static __inline float length ( const vec3 &v ) { return sqrtf ( v.x * v.x + v.y * v.y + v.z * v.z ); }
vec3
normalize
(
const
vec3
&
v
)
{
float
l
=
1.
f
/
length
(
v
);
return
vec3
(
v
.
x
*
l
,
v
.
y
*
l
,
v
.
z
*
l
);
}
static __inline vec3 normalize ( const vec3 &v ) { float l = 1.f / length ( v ); return vec3 ( v.x * l, v.y * l, v.z * l ); }
float
max
(
float
a
,
float
b
)
{
return
a
>
b
?
a
:
b
;
}
static __inline float maximum ( float a, float b ) { return a > b ? a : b; }
float
min
(
float
a
,
float
b
)
{
return
a
<
b
?
a
:
b
;
}
static __inline float minimum ( float a, float b ) { return a < b ? a : b; }
vec4
clamp
(
const
vec4
&
a
,
f32
low
,
f32
high
)
{
return
vec4
(
min
(
max
(
a
.
x
,
low
),
high
),
min
(
max
(
a
.
y
,
low
),
high
),
min
(
max
(
a
.
z
,
low
),
high
),
min
(
max
(
a
.
w
,
low
),
high
)
);
}
static __inline vec4 clamp ( const vec4 &a, f32 low, f32 high )
{
return vec4 ( minimum (maximum(a.x,low), high), minimum (maximum(a.y,low), high), minimum (maximum(a.z,low), high), minimum (maximum(a.w,low), high) );
}
...
@@ -239,8 +242,8 @@ struct program1
...
@@ -239,8 +242,8 @@ struct program1
halfVector = normalize(VP + eye);
halfVector = normalize(VP + eye);
nDotVP
=
max
(
0.0
,
dot
(
normal
,
VP
));
nDotVP = max
imum
(0.0, dot(normal, VP));
nDotHV
=
max
(
0.0
,
dot
(
normal
,
halfVector
));
nDotHV = max
imum
(0.0, dot(normal, halfVector));
if (nDotVP == 0.0)
if (nDotVP == 0.0)
{
{
...
@@ -331,13 +334,15 @@ struct program1
...
@@ -331,13 +334,15 @@ struct program1
}
}
#endif
//! constructor
//! constructor
CBurningVideoDriver
::
CBurningVideoDriver
(
const
irr
::
SIrrlichtCreationParameters
&
params
,
io
::
IFileSystem
*
io
,
video
::
IImagePresenter
*
presenter
)
CBurningVideoDriver
::
CBurningVideoDriver
(
const
irr
::
SIrrlichtCreationParameters
&
params
,
io
::
IFileSystem
*
io
,
video
::
IImagePresenter
*
presenter
)
:
CNullDriver
(
io
,
params
.
WindowSize
),
BackBuffer
(
0
),
Presenter
(
presenter
),
:
CNullDriver
(
io
,
params
.
WindowSize
),
BackBuffer
(
0
),
Presenter
(
presenter
),
WindowId
(
0
),
SceneSourceRect
(
0
),
WindowId
(
0
),
SceneSourceRect
(
0
),
RenderTargetTexture
(
0
),
RenderTargetSurface
(
0
),
CurrentShader
(
0
),
RenderTargetTexture
(
0
),
RenderTargetSurface
(
0
),
CurrentShader
(
0
),
DepthBuffer
(
0
),
StencilBuffer
(
0
),
DepthBuffer
(
0
),
StencilBuffer
(
0
),
CurrentOut
(
1
2
*
2
,
128
),
Temp
(
12
*
2
,
128
)
CurrentOut
(
1
6
*
2
,
256
),
Temp
(
16
*
2
,
256
)
{
{
#ifdef _DEBUG
#ifdef _DEBUG
setDebugName
(
"CBurningVideoDriver"
);
setDebugName
(
"CBurningVideoDriver"
);
...
@@ -360,10 +365,10 @@ CBurningVideoDriver::CBurningVideoDriver(const irr::SIrrlichtCreationParameters&
...
@@ -360,10 +365,10 @@ CBurningVideoDriver::CBurningVideoDriver(const irr::SIrrlichtCreationParameters&
DriverAttributes
->
setAttribute
(
"MaxTextures"
,
2
);
DriverAttributes
->
setAttribute
(
"MaxTextures"
,
2
);
DriverAttributes
->
setAttribute
(
"MaxIndices"
,
1
<<
16
);
DriverAttributes
->
setAttribute
(
"MaxIndices"
,
1
<<
16
);
DriverAttributes
->
setAttribute
(
"MaxTextureSize"
,
1024
);
DriverAttributes
->
setAttribute
(
"MaxTextureSize"
,
SOFTWARE_DRIVER_2_TEXTURE_MAXSIZE
);
DriverAttributes
->
setAttribute
(
"MaxLights"
,
glsl
::
gl_MaxLights
);
DriverAttributes
->
setAttribute
(
"MaxLights"
,
1024
);
//
glsl::gl_MaxLights);
DriverAttributes
->
setAttribute
(
"MaxTextureLODBias"
,
16.
f
);
DriverAttributes
->
setAttribute
(
"MaxTextureLODBias"
,
16.
f
);
DriverAttributes
->
setAttribute
(
"Version"
,
4
7
);
DriverAttributes
->
setAttribute
(
"Version"
,
4
8
);
// create triangle renderers
// create triangle renderers
...
@@ -874,6 +879,16 @@ REALINLINE u32 CBurningVideoDriver::clipToFrustumTest ( const s4DVertex * v ) c
...
@@ -874,6 +879,16 @@ REALINLINE u32 CBurningVideoDriver::clipToFrustumTest ( const s4DVertex * v ) c
{
{
u32
flag
=
0
;
u32
flag
=
0
;
flag
|=
v
->
Pos
.
z
<=
v
->
Pos
.
w
?
1
:
0
;
flag
|=
-
v
->
Pos
.
z
<=
v
->
Pos
.
w
?
2
:
0
;
flag
|=
v
->
Pos
.
x
<=
v
->
Pos
.
w
?
4
:
0
;
flag
|=
-
v
->
Pos
.
x
<=
v
->
Pos
.
w
?
8
:
0
;
flag
|=
v
->
Pos
.
y
<=
v
->
Pos
.
w
?
16
:
0
;
flag
|=
-
v
->
Pos
.
y
<=
v
->
Pos
.
w
?
32
:
0
;
/*
if ( v->Pos.z <= v->Pos.w ) flag |= 1;
if ( v->Pos.z <= v->Pos.w ) flag |= 1;
if (-v->Pos.z <= v->Pos.w ) flag |= 2;
if (-v->Pos.z <= v->Pos.w ) flag |= 2;
...
@@ -882,7 +897,7 @@ REALINLINE u32 CBurningVideoDriver::clipToFrustumTest ( const s4DVertex * v ) c
...
@@ -882,7 +897,7 @@ REALINLINE u32 CBurningVideoDriver::clipToFrustumTest ( const s4DVertex * v ) c
if ( v->Pos.y <= v->Pos.w ) flag |= 16;
if ( v->Pos.y <= v->Pos.w ) flag |= 16;
if (-v->Pos.y <= v->Pos.w ) flag |= 32;
if (-v->Pos.y <= v->Pos.w ) flag |= 32;
*/
/*
/*
for ( u32 i = 0; i!= 6; ++i )
for ( u32 i = 0; i!= 6; ++i )
{
{
...
@@ -908,6 +923,7 @@ u32 CBurningVideoDriver::clipToHyperPlane ( s4DVertex * dest, const s4DVertex *
...
@@ -908,6 +923,7 @@ u32 CBurningVideoDriver::clipToHyperPlane ( s4DVertex * dest, const s4DVertex *
for
(
u32
i
=
1
;
i
<
inCount
+
1
;
++
i
)
for
(
u32
i
=
1
;
i
<
inCount
+
1
;
++
i
)
{
{
// i really have problem
const
s32
condition
=
i
-
inCount
;
const
s32
condition
=
i
-
inCount
;
const
s32
index
=
((
(
condition
>>
31
)
&
(
i
^
condition
)
)
^
condition
)
<<
1
;
const
s32
index
=
((
(
condition
>>
31
)
&
(
i
^
condition
)
)
^
condition
)
<<
1
;
...
@@ -1748,7 +1764,7 @@ void CBurningVideoDriver::drawVertexPrimitiveList(const void* vertices, u32 vert
...
@@ -1748,7 +1764,7 @@ void CBurningVideoDriver::drawVertexPrimitiveList(const void* vertices, u32 vert
// The vertex cache needs to be rewritten for these primitives.
// The vertex cache needs to be rewritten for these primitives.
if
(
pType
==
scene
::
EPT_POINTS
||
pType
==
scene
::
EPT_LINE_STRIP
||
if
(
pType
==
scene
::
EPT_POINTS
||
pType
==
scene
::
EPT_LINE_STRIP
||
pType
==
scene
::
EPT_LINE_LOOP
||
pType
==
scene
::
EPT_LINES
||
pType
==
scene
::
EPT_LINE_LOOP
||
pType
==
scene
::
EPT_LINES
||
pType
==
scene
::
EPT_
TRIANGLE_FAN
||
pType
==
scene
::
EPT_
POLYGON
||
pType
==
scene
::
EPT_POLYGON
||
pType
==
scene
::
EPT_POINT_SPRITES
)
pType
==
scene
::
EPT_POINT_SPRITES
)
return
;
return
;
...
@@ -2502,20 +2518,20 @@ void CBurningVideoDriver::draw3DLine(const core::vector3df& start,
...
@@ -2502,20 +2518,20 @@ void CBurningVideoDriver::draw3DLine(const core::vector3df& start,
const
wchar_t
*
CBurningVideoDriver
::
getName
()
const
const
wchar_t
*
CBurningVideoDriver
::
getName
()
const
{
{
#ifdef BURNINGVIDEO_RENDERER_BEAUTIFUL
#ifdef BURNINGVIDEO_RENDERER_BEAUTIFUL
return
L"Burning's Video 0.4
7
beautiful"
;
return
L"Burning's Video 0.4
8
beautiful"
;
#elif defined ( BURNINGVIDEO_RENDERER_ULTRA_FAST )
#elif defined ( BURNINGVIDEO_RENDERER_ULTRA_FAST )
return
L"Burning's Video 0.4
7
ultra fast"
;
return
L"Burning's Video 0.4
8
ultra fast"
;
#elif defined ( BURNINGVIDEO_RENDERER_FAST )
#elif defined ( BURNINGVIDEO_RENDERER_FAST )
return
L"Burning's Video 0.4
7
fast"
;
return
L"Burning's Video 0.4
8
fast"
;
#else
#else
return
L"Burning's Video 0.4
7
"
;
return
L"Burning's Video 0.4
8
"
;
#endif
#endif
}
}
//! Returns the graphics card vendor name.
//! Returns the graphics card vendor name.
core
::
stringc
CBurningVideoDriver
::
getVendorInfo
()
core
::
stringc
CBurningVideoDriver
::
getVendorInfo
()
{
{
return
"Burning's Video: Ing. Thomas Alten (c) 2006-201
2
"
;
return
"Burning's Video: Ing. Thomas Alten (c) 2006-201
3
"
;
}
}
...
@@ -2703,6 +2719,38 @@ core::dimension2du CBurningVideoDriver::getMaxTextureSize() const
...
@@ -2703,6 +2719,38 @@ core::dimension2du CBurningVideoDriver::getMaxTextureSize() const
#endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_
#endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_
#ifdef _IRR_WINDOWS_
#include <windows.h>
struct
dreadglobal
{
DWORD
dreadid
;
HANDLE
dread
;
irr
::
video
::
CBurningVideoDriver
*
driver
;
HANDLE
sync
;
const
irr
::
SIrrlichtCreationParameters
*
params
;
irr
::
io
::
IFileSystem
*
io
;
irr
::
video
::
IImagePresenter
*
presenter
;
};
dreadglobal
b
;
DWORD
WINAPI
dreadFun
(
void
*
p
)
{
printf
(
"Hi This is burning dread
\n
"
);
b
.
driver
=
new
irr
::
video
::
CBurningVideoDriver
(
*
b
.
params
,
b
.
io
,
b
.
presenter
);
SetEvent
(
b
.
sync
);
while
(
1
)
{
Sleep
(
1000
);
}
return
0
;
}
#endif
namespace
irr
namespace
irr
{
{
namespace
video
namespace
video
...
@@ -2712,7 +2760,17 @@ namespace video
...
@@ -2712,7 +2760,17 @@ namespace video
IVideoDriver
*
createBurningVideoDriver
(
const
irr
::
SIrrlichtCreationParameters
&
params
,
io
::
IFileSystem
*
io
,
video
::
IImagePresenter
*
presenter
)
IVideoDriver
*
createBurningVideoDriver
(
const
irr
::
SIrrlichtCreationParameters
&
params
,
io
::
IFileSystem
*
io
,
video
::
IImagePresenter
*
presenter
)
{
{
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
return
new
CBurningVideoDriver
(
params
,
io
,
presenter
);
b
.
sync
=
CreateEvent
(
0
,
0
,
0
,
"burnevent0"
);
b
.
params
=
&
params
;
b
.
io
=
io
;
b
.
presenter
=
presenter
;
b
.
dread
=
CreateThread
(
0
,
0
,
dreadFun
,
0
,
0
,
&
b
.
dreadid
);
WaitForSingleObject
(
b
.
sync
,
INFINITE
);
return
b
.
driver
;
//return new CBurningVideoDriver(params, io, presenter);
#else
#else
return
0
;
return
0
;
#endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_
#endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment