binds...
	* m3: apply texture name and alignment to selected primitives and faces
	cleaning
This commit is contained in:
Garux 2017-08-02 09:46:24 +03:00
parent a102c41b48
commit b0c4caa9d1
26 changed files with 35 additions and 121 deletions

View File

@ -23,12 +23,6 @@
#include "../StdAfx.h"
#include "AboutDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
//static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDialog dialog

View File

@ -24,12 +24,6 @@
#include "../bobtoolz.h"
#include "AutoCaulkDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAutoCaulkDialog dialog

View File

@ -24,12 +24,6 @@
#include "../bobtoolz.h"
#include "AutoCaulkStartDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAutoCaulkStartDialog dialog

View File

@ -23,12 +23,6 @@
#include "../StdAfx.h"
#include "DoorDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDoorDialog dialog

View File

@ -23,12 +23,6 @@
#include "../StdAfx.h"
#include "IntersectDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CIntersectDialog dialog

View File

@ -24,12 +24,6 @@
#include "../bobtoolz.h"
#include "IntersectInfoDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CIntersectInfoDialog dialog

View File

@ -24,12 +24,6 @@
#include "PolygonDialog.h"
#include "../shapes.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPolygonDialog dialog

View File

@ -23,12 +23,6 @@
#include "../StdAfx.h"
#include "StairDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CStairDialog dialog

View File

@ -24,12 +24,6 @@
#include "../bobtoolz.h"
#include "TextureResetDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTextureResetDialog dialog

View File

@ -24,12 +24,6 @@
#include "../bobtoolz.h"
#include "BrushCheckDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBrushCheckDialog dialog

View File

@ -24,12 +24,6 @@
#include "../bobtoolz.h"
#include "PathPlotterDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPathPlotterDialog dialog

View File

@ -594,7 +594,7 @@ void rotate( float angle ){
addScale();
}
void ProjectTexture( const Plane3& plane, const texdef_t& texdef, Vector3* direction ){
void ProjectTexture( const Plane3& plane, const texdef_t& texdef, const Vector3* direction ){
Texdef_ProjectTexture( m_projection, m_shader.width(), m_shader.height(), plane, texdef, direction );
}
@ -1207,7 +1207,7 @@ void RotateTexdef( float angle ){
texdefChanged();
}
void ProjectTexture( const texdef_t& texdef, Vector3* direction ){
void ProjectTexture( const texdef_t& texdef, const Vector3* direction ){
undoSave();
m_texdef.ProjectTexture( m_plane.plane3(), texdef, direction );
texdefChanged();

View File

@ -1507,7 +1507,7 @@ void Texdef_transformLocked( TextureProjection& projection, std::size_t width, s
identity2stOriginal = matrix4_multiplied_by_matrix4( identity2stOriginal, identityCorrected );
}
else if( dot != dot ){ //catch QNAN: happens on scaling cuboid on Z and sometimes on rotating (in bp mode)
else if( dot != dot ){ //catch QNAN: happens on scaling cuboid on Z and sometimes on rotating (in bp mode) //and in making seamless to self or parallel
return;
}
@ -1552,7 +1552,7 @@ void Q3_to_BP( const texdef_t& texdef, float width, float height, const Vector3&
/// for arbitrary texture projections
void EmitTextureCoordinates( const texdef_t& texdef, std::size_t width, std::size_t height, const Vector3& normal, DoubleVector3 points[3], DoubleVector3 st[3], Vector3* direction ){
void Emit3TextureCoordinates( const texdef_t& texdef, std::size_t width, std::size_t height, const Vector3& normal, DoubleVector3 points[3], DoubleVector3 st[3], const Vector3* direction ){
Matrix4 local2tex;
Texdef_toTransform( texdef, (float)width, (float)height, local2tex );
{
@ -1580,28 +1580,16 @@ void EmitTextureCoordinates( const texdef_t& texdef, std::size_t width, std::siz
}
}
void Texdef_ProjectTexture( TextureProjection& projection, std::size_t width, std::size_t height, const Plane3& plane, const texdef_t& texdef, Vector3* direction ){
void Texdef_ProjectTexture( TextureProjection& projection, std::size_t width, std::size_t height, const Plane3& plane, const texdef_t& texdef, const Vector3* direction ){
//texdef_t texdef;
//Q3_to_BP( texdef, (float)width, (float)height, normal, projection.m_brushprimit_texdef );
DoubleVector3 texX, texY;
DoubleVector3 proj;
#ifdef DBG_BP
if( f->plane.normal[0] == 0.0f && f->plane.normal[1] == 0.0f && f->plane.normal[2] == 0.0f ) {
globalOutputStream() << "Warning : f->plane.normal is (0,0,0) in FaceToBrushPrimitFace\n";
}
// check d_texture
if( !f->d_texture ) {
globalOutputStream() << "Warning : f.d_texture is 0 in FaceToBrushPrimitFace\n";
return;
}
#endif
// compute axis base
ComputeAxisBase( plane.normal(), texX, texY );
// compute projection vector
proj = plane.normal() * plane.dist();
const DoubleVector3 anchor = plane.normal() * plane.dist();
// (0,0) in plane axis base is (0,0,0) in world coordinates + projection on the affine plane
// (1,0) in plane axis base is texX in world coordinates + projection on the affine plane
@ -1610,13 +1598,11 @@ void Texdef_ProjectTexture( TextureProjection& projection, std::size_t width, st
// ST of (0,0) (1,0) (0,1)
DoubleVector3 points[3];
DoubleVector3 st[3];
// texdef_t texdef;
// texdef.scale[0] = texdef.scale[1] = 0.5f;
points[0] = proj;
points[1] = texX + proj;
points[2] = texY + proj;
EmitTextureCoordinates( texdef, width, height, plane.normal(), points, st, direction );
points[0] = anchor;
points[1] = texX + anchor;
points[2] = texY + anchor;
Emit3TextureCoordinates( texdef, width, height, plane.normal(), points, st, direction );
// compute texture matrix
projection.m_brushprimit_texdef.coords[0][2] = st[0][0];
projection.m_brushprimit_texdef.coords[1][2] = st[0][1];

View File

@ -106,7 +106,7 @@ void Texdef_Assign( TextureProjection& projection, const float* hShift, const fl
void Texdef_Shift( TextureProjection& projection, float s, float t );
void Texdef_Scale( TextureProjection& projection, float s, float t );
void Texdef_Rotate( TextureProjection& projection, float angle );
void Texdef_ProjectTexture( TextureProjection& projection, std::size_t width, std::size_t height, const Plane3& plane, const texdef_t& texdef, Vector3* direction );
void Texdef_ProjectTexture( TextureProjection& projection, std::size_t width, std::size_t height, const Plane3& plane, const texdef_t& texdef, const Vector3* direction );
void Texdef_FitTexture( TextureProjection& projection, std::size_t width, std::size_t height, const Vector3& normal, const Winding& w, float s_repeat, float t_repeat );
void Texdef_EmitTextureCoordinates( const TextureProjection& projection, std::size_t width, std::size_t height, Winding& w, const Vector3& normal, const Matrix4& localToWorld );

View File

@ -738,21 +738,21 @@ void Scene_BrushFindReplaceShader_Component_Selected( scene::Graph& graph, const
class FaceProjectTexture
{
const texdef_t& m_texdef;
Vector3* m_direction;
const Vector3* m_direction;
public:
FaceProjectTexture( const texdef_t& texdef, Vector3* direction ) : m_texdef( texdef ), m_direction( direction ) {
FaceProjectTexture( const texdef_t& texdef, const Vector3* direction ) : m_texdef( texdef ), m_direction( direction ) {
}
void operator()( Face& face ) const {
face.ProjectTexture( m_texdef, m_direction );
}
};
void Scene_BrushProjectTexture_Selected( scene::Graph& graph, const texdef_t& texdef, Vector3* direction ){
void Scene_BrushProjectTexture_Selected( scene::Graph& graph, const texdef_t& texdef, const Vector3* direction ){
Scene_ForEachSelectedBrush_ForEachFace( graph, FaceProjectTexture( texdef, direction ) );
SceneChangeNotify();
}
void Scene_BrushProjectTexture_Component_Selected( scene::Graph& graph, const texdef_t& texdef, Vector3* direction ){
void Scene_BrushProjectTexture_Component_Selected( scene::Graph& graph, const texdef_t& texdef, const Vector3* direction ){
Scene_ForEachSelectedBrushFace( graph, FaceProjectTexture( texdef, direction ) );
SceneChangeNotify();
}

View File

@ -78,8 +78,8 @@ void Scene_BrushFacesSelectByShader( scene::Graph& graph, const char* name );
#include "itexdef.h"
template<typename Element> class BasicVector3;
typedef BasicVector3<float> Vector3;
void Scene_BrushProjectTexture_Selected( scene::Graph& graph, const texdef_t& texdef, Vector3* direction );
void Scene_BrushProjectTexture_Component_Selected( scene::Graph& graph, const texdef_t& texdef, Vector3* direction );
void Scene_BrushProjectTexture_Selected( scene::Graph& graph, const texdef_t& texdef, const Vector3* direction );
void Scene_BrushProjectTexture_Component_Selected( scene::Graph& graph, const texdef_t& texdef, const Vector3* direction );
void Scene_BrushFitTexture_Selected( scene::Graph& graph, float s_repeat, float t_repeat );
void Scene_BrushFitTexture_Component_Selected( scene::Graph& graph, float s_repeat, float t_repeat );

View File

@ -1275,7 +1275,7 @@ void CSG_Tool(){
gtk_table_attach( table, button, 4, 5, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_tooltip_text( button, "Hollow::warp" );
gtk_widget_set_tooltip_text( button, "Hollow::wrap" );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( CSGdlg_HollowWrap ), &g_csgtool_dialog );
}

View File

@ -1552,23 +1552,11 @@ void ClipperMode(){
void ToggleRotateScaleModes(){
if ( g_currentToolMode == RotateMode ) {
ScaleMode();
}
else
{
RotateMode();
}
return g_currentToolMode == RotateMode? ScaleMode() : RotateMode();
}
void ToggleDragScaleModes(){
if ( g_currentToolMode == DragMode ) {
ScaleMode();
}
else
{
DragMode();
}
return g_currentToolMode == DragMode? ScaleMode() : DragMode();
}

View File

@ -631,6 +631,9 @@ void Patch::CapTexture(){
vector3_add( normal, tmp );
}
}
normal[0] = fabs( normal[0] );
normal[1] = fabs( normal[1] );
normal[2] = fabs( normal[2] );
ProjectTexture( texture_axis( normal ) );
}

View File

@ -297,7 +297,7 @@ void operator()( Patch& patch ) const {
void Scene_PatchCapTexture_Selected( scene::Graph& graph ){
Scene_forEachVisibleSelectedPatch( PatchCapTexture() );
Patch::m_CycleCapIndex = ( Patch::m_CycleCapIndex == 0 ) ? 1 : ( Patch::m_CycleCapIndex == 1 ) ? 2 : 0;
Patch::m_CycleCapIndex = ( Patch::m_CycleCapIndex + 1 ) % 3;
SceneChangeNotify();
}

View File

@ -888,7 +888,7 @@ void Select_Touching( void ){
SelectByBounds<SelectionPolicy_Touching>::DoSelection( false );
}
void Select_ProjectTexture( const texdef_t& texdef, Vector3* direction ){
void Select_ProjectTexture( const texdef_t& texdef, const Vector3* direction ){
if ( GlobalSelectionSystem().Mode() != SelectionSystem::eComponent ) {
Scene_BrushProjectTexture_Selected( GlobalSceneGraph(), texdef, direction );
}

View File

@ -68,7 +68,7 @@ void Select_RotateTexture( float amt );
void Select_ScaleTexture( float x, float y );
void Select_ShiftTexture( float x, float y );
class texdef_t;
void Select_ProjectTexture( const texdef_t& texdef, Vector3* direction );
void Select_ProjectTexture( const texdef_t& texdef, const Vector3* direction );
void Select_FitTexture( float horizontal = 1, float vertical = 1 );
void FindReplaceTextures( const char* pFind, const char* pReplace, bool bSelected );

View File

@ -465,10 +465,10 @@ void SurfaceInspector_ProjectTexture(){
Vector3 direction;
if( getSurfaceInspector().m_projectRadio == 0 ){
if( getSurfaceInspector().m_projectRadio == 0 ){ //axial
return Select_ProjectTexture( texdef, NULL );
}
else if( getSurfaceInspector().m_projectRadio == 1 ){
else if( getSurfaceInspector().m_projectRadio == 1 ){ //ortho
if( GlobalXYWnd_getCurrentViewType() == YZ ){
direction = Vector3( 1, 0, 0 );
}
@ -479,7 +479,7 @@ void SurfaceInspector_ProjectTexture(){
direction = Vector3( 0, 0, 1 );
}
}
else if( getSurfaceInspector().m_projectRadio == 2 ){
else if( getSurfaceInspector().m_projectRadio == 2 ){ //cam
//direction = -g_pParentWnd->GetCamWnd()->getCamera().vpn ;
direction = -Camera_getViewVector( *g_pParentWnd->GetCamWnd() );
}
@ -1688,6 +1688,9 @@ void Scene_copyClosestTexture( SelectionTest& test ){
CopiedString shader;
if ( Scene_getClosestTexture( GlobalSceneGraph(), test, shader, g_faceTextureClipboard.m_projection, g_faceTextureClipboard.m_flags ) ) {
TextureBrowser_SetSelectedShader( g_TextureBrowser, shader.c_str() );
UndoableCommand undo( "textureNameAndProjectionSetSelected" );
Select_SetShader( shader.c_str() );
Select_SetTexdef( g_faceTextureClipboard.m_projection );
}
}

View File

@ -172,7 +172,7 @@ const Matrix4& GetViewMatrix() const {
}
const Matrix4& GetViewport() const {
return m_viewport;
};
}
const Matrix4& GetModelview() const {
return m_modelview;
}

View File

@ -32,7 +32,7 @@
#define SHADER_MAX_INDEXES ( 6 * SHADER_MAX_VERTEXES )
// the maximum size of game reletive pathnames
// the maximum size of game relative pathnames
#define MAX_QPATH 64
/*

View File

@ -1220,7 +1220,7 @@ void SetupSurfaceLightmaps( void ){
}
if ( debugSampleSize < -1 ){
Sys_FPrintf( SYS_VRB, "+%d similar occurrences;\t-debugSampleSize to show ones\n", -debugSampleSize - 1 );
Sys_FPrintf( SYS_VRB, "+%d similar occurrences;\t-debugsamplesize to show ones\n", -debugSampleSize - 1 );
}
/* allocate vertex luxel storage */